Bind contextHandler to children of contentPanel
Changes to statsPane.py: Added new method applyBinding which loops through all the children of the contentPanel passed to it and binds contextHandler to each of them Changes to miningyieldViewFull.py: Call to new method applyBinding
This commit is contained in:
@@ -122,6 +122,8 @@ class MiningYieldViewFull(StatsView):
|
|||||||
self.parent.views.append(view)
|
self.parent.views.append(view)
|
||||||
# Get the TogglePanel
|
# Get the TogglePanel
|
||||||
tp = self.panel.GetParent()
|
tp = self.panel.GetParent()
|
||||||
|
# Bind the new panel's children to allow context menu access
|
||||||
|
self.parent.applyBinding(self.parent, tp.GetContentPane())
|
||||||
tp.SetLabel(view.getHeaderText(fit))
|
tp.SetLabel(view.getHeaderText(fit))
|
||||||
view.refreshPanel(fit)
|
view.refreshPanel(fit)
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class StatsPane(wx.Panel):
|
|||||||
view.populatePanel(contentPanel, headerPanel)
|
view.populatePanel(contentPanel, headerPanel)
|
||||||
tp.SetLabel(view.getHeaderText(None))
|
tp.SetLabel(view.getHeaderText(None))
|
||||||
view.refreshPanel(None)
|
view.refreshPanel(None)
|
||||||
|
|
||||||
contentPanel.Bind(wx.EVT_RIGHT_DOWN, self.contextHandler(contentPanel))
|
contentPanel.Bind(wx.EVT_RIGHT_DOWN, self.contextHandler(contentPanel))
|
||||||
for child in contentPanel.GetChildren():
|
for child in contentPanel.GetChildren():
|
||||||
child.Bind(wx.EVT_RIGHT_DOWN, self.contextHandler(contentPanel))
|
child.Bind(wx.EVT_RIGHT_DOWN, self.contextHandler(contentPanel))
|
||||||
@@ -143,3 +143,10 @@ class StatsPane(wx.Panel):
|
|||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def applyBinding(self, contentPanel):
|
||||||
|
pyfalog.debug("Attempt applyBinding to children of {0}", contentPanel.viewName)
|
||||||
|
for child in contentPanel.GetChildren():
|
||||||
|
child.Bind(wx.EVT_RIGHT_DOWN, self.contextHandler(contentPanel))
|
||||||
|
|
||||||
Reference in New Issue
Block a user