From 8b03e831ea6b7c3672fe331651ea5cb3f5957b98 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Wed, 15 Sep 2010 09:59:17 +0200 Subject: [PATCH] Update the character selection dropdown when the character editor is used --- gui/characterEditor.py | 12 +++++++++++- gui/characterSelection.py | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 23e37c00c..a8afdab78 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -18,11 +18,15 @@ #=============================================================================== import wx +import gui.mainFrame +import wx.lib.newevent import wx.gizmos from gui import bitmapLoader import controller import sys +CharListUpdated, CHAR_LIST_UPDATED = wx.lib.newevent.NewEvent() + class CharacterEditor(wx.Dialog): def __init__(self, parent): wx.Dialog.__init__ (self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition, @@ -92,7 +96,7 @@ class CharacterEditor(wx.Dialog): self.btnOK = wx.Button(self, wx.ID_OK) bSizerButtons.Add(self.btnOK, 0, wx.ALL, 5) - + self.btnOK.Bind(wx.EVT_BUTTON, self.editingFinished) mainSizer.Add(bSizerButtons, 0, wx.ALIGN_RIGHT, 5) @@ -108,6 +112,12 @@ class CharacterEditor(wx.Dialog): self.registerEvents() + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + + def editingFinished(self, event): + wx.PostEvent(self.mainFrame, CharListUpdated()) + event.Skip() + def registerEvents(self): self.Bind(wx.EVT_CLOSE, self.closeEvent) self.skillTreeChoice.Bind(wx.EVT_CHOICE, self.charChanged) diff --git a/gui/characterSelection.py b/gui/characterSelection.py index c84b84717..ac09adfc8 100644 --- a/gui/characterSelection.py +++ b/gui/characterSelection.py @@ -39,6 +39,7 @@ class CharacterSelection(wx.Panel): self.refreshCharacterList() self.Bind(wx.EVT_CHOICE, self.charChanged) + self.mainFrame.Bind(ce.CHAR_LIST_UPDATED, self.refreshCharacterList) def getActiveCharacter(self): selection = self.charChoice.GetCurrentSelection() @@ -60,6 +61,9 @@ class CharacterSelection(wx.Panel): if activeChar is None: choice.SetSelection(all0) + if event is not None: + event.Skip() + def charChanged(self, event): fitID = self.mainFrame.fitMultiSwitch.getActiveFit() charID = self.getActiveCharacter()