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