Fix a bug where we'd bind our context menu handler several times,
leading to superfluous handler calls
This commit is contained in:
@@ -31,6 +31,7 @@ class ContextMenu(object):
|
|||||||
menu.info = {}
|
menu.info = {}
|
||||||
menu.selection = selection
|
menu.selection = selection
|
||||||
empty = True
|
empty = True
|
||||||
|
menu.Bind(wx.EVT_MENU, cls.handler)
|
||||||
for i, context in enumerate(contexts):
|
for i, context in enumerate(contexts):
|
||||||
amount = 0
|
amount = 0
|
||||||
for menuHandler in cls.menus:
|
for menuHandler in cls.menus:
|
||||||
@@ -46,7 +47,6 @@ class ContextMenu(object):
|
|||||||
item = wx.MenuItem(menu, id, text)
|
item = wx.MenuItem(menu, id, text)
|
||||||
menu.info[id] = (m, context, it)
|
menu.info[id] = (m, context, it)
|
||||||
|
|
||||||
menu.Bind(wx.EVT_MENU, cls.handler)
|
|
||||||
bitmap = m.getBitmap(context, selection)
|
bitmap = m.getBitmap(context, selection)
|
||||||
if bitmap:
|
if bitmap:
|
||||||
item.SetBitmap(bitmap)
|
item.SetBitmap(bitmap)
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ class ItemStatsDialog(wx.Dialog):
|
|||||||
dlgsize = self.GetSize()
|
dlgsize = self.GetSize()
|
||||||
psize = parent.GetSize()
|
psize = parent.GetSize()
|
||||||
ppos = parent.GetPosition()
|
ppos = parent.GetPosition()
|
||||||
|
|
||||||
ItemStatsDialog.counter += 1
|
ItemStatsDialog.counter += 1
|
||||||
self.dlgOrder = ItemStatsDialog.counter
|
self.dlgOrder = ItemStatsDialog.counter
|
||||||
|
|
||||||
counter = ItemStatsDialog.counter
|
counter = ItemStatsDialog.counter
|
||||||
dlgStep = 30
|
dlgStep = 30
|
||||||
if counter * dlgStep > ppos.x+psize.width-dlgsize.x or counter * dlgStep > ppos.y+psize.height-dlgsize.y:
|
if counter * dlgStep > ppos.x+psize.width-dlgsize.x or counter * dlgStep > ppos.y+psize.height-dlgsize.y:
|
||||||
@@ -90,7 +90,7 @@ class ItemStatsDialog(wx.Dialog):
|
|||||||
self.Bind(wx.EVT_CLOSE, self.closeEvent)
|
self.Bind(wx.EVT_CLOSE, self.closeEvent)
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
|
|
||||||
if self.dlgOrder==ItemStatsDialog.counter:
|
if self.dlgOrder==ItemStatsDialog.counter:
|
||||||
ItemStatsDialog.counter -= 1
|
ItemStatsDialog.counter -= 1
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
@@ -218,7 +218,7 @@ class ItemRequirements ( wx.Panel ):
|
|||||||
skillBookId = self.imageList.Add(bitmapLoader.getBitmap("skill_small", "icons"))
|
skillBookId = self.imageList.Add(bitmapLoader.getBitmap("skill_small", "icons"))
|
||||||
|
|
||||||
self.getFullSkillTree(item,self.root,skillBookId)
|
self.getFullSkillTree(item,self.root,skillBookId)
|
||||||
|
|
||||||
self.reqTree.ExpandAll()
|
self.reqTree.ExpandAll()
|
||||||
|
|
||||||
self.Layout()
|
self.Layout()
|
||||||
@@ -229,7 +229,7 @@ class ItemRequirements ( wx.Panel ):
|
|||||||
if skill.ID not in self.skillIdHistory:
|
if skill.ID not in self.skillIdHistory:
|
||||||
self.getFullSkillTree(skill,child,sbIconId)
|
self.getFullSkillTree(skill,child,sbIconId)
|
||||||
self.skillIdHistory.append(skill.ID)
|
self.skillIdHistory.append(skill.ID)
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
## Class ItemEffects
|
## Class ItemEffects
|
||||||
@@ -250,11 +250,11 @@ class ItemEffects (wx.Panel):
|
|||||||
|
|
||||||
self.effectList.InsertColumn(0,"Name")
|
self.effectList.InsertColumn(0,"Name")
|
||||||
self.effectList.InsertColumn(1,"Implemented")
|
self.effectList.InsertColumn(1,"Implemented")
|
||||||
|
|
||||||
self.effectList.SetColumnWidth(0,385)
|
self.effectList.SetColumnWidth(0,385)
|
||||||
|
|
||||||
self.effectList.setResizeColumn(0)
|
self.effectList.setResizeColumn(0)
|
||||||
|
|
||||||
self.effectList.SetColumnWidth(1,80)
|
self.effectList.SetColumnWidth(1,80)
|
||||||
|
|
||||||
effects = item.effects
|
effects = item.effects
|
||||||
@@ -279,24 +279,20 @@ class ItemEffects (wx.Panel):
|
|||||||
## Class ItemAffectedBy
|
## Class ItemAffectedBy
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
|
|
||||||
class ItemAffectedBy (wx.Panel):
|
class ItemAffectedBy (wx.Panel):
|
||||||
def __init__(self, parent, stuff, item):
|
def __init__(self, parent, stuff, item):
|
||||||
wx.Panel.__init__ (self, parent)
|
wx.Panel.__init__ (self, parent)
|
||||||
mainSizer = wx.BoxSizer( wx.VERTICAL )
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
self.effectList = AutoListCtrl(self, wx.ID_ANY, style = wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.NO_BORDER)
|
||||||
self.effectList = AutoListCtrl(self, wx.ID_ANY,
|
mainSizer.Add(self.effectList, 1, wx.ALL|wx.EXPAND, 0)
|
||||||
style =
|
self.SetSizer(mainSizer)
|
||||||
#wx.LC_HRULES |
|
|
||||||
#wx.LC_NO_HEADER |
|
|
||||||
wx.LC_REPORT |wx.LC_SINGLE_SEL |
|
|
||||||
#wx.LC_VRULES |
|
|
||||||
wx.NO_BORDER)
|
|
||||||
mainSizer.Add( self.effectList, 1, wx.ALL|wx.EXPAND, 0 )
|
|
||||||
self.SetSizer( mainSizer )
|
|
||||||
|
|
||||||
self.effectList.InsertColumn(0,"Name")
|
self.effectList.InsertColumn(0,"Name")
|
||||||
self.effectList.setResizeColumn(0)
|
self.effectList.setResizeColumn(0)
|
||||||
|
|
||||||
|
print stuff.itemModifiedAttributes._ModifiedAttributeDict__affectedBy
|
||||||
|
|
||||||
effects = item.effects
|
effects = item.effects
|
||||||
names = list(effects.iterkeys())
|
names = list(effects.iterkeys())
|
||||||
names.sort()
|
names.sort()
|
||||||
|
|||||||
Reference in New Issue
Block a user