From 253ebdc4e1f9d618a84e8da88200710dd999aaee Mon Sep 17 00:00:00 2001 From: blitzmann Date: Mon, 25 Jan 2016 21:09:57 -0500 Subject: [PATCH] Tentative fix for character editor issues. --- gui/characterEditor.py | 25 +++++++++---------------- gui/mainFrame.py | 2 +- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 05824e80a..0fe9b37f6 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -29,18 +29,16 @@ from gui.contextMenu import ContextMenu from wx.lib.buttons import GenBitmapButton import gui.globalEvents as GE -class CharacterEditor(wx.Frame): +class CharacterEditor(wx.Dialog): def __init__(self, parent): - wx.Frame.__init__ (self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition, - size=wx.Size(641, 600), style=wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.TAB_TRAVERSAL) + wx.Dialog.__init__ (self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition, + size=wx.Size(640, 600), style=wx.DEFAULT_DIALOG_STYLE) i = wx.IconFromBitmap(BitmapLoader.getBitmap("character_small", "gui")) self.SetIcon(i) self.mainFrame = parent - - #self.disableWin = wx.WindowDisabler(self) - self.SetSizeHintsSz(wx.Size(640, 600), wx.DefaultSize) + self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) mainSizer = wx.BoxSizer(wx.VERTICAL) @@ -170,12 +168,11 @@ class CharacterEditor(wx.Frame): self.btnRestrict() def editingFinished(self, event): - #del self.disableWin wx.PostEvent(self.mainFrame, GE.CharListUpdated()) - self.Destroy() + self.Close() def registerEvents(self): - self.Bind(wx.EVT_CLOSE, self.closeEvent) + self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(GE.CHAR_LIST_UPDATED, self.refreshCharacterList) self.charChoice.Bind(wx.EVT_CHOICE, self.charChanged) @@ -199,11 +196,6 @@ class CharacterEditor(wx.Frame): self.sview.populateSkillTree() wx.PostEvent(self, GE.CharListUpdated()) - def closeEvent(self, event): - #del self.disableWin - wx.PostEvent(self.mainFrame, GE.CharListUpdated()) - self.Destroy() - def restrict(self): self.btnRename.Enable(False) self.btnDelete.Enable(False) @@ -319,14 +311,15 @@ class CharacterEditor(wx.Frame): wx.PostEvent(self, GE.CharChanged()) - def Destroy(self): + def OnClose(self, event): + wx.PostEvent(self.mainFrame, GE.CharListUpdated()) sFit = service.Fit.getInstance() fitID = self.mainFrame.getActiveFit() if fitID is not None: sFit.clearFit(fitID) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - wx.Frame.Destroy(self) + self.Destroy() class SkillTreeView (wx.Panel): def __init__(self, parent): diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 3c47e08fd..23cc8146c 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -350,7 +350,7 @@ class MainFrame(wx.Frame): def showCharacterEditor(self, event): dlg=CharacterEditor(self) - dlg.Show() + dlg.ShowModal() def showAttrEditor(self, event): dlg=AttributeEditor(self)