objdictgen/commondialogs.py
changeset 254 f2b0acb54e65
parent 206 6787754b251b
child 258 8f7725451453
equal deleted inserted replaced
253:bf58ce630b88 254:f2b0acb54e65
    19 #
    19 #
    20 #You should have received a copy of the GNU Lesser General Public
    20 #You should have received a copy of the GNU Lesser General Public
    21 #License along with this library; if not, write to the Free Software
    21 #License along with this library; if not, write to the Free Software
    22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    23 
    23 
    24 from wxPython.wx import *
       
    25 from wxPython.grid import *
       
    26 import wx
    24 import wx
    27 
    25 
    28 import os
    26 import os
    29 
    27 
    30 #-------------------------------------------------------------------------------
    28 #-------------------------------------------------------------------------------
    31 #                          Editing Communication Dialog
    29 #                          Editing Communication Dialog
    32 #-------------------------------------------------------------------------------
    30 #-------------------------------------------------------------------------------
    33 
    31 
    34 
    32 
    35 [wxID_COMMUNICATIONDIALOG, wxID_COMMUNICATIONDIALOGMAINPANEL,
    33 [ID_COMMUNICATIONDIALOG, ID_COMMUNICATIONDIALOGPOSSIBLEINDEXES, 
    36  wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES, wxID_COMMUNICATIONDIALOGCURRENTINDEXES,
    34  ID_COMMUNICATIONDIALOGCURRENTINDEXES, ID_COMMUNICATIONDIALOGSELECT, 
    37  wxID_COMMUNICATIONDIALOGSELECT, wxID_COMMUNICATIONDIALOGUNSELECT, 
    35  ID_COMMUNICATIONDIALOGUNSELECT, ID_COMMUNICATIONDIALOGSTATICTEXT1, 
    38  wxID_COMMUNICATIONDIALOGSTATICTEXT1, wxID_COMMUNICATIONDIALOGSTATICTEXT2
    36  ID_COMMUNICATIONDIALOGSTATICTEXT2
    39 ] = [wx.NewId() for _init_ctrls in range(8)]
    37 ] = [wx.NewId() for _init_ctrls in range(7)]
    40 
    38 
    41 class CommunicationDialog(wx.Dialog):
    39 class CommunicationDialog(wx.Dialog):
    42     def _init_coll_flexGridSizer1_Items(self, parent):
    40     def _init_coll_flexGridSizer1_Items(self, parent):
    43         # generated method, don't edit
    41         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
    44 
    42         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
    45         parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
    43 
       
    44     def _init_coll_flexGridSizer1_Growables(self, parent):
       
    45         parent.AddGrowableCol(0)
       
    46         parent.AddGrowableRow(0)
       
    47 
       
    48     def _init_coll_MainSizer_Items(self, parent):
       
    49         parent.AddSizer(self.LeftGridSizer, 0, border=0, flag=wx.GROW)
       
    50         parent.AddSizer(self.MiddleGridSizer, 0, border=0, flag=wx.GROW)
       
    51         parent.AddSizer(self.RightGridSizer, 0, border=0, flag=wx.GROW)
       
    52 
       
    53     def _init_coll_MainSizer_Growables(self, parent):
       
    54         parent.AddGrowableCol(0)
       
    55         parent.AddGrowableCol(2)
       
    56         parent.AddGrowableRow(0)
       
    57 
       
    58     def _init_coll_LeftGridSizer_Items(self, parent):
       
    59         parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
       
    60         parent.AddWindow(self.PossibleIndexes, 0, border=0, flag=wx.GROW)
       
    61 
       
    62     def _init_coll_LeftGridSizer_Growables(self, parent):
       
    63         parent.AddGrowableCol(0)
       
    64         parent.AddGrowableRow(1)
       
    65 
       
    66     def _init_coll_MiddleGridSizer_Items(self, parent):
       
    67         parent.AddWindow(self.Select, 0, border=0, flag=wx.ALIGN_BOTTOM)
       
    68         parent.AddWindow(self.Unselect, 0, border=0, flag=wx.ALIGN_TOP)
       
    69 
       
    70     def _init_coll_MiddleGridSizer_Growables(self, parent):
       
    71         parent.AddGrowableCol(0)
       
    72         parent.AddGrowableRow(0)
       
    73         parent.AddGrowableRow(1)
       
    74 
       
    75     def _init_coll_RightGridSizer_Items(self, parent):
       
    76         parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
       
    77         parent.AddWindow(self.CurrentIndexes, 0, border=0, flag=wx.GROW)
       
    78 
       
    79     def _init_coll_RightGridSizer_Growables(self, parent):
       
    80         parent.AddGrowableCol(0)
       
    81         parent.AddGrowableRow(1)
    46 
    82 
    47     def _init_sizers(self):
    83     def _init_sizers(self):
    48         # generated method, don't edit
    84         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
    49         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
    85         self.MainSizer = wx.FlexGridSizer(cols=3, hgap=15, rows=1, vgap=0)
    50 
    86         self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
       
    87         self.MiddleGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=40)
       
    88         self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5)
       
    89         
    51         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
    90         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
    52 
    91         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
       
    92         self._init_coll_MainSizer_Items(self.MainSizer)
       
    93         self._init_coll_MainSizer_Growables(self.MainSizer)
       
    94         self._init_coll_LeftGridSizer_Items(self.LeftGridSizer)
       
    95         self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer)
       
    96         self._init_coll_MiddleGridSizer_Items(self.MiddleGridSizer)
       
    97         self._init_coll_MiddleGridSizer_Growables(self.MiddleGridSizer)
       
    98         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
       
    99         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
       
   100         
    53         self.SetSizer(self.flexGridSizer1)
   101         self.SetSizer(self.flexGridSizer1)
    54 
   102 
    55     def _init_ctrls(self, prnt):
   103     def _init_ctrls(self, prnt):
    56         # generated method, don't edit
   104         wx.Dialog.__init__(self, id=ID_COMMUNICATIONDIALOG,
    57         wx.Dialog.__init__(self, id=wxID_COMMUNICATIONDIALOG,
       
    58               name='CommunicationDialog', parent=prnt, pos=wx.Point(234, 216),
   105               name='CommunicationDialog', parent=prnt, pos=wx.Point(234, 216),
    59               size=wx.Size(726, 437), style=wx.DEFAULT_DIALOG_STYLE,
   106               size=wx.Size(726, 437), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
    60               title='Edit Communication Profile')
   107               title='Edit Communication Profile')
    61         self.SetClientSize(wx.Size(726, 437))
   108         self.SetClientSize(wx.Size(726, 437))
    62 
   109 
    63         self.MainPanel = wx.Panel(id=wxID_COMMUNICATIONDIALOGMAINPANEL,
   110         self.staticText1 = wx.StaticText(id=ID_COMMUNICATIONDIALOGSTATICTEXT1,
    64               name='MainPanel', parent=self, pos=wx.Point(0, 0),
   111               label='Possible Profile Indexes:', name='staticText1',
    65               size=wx.Size(688, 382), style=wx.TAB_TRAVERSAL)
   112               parent=self, pos=wx.Point(0, 0), size=wx.Size(0,
    66         self.MainPanel.SetAutoLayout(True)
   113               17), style=0)
    67 
   114 
    68         self.PossibleIndexes = wx.ListBox(choices=[],
   115         self.PossibleIndexes = wx.ListBox(choices=[],
    69               id=wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES,
   116               id=ID_COMMUNICATIONDIALOGPOSSIBLEINDEXES,
    70               name='PossibleIndexes', parent=self.MainPanel, pos=wx.Point(40,
   117               name='PossibleIndexes', parent=self, pos=wx.Point(0, 0), 
    71               48), size=wx.Size(280, 320), style=wxLB_EXTENDED)
   118               size=wx.Size(0, 0), style=wx.LB_EXTENDED)
    72         self.PossibleIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnPossibleIndexesDClick,
   119         self.PossibleIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnPossibleIndexesDClick,
    73               id=wxID_COMMUNICATIONDIALOGPOSSIBLEINDEXES)
   120               id=ID_COMMUNICATIONDIALOGPOSSIBLEINDEXES)
    74 
   121 
    75         self.CurrentIndexes = wx.ListBox(choices=[],
   122         self.Select = wx.Button(id=ID_COMMUNICATIONDIALOGSELECT, label='>>',
    76               id=wxID_COMMUNICATIONDIALOGCURRENTINDEXES, name='CurrentIndexes',
   123               name='Select', parent=self, pos=wx.Point(0, 0),
    77               parent=self.MainPanel, pos=wx.Point(400, 48), size=wx.Size(280,
       
    78               320), style=wxLB_EXTENDED)
       
    79         self.CurrentIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnCurrentIndexesDClick,
       
    80               id=wxID_COMMUNICATIONDIALOGCURRENTINDEXES)
       
    81 
       
    82         self.Select = wx.Button(id=wxID_COMMUNICATIONDIALOGSELECT, label='>>',
       
    83               name='Select', parent=self.MainPanel, pos=wx.Point(345, 136),
       
    84               size=wx.Size(32, 32), style=0)
   124               size=wx.Size(32, 32), style=0)
    85         self.Select.Bind(wx.EVT_BUTTON, self.OnSelectButton,
   125         self.Select.Bind(wx.EVT_BUTTON, self.OnSelectButton,
    86               id=wxID_COMMUNICATIONDIALOGSELECT)
   126               id=ID_COMMUNICATIONDIALOGSELECT)
    87 
   127 
    88         self.Unselect = wx.Button(id=wxID_COMMUNICATIONDIALOGUNSELECT,
   128         self.Unselect = wx.Button(id=ID_COMMUNICATIONDIALOGUNSELECT,
    89               label='<<', name='Unselect', parent=self.MainPanel,
   129               label='<<', name='Unselect', parent=self,
    90               pos=wx.Point(345, 216), size=wx.Size(32, 30), style=0)
   130               pos=wx.Point(0, 0), size=wx.Size(32, 32), style=0)
    91         self.Unselect.Bind(wx.EVT_BUTTON, self.OnUnselectButton,
   131         self.Unselect.Bind(wx.EVT_BUTTON, self.OnUnselectButton,
    92               id=wxID_COMMUNICATIONDIALOGUNSELECT)
   132               id=ID_COMMUNICATIONDIALOGUNSELECT)
    93 
   133 
    94         self.staticText1 = wx.StaticText(id=wxID_COMMUNICATIONDIALOGSTATICTEXT1,
   134         self.staticText2 = wx.StaticText(id=ID_COMMUNICATIONDIALOGSTATICTEXT2,
    95               label='Possible Profile Indexes:', name='staticText1',
   135               label='Current Profile Indexes:', name='staticText2',
    96               parent=self.MainPanel, pos=wx.Point(40, 24), size=wx.Size(156,
   136               parent=self, pos=wx.Point(0, 0), size=wx.Size(0,
    97               17), style=0)
   137               17), style=0)
    98 
   138 
    99         self.staticText2 = wx.StaticText(id=wxID_COMMUNICATIONDIALOGSTATICTEXT2,
   139         self.CurrentIndexes = wx.ListBox(choices=[],
   100               label='Current Profile Indexes:', name='staticText2',
   140               id=ID_COMMUNICATIONDIALOGCURRENTINDEXES, name='CurrentIndexes',
   101               parent=self.MainPanel, pos=wx.Point(400, 24), size=wx.Size(152,
   141               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), 
   102               17), style=0)
   142               style=wx.LB_EXTENDED)
   103 
   143         self.CurrentIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnCurrentIndexesDClick,
       
   144               id=ID_COMMUNICATIONDIALOGCURRENTINDEXES)
       
   145 
       
   146         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
       
   147         
   104         self._init_sizers()
   148         self._init_sizers()
   105 
   149 
   106     def __init__(self, parent):
   150     def __init__(self, parent):
   107         self._init_ctrls(parent)
   151         self._init_ctrls(parent)
   108         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
       
   109         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
       
   110         self.AllList = []
   152         self.AllList = []
   111         self.CurrentList = []
   153         self.CurrentList = []
   112         self.IndexDictionary = {}
   154         self.IndexDictionary = {}
   113 
   155 
   114     def SetIndexDictionary(self, dictionary):
   156     def SetIndexDictionary(self, dictionary):
   172 #-------------------------------------------------------------------------------
   214 #-------------------------------------------------------------------------------
   173 #                          Create Map Variable Dialog
   215 #                          Create Map Variable Dialog
   174 #-------------------------------------------------------------------------------
   216 #-------------------------------------------------------------------------------
   175 
   217 
   176 
   218 
   177 [wxID_MAPVARIABLEDIALOG, wxID_MAPVARIABLEDIALOGINDEX, 
   219 [ID_MAPVARIABLEDIALOG, ID_MAPVARIABLEDIALOGINDEX, 
   178  wxID_MAPVARIABLEDIALOGINDEXNAME, wxID_MAPVARIABLEDIALOGMAINPANEL, 
   220  ID_MAPVARIABLEDIALOGINDEXNAME, ID_MAPVARIABLEDIALOGSPACER, 
   179  wxID_MAPVARIABLEDIALOGNUMBER, wxID_MAPVARIABLEDIALOGRADIOBUTTON1, 
   221  ID_MAPVARIABLEDIALOGNUMBER, ID_MAPVARIABLEDIALOGRADIOBUTTON1, 
   180  wxID_MAPVARIABLEDIALOGRADIOBUTTON2, wxID_MAPVARIABLEDIALOGRADIOBUTTON3, 
   222  ID_MAPVARIABLEDIALOGRADIOBUTTON2, ID_MAPVARIABLEDIALOGRADIOBUTTON3, 
   181  wxID_MAPVARIABLEDIALOGSTATICTEXT1, wxID_MAPVARIABLEDIALOGSTATICTEXT2, 
   223  ID_MAPVARIABLEDIALOGSTATICTEXT1, ID_MAPVARIABLEDIALOGSTATICTEXT2, 
   182  wxID_MAPVARIABLEDIALOGSTATICTEXT3, wxID_MAPVARIABLEDIALOGSTATICTEXT4, 
   224  ID_MAPVARIABLEDIALOGSTATICTEXT3, ID_MAPVARIABLEDIALOGSTATICTEXT4, 
   183 ] = [wx.NewId() for _init_ctrls in range(12)]
   225 ] = [wx.NewId() for _init_ctrls in range(12)]
   184 
   226 
   185 class MapVariableDialog(wx.Dialog):
   227 class MapVariableDialog(wx.Dialog):
   186     def _init_coll_flexGridSizer1_Items(self, parent):
   228     def _init_coll_flexGridSizer1_Items(self, parent):
   187         # generated method, don't edit
   229         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   188 
   230         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   189         parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
   231 
       
   232     def _init_coll_flexGridSizer1_Growables(self, parent):
       
   233         parent.AddGrowableCol(0)
       
   234         parent.AddGrowableRow(0)
       
   235 
       
   236     def _init_coll_MainSizer_Items(self, parent):
       
   237         parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
       
   238         parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
       
   239         parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
       
   240         parent.AddWindow(self.Index, 0, border=0, flag=wx.GROW)
       
   241         parent.AddWindow(self.radioButton1, 0, border=0, flag=wx.GROW)
       
   242         parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
       
   243         parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
       
   244         parent.AddWindow(self.radioButton2, 0, border=0, flag=wx.GROW)
       
   245         parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
       
   246         parent.AddWindow(self.IndexName, 0, border=0, flag=wx.GROW)
       
   247         parent.AddWindow(self.radioButton3, 0, border=0, flag=wx.GROW)
       
   248         parent.AddWindow(self.Number, 0, border=0, flag=wx.GROW)
       
   249         
       
   250     def _init_coll_MainSizer_Growables(self, parent):
       
   251         parent.AddGrowableCol(0)
       
   252         parent.AddGrowableCol(2)
   190 
   253 
   191     def _init_sizers(self):
   254     def _init_sizers(self):
   192         # generated method, don't edit
   255         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
   193         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
   256         self.MainSizer = wx.FlexGridSizer(cols=3, hgap=30, rows=4, vgap=5)
   194 
   257         
   195         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   258         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   196 
   259         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
       
   260         self._init_coll_MainSizer_Items(self.MainSizer)
       
   261         self._init_coll_MainSizer_Growables(self.MainSizer)
       
   262         
   197         self.SetSizer(self.flexGridSizer1)
   263         self.SetSizer(self.flexGridSizer1)
   198 
   264 
   199     def _init_ctrls(self, prnt):
   265     def _init_ctrls(self, prnt):
   200         # generated method, don't edit
   266         wx.Dialog.__init__(self, id=ID_MAPVARIABLEDIALOG,
   201         wx.Dialog.__init__(self, id=wxID_MAPVARIABLEDIALOG,
       
   202               name='CommunicationDialog', parent=prnt, pos=wx.Point(376, 223),
   267               name='CommunicationDialog', parent=prnt, pos=wx.Point(376, 223),
   203               size=wx.Size(444, 186), style=wx.DEFAULT_DIALOG_STYLE,
   268               size=wx.Size(444, 186), style=wx.DEFAULT_DIALOG_STYLE,
   204               title='Add Map Variable')
   269               title='Add Map Variable')
   205         self.SetClientSize(wx.Size(444, 186))
   270         self.SetClientSize(wx.Size(444, 186))
   206 
   271 
   207         self.MainPanel = wx.Panel(id=wxID_MAPVARIABLEDIALOGMAINPANEL,
   272         self.staticText1 = wx.StaticText(id=ID_MAPVARIABLEDIALOGSTATICTEXT1,
   208               name='MainPanel', parent=self, pos=wx.Point(0, 0),
   273               label='Index:', name='staticText1', parent=self,
   209               size=wx.Size(431, 142), style=wx.TAB_TRAVERSAL)
   274               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   210         self.MainPanel.SetAutoLayout(True)
   275 
   211 
   276         self.staticText2 = wx.StaticText(id=ID_MAPVARIABLEDIALOGSTATICTEXT2,
   212         self.staticText1 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT1,
   277               label='Type:', name='staticText2', parent=self,
   213               label='Index:', name='staticText1', parent=self.MainPanel,
   278               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   214               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
   279 
   215 
   280         self.staticText3 = wx.StaticText(id=ID_MAPVARIABLEDIALOGSTATICTEXT3,
   216         self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index',
   281               label='Name:', name='staticText3', parent=self,
   217               parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152,
   282               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   218               25), style=0, value='0x2000')
   283 
   219 
   284         self.staticText4 = wx.StaticText(id=ID_MAPVARIABLEDIALOGSTATICTEXT4,
   220         self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3,
   285               label='Number:', name='staticText4', parent=self,
   221               label='Name:', name='staticText3', parent=self.MainPanel,
   286               pos=wx.Point(0, 0), size=wx.Size(0, 16), style=0)
   222               pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0)
   287 
   223 
   288         self.radioButton1 = wx.RadioButton(id=ID_MAPVARIABLEDIALOGRADIOBUTTON1,
   224         self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME,
   289               label='VAR', name='radioButton1', parent=self,
   225               name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104),
   290               pos=wx.Point(0, 0), size=wx.Size(80, 24), style=wx.RB_GROUP)
   226               size=wx.Size(152, 24), style=0, value='Undefined')
       
   227 
       
   228         self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2,
       
   229               label='Type:', name='staticText2', parent=self.MainPanel,
       
   230               pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0)
       
   231 
       
   232         self.radioButton1 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1,
       
   233               label='VAR', name='radioButton1', parent=self.MainPanel,
       
   234               pos=wx.Point(208, 48), size=wx.Size(72, 24), style=wxRB_GROUP)
       
   235         self.radioButton1.SetValue(True)
   291         self.radioButton1.SetValue(True)
   236         self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click,
   292         self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click,
   237               id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1)
   293               id=ID_MAPVARIABLEDIALOGRADIOBUTTON1)
   238 
   294 
   239         self.radioButton2 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2,
   295         self.radioButton2 = wx.RadioButton(id=ID_MAPVARIABLEDIALOGRADIOBUTTON2,
   240               label='ARRAY', name='radioButton2', parent=self.MainPanel,
   296               label='ARRAY', name='radioButton2', parent=self,
   241               pos=wx.Point(208, 72), size=wx.Size(80, 24), style=wxRB_SINGLE)
   297               pos=wx.Point(0, 0), size=wx.Size(80, 24), style=wx.RB_SINGLE)
   242         self.radioButton2.SetValue(False)
   298         self.radioButton2.SetValue(False)
   243         self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click,
   299         self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click,
   244               id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2)
   300               id=ID_MAPVARIABLEDIALOGRADIOBUTTON2)
   245 
   301 
   246         self.radioButton3 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3,
   302         self.radioButton3 = wx.RadioButton(id=ID_MAPVARIABLEDIALOGRADIOBUTTON3,
   247               label='REC', name='radioButton3', parent=self.MainPanel,
   303               label='REC', name='radioButton3', parent=self,
   248               pos=wx.Point(208, 96), size=wx.Size(96, 24), style=wxRB_SINGLE)
   304               pos=wx.Point(0, 0), size=wx.Size(80, 24), style=wx.RB_SINGLE)
   249         self.radioButton3.SetValue(False)
   305         self.radioButton3.SetValue(False)
   250         self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click,
   306         self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click,
   251               id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3)
   307               id=ID_MAPVARIABLEDIALOGRADIOBUTTON3)
   252 
   308 
   253         self.staticText4 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT4,
   309         self.Index = wx.TextCtrl(id=ID_MAPVARIABLEDIALOGINDEX, name='Index',
   254               label='Number:', name='staticText4', parent=self.MainPanel,
   310               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 25), 
   255               pos=wx.Point(312, 80), size=wx.Size(88, 16), style=0)
   311               style=0, value='0x2000')
   256 
   312         
   257         self.Number = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGNUMBER,
   313         self.IndexName = wx.TextCtrl(id=ID_MAPVARIABLEDIALOGINDEXNAME,
   258               name='Number', parent=self.MainPanel, pos=wx.Point(312, 104),
   314               name='IndexName', parent=self, pos=wx.Point(0, 0),
   259               size=wx.Size(112, 24), style=wx.TE_RIGHT, value='0')
   315               size=wx.Size(0, 24), style=0, value='Undefined')
   260 
   316         
       
   317         self.Number = wx.TextCtrl(id=ID_MAPVARIABLEDIALOGNUMBER,
       
   318               name='Number', parent=self, pos=wx.Point(0, 0),
       
   319               size=wx.Size(0, 24), style=wx.TE_RIGHT, value='0')
       
   320         
       
   321         self.Spacer = wx.Panel(id=ID_MAPVARIABLEDIALOGSPACER,
       
   322               name='Spacer', parent=self, pos=wx.Point(0, 0),
       
   323               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
       
   324         
       
   325         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
       
   326         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
       
   327         
   261         self._init_sizers()
   328         self._init_sizers()
   262 
   329 
   263     def __init__(self, parent):
   330     def __init__(self, parent):
   264         self._init_ctrls(parent)
   331         self._init_ctrls(parent)
   265         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
       
   266         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
       
   267         self.staticText4.Enable(False)
   332         self.staticText4.Enable(False)
   268         self.Number.Enable(False)
   333         self.Number.Enable(False)
   269         
   334         
   270         EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
       
   271 
       
   272     def SetIndex(self, index):
   335     def SetIndex(self, index):
   273         self.Index.SetValue("0x%04X"%index)
   336         self.Index.SetValue("0x%04X"%index)
   274 
   337 
   275     def OnOK(self, event):
   338     def OnOK(self, event):
   276         error = []
   339         error = []
   294                     text += item
   357                     text += item
   295                 elif i == len(error) - 1:
   358                 elif i == len(error) - 1:
   296                     text += " and %s"%item
   359                     text += " and %s"%item
   297                 else:
   360                 else:
   298                     text += ", %s"%item
   361                     text += ", %s"%item
   299             message = wxMessageDialog(self, "Form isn't valid. %s must be integer%s!"%(text,suffix), "Error", wxOK|wxICON_ERROR)
   362             message = wx.MessageDialog(self, "Form isn't valid. %s must be integer%s!"%(text,suffix), "Error", wx.OK|wx.ICON_ERROR)
   300             message.ShowModal()
   363             message.ShowModal()
   301             message.Destroy()
   364             message.Destroy()
   302         else:
   365         else:
   303             self.EndModal(wxID_OK)
   366             self.EndModal(wx.ID_OK)
   304 
   367 
   305     def GetValues(self):
   368     def GetValues(self):
   306         name = self.IndexName.GetValue()
   369         name = self.IndexName.GetValue()
   307         index = int(self.Index.GetValue(), 16)
   370         index = int(self.Index.GetValue(), 16)
   308         if self.radioButton1.GetValue():
   371         if self.radioButton1.GetValue():
   336 #-------------------------------------------------------------------------------
   399 #-------------------------------------------------------------------------------
   337 #                          Create User Type Dialog
   400 #                          Create User Type Dialog
   338 #-------------------------------------------------------------------------------
   401 #-------------------------------------------------------------------------------
   339 
   402 
   340 
   403 
   341 [wxID_USERTYPEDIALOG, wxID_USERTYPEDIALOGLENGTH, wxID_USERTYPEDIALOGMAINPANEL, 
   404 [ID_USERTYPEDIALOG, ID_USERTYPEDIALOGSPACER, 
   342  wxID_USERTYPEDIALOGMAX, wxID_USERTYPEDIALOGMIN, 
   405  ID_USERTYPEDIALOGTYPE, ID_USERTYPEDIALOGMAX, 
   343  wxID_USERTYPEDIALOGSTATICBOX1, wxID_USERTYPEDIALOGSTATICTEXT1, 
   406  ID_USERTYPEDIALOGMIN, ID_USERTYPEDIALOGLENGTH, 
   344  wxID_USERTYPEDIALOGSTATICTEXT2, wxID_USERTYPEDIALOGSTATICTEXT3, 
   407  ID_USERTYPEDIALOGSTATICBOX1, ID_USERTYPEDIALOGSTATICTEXT1, 
   345  wxID_USERTYPEDIALOGSTATICTEXT4, wxID_USERTYPEDIALOGTYPE, 
   408  ID_USERTYPEDIALOGSTATICTEXT2, ID_USERTYPEDIALOGSTATICTEXT3, 
       
   409  ID_USERTYPEDIALOGSTATICTEXT4,  
   346 ] = [wx.NewId() for _init_ctrls in range(11)]
   410 ] = [wx.NewId() for _init_ctrls in range(11)]
   347 
   411 
   348 class UserTypeDialog(wx.Dialog):
   412 class UserTypeDialog(wx.Dialog):
   349     def _init_coll_flexGridSizer1_Items(self, parent):
   413     def _init_coll_flexGridSizer1_Items(self, parent):
   350         # generated method, don't edit
   414         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   351 
   415         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   352         parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
   416 
   353 
   417     def _init_coll_flexGridSizer1_Growables(self, parent):
       
   418         parent.AddGrowableCol(0)
       
   419         parent.AddGrowableRow(0)
       
   420 
       
   421     def _init_coll_MainSizer_Items(self, parent):
       
   422         parent.AddSizer(self.LeftGridSizer, 2, border=5, flag=wx.GROW|wx.RIGHT)
       
   423         parent.AddSizer(self.RightBoxSizer, 3, border=5, flag=wx.GROW|wx.LEFT)
       
   424 
       
   425     def _init_coll_LeftGridSizer_Items(self, parent):
       
   426         parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
       
   427         parent.AddWindow(self.Type, 0, border=0, flag=wx.GROW)
       
   428         parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
       
   429 
       
   430     def _init_coll_LeftGridSizer_Growables(self, parent):
       
   431         parent.AddGrowableCol(0)
       
   432         parent.AddGrowableRow(2)
       
   433 
       
   434     def _init_coll_RightBoxSizer_Items(self, parent):
       
   435         parent.AddSizer(self.RightBoxGridSizer, 0, border=10, flag=wx.GROW|wx.ALL)
       
   436 
       
   437     def _init_coll_RightBoxGridSizer_Items(self, parent):
       
   438         parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
       
   439         parent.AddWindow(self.Min, 0, border=0, flag=wx.GROW)
       
   440         parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
       
   441         parent.AddWindow(self.Max, 0, border=0, flag=wx.GROW)
       
   442         parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
       
   443         parent.AddWindow(self.Length, 0, border=0, flag=wx.GROW)
       
   444         
       
   445     def _init_coll_RightBoxGridSizer_Growables(self, parent):
       
   446         parent.AddGrowableCol(1)
       
   447         
   354     def _init_sizers(self):
   448     def _init_sizers(self):
   355         # generated method, don't edit
   449         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
   356         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
   450         self.MainSizer = wx.BoxSizer(wx.HORIZONTAL)
   357 
   451         self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
       
   452         self.RightBoxSizer = wx.StaticBoxSizer(self.staticBox1, wx.VERTICAL)
       
   453         self.RightBoxGridSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=10)
       
   454         
   358         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   455         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   359 
   456         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
       
   457         self._init_coll_MainSizer_Items(self.MainSizer)
       
   458         self._init_coll_LeftGridSizer_Items(self.LeftGridSizer)
       
   459         self._init_coll_LeftGridSizer_Growables(self.LeftGridSizer)
       
   460         self._init_coll_RightBoxSizer_Items(self.RightBoxSizer)
       
   461         self._init_coll_RightBoxGridSizer_Items(self.RightBoxGridSizer)
       
   462         self._init_coll_RightBoxGridSizer_Growables(self.RightBoxGridSizer)
       
   463         
   360         self.SetSizer(self.flexGridSizer1)
   464         self.SetSizer(self.flexGridSizer1)
   361 
   465 
   362     def _init_ctrls(self, prnt):
   466     def _init_ctrls(self, prnt):
   363         # generated method, don't edit
   467         wx.Dialog.__init__(self, id=ID_USERTYPEDIALOG, name='UserTypeDialog',
   364         wx.Dialog.__init__(self, id=wxID_USERTYPEDIALOG, name='UserTypeDialog',
   468               parent=prnt, pos=wx.Point(376, 223), size=wx.Size(444, 210),
   365               parent=prnt, pos=wx.Point(376, 223), size=wx.Size(444, 228),
       
   366               style=wx.DEFAULT_DIALOG_STYLE, title='Add User Type')
   469               style=wx.DEFAULT_DIALOG_STYLE, title='Add User Type')
   367         self.SetClientSize(wx.Size(444, 228))
   470         self.SetClientSize(wx.Size(444, 210))
   368 
   471 
   369         self.MainPanel = wx.Panel(id=wxID_USERTYPEDIALOGMAINPANEL,
   472         self.staticText1 = wx.StaticText(id=ID_USERTYPEDIALOGSTATICTEXT1,
   370               name='MainPanel', parent=self, pos=wx.Point(0, 0),
   473               label='Type:', name='staticText1', parent=self,
   371               size=wx.Size(431, 182), style=wx.TAB_TRAVERSAL)
   474               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   372         self.MainPanel.SetAutoLayout(True)
   475 
   373 
   476         self.Type = wx.Choice(choices=[], id=ID_USERTYPEDIALOGTYPE,
   374         self.staticText1 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT1,
   477               name='Type', parent=self, pos=wx.Point(0, 0),
   375               label='Type:', name='staticText1', parent=self.MainPanel,
   478               size=wx.Size(0, 24), style=0)
   376               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
       
   377 
       
   378         self.Type = wx.Choice(choices=[], id=wxID_USERTYPEDIALOGTYPE,
       
   379               name='Type', parent=self.MainPanel, pos=wx.Point(24, 48),
       
   380               size=wx.Size(160, 24), style=0)
       
   381         self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice,
   479         self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice,
   382               id=wxID_USERTYPEDIALOGTYPE)
   480               id=ID_USERTYPEDIALOGTYPE)
   383 
   481 
   384         self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1,
   482         self.Spacer = wx.Panel(id=ID_MAPVARIABLEDIALOGSPACER,
   385               label='Values', name='staticBox1', parent=self.MainPanel,
   483               name='Spacer', parent=self, pos=wx.Point(0, 0),
   386               pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0)
   484               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   387 
   485 
   388         self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2,
   486         self.staticBox1 = wx.StaticBox(id=ID_USERTYPEDIALOGSTATICBOX1,
   389               label='Minimum:', name='staticText2', parent=self.MainPanel,
   487               label='Values', name='staticBox1', parent=self,
   390               pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0)
   488               pos=wx.Point(0, 0), size=wx.Size(0, 0), style=0)
   391 
   489 
   392         self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min',
   490         self.staticText2 = wx.StaticText(id=ID_USERTYPEDIALOGSTATICTEXT2,
   393               parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112,
   491               label='Minimum:', name='staticText2', parent=self,
   394               24), style=wx.TE_RIGHT, value='0')
   492               pos=wx.Point(0, 0), size=wx.Size(80, 17), style=0)
   395 
   493 
   396         self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3,
   494         self.Min = wx.TextCtrl(id=ID_USERTYPEDIALOGMIN, name='Min',
   397               label='Maximum:', name='staticText3', parent=self.MainPanel,
   495               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), 
   398               pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0)
   496               style=wx.TE_RIGHT, value='0')
   399 
   497 
   400         self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max',
   498         self.staticText3 = wx.StaticText(id=ID_USERTYPEDIALOGSTATICTEXT3,
   401               parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112,
   499               label='Maximum:', name='staticText3', parent=self,
   402               25), style=wx.TE_RIGHT, value='0')
   500               pos=wx.Point(0, 0), size=wx.Size(80, 17), style=0)
   403 
   501 
   404         self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4,
   502         self.Max = wx.TextCtrl(id=ID_USERTYPEDIALOGMAX, name='Max',
   405               label='Length:', name='staticText4', parent=self.MainPanel,
   503               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), 
   406               pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0)
   504               style=wx.TE_RIGHT, value='0')
   407 
   505 
   408         self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length',
   506         self.staticText4 = wx.StaticText(id=ID_USERTYPEDIALOGSTATICTEXT4,
   409               parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112,
   507               label='Length:', name='staticText4', parent=self,
   410               25), style=wx.TE_RIGHT, value='0')
   508               pos=wx.Point(0, 0), size=wx.Size(80, 17), style=0)
   411 
   509 
       
   510         self.Length = wx.TextCtrl(id=ID_USERTYPEDIALOGLENGTH, name='Length',
       
   511               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), 
       
   512               style=wx.TE_RIGHT, value='0')
       
   513 
       
   514         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
       
   515         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
       
   516         
   412         self._init_sizers()
   517         self._init_sizers()
   413 
   518 
   414     def __init__(self, parent):
   519     def __init__(self, parent):
   415         self._init_ctrls(parent)
   520         self._init_ctrls(parent)
   416         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
   521         
   417         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
       
   418         self.TypeDictionary = {}
   522         self.TypeDictionary = {}
   419 
       
   420         EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
       
   421 
   523 
   422     def OnOK(self, event):
   524     def OnOK(self, event):
   423         error = []
   525         error = []
   424         good = True
   526         good = True
   425         firstmessage = ""
   527         firstmessage = ""
   458                     secondmessage += "s"
   560                     secondmessage += "s"
   459         else:
   561         else:
   460             firstmessage = ". A type must be selected"
   562             firstmessage = ". A type must be selected"
   461             good = False
   563             good = False
   462         if not good:
   564         if not good:
   463             message = wxMessageDialog(self, "Form isn't valid%s%s%s!"%(firstmessage,secondmessage), "Error", wxOK|wxICON_ERROR)
   565             message = wx.MessageDialog(self, "Form isn't valid%s%s%s!"%(firstmessage,secondmessage), "Error", wx.OK|wx.ICON_ERROR)
   464             message.ShowModal()
   566             message.ShowModal()
   465             message.Destroy()
   567             message.Destroy()
   466             self.Name.SetFocus()
   568             self.Name.SetFocus()
   467         else:
   569         else:
   468             self.EndModal(wxID_OK)
   570             self.EndModal(wx.ID_OK)
   469 
   571 
   470     def SetValues(self, min = None, max = None, length = None):
   572     def SetValues(self, min = None, max = None, length = None):
   471         if min != None:
   573         if min != None:
   472             self.Min.SetValue(str(min))
   574             self.Min.SetValue(str(min))
   473         if max != None:
   575         if max != None:
   531 #-------------------------------------------------------------------------------
   633 #-------------------------------------------------------------------------------
   532 #                          Editing Node Infos Dialog
   634 #                          Editing Node Infos Dialog
   533 #-------------------------------------------------------------------------------
   635 #-------------------------------------------------------------------------------
   534 
   636 
   535 
   637 
   536 [wxID_NODEINFOSDIALOG, wxID_NODEINFOSDIALOGMAINPANEL, 
   638 [ID_NODEINFOSDIALOG, ID_NODEINFOSDIALOGNAME, 
   537  wxID_NODEINFOSDIALOGNAME, wxID_NODEINFOSDIALOGNODEID, 
   639  ID_NODEINFOSDIALOGNODEID, ID_NODEINFOSDIALOGDESCRIPTION, 
   538  wxID_NODEINFOSDIALOGDESCRIPTION, wxID_NODEINFOSDIALOGSTATICTEXT1, 
   640  ID_NODEINFOSDIALOGTYPE, ID_NODEINFOSDIALOGSTATICTEXT1, 
   539  wxID_NODEINFOSDIALOGSTATICTEXT2, wxID_NODEINFOSDIALOGSTATICTEXT3, 
   641  ID_NODEINFOSDIALOGSTATICTEXT2, ID_NODEINFOSDIALOGSTATICTEXT3, 
   540  wxID_NODEINFOSDIALOGSTATICTEXT4, wxID_NODEINFOSDIALOGTYPE, 
   642  ID_NODEINFOSDIALOGSTATICTEXT4,  
   541 ] = [wx.NewId() for _init_ctrls in range(10)]
   643 ] = [wx.NewId() for _init_ctrls in range(9)]
   542 
   644 
   543 class NodeInfosDialog(wx.Dialog):
   645 class NodeInfosDialog(wx.Dialog):
   544     def _init_coll_flexGridSizer1_Items(self, parent):
   646     def _init_coll_flexGridSizer1_Items(self, parent):
   545         # generated method, don't edit
   647         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   546 
   648         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   547         parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
   649 
       
   650     def _init_coll_flexGridSizer1_Growables(self, parent):
       
   651         parent.AddGrowableCol(0)
       
   652         parent.AddGrowableRow(0)
       
   653 
       
   654     def _init_coll_MainSizer_Items(self, parent):
       
   655         parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW)
       
   656         parent.AddWindow(self.Name, 0, border=0, flag=wx.GROW)
       
   657         parent.AddWindow(self.staticText2, 0, border=0, flag=wx.GROW)
       
   658         parent.AddWindow(self.NodeID, 0, border=0, flag=wx.GROW)
       
   659         parent.AddWindow(self.staticText3, 0, border=0, flag=wx.GROW)
       
   660         parent.AddWindow(self.Type, 0, border=0, flag=wx.GROW)
       
   661         parent.AddWindow(self.staticText4, 0, border=0, flag=wx.GROW)
       
   662         parent.AddWindow(self.Description, 0, border=0, flag=wx.GROW)
       
   663 
       
   664     def _init_coll_MainSizer_Growables(self, parent):
       
   665         parent.AddGrowableCol(0)
   548 
   666 
   549     def _init_sizers(self):
   667     def _init_sizers(self):
   550         # generated method, don't edit
   668         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
   551         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
   669         self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=8, vgap=5)
   552 
   670         
   553         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   671         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   554 
   672         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
       
   673         self._init_coll_MainSizer_Items(self.MainSizer)
       
   674         self._init_coll_MainSizer_Growables(self.MainSizer)
       
   675         
   555         self.SetSizer(self.flexGridSizer1)
   676         self.SetSizer(self.flexGridSizer1)
   556 
   677         
   557     def _init_ctrls(self, prnt):
   678     def _init_ctrls(self, prnt):
   558         # generated method, don't edit
   679         wx.Dialog.__init__(self, id=ID_NODEINFOSDIALOG,
   559         wx.Dialog.__init__(self, id=wxID_NODEINFOSDIALOG,
       
   560               name='NodeInfosDialog', parent=prnt, pos=wx.Point(376, 223),
   680               name='NodeInfosDialog', parent=prnt, pos=wx.Point(376, 223),
   561               size=wx.Size(300, 300), style=wx.DEFAULT_DIALOG_STYLE,
   681               size=wx.Size(300, 280), style=wx.DEFAULT_DIALOG_STYLE,
   562               title='Node Infos')
   682               title='Node Infos')
   563         self.SetClientSize(wx.Size(300, 300))
   683         self.SetClientSize(wx.Size(300, 280))
   564 
   684 
   565         self.MainPanel = wx.Panel(id=wxID_NODEINFOSDIALOGMAINPANEL,
   685         self.staticText1 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT1,
   566               name='MainPanel', parent=self, pos=wx.Point(0, 0),
   686               label='Name:', name='staticText1', parent=self,
   567               size=wx.Size(280, 264), style=wx.TAB_TRAVERSAL)
   687               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   568         self.MainPanel.SetAutoLayout(True)
   688 
   569 
   689         self.Name = wx.TextCtrl(id=ID_NODEINFOSDIALOGNAME, name='Name',
   570         self.staticText1 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT1,
   690               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), 
   571               label='Name:', 
   691               style=0, value='')
   572               name='staticText1', parent=self.MainPanel,
   692 
   573               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
   693         self.staticText2 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT2,
   574 
   694               label='Node ID:', name='staticText2', parent=self,
   575         self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name',
   695               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   576               parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(250,
   696 
   577               25), style=0, value='')
   697         self.NodeID = wx.TextCtrl(id=ID_NODEINFOSDIALOGNODEID, name='NodeID',
   578 
   698               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 25), 
   579         self.staticText2 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT2,
   699               style=wx.TE_RIGHT, value='')
   580               label='Node ID:', name='staticText2', parent=self.MainPanel,
   700 
   581               pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
   701         self.staticText3 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT3,
   582 
   702               label='Type:', name='staticText3', parent=self,
   583         self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID',
   703               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   584               parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(250,
   704 
   585               25), style=wx.TE_RIGHT, value='')
   705         self.Type = wx.Choice(choices=[], id=ID_NODEINFOSDIALOGTYPE,
   586 
   706               name='Type', parent=self, pos=wx.Point(0, 0),
   587         self.staticText3 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT3,
   707               size=wx.Size(0, 25), style=0)
   588               label='Type:', name='staticText3', parent=self.MainPanel,
   708 
   589               pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
   709         self.staticText4 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT4,
   590 
   710               label='Description:', name='staticText4', parent=self,
   591         self.Type = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGTYPE,
   711               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   592               name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
   712 
   593               size=wx.Size(250, 25), style=0)
   713         self.Description = wx.TextCtrl(id=ID_NODEINFOSDIALOGDESCRIPTION, 
   594 
   714               name='Description', parent=self, pos=wx.Point(0, 0), 
   595         self.staticText4 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT4,
   715               size=wx.Size(0, 24), style=0, value='')
   596               label='Description:', name='staticText4', parent=self.MainPanel,
   716 
   597               pos=wx.Point(24, 192), size=wx.Size(71, 17), style=0)
   717         self.Spacer = wx.Panel(id=ID_MAPVARIABLEDIALOGSPACER,
   598 
   718               name='Spacer', parent=self, pos=wx.Point(0, 0),
   599         self.Description = wx.TextCtrl(id=wxID_NODEINFOSDIALOGDESCRIPTION, 
   719               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   600               name='Description', parent=self.MainPanel, pos=wx.Point(24, 216), 
   720 
   601               size=wx.Size(250, 25), style=0, value='')
   721         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
   602 
   722         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
       
   723         
   603         self._init_sizers()
   724         self._init_sizers()
   604 
   725 
   605     def __init__(self, parent):
   726     def __init__(self, parent):
   606         self._init_ctrls(parent)
   727         self._init_ctrls(parent)
   607         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
   728         
   608         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
       
   609         self.Type.Append("master")
   729         self.Type.Append("master")
   610         self.Type.Append("slave")
   730         self.Type.Append("slave")
   611 
       
   612         EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
       
   613 
   731 
   614     def OnOK(self, event):
   732     def OnOK(self, event):
   615         name = self.Name.GetValue()
   733         name = self.Name.GetValue()
   616         message = ""
   734         message = ""
   617         if name != "":
   735         if name != "":
   624             try:
   742             try:
   625                 nodeid = int(self.NodeID.GetValue(), 16)
   743                 nodeid = int(self.NodeID.GetValue(), 16)
   626             except:
   744             except:
   627                 message = "Node ID must be integer!"
   745                 message = "Node ID must be integer!"
   628         if message != "":
   746         if message != "":
   629             message = wxMessageDialog(self, message, "ERROR", wxOK|wxICON_ERROR)
   747             message = wx.MessageDialog(self, message, "ERROR", wx.OK|wx.ICON_ERROR)
   630             message.ShowModal()
   748             message.ShowModal()
   631             message.Destroy()
   749             message.Destroy()
   632             self.Name.SetFocus()
   750             self.Name.SetFocus()
   633         else:
   751         else:
   634             self.EndModal(wxID_OK)
   752             self.EndModal(wx.ID_OK)
   635     
   753     
   636     def SetValues(self, name, id, type, description):
   754     def SetValues(self, name, id, type, description):
   637         self.Name.SetValue(name)
   755         self.Name.SetValue(name)
   638         self.NodeID.SetValue("0x%02X"%id)
   756         self.NodeID.SetValue("0x%02X"%id)
   639         self.Type.SetStringSelection(type)
   757         self.Type.SetStringSelection(type)
   651 #-------------------------------------------------------------------------------
   769 #-------------------------------------------------------------------------------
   652 #                          Create New Node Dialog
   770 #                          Create New Node Dialog
   653 #-------------------------------------------------------------------------------
   771 #-------------------------------------------------------------------------------
   654 
   772 
   655 
   773 
   656 [wxID_CREATENODEDIALOG, wxID_CREATENODEDIALOGEMERGENCY, 
   774 [ID_CREATENODEDIALOG, ID_CREATENODEDIALOGEMERGENCY, 
   657  wxID_CREATENODEDIALOGGENSYNC, wxID_CREATENODEDIALOGMAINPANEL, 
   775  ID_CREATENODEDIALOGGENSYNC, ID_CREATENODEDIALOGSPACER, 
   658  wxID_CREATENODEDIALOGNAME, wxID_CREATENODEDIALOGNMT_HEARTBEAT, 
   776  ID_CREATENODEDIALOGNAME, ID_CREATENODEDIALOGNMT_HEARTBEAT, 
   659  wxID_CREATENODEDIALOGNMT_NODEGUARDING, wxID_CREATENODEDIALOGNMT_NONE, 
   777  ID_CREATENODEDIALOGNMT_NODEGUARDING, ID_CREATENODEDIALOGNMT_NONE, 
   660  wxID_CREATENODEDIALOGNODEID, wxID_CREATENODEDIALOGPROFILE, 
   778  ID_CREATENODEDIALOGNODEID, ID_CREATENODEDIALOGPROFILE, 
   661  wxID_CREATENODEDIALOGSAVECONFIG, wxID_CREATENODEDIALOGSTATICTEXT1, 
   779  ID_CREATENODEDIALOGSAVECONFIG, ID_CREATENODEDIALOGSTATICTEXT1, 
   662  wxID_CREATENODEDIALOGSTATICTEXT2, wxID_CREATENODEDIALOGSTATICTEXT3, 
   780  ID_CREATENODEDIALOGSTATICTEXT2, ID_CREATENODEDIALOGSTATICTEXT3, 
   663  wxID_CREATENODEDIALOGSTATICTEXT4, wxID_CREATENODEDIALOGSTATICTEXT5, 
   781  ID_CREATENODEDIALOGSTATICTEXT4, ID_CREATENODEDIALOGSTATICTEXT5, 
   664  wxID_CREATENODEDIALOGSTATICTEXT6, wxID_CREATENODEDIALOGSTATICTEXT7,
   782  ID_CREATENODEDIALOGSTATICTEXT6, ID_CREATENODEDIALOGSTATICTEXT7,
   665  wxID_CREATENODEDIALOGSTOREEDS, wxID_CREATENODEDIALOGDESCRIPTION,
   783  ID_CREATENODEDIALOGSTOREEDS, ID_CREATENODEDIALOGDESCRIPTION,
   666  wxID_CREATENODEDIALOGTYPE, 
   784  ID_CREATENODEDIALOGTYPE, 
   667 ] = [wx.NewId() for _init_ctrls in range(21)]
   785 ] = [wx.NewId() for _init_ctrls in range(21)]
   668 
   786 
   669 class CreateNodeDialog(wx.Dialog):
   787 class CreateNodeDialog(wx.Dialog):
   670     def _init_coll_flexGridSizer1_Items(self, parent):
   788     def _init_coll_flexGridSizer1_Items(self, parent):
   671         # generated method, don't edit
   789         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   672 
   790         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   673         parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
   791 
       
   792     def _init_coll_flexGridSizer1_Growables(self, parent):
       
   793         parent.AddGrowableCol(0)
       
   794         parent.AddGrowableRow(0)
       
   795 
       
   796     def _init_coll_MainSizer_Items(self, parent):
       
   797         parent.AddSizer(self.TopBoxSizer, 0, border=0, flag=wx.GROW)
       
   798         parent.AddWindow(self.staticText7, 0, border=0, flag=wx.GROW)
       
   799         parent.AddWindow(self.Description, 0, border=0, flag=wx.GROW)
       
   800 
       
   801     def _init_coll_MainSizer_Growables(self, parent):
       
   802         parent.AddGrowableCol(0)
       
   803         parent.AddGrowableCol(0)
       
   804     
       
   805     def _init_coll_TopBoxSizer_Items(self, parent):
       
   806         parent.AddSizer(self.LeftBoxSizer, 1, border=10, flag=wx.GROW|wx.RIGHT)
       
   807         parent.AddSizer(self.RightGridSizer, 1, border=10, flag=wx.GROW|wx.LEFT)
       
   808     
       
   809     def _init_coll_LeftBoxSizer_Items(self, parent):
       
   810         parent.AddWindow(self.staticText1, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
   811         parent.AddWindow(self.Type, 0, border=10, flag=wx.GROW|wx.BOTTOM)
       
   812         parent.AddWindow(self.staticText2, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
   813         parent.AddWindow(self.Name, 0, border=10, flag=wx.GROW|wx.BOTTOM)
       
   814         parent.AddWindow(self.staticText3, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
   815         parent.AddWindow(self.NodeID, 0, border=10, flag=wx.GROW|wx.BOTTOM)
       
   816         parent.AddWindow(self.staticText4, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
   817         parent.AddWindow(self.Profile, 0, border=20, flag=wx.GROW|wx.BOTTOM)
       
   818 
       
   819     def _init_coll_RightGridSizer_Items(self, parent):
       
   820         parent.AddSizer(self.RightTopGridSizer, 0, border=0, flag=wx.GROW)
       
   821         parent.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW)
       
   822         parent.AddSizer(self.RightBottomGridSizer, 0, border=0, flag=wx.GROW)
       
   823 
       
   824     def _init_coll_RightGridSizer_Growables(self, parent):
       
   825         parent.AddGrowableCol(0)
       
   826         parent.AddGrowableRow(1)
       
   827 
       
   828     def _init_coll_RightTopGridSizer_Items(self, parent):
       
   829         parent.AddWindow(self.staticText5, 0, border=0, flag=wx.GROW)
       
   830         parent.AddWindow(self.NMT_None, 0, border=0, flag=wx.GROW)
       
   831         parent.AddWindow(self.NMT_NodeGuarding, 0, border=0, flag=wx.GROW)
       
   832         parent.AddWindow(self.NMT_Heartbeat, 0, border=0, flag=wx.GROW)
       
   833         
       
   834     def _init_coll_RightTopGridSizer_Growables(self, parent):
       
   835         parent.AddGrowableCol(0)
       
   836         
       
   837     def _init_coll_RightBottomGridSizer_Items(self, parent):
       
   838         parent.AddWindow(self.staticText6, 0, border=0, flag=wx.GROW)
       
   839         parent.AddWindow(self.DS302, 0, border=0, flag=wx.GROW)
       
   840         parent.AddWindow(self.GenSYNC, 0, border=0, flag=wx.GROW)
       
   841         parent.AddWindow(self.Emergency, 0, border=0, flag=wx.GROW)
       
   842         parent.AddWindow(self.SaveConfig, 0, border=0, flag=wx.GROW)
       
   843         parent.AddWindow(self.StoreEDS, 0, border=0, flag=wx.GROW)
       
   844         
       
   845     def _init_coll_RightBottomGridSizer_Growables(self, parent):
       
   846         parent.AddGrowableCol(0)
   674 
   847 
   675     def _init_sizers(self):
   848     def _init_sizers(self):
   676         # generated method, don't edit
   849         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
   677         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
   850         self.MainSizer = wx.FlexGridSizer(cols=1, hgap=5, rows=3, vgap=0)
   678 
   851         self.TopBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
       
   852         self.LeftBoxSizer = wx.BoxSizer(wx.VERTICAL)
       
   853         self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=5)
       
   854         self.RightTopGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=4, vgap=0)
       
   855         self.RightBottomGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=6, vgap=0)
       
   856         
   679         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   857         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   680 
   858         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
       
   859         self._init_coll_MainSizer_Items(self.MainSizer)
       
   860         self._init_coll_MainSizer_Growables(self.MainSizer)
       
   861         self._init_coll_TopBoxSizer_Items(self.TopBoxSizer)
       
   862         self._init_coll_LeftBoxSizer_Items(self.LeftBoxSizer)
       
   863         self._init_coll_RightGridSizer_Items(self.RightGridSizer)
       
   864         self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
       
   865         self._init_coll_RightTopGridSizer_Items(self.RightTopGridSizer)
       
   866         self._init_coll_RightTopGridSizer_Growables(self.RightTopGridSizer)
       
   867         self._init_coll_RightBottomGridSizer_Items(self.RightBottomGridSizer)
       
   868         self._init_coll_RightBottomGridSizer_Growables(self.RightBottomGridSizer)
       
   869         
   681         self.SetSizer(self.flexGridSizer1)
   870         self.SetSizer(self.flexGridSizer1)
   682 
   871 
   683     def _init_ctrls(self, prnt):
   872     def _init_ctrls(self, prnt):
   684         # generated method, don't edit
   873         wx.Dialog.__init__(self, id=ID_CREATENODEDIALOG,
   685         wx.Dialog.__init__(self, id=wxID_CREATENODEDIALOG,
       
   686               name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
   874               name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
   687               size=wx.Size(451, 376), style=wx.DEFAULT_DIALOG_STYLE,
   875               size=wx.Size(450, 350), style=wx.DEFAULT_DIALOG_STYLE,
   688               title='Create a new Node')
   876               title='Create a new Node')
   689         self.SetClientSize(wx.Size(451, 376))
   877         self.SetClientSize(wx.Size(450, 350))
   690 
   878 
   691         self.MainPanel = wx.Panel(id=wxID_CREATENODEDIALOGMAINPANEL,
   879         self.staticText1 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT1,
   692               name='MainPanel', parent=self, pos=wx.Point(0, 0),
   880               label='Name:', name='staticText1', parent=self,
   693               size=wx.Size(440, 278), style=wx.TAB_TRAVERSAL)
   881               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   694         self.MainPanel.SetAutoLayout(True)
   882 
   695 
   883         self.staticText2 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT2,
   696         self.staticText1 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT1,
   884               label='Node ID:', name='staticText2', parent=self,
   697               label='Name:', name='staticText1', parent=self.MainPanel,
   885               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   698               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
   886 
   699 
   887         self.staticText3 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT3,
   700         self.staticText2 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT2,
   888               label='Type:', name='staticText3', parent=self,
   701               label='Node ID:', name='staticText2', parent=self.MainPanel,
   889               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   702               pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
   890 
   703 
   891         self.staticText4 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT4,
   704         self.staticText3 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT3,
   892               label='Profile:', name='staticText4', parent=self,
   705               label='Type:', name='staticText3', parent=self.MainPanel,
   893               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   706               pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
   894 
   707 
   895         self.Type = wx.Choice(choices=[], id=ID_CREATENODEDIALOGTYPE,
   708         self.Type = wx.Choice(choices=[], id=wxID_CREATENODEDIALOGTYPE,
   896               name='Type', parent=self, pos=wx.Point(0, 0),
   709               name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
   897               size=wx.Size(0, 25), style=0)
   710               size=wx.Size(200, 24), style=0)
   898 
   711 
   899         self.Name = wx.TextCtrl(id=ID_CREATENODEDIALOGNAME, name='Name',
   712         self.Name = wx.TextCtrl(id=wxID_CREATENODEDIALOGNAME, name='Name',
   900               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), 
   713               parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200,
   901               style=0, value='')
   714               25), style=0, value='')
   902 
   715 
   903         self.NodeID = wx.TextCtrl(id=ID_CREATENODEDIALOGNODEID, name='NodeID',
   716         self.NodeID = wx.TextCtrl(id=wxID_CREATENODEDIALOGNODEID, name='NodeID',
   904               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), 
   717               parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200,
   905               style=wx.TE_RIGHT, value='')
   718               25), style=wx.TE_RIGHT, value='')
   906 
   719 
   907         self.Profile = wx.Choice(choices=[], id=ID_CREATENODEDIALOGPROFILE,
   720         self.staticText4 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT4,
   908               name='Profile', parent=self, pos=wx.Point(0, 0),
   721               label='Profile:', name='staticText4', parent=self.MainPanel,
   909               size=wx.Size(0, 24), style=0)
   722               pos=wx.Point(24, 192), size=wx.Size(47, 17), style=0)
       
   723 
       
   724         self.Profile = wx.Choice(choices=[], id=wxID_CREATENODEDIALOGPROFILE,
       
   725               name='Profile', parent=self.MainPanel, pos=wx.Point(24, 216),
       
   726               size=wx.Size(200, 24), style=0)
       
   727         self.Profile.Bind(wx.EVT_CHOICE, self.OnProfileChoice,
   910         self.Profile.Bind(wx.EVT_CHOICE, self.OnProfileChoice,
   728               id=wxID_CREATENODEDIALOGPROFILE)
   911               id=ID_CREATENODEDIALOGPROFILE)
   729 
   912 
   730         self.staticText5 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT5,
   913         self.staticText5 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT5,
   731               label='Network Management:', name='staticText5',
   914               label='Network Management:', name='staticText5',
   732               parent=self.MainPanel, pos=wx.Point(256, 24), size=wx.Size(152,
   915               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   733               16), style=0)
   916 
   734 
   917         self.NMT_None = wx.RadioButton(id=ID_CREATENODEDIALOGNMT_NONE,
   735         self.NMT_None = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_NONE,
   918               label='None', name='NMT_None', parent=self,
   736               label='None', name='NMT_None', parent=self.MainPanel,
   919               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   737               pos=wx.Point(256, 40), size=wx.Size(114, 24), style=0)
       
   738         self.NMT_None.SetValue(True)
   920         self.NMT_None.SetValue(True)
   739 
   921 
   740         self.NMT_NodeGuarding = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_NODEGUARDING,
   922         self.NMT_NodeGuarding = wx.RadioButton(id=ID_CREATENODEDIALOGNMT_NODEGUARDING,
   741               label='Node Guarding', name='NMT_NodeGuarding',
   923               label='Node Guarding', name='NMT_NodeGuarding', parent=self, 
   742               parent=self.MainPanel, pos=wx.Point(256, 64), size=wx.Size(128,
   924               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   743               24), style=0)
       
   744         self.NMT_NodeGuarding.SetValue(False)
   925         self.NMT_NodeGuarding.SetValue(False)
   745 
   926 
   746         self.NMT_Heartbeat = wx.RadioButton(id=wxID_CREATENODEDIALOGNMT_HEARTBEAT,
   927         self.NMT_Heartbeat = wx.RadioButton(id=ID_CREATENODEDIALOGNMT_HEARTBEAT,
   747               label='Heartbeat', name='NMT_Heartbeat', parent=self.MainPanel,
   928               label='Heartbeat', name='NMT_Heartbeat', parent=self,
   748               pos=wx.Point(256, 88), size=wx.Size(114, 24), style=0)
   929               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   749         self.NMT_Heartbeat.SetValue(False)
   930         self.NMT_Heartbeat.SetValue(False)
   750 
   931 
   751         self.staticText6 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT6,
   932         self.staticText6 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT6,
   752               label='Options:', name='staticText6', parent=self.MainPanel,
   933               label='Options:', name='staticText6', parent=self,
   753               pos=wx.Point(256, 128), size=wx.Size(72, 17), style=0)
   934               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   754 
   935 
   755         self.DS302 = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
   936         self.DS302 = wx.CheckBox(id=ID_CREATENODEDIALOGGENSYNC,
   756               label='DS-302 Profile', name='DS302', parent=self.MainPanel,
   937               label='DS-302 Profile', name='DS302', parent=self,
   757               pos=wx.Point(256, 144), size=wx.Size(128, 24), style=0)
   938               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   758         self.DS302.SetValue(False)
   939         self.DS302.SetValue(False)
   759         #self.DS302.Enable(False)
   940         #self.DS302.Enable(False)
   760 
   941 
   761         self.GenSYNC = wx.CheckBox(id=wxID_CREATENODEDIALOGGENSYNC,
   942         self.GenSYNC = wx.CheckBox(id=ID_CREATENODEDIALOGGENSYNC,
   762               label='Generate SYNC', name='GenSYNC', parent=self.MainPanel,
   943               label='Generate SYNC', name='GenSYNC', parent=self,
   763               pos=wx.Point(256, 168), size=wx.Size(128, 24), style=0)
   944               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   764         self.GenSYNC.SetValue(False)
   945         self.GenSYNC.SetValue(False)
   765 
   946 
   766         self.Emergency = wx.CheckBox(id=wxID_CREATENODEDIALOGEMERGENCY,
   947         self.Emergency = wx.CheckBox(id=ID_CREATENODEDIALOGEMERGENCY,
   767               label='Emergency support', name='Emergency',
   948               label='Emergency support', name='Emergency',
   768               parent=self.MainPanel, pos=wx.Point(256, 192), size=wx.Size(152,
   949               parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   769               24), style=0)
       
   770         self.Emergency.SetValue(False)
   950         self.Emergency.SetValue(False)
   771         self.Emergency.Enable(False)
   951         self.Emergency.Enable(False)
   772 
   952 
   773         self.SaveConfig = wx.CheckBox(id=wxID_CREATENODEDIALOGSAVECONFIG,
   953         self.SaveConfig = wx.CheckBox(id=ID_CREATENODEDIALOGSAVECONFIG,
   774               label='Save Configuration', name='SaveConfig',
   954               label='Save Configuration', name='SaveConfig', parent=self, 
   775               parent=self.MainPanel, pos=wx.Point(256, 216), size=wx.Size(152,
   955               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   776               24), style=0)
       
   777         self.SaveConfig.SetValue(False)
   956         self.SaveConfig.SetValue(False)
   778         self.SaveConfig.Enable(False)
   957         self.SaveConfig.Enable(False)
   779 
   958 
   780 #        self.StoreEDS = wx.CheckBox(id=wxID_CREATENODEDIALOGSTOREEDS,
   959         self.StoreEDS = wx.CheckBox(id=ID_CREATENODEDIALOGSTOREEDS,
   781 #              label='Store EDS', name='StoreEDS', parent=self.MainPanel,
   960               label='Store EDS', name='StoreEDS', parent=self,
   782 #              pos=wx.Point(256, 240), size=wx.Size(144, 24), style=0)
   961               pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
   783 #        self.StoreEDS.SetValue(False)
   962         self.StoreEDS.SetValue(False)
   784 
   963         self.StoreEDS.Hide()
   785         self.staticText7 = wx.StaticText(id=wxID_CREATENODEDIALOGSTATICTEXT7,
   964 
   786               label='Description:', name='staticText7', parent=self.MainPanel,
   965         self.staticText7 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT7,
   787               pos=wx.Point(24, 248), size=wx.Size(71, 17), style=0)
   966               label='Description:', name='staticText7', parent=self,
   788 
   967               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   789         self.Description = wx.TextCtrl(id=wxID_CREATENODEDIALOGDESCRIPTION, 
   968 
   790               name='Description', parent=self.MainPanel, pos=wx.Point(24, 272), 
   969         self.Description = wx.TextCtrl(id=ID_CREATENODEDIALOGDESCRIPTION, 
   791               size=wx.Size(400, 25), style=0, value='')
   970               name='Description', parent=self, pos=wx.Point(0, 0), 
   792 
   971               size=wx.Size(0, 24), style=0, value='')
       
   972 
       
   973         self.Spacer = wx.Panel(id=ID_MAPVARIABLEDIALOGSPACER,
       
   974               name='Spacer', parent=self, pos=wx.Point(0, 0),
       
   975               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
       
   976 
       
   977         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
       
   978         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
       
   979         
   793         self._init_sizers()
   980         self._init_sizers()
   794 
   981 
   795     def __init__(self, parent, cwd):
   982     def __init__(self, parent, cwd):
   796         self._init_ctrls(parent)
   983         self._init_ctrls(parent)
   797         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL)
   984         
   798         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_CENTER)
       
   799         self.NodeID.SetValue("0x00")
   985         self.NodeID.SetValue("0x00")
   800         self.Type.Append("master")
   986         self.Type.Append("master")
   801         self.Type.Append("slave")
   987         self.Type.Append("slave")
   802         self.Type.SetStringSelection("slave")
   988         self.Type.SetStringSelection("slave")
   803         self.Description.SetValue("")
   989         self.Description.SetValue("")
   813                 self.Profile.Append(name)
   999                 self.Profile.Append(name)
   814         self.Profile.Append("Other")
  1000         self.Profile.Append("Other")
   815         self.Profile.SetStringSelection("None")
  1001         self.Profile.SetStringSelection("None")
   816         self.Name.SetFocus()
  1002         self.Name.SetFocus()
   817         
  1003         
   818         EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
       
   819 
       
   820     def OnOK(self, event):
  1004     def OnOK(self, event):
   821         name = self.Name.GetValue()
  1005         name = self.Name.GetValue()
   822         message = ""
  1006         message = ""
   823         if name != "":
  1007         if name != "":
   824             good = not name[0].isdigit()
  1008             good = not name[0].isdigit()
   830             try:
  1014             try:
   831                 nodeid = int(self.NodeID.GetValue(), 16)
  1015                 nodeid = int(self.NodeID.GetValue(), 16)
   832             except:
  1016             except:
   833                 message = "Node ID must be an integer!"
  1017                 message = "Node ID must be an integer!"
   834         if message != "":
  1018         if message != "":
   835             message = wxMessageDialog(self, message, "ERROR", wxOK|wxICON_ERROR)
  1019             message = wx.MessageDialog(self, message, "ERROR", wx.OK|wx.ICON_ERROR)
   836             message.ShowModal()
  1020             message.ShowModal()
   837             message.Destroy()
  1021             message.Destroy()
   838             self.Name.SetFocus()
  1022             self.Name.SetFocus()
   839         else:
  1023         else:
   840             self.EndModal(wxID_OK)
  1024             self.EndModal(wx.ID_OK)
   841 
  1025 
   842     def GetValues(self):
  1026     def GetValues(self):
   843         name = self.Name.GetValue()
  1027         name = self.Name.GetValue()
   844         nodeid = 0
  1028         nodeid = 0
   845         if self.NodeID.GetValue() != "":
  1029         if self.NodeID.GetValue() != "":
   869             options.append("GenSYNC")
  1053             options.append("GenSYNC")
   870         if self.Emergency.GetValue():
  1054         if self.Emergency.GetValue():
   871             options.append("Emergency")
  1055             options.append("Emergency")
   872         if self.SaveConfig.GetValue():
  1056         if self.SaveConfig.GetValue():
   873             options.append("SaveConfig")
  1057             options.append("SaveConfig")
   874 #        if self.StoreEDS.GetValue():
  1058         if self.StoreEDS.GetValue():
   875 #            options.append("StoreEDS")
  1059             options.append("StoreEDS")
   876         return options
  1060         return options
   877 
  1061 
   878     def OnProfileChoice(self, event):
  1062     def OnProfileChoice(self, event):
   879         if self.Profile.GetStringSelection() == "Other":
  1063         if self.Profile.GetStringSelection() == "Other":
   880             dialog = wxFileDialog(self, "Choose a file", self.Directory, "",  "OD Profile files (*.prf)|*.prf|All files|*.*", wxOPEN|wxCHANGE_DIR)
  1064             dialog = wx.FileDialog(self, "Choose a file", self.Directory, "",  "OD Profile files (*.prf)|*.prf|All files|*.*", wx.OPEN|wx.CHANGE_DIR)
   881             dialog.ShowModal()
  1065             dialog.ShowModal()
   882             filepath = dialog.GetPath()
  1066             filepath = dialog.GetPath()
   883             dialog.Destroy()
  1067             dialog.Destroy()
   884             if os.path.isfile(filepath):
  1068             if os.path.isfile(filepath):
   885                 name = os.path.splitext(os.path.basename(filepath))[0]
  1069                 name = os.path.splitext(os.path.basename(filepath))[0]
   894 
  1078 
   895 #-------------------------------------------------------------------------------
  1079 #-------------------------------------------------------------------------------
   896 #                            ADD Slave to NodeList Dialog
  1080 #                            ADD Slave to NodeList Dialog
   897 #-------------------------------------------------------------------------------
  1081 #-------------------------------------------------------------------------------
   898 
  1082 
   899 [wxID_ADDSLAVEDIALOG, wxID_ADDSLAVEDIALOGMAINPANEL, wxID_ADDSLAVEDIALOGSLAVENAME, 
  1083 [ID_ADDSLAVEDIALOG, ID_ADDSLAVEDIALOGSLAVENAME, 
   900  wxID_ADDSLAVEDIALOGSLAVENODEID, wxID_ADDSLAVEDIALOGEDSFILE, 
  1084  ID_ADDSLAVEDIALOGSLAVENODEID, ID_ADDSLAVEDIALOGEDSFILE, 
   901  wxID_ADDSLAVEDIALOGIMPORTEDS, wxID_ADDSLAVEDIALOGSTATICTEXT1, 
  1085  ID_ADDSLAVEDIALOGIMPORTEDS, ID_ADDSLAVEDIALOGSTATICTEXT1, 
   902  wxID_ADDSLAVEDIALOGSTATICTEXT2, wxID_ADDSLAVEDIALOGSTATICTEXT3, 
  1086  ID_ADDSLAVEDIALOGSTATICTEXT2, ID_ADDSLAVEDIALOGSTATICTEXT3, 
   903 ] = [wx.NewId() for _init_ctrls in range(9)]
  1087 ] = [wx.NewId() for _init_ctrls in range(8)]
   904 
  1088 
   905 class AddSlaveDialog(wx.Dialog):
  1089 class AddSlaveDialog(wx.Dialog):
   906     def _init_coll_flexGridSizer1_Items(self, parent):
  1090     def _init_coll_flexGridSizer1_Items(self, parent):
   907         # generated method, don't edit
  1091         parent.AddSizer(self.MainSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT)
   908 
  1092         parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT)
   909         parent.AddWindow(self.MainPanel, 0, border=0, flag=0)
  1093 
       
  1094     def _init_coll_flexGridSizer1_Growables(self, parent):
       
  1095         parent.AddGrowableCol(0)
       
  1096         parent.AddGrowableRow(0)
       
  1097 
       
  1098     def _init_coll_MainSizer_Items(self, parent):
       
  1099         parent.AddWindow(self.staticText1, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
  1100         parent.AddWindow(self.SlaveName, 0, border=10, flag=wx.GROW|wx.BOTTOM)
       
  1101         parent.AddWindow(self.staticText2, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
  1102         parent.AddWindow(self.SlaveNodeID, 0, border=10, flag=wx.GROW|wx.BOTTOM)
       
  1103         parent.AddWindow(self.staticText3, 0, border=5, flag=wx.GROW|wx.BOTTOM)
       
  1104         parent.AddSizer(self.BottomSizer, 0, border=0, flag=wx.GROW)
       
  1105 
       
  1106     def _init_coll_BottomSizer_Items(self, parent):
       
  1107         parent.AddWindow(self.EDSFile, 0, border=4, flag=wx.GROW|wx.TOP|wx.BOTTOM)
       
  1108         parent.AddWindow(self.ImportEDS, 0, border=0, flag=0)
       
  1109 
       
  1110     def _init_coll_BottomSizer_Growables(self, parent):
       
  1111         parent.AddGrowableCol(0)
       
  1112         parent.AddGrowableRow(0)
   910 
  1113 
   911     def _init_sizers(self):
  1114     def _init_sizers(self):
   912         # generated method, don't edit
  1115         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
   913         self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
  1116         self.MainSizer = wx.BoxSizer(wx.VERTICAL)
   914 
  1117         self.BottomSizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=0)
       
  1118         
   915         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
  1119         self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
   916 
  1120         self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
       
  1121         self._init_coll_MainSizer_Items(self.MainSizer)
       
  1122         self._init_coll_BottomSizer_Items(self.BottomSizer)
       
  1123         self._init_coll_BottomSizer_Growables(self.BottomSizer)
       
  1124         
   917         self.SetSizer(self.flexGridSizer1)
  1125         self.SetSizer(self.flexGridSizer1)
   918 
  1126 
   919     def _init_ctrls(self, prnt):
  1127     def _init_ctrls(self, prnt):
   920         # generated method, don't edit
  1128         wx.Dialog.__init__(self, id=ID_ADDSLAVEDIALOG,
   921         wx.Dialog.__init__(self, id=wxID_ADDSLAVEDIALOG,
       
   922               name='AddSlaveDialog', parent=prnt, pos=wx.Point(376, 223),
  1129               name='AddSlaveDialog', parent=prnt, pos=wx.Point(376, 223),
   923               size=wx.Size(300, 250), style=wx.DEFAULT_DIALOG_STYLE,
  1130               size=wx.Size(300, 250), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
   924               title='Add a slave to nodelist')
  1131               title='Add a slave to nodelist')
   925         self.SetClientSize(wx.Size(300, 250))
  1132         self.SetClientSize(wx.Size(300, 250))
   926 
  1133 
   927         self.MainPanel = wx.Panel(id=wxID_ADDSLAVEDIALOGMAINPANEL,
  1134         self.staticText1 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT1,
   928               name='MainPanel', parent=self, pos=wx.Point(0, 0),
  1135               label='Slave Name:', name='staticText1', parent=self,
   929               size=wx.Size(350, 250), style=wx.TAB_TRAVERSAL)
  1136               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   930         self.MainPanel.SetAutoLayout(True)
  1137 
   931 
  1138         self.SlaveName = wx.TextCtrl(id=ID_ADDSLAVEDIALOGSLAVENAME,
   932         self.staticText1 = wx.StaticText(id=wxID_ADDSLAVEDIALOGSTATICTEXT1,
  1139               name='SlaveName', parent=self, pos=wx.Point(0, 0), 
   933               label='Slave Name:', name='staticText1', parent=self.MainPanel,
  1140               size=wx.Size(0, 24), style=0)
   934               pos=wx.Point(24, 24), size=wx.Size(150, 17), style=0)
  1141 
   935 
  1142         self.staticText2 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT2,
   936         self.SlaveName = wx.TextCtrl(id=wxID_ADDSLAVEDIALOGSLAVENAME,
  1143               label='Slave Node ID:', name='staticText2', parent=self,
   937               name='SlaveName', parent=self.MainPanel, pos=wx.Point(24, 48), 
  1144               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   938               size=wx.Size(250, 24), style=0)
  1145 
   939 
  1146         self.SlaveNodeID = wx.TextCtrl(id=ID_ADDSLAVEDIALOGSLAVENODEID,
   940         self.staticText2 = wx.StaticText(id=wxID_ADDSLAVEDIALOGSTATICTEXT2,
  1147               name='SlaveName', parent=self, pos=wx.Point(0, 0), 
   941               label='Slave Node ID:', name='staticText2', parent=self.MainPanel,
  1148               size=wx.Size(0, 24), style=wx.ALIGN_RIGHT)
   942               pos=wx.Point(24, 80), size=wx.Size(150, 17), style=0)
  1149 
   943 
  1150         self.staticText3 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT3,
   944         self.SlaveNodeID = wx.TextCtrl(id=wxID_ADDSLAVEDIALOGSLAVENODEID,
  1151               label='EDS File:', name='staticText3', parent=self,
   945               name='SlaveName', parent=self.MainPanel, pos=wx.Point(24, 104), 
  1152               pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
   946               size=wx.Size(250, 24), style=wxALIGN_RIGHT)
  1153 
   947 
  1154         self.EDSFile = wx.Choice(id=ID_ADDSLAVEDIALOGEDSFILE,
   948         self.staticText3 = wx.StaticText(id=wxID_ADDSLAVEDIALOGSTATICTEXT3,
  1155               name='EDSFile', parent=self, pos=wx.Point(0, 0),
   949               label='EDS File:', name='staticText3', parent=self.MainPanel,
  1156               size=wx.Size(0, 24), style=0)
   950               pos=wx.Point(24, 136), size=wx.Size(155, 17), style=0)
  1157         
   951 
  1158         self.ImportEDS = wx.Button(id=ID_ADDSLAVEDIALOGIMPORTEDS, label='Import EDS',
   952         self.EDSFile = wx.Choice(id=wxID_ADDSLAVEDIALOGEDSFILE,
  1159               name='ImportEDS', parent=self, pos=wx.Point(0, 0),
   953               name='EDSFile', parent=self.MainPanel, pos=wx.Point(24, 160),
       
   954               size=wx.Size(145, 24), style=0)
       
   955         
       
   956         self.ImportEDS = wxButton(id=wxID_ADDSLAVEDIALOGIMPORTEDS, label='Import EDS',
       
   957               name='ImportEDS', parent=self.MainPanel, pos=wx.Point(174, 160),
       
   958               size=wx.Size(100, 32), style=0)
  1160               size=wx.Size(100, 32), style=0)
   959         self.ImportEDS.Bind(wx.EVT_BUTTON, self.OnImportEDSButton,
  1161         self.ImportEDS.Bind(wx.EVT_BUTTON, self.OnImportEDSButton,
   960               id=wxID_ADDSLAVEDIALOGIMPORTEDS)
  1162               id=ID_ADDSLAVEDIALOGIMPORTEDS)
   961         
  1163         
       
  1164         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
       
  1165         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
       
  1166     
   962         self._init_sizers()
  1167         self._init_sizers()
   963 
  1168 
   964     def __init__(self, parent):
  1169     def __init__(self, parent):
   965         self._init_ctrls(parent)
  1170         self._init_ctrls(parent)
   966         self.ButtonSizer = self.CreateButtonSizer(wxOK|wxCANCEL|wxCENTRE)
       
   967         self.flexGridSizer1.Add(self.ButtonSizer, 1, wxALIGN_RIGHT)
       
   968         
  1171         
   969         self.SlaveNodeID.SetValue("0x00")
  1172         self.SlaveNodeID.SetValue("0x00")
   970         
  1173             
   971         EVT_BUTTON(self, self.ButtonSizer.GetAffirmativeButton().GetId(), self.OnOK)
       
   972     
       
   973     def OnOK(self, event):
  1174     def OnOK(self, event):
   974         error = []
  1175         error = []
   975         if self.SlaveName.GetValue() == "":
  1176         if self.SlaveName.GetValue() == "":
   976             error.append("Slave Name")
  1177             error.append("Slave Name")
   977         if self.SlaveNodeID.GetValue() == "":
  1178         if self.SlaveNodeID.GetValue() == "":
   985                     text += item
  1186                     text += item
   986                 elif i == len(error) - 1:
  1187                 elif i == len(error) - 1:
   987                     text += " and %s"%item
  1188                     text += " and %s"%item
   988                 else:
  1189                 else:
   989                     text += ", %s"%item 
  1190                     text += ", %s"%item 
   990             message = wxMessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wxOK|wxICON_ERROR)
  1191             message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
   991             message.ShowModal()
  1192             message.ShowModal()
   992             message.Destroy()
  1193             message.Destroy()
   993         else:
  1194         else:
   994             try:
  1195             try:
   995                 nodeid = self.SlaveNodeID.GetValue()
  1196                 nodeid = self.SlaveNodeID.GetValue()
   996                 if nodeid.find("x") != -1:
  1197                 if nodeid.find("x") != -1:
   997                     nodeid = int(nodeid, 16)
  1198                     nodeid = int(nodeid, 16)
   998                 else:
  1199                 else:
   999                     nodeid = int(nodeid)
  1200                     nodeid = int(nodeid)
  1000             except:
  1201             except:
  1001                 message = wxMessageDialog(self, "Slave Node ID must be a value in decimal or hexadecimal!", "Error", wxOK|wxICON_ERROR)
  1202                 message = wx.MessageDialog(self, "Slave Node ID must be a value in decimal or hexadecimal!", "Error", wx.OK|wx.ICON_ERROR)
  1002                 message.ShowModal()
  1203                 message.ShowModal()
  1003                 message.Destroy()
  1204                 message.Destroy()
  1004                 return
  1205                 return
  1005             if not 0 <= nodeid <= 127:
  1206             if not 0 <= nodeid <= 127:
  1006                 message = wxMessageDialog(self, "Slave Node ID must be between 0 and 127!", "Error", wxOK|wxICON_ERROR)
  1207                 message = wx.MessageDialog(self, "Slave Node ID must be between 0 and 127!", "Error", wx.OK|wx.ICON_ERROR)
  1007                 message.ShowModal()
  1208                 message.ShowModal()
  1008                 message.Destroy()
  1209                 message.Destroy()
  1009             elif nodeid == 0 or nodeid in self.NodeList.SlaveNodes.keys():
  1210             elif nodeid == 0 or nodeid in self.NodeList.SlaveNodes.keys():
  1010                 message = wxMessageDialog(self, "A Node with this ID already exist in the network!", "Error", wxOK|wxICON_ERROR)
  1211                 message = wx.MessageDialog(self, "A Node with this ID already exist in the network!", "Error", wx.OK|wx.ICON_ERROR)
  1011                 message.ShowModal()
  1212                 message.ShowModal()
  1012                 message.Destroy()
  1213                 message.Destroy()
  1013             else:
  1214             else:
  1014                 self.EndModal(wxID_OK)
  1215                 self.EndModal(wx.ID_OK)
  1015 
  1216 
  1016     def OnImportEDSButton(self, event):
  1217     def OnImportEDSButton(self, event):
  1017         dialog = wxFileDialog(self, "Choose an EDS file", os.getcwd(), "",  "EDS files (*.eds)|*.eds|All files|*.*", wxOPEN|wxCHANGE_DIR)
  1218         dialog = wx.FileDialog(self, "Choose an EDS file", os.getcwd(), "",  "EDS files (*.eds)|*.eds|All files|*.*", wx.OPEN|wx.CHANGE_DIR)
  1018         if dialog.ShowModal() == wxID_OK:
  1219         if dialog.ShowModal() == wx.ID_OK:
  1019             filepath = dialog.GetPath()
  1220             filepath = dialog.GetPath()
  1020             if os.path.isfile(filepath):
  1221             if os.path.isfile(filepath):
  1021                 result = self.NodeList.ImportEDSFile(filepath)
  1222                 result = self.NodeList.ImportEDSFile(filepath)
  1022                 if result:
  1223                 if result:
  1023                     message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
  1224                     message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
  1024                     message.ShowModal()
  1225                     message.ShowModal()
  1025                     message.Destroy()
  1226                     message.Destroy()
  1026         dialog.Destroy()
  1227         dialog.Destroy()
  1027         self.RefreshEDSFile()
  1228         self.RefreshEDSFile()
  1028         event.Skip()
  1229         event.Skip()
  1030     def RefreshEDSFile(self):
  1231     def RefreshEDSFile(self):
  1031         selection = self.EDSFile.GetStringSelection()
  1232         selection = self.EDSFile.GetStringSelection()
  1032         self.EDSFile.Clear()
  1233         self.EDSFile.Clear()
  1033         for option in self.NodeList.EDSNodes.keys():
  1234         for option in self.NodeList.EDSNodes.keys():
  1034             self.EDSFile.Append(option)
  1235             self.EDSFile.Append(option)
  1035         if self.EDSFile.FindString(selection) != wxNOT_FOUND:
  1236         if self.EDSFile.FindString(selection) != wx.NOT_FOUND:
  1036             self.EDSFile.SetStringSelection(selection)
  1237             self.EDSFile.SetStringSelection(selection)
  1037     
  1238     
  1038     def SetNodeList(self, nodelist):
  1239     def SetNodeList(self, nodelist):
  1039         self.NodeList = nodelist
  1240         self.NodeList = nodelist
  1040         self.RefreshEDSFile()
  1241         self.RefreshEDSFile()