Update the character selection dropdown when the character editor is
used
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user