Skip to content

Commit

Permalink
Fix damage profile / target resists editor (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
blitzmann committed May 3, 2016
1 parent b9dad60 commit d4e5f8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion gui/patternEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def __init__(self, parent):
btn.Enable(True)
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower())))

self.Layout()
bsize = self.GetBestSize()
Expand Down Expand Up @@ -259,7 +260,7 @@ def importPatterns(self, event):
except Exception, e:
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
finally:
self.updateChoices()
self.entityEditor.refreshEntityList()
else:
self.stNotice.SetLabel("Could not import from clipboard")

Expand Down
23 changes: 11 additions & 12 deletions gui/resistsEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,18 @@ def __init__(self, parent):
("Export", wx.ART_FILE_SAVE_AS, "to"))

for name, art, direction in importExport:
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)

btn.SetMinSize( btn.GetSize() )
btn.SetMaxSize( btn.GetSize() )
btn.SetMinSize( btn.GetSize() )
btn.SetMaxSize( btn.GetSize() )

btn.Layout()
setattr(self, name, btn)
btn.Enable(True)
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
btn.Layout()
setattr(self, name, btn)
btn.Enable(True)
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower())))

if not self.entityEditor.checkEntitiesExist():
self.Destroy()
Expand Down Expand Up @@ -267,19 +268,17 @@ def importPatterns(self, event):
try:
sTR.importPatterns(text)
self.stNotice.SetLabel("Patterns successfully imported from clipboard")
self.showInput(False)
except service.targetResists.ImportError, e:
self.stNotice.SetLabel(str(e))
except Exception, e:
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
finally:
self.updateChoices()
self.entityEditor.refreshEntityList()
else:
self.stNotice.SetLabel("Could not import from clipboard")

def exportPatterns(self, event):
"Event fired when export to clipboard button is clicked"

sTR = service.TargetResists.getInstance()
toClipboard( sTR.exportPatterns() )
self.stNotice.SetLabel("Patterns exported to clipboard")

0 comments on commit d4e5f8d

Please sign in to comment.