libgui/GuiFrame.py:{load{Accel,Menu,ToolBar}s,__init__}(): replace lastId w/ wx.NewId().

This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-11 14:45:59 +02:00
parent 3be34bc657
commit 418d16a81a

View File

@ -62,7 +62,7 @@ class GuiFrame(wx.Frame):
and (accel.attrDict["accel"] != None): and (accel.attrDict["accel"] != None):
accelTableEntries += [wx.AcceleratorEntry()] accelTableEntries += [wx.AcceleratorEntry()]
if accel.attrDict["id"] == None: if accel.attrDict["id"] == None:
accel.attrDict["id"] = self.lastId; self.lastId += 1; accel.attrDict["id"] = wx.NewId()
accelTableEntries[-1].Set(*accel.attrDict["accel"], accel.attrDict["id"]) accelTableEntries[-1].Set(*accel.attrDict["accel"], accel.attrDict["id"])
accel.attrDict["accelEntry"] = accelTableEntries[-1] accel.attrDict["accelEntry"] = accelTableEntries[-1]
self.itemsById[accel.attrDict["id"]] = accel self.itemsById[accel.attrDict["id"]] = accel
@ -95,7 +95,7 @@ class GuiFrame(wx.Frame):
menuWindow.AppendSeparator() menuWindow.AppendSeparator()
else: else:
if menuItem.attrDict["id"] == None: if menuItem.attrDict["id"] == None:
menuItem.attrDict["id"] = self.lastId; self.lastId += 1; menuItem.attrDict["id"] = wx.NewId()
self.itemsById[menuItem.attrDict["id"]] = menuItem self.itemsById[menuItem.attrDict["id"]] = menuItem
if hasattr(menuItem, "isSelect"): if hasattr(menuItem, "isSelect"):
menuItemWindow = menuWindow.AppendRadioItem(menuItem.attrDict["id"], menuItem.attrDict["label"], menuItem.attrDict["caption"]) menuItemWindow = menuWindow.AppendRadioItem(menuItem.attrDict["id"], menuItem.attrDict["label"], menuItem.attrDict["caption"])
@ -123,7 +123,7 @@ class GuiFrame(wx.Frame):
self.toolBars[-1].AddSeparator() self.toolBars[-1].AddSeparator()
else: else:
if toolBarItem.attrDict["id"] == None: if toolBarItem.attrDict["id"] == None:
toolBarItem.attrDict["id"] = self.lastId; self.lastId += 1; toolBarItem.attrDict["id"] = wx.NewId()
self.itemsById[toolBarItem.attrDict["id"]] = toolBarItem self.itemsById[toolBarItem.attrDict["id"]] = toolBarItem
if hasattr(toolBarItem, "isSelect"): if hasattr(toolBarItem, "isSelect"):
toolBarItemWindow = self.toolBars[-1].AddRadioTool(toolBarItem.attrDict["id"], toolBarItem.attrDict["caption"], toolBarItem.attrDict["icon"][2], shortHelp=toolBarItem.attrDict["label"]) toolBarItemWindow = self.toolBars[-1].AddRadioTool(toolBarItem.attrDict["id"], toolBarItem.attrDict["caption"], toolBarItem.attrDict["icon"][2], shortHelp=toolBarItem.attrDict["label"])
@ -167,7 +167,7 @@ class GuiFrame(wx.Frame):
# __init__(self, iconPathName, size, parent=None, title=""): initialisation method # __init__(self, iconPathName, size, parent=None, title=""): initialisation method
def __init__(self, iconPathName, size, parent=None, title=""): def __init__(self, iconPathName, size, parent=None, title=""):
super().__init__(parent, wx.ID_ANY, title, size=size) super().__init__(parent, wx.ID_ANY, title, size=size)
self.itemsById, self.lastId, self.menuItemsById, self.toolBarItemsById = {}, 0, {}, {} self.itemsById, self.menuItemsById, self.toolBarItemsById = {}, {}, {}
self.panelSkin, self.sizerSkin, self.toolBars = wx.Panel(self, wx.ID_ANY), wx.BoxSizer(wx.VERTICAL), [] self.panelSkin, self.sizerSkin, self.toolBars = wx.Panel(self, wx.ID_ANY), wx.BoxSizer(wx.VERTICAL), []
self.sizerSkin.AddSpacer(5); self.panelSkin.SetSizer(self.sizerSkin); self.panelSkin.SetAutoLayout(1); self.sizerSkin.AddSpacer(5); self.panelSkin.SetSizer(self.sizerSkin); self.panelSkin.SetAutoLayout(1);
self._initIcon(iconPathName); self.statusBar = self.CreateStatusBar(); self._initIcon(iconPathName); self.statusBar = self.CreateStatusBar();