Skip to content

Commit

Permalink
Attempt to avoid calling wx.GetID()
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinse committed Apr 7, 2024
1 parent 21650af commit a408ffa
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/objdictgen/ui/commondialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@
# Editing Communication Dialog
# ------------------------------------------------------------------------------

NUM = 0
def NewId():
global NUM
NUM += 1
return NUM

[
ID_COMMUNICATIONDIALOG, ID_COMMUNICATIONDIALOGPOSSIBLEINDEXES,
ID_COMMUNICATIONDIALOGCURRENTINDEXES, ID_COMMUNICATIONDIALOGSELECT,
ID_COMMUNICATIONDIALOGUNSELECT, ID_COMMUNICATIONDIALOGSTATICTEXT1,
ID_COMMUNICATIONDIALOGSTATICTEXT2
] = [wx.NewId() for _ in range(7)]
] = [NewId() for _ in range(7)]


class CommunicationDialog(wx.Dialog):
Expand Down Expand Up @@ -243,7 +248,7 @@ def UnselectCurrent(self):
ID_MAPVARIABLEDIALOGRADIOBUTTON3, ID_MAPVARIABLEDIALOGSTATICTEXT1,
ID_MAPVARIABLEDIALOGSTATICTEXT2, ID_MAPVARIABLEDIALOGSTATICTEXT3,
ID_MAPVARIABLEDIALOGSTATICTEXT4,
] = [wx.NewId() for _ in range(13)]
] = [NewId() for _ in range(13)]


class MapVariableDialog(wx.Dialog):
Expand Down Expand Up @@ -453,7 +458,7 @@ def EnableNumberTyping(self, enable):
ID_USERTYPEDIALOGSTATICBOX1, ID_USERTYPEDIALOGSTATICTEXT1,
ID_USERTYPEDIALOGSTATICTEXT2, ID_USERTYPEDIALOGSTATICTEXT3,
ID_USERTYPEDIALOGSTATICTEXT4,
] = [wx.NewId() for _ in range(11)]
] = [NewId() for _ in range(11)]


class UserTypeDialog(wx.Dialog):
Expand Down Expand Up @@ -701,7 +706,7 @@ def GetValues(self):
ID_NODEINFOSDIALOGSTATICTEXT1, ID_NODEINFOSDIALOGSTATICTEXT2,
ID_NODEINFOSDIALOGSTATICTEXT3, ID_NODEINFOSDIALOGSTATICTEXT4,
ID_NODEINFOSDIALOGSTATICTEXT5,
] = [wx.NewId() for _ in range(11)]
] = [NewId() for _ in range(11)]


NODE_TYPES = ["master", "slave"]
Expand Down Expand Up @@ -877,7 +882,7 @@ def GetValues(self):
ID_CREATENODEDIALOGSTATICTEXT6, ID_CREATENODEDIALOGSTATICTEXT7,
ID_CREATENODEDIALOGSTOREEDS, ID_CREATENODEDIALOGDESCRIPTION,
ID_CREATENODEDIALOGTYPE,
] = [wx.NewId() for _ in range(21)]
] = [NewId() for _ in range(21)]


class CreateNodeDialog(wx.Dialog):
Expand Down Expand Up @@ -1211,7 +1216,7 @@ def OnProfileChoice(self, event):
ID_ADDSLAVEDIALOGSLAVENODEID, ID_ADDSLAVEDIALOGEDSFILE,
ID_ADDSLAVEDIALOGIMPORTEDS, ID_ADDSLAVEDIALOGSTATICTEXT1,
ID_ADDSLAVEDIALOGSTATICTEXT2, ID_ADDSLAVEDIALOGSTATICTEXT3,
] = [wx.NewId() for _ in range(8)]
] = [NewId() for _ in range(8)]


class AddSlaveDialog(wx.Dialog):
Expand Down Expand Up @@ -1525,7 +1530,7 @@ def Empty(self):
ID_DCFENTRYVALUESDIALOGADDBUTTON, ID_DCFENTRYVALUESDIALOGDELETEBUTTON,
ID_DCFENTRYVALUESDIALOGUPBUTTON, ID_DCFENTRYVALUESDIALOGDOWNBUTTON,
ID_VARIABLEEDITORPANELSTATICTEXT1,
] = [wx.NewId() for _ in range(7)]
] = [NewId() for _ in range(7)]


class DCFEntryValuesDialog(wx.Dialog):
Expand Down

0 comments on commit a408ffa

Please sign in to comment.