Fix damage profile / target resists editor (#587)
This commit is contained in:
@@ -177,6 +177,7 @@ class DmgPatternEditorDlg(wx.Dialog):
|
|||||||
btn.Enable(True)
|
btn.Enable(True)
|
||||||
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
|
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
|
||||||
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
|
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
|
||||||
|
btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower())))
|
||||||
|
|
||||||
self.Layout()
|
self.Layout()
|
||||||
bsize = self.GetBestSize()
|
bsize = self.GetBestSize()
|
||||||
@@ -259,7 +260,7 @@ class DmgPatternEditorDlg(wx.Dialog):
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
|
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
|
||||||
finally:
|
finally:
|
||||||
self.updateChoices()
|
self.entityEditor.refreshEntityList()
|
||||||
else:
|
else:
|
||||||
self.stNotice.SetLabel("Could not import from clipboard")
|
self.stNotice.SetLabel("Could not import from clipboard")
|
||||||
|
|
||||||
|
|||||||
@@ -157,17 +157,18 @@ class ResistsEditorDlg(wx.Dialog):
|
|||||||
("Export", wx.ART_FILE_SAVE_AS, "to"))
|
("Export", wx.ART_FILE_SAVE_AS, "to"))
|
||||||
|
|
||||||
for name, art, direction in importExport:
|
for name, art, direction in importExport:
|
||||||
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
|
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
|
||||||
btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)
|
btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)
|
||||||
|
|
||||||
btn.SetMinSize( btn.GetSize() )
|
btn.SetMinSize( btn.GetSize() )
|
||||||
btn.SetMaxSize( btn.GetSize() )
|
btn.SetMaxSize( btn.GetSize() )
|
||||||
|
|
||||||
btn.Layout()
|
btn.Layout()
|
||||||
setattr(self, name, btn)
|
setattr(self, name, btn)
|
||||||
btn.Enable(True)
|
btn.Enable(True)
|
||||||
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
|
btn.SetToolTipString("%s patterns %s clipboard" % (name, direction) )
|
||||||
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
|
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():
|
if not self.entityEditor.checkEntitiesExist():
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
@@ -267,19 +268,17 @@ class ResistsEditorDlg(wx.Dialog):
|
|||||||
try:
|
try:
|
||||||
sTR.importPatterns(text)
|
sTR.importPatterns(text)
|
||||||
self.stNotice.SetLabel("Patterns successfully imported from clipboard")
|
self.stNotice.SetLabel("Patterns successfully imported from clipboard")
|
||||||
self.showInput(False)
|
|
||||||
except service.targetResists.ImportError, e:
|
except service.targetResists.ImportError, e:
|
||||||
self.stNotice.SetLabel(str(e))
|
self.stNotice.SetLabel(str(e))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
|
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
|
||||||
finally:
|
finally:
|
||||||
self.updateChoices()
|
self.entityEditor.refreshEntityList()
|
||||||
else:
|
else:
|
||||||
self.stNotice.SetLabel("Could not import from clipboard")
|
self.stNotice.SetLabel("Could not import from clipboard")
|
||||||
|
|
||||||
def exportPatterns(self, event):
|
def exportPatterns(self, event):
|
||||||
"Event fired when export to clipboard button is clicked"
|
"Event fired when export to clipboard button is clicked"
|
||||||
|
|
||||||
sTR = service.TargetResists.getInstance()
|
sTR = service.TargetResists.getInstance()
|
||||||
toClipboard( sTR.exportPatterns() )
|
toClipboard( sTR.exportPatterns() )
|
||||||
self.stNotice.SetLabel("Patterns exported to clipboard")
|
self.stNotice.SetLabel("Patterns exported to clipboard")
|
||||||
|
|||||||
Reference in New Issue
Block a user