Post all custom events on the mainFrame

This commit is contained in:
cncfanatics
2010-08-27 13:23:06 +02:00
parent 0e19433788
commit 5cd0b01e5e
4 changed files with 20 additions and 11 deletions

View File

@@ -45,8 +45,8 @@ class FittingView(wx.ListCtrl):
self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL)
self.activeColumns = []
self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeChecker)
self.Bind(FIT_CHANGED, self.fitChanged)
mainFrame = gui.mainFrame.MainFrame.getInstance()
mainFrame.Bind(FIT_CHANGED, self.fitChanged)
self.shipBrowser = mainFrame.shipBrowser
self.shipView = mainFrame.shipBrowser.shipView
self.searchView = mainFrame.shipBrowser.shipView
@@ -96,7 +96,7 @@ class FittingView(wx.ListCtrl):
if fitID == None:
self.Hide()
else:
wx.PostEvent(self, FitChanged(fitID=fitID))
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), FitChanged(fitID=fitID))
self.Show()
def fitChanged(self, event):

View File

@@ -31,11 +31,12 @@ class MultiSwitch(wx.Notebook):
self.AddPage(wx.Panel(self), "+")
self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.checkAdd)
self.Bind(wx.EVT_MIDDLE_DOWN, self.checkRemove)
self.shipBrowser = gui.mainFrame.MainFrame.getInstance().shipBrowser
self.shipBrowser.Bind(sb.EVT_FIT_RENAMED, self.processRename)
self.shipBrowser.Bind(sb.EVT_FIT_SELECTED, self.changeFit)
self.shipBrowser.Bind(sb.EVT_FIT_REMOVED, self.processRemove)
mainFrame = gui.mainFrame.MainFrame.getInstance()
mainFrame.Bind(sb.EVT_FIT_RENAMED, self.processRename)
mainFrame.Bind(sb.EVT_FIT_SELECTED, self.changeFit)
mainFrame.Bind(sb.EVT_FIT_REMOVED, self.processRemove)
self.imageList = wx.ImageList(16, 16)

View File

@@ -102,7 +102,7 @@ class ShipBrowser(wx.Panel):
if data is not None:
type, fitID = data
if type == "fit":
wx.PostEvent(self, FitSelected(fitID=fitID))
wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID))
def toggleButtons(self, event):
tree = self.getActiveTree()
@@ -173,7 +173,7 @@ class ShipBrowser(wx.Panel):
tree.SelectItem(childId)
tree.EditLabel(childId)
wx.PostEvent(self, FitCreated(fitID=fitID))
wx.PostEvent(self.mainFrame, FitCreated(fitID=fitID))
def renameFit(self, event):
tree = self.getActiveTree()
@@ -197,7 +197,7 @@ class ShipBrowser(wx.Panel):
wx.CallAfter(tree.SortChildren, tree.GetItemParent(item))
wx.PostEvent(self, FitRenamed(fitID=fitID))
wx.PostEvent(self.mainFrame, FitRenamed(fitID=fitID))
def deleteFit(self, event):
tree = self.getActiveTree()
@@ -208,7 +208,7 @@ class ShipBrowser(wx.Panel):
cFit.deleteFit(fitID)
tree.Delete(root)
wx.PostEvent(self, FitRemoved(fitID=fitID))
wx.PostEvent(self.mainFrame, FitRemoved(fitID=fitID))
def copyFit(self, event):
tree = self.getActiveTree()
@@ -224,7 +224,7 @@ class ShipBrowser(wx.Panel):
tree.SelectItem(childId)
tree.EditLabel(childId)
wx.PostEvent(self, FitCreated(fitID=newID))
wx.PostEvent(self.mainFrame, FitCreated(fitID=newID))
def scheduleSearch(self, event):
self.searchTimer.Stop()

View File

@@ -19,7 +19,10 @@
import wx
from gui import bitmapLoader
import gui.shipBrowser as sb
import gui.fittingView as fv
import gui.mainFrame
import controller
class StatsPane(wx.Panel):
def collapseChanged(self, event):
@@ -35,6 +38,11 @@ class StatsPane(wx.Panel):
self.miniPanel.Show(collapsed)
gui.mainFrame.MainFrame.getInstance().statsSizer.Layout()
def fitChanged(self, event):
cFit = controller.Fit.getInstance()
fit = cFit.getFit(event.fitID)
pass
def __init__(self, parent):
wx.Panel.__init__(self, parent)