objdictgen/commondialogs.py
author etisserant
Fri, 31 Aug 2007 10:20:10 +0200
changeset 264 6fa295ec7dda
parent 259 fefaeb965850
child 266 8678a3cf7fe7
permissions -rw-r--r--
Updated .cvsignores
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)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   121
        self.PossibleIndexes.Bind(wx.EVT_LEFT_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)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   145
        self.CurrentIndexes.Bind(wx.EVT_LEFT_DCLICK, self.OnCurrentIndexesDClick,
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
            self.Name.SetFocus()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   576
        else:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   577
            self.EndModal(wx.ID_OK)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   578
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   579
    def SetValues(self, min = None, max = None, length = None):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   580
        if min != None:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   581
            self.Min.SetValue(str(min))
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   582
        if max != None:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   583
            self.Max.SetValue(str(max))
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   584
        if length != None:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   585
            self.Length.SetValue(str(length))
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   586
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   587
    def SetTypeList(self, typedic, type = None):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   588
        self.Type.Clear()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   589
        list = []
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   590
        for index, (name, valuetype) in typedic.iteritems():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   591
            self.TypeDictionary[name] = (index, valuetype)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   592
            list.append((index, name))
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   593
        list.sort()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   594
        for index, name in list:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   595
            self.Type.Append(name)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   596
        if type != None:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   597
            self.Type.SetStringSelection(typedic[type][0])
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   598
        self.RefreshValues()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   599
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   600
    def OnTypeChoice(self, event):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   601
        self.RefreshValues()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   602
        event.Skip()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   603
    
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   604
    def RefreshValues(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   605
        name = self.Type.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   606
        if name != "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   607
            valuetype = self.TypeDictionary[name][1]
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   608
            if valuetype == 0:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   609
                self.staticText2.Enable(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   610
                self.staticText3.Enable(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   611
                self.staticText4.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   612
                self.Min.Enable(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   613
                self.Max.Enable(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   614
                self.Length.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   615
            elif valuetype == 1:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   616
                self.staticText2.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   617
                self.staticText3.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   618
                self.staticText4.Enable(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   619
                self.Min.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   620
                self.Max.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   621
                self.Length.Enable(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   622
        else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   623
            self.staticText2.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   624
            self.staticText3.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   625
            self.staticText4.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   626
            self.Min.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   627
            self.Max.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   628
            self.Length.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   629
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   630
    def GetValues(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   631
        name = self.Type.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   632
        type = self.TypeDictionary[name][0]
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   633
        min = int(self.Min.GetValue())
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   634
        max = int(self.Max.GetValue())
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   635
        length = int(self.Length.GetValue())
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   636
        return type, min, max, length
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
#-------------------------------------------------------------------------------
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   641
#                          Editing Node Infos Dialog
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   642
#-------------------------------------------------------------------------------
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   643
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   644
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   645
[ID_NODEINFOSDIALOG, ID_NODEINFOSDIALOGNAME, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   646
 ID_NODEINFOSDIALOGNODEID, ID_NODEINFOSDIALOGDESCRIPTION, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   647
 ID_NODEINFOSDIALOGTYPE, ID_NODEINFOSDIALOGSTATICTEXT1, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   648
 ID_NODEINFOSDIALOGSTATICTEXT2, ID_NODEINFOSDIALOGSTATICTEXT3, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   649
 ID_NODEINFOSDIALOGSTATICTEXT4,  
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   650
] = [wx.NewId() for _init_ctrls in range(9)]
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   651
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   652
class NodeInfosDialog(wx.Dialog):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   653
    def _init_coll_flexGridSizer1_Items(self, parent):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   654
        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
   655
        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
   656
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   657
    def _init_coll_flexGridSizer1_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   658
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   659
        parent.AddGrowableRow(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   660
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   661
    def _init_coll_MainSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   662
        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
   663
        parent.AddWindow(self.Name, 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.staticText2, 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.NodeID, 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.staticText3, 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.Type, 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.staticText4, 0, border=0, flag=wx.GROW)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   669
        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
   670
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   671
    def _init_coll_MainSizer_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   672
        parent.AddGrowableCol(0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   673
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   674
    def _init_sizers(self):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   675
        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
   676
        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
   677
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   678
        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   679
        self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   680
        self._init_coll_MainSizer_Items(self.MainSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   681
        self._init_coll_MainSizer_Growables(self.MainSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   682
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   683
        self.SetSizer(self.flexGridSizer1)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   684
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   685
    def _init_ctrls(self, prnt):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   686
        wx.Dialog.__init__(self, id=ID_NODEINFOSDIALOG,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   687
              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
   688
              size=wx.Size(300, 280), style=wx.DEFAULT_DIALOG_STYLE,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   689
              title='Node Infos')
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   690
        self.SetClientSize(wx.Size(300, 280))
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   691
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   692
        self.staticText1 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT1,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   693
              label='Name:', name='staticText1', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   694
              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
   695
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   696
        self.Name = wx.TextCtrl(id=ID_NODEINFOSDIALOGNAME, name='Name',
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   697
              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
   698
              style=0, value='')
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   699
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   700
        self.staticText2 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT2,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   701
              label='Node ID:', name='staticText2', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   702
              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
   703
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   704
        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
   705
              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
   706
              style=wx.TE_RIGHT, value='')
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   707
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   708
        self.staticText3 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT3,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   709
              label='Type:', name='staticText3', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   710
              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
   711
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   712
        self.Type = wx.Choice(choices=[], id=ID_NODEINFOSDIALOGTYPE,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   713
              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
   714
              size=wx.Size(0, 25), style=0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   715
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   716
        self.staticText4 = wx.StaticText(id=ID_NODEINFOSDIALOGSTATICTEXT4,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   717
              label='Description:', name='staticText4', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   718
              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
   719
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   720
        self.Description = wx.TextCtrl(id=ID_NODEINFOSDIALOGDESCRIPTION, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   721
              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
   722
              size=wx.Size(0, 24), style=0, value='')
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   723
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   724
        self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   725
        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
   726
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   727
        self._init_sizers()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   728
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   729
    def __init__(self, parent):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   730
        self._init_ctrls(parent)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   731
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   732
        self.Type.Append("master")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   733
        self.Type.Append("slave")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   734
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   735
    def OnOK(self, event):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   736
        name = self.Name.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   737
        message = ""
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   738
        if name != "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   739
            good = not name[0].isdigit()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   740
            for item in name.split("_"):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   741
                good &= item.isalnum()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   742
            if not good:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   743
                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
   744
        if message != "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   745
            try:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   746
                nodeid = int(self.NodeID.GetValue(), 16)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   747
            except:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   748
                message = "Node ID must be integer!"
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   749
        if message != "":
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   750
            message = wx.MessageDialog(self, message, "ERROR", wx.OK|wx.ICON_ERROR)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   751
            message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   752
            message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   753
            self.Name.SetFocus()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   754
        else:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   755
            self.EndModal(wx.ID_OK)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   756
    
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   757
    def SetValues(self, name, id, type, description):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   758
        self.Name.SetValue(name)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   759
        self.NodeID.SetValue("0x%02X"%id)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   760
        self.Type.SetStringSelection(type)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   761
        self.Description.SetValue(description)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   762
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   763
    def GetValues(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   764
        name = self.Name.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   765
        nodeid = int(self.NodeID.GetValue(), 16)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   766
        type = self.Type.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   767
        description = self.Description.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   768
        return name, nodeid, type, description
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
#-------------------------------------------------------------------------------
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   773
#                          Create New Node Dialog
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   774
#-------------------------------------------------------------------------------
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   775
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   776
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   777
[ID_CREATENODEDIALOG, ID_CREATENODEDIALOGEMERGENCY, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   778
 ID_CREATENODEDIALOGGENSYNC, ID_CREATENODEDIALOGSPACER, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   779
 ID_CREATENODEDIALOGNAME, ID_CREATENODEDIALOGNMT_HEARTBEAT, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   780
 ID_CREATENODEDIALOGNMT_NODEGUARDING, ID_CREATENODEDIALOGNMT_NONE, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   781
 ID_CREATENODEDIALOGNODEID, ID_CREATENODEDIALOGPROFILE, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   782
 ID_CREATENODEDIALOGSAVECONFIG, ID_CREATENODEDIALOGSTATICTEXT1, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   783
 ID_CREATENODEDIALOGSTATICTEXT2, ID_CREATENODEDIALOGSTATICTEXT3, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   784
 ID_CREATENODEDIALOGSTATICTEXT4, ID_CREATENODEDIALOGSTATICTEXT5, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   785
 ID_CREATENODEDIALOGSTATICTEXT6, ID_CREATENODEDIALOGSTATICTEXT7,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   786
 ID_CREATENODEDIALOGSTOREEDS, ID_CREATENODEDIALOGDESCRIPTION,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   787
 ID_CREATENODEDIALOGTYPE, 
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   788
] = [wx.NewId() for _init_ctrls in range(21)]
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   789
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   790
class CreateNodeDialog(wx.Dialog):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   791
    def _init_coll_flexGridSizer1_Items(self, parent):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   792
        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
   793
        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
   794
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   795
    def _init_coll_flexGridSizer1_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   796
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   797
        parent.AddGrowableRow(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   798
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   799
    def _init_coll_MainSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   800
        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
   801
        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
   802
        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
   803
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   804
    def _init_coll_MainSizer_Growables(self, parent):
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
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   807
    
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   808
    def _init_coll_TopBoxSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   809
        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
   810
        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
   811
    
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   812
    def _init_coll_LeftBoxSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   813
        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
   814
        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
   815
        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
   816
        parent.AddWindow(self.Name, 0, border=10, 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.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
   818
        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
   819
        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
   820
        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
   821
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   822
    def _init_coll_RightGridSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   823
        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
   824
        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
   825
        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
   826
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   827
    def _init_coll_RightGridSizer_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   828
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   829
        parent.AddGrowableRow(1)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   830
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   831
    def _init_coll_RightTopGridSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   832
        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
   833
        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
   834
        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
   835
        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
   836
        
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   837
    def _init_coll_RightTopGridSizer_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   838
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   839
        
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   840
    def _init_coll_RightBottomGridSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   841
        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
   842
        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
   843
        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
   844
        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
   845
        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
   846
        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
   847
        
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   848
    def _init_coll_RightBottomGridSizer_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   849
        parent.AddGrowableCol(0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   850
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   851
    def _init_sizers(self):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   852
        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
   853
        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
   854
        self.TopBoxSizer = wx.BoxSizer(wx.HORIZONTAL)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   855
        self.LeftBoxSizer = wx.BoxSizer(wx.VERTICAL)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   856
        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
   857
        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
   858
        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
   859
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   860
        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   861
        self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   862
        self._init_coll_MainSizer_Items(self.MainSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   863
        self._init_coll_MainSizer_Growables(self.MainSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   864
        self._init_coll_TopBoxSizer_Items(self.TopBoxSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   865
        self._init_coll_LeftBoxSizer_Items(self.LeftBoxSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   866
        self._init_coll_RightGridSizer_Items(self.RightGridSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   867
        self._init_coll_RightGridSizer_Growables(self.RightGridSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   868
        self._init_coll_RightTopGridSizer_Items(self.RightTopGridSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   869
        self._init_coll_RightTopGridSizer_Growables(self.RightTopGridSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   870
        self._init_coll_RightBottomGridSizer_Items(self.RightBottomGridSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   871
        self._init_coll_RightBottomGridSizer_Growables(self.RightBottomGridSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   872
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   873
        self.SetSizer(self.flexGridSizer1)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   874
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   875
    def _init_ctrls(self, prnt):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   876
        wx.Dialog.__init__(self, id=ID_CREATENODEDIALOG,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   877
              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
   878
              size=wx.Size(450, 350), style=wx.DEFAULT_DIALOG_STYLE,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   879
              title='Create a new Node')
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   880
        self.SetClientSize(wx.Size(450, 350))
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   881
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   882
        self.staticText1 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT1,
259
fefaeb965850 Bugs fixed on objdictedit dialogs
lbessard
parents: 258
diff changeset
   883
              label='Type:', name='staticText1', parent=self,
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   884
              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
   885
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   886
        self.staticText2 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT2,
259
fefaeb965850 Bugs fixed on objdictedit dialogs
lbessard
parents: 258
diff changeset
   887
              label='Name:', name='staticText2', parent=self,
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   888
              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
   889
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   890
        self.staticText3 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT3,
259
fefaeb965850 Bugs fixed on objdictedit dialogs
lbessard
parents: 258
diff changeset
   891
              label='Node ID:', name='staticText3', parent=self,
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   892
              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
   893
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   894
        self.staticText4 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT4,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   895
              label='Profile:', name='staticText4', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   896
              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
   897
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   898
        self.Type = wx.Choice(choices=[], id=ID_CREATENODEDIALOGTYPE,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   899
              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
   900
              size=wx.Size(0, 25), style=0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   901
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   902
        self.Name = wx.TextCtrl(id=ID_CREATENODEDIALOGNAME, name='Name',
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   903
              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
   904
              style=0, value='')
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   905
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   906
        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
   907
              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
   908
              style=wx.TE_RIGHT, value='')
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   909
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   910
        self.Profile = wx.Choice(choices=[], id=ID_CREATENODEDIALOGPROFILE,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   911
              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
   912
              size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   913
        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
   914
              id=ID_CREATENODEDIALOGPROFILE)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   915
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   916
        self.staticText5 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT5,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   917
              label='Network Management:', name='staticText5',
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   918
              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
   919
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   920
        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
   921
              label='None', name='NMT_None', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   922
              pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   923
        self.NMT_None.SetValue(True)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   924
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   925
        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
   926
              label='Node Guarding', name='NMT_NodeGuarding', parent=self, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   927
              pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   928
        self.NMT_NodeGuarding.SetValue(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   929
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   930
        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
   931
              label='Heartbeat', name='NMT_Heartbeat', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   932
              pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   933
        self.NMT_Heartbeat.SetValue(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   934
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   935
        self.staticText6 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT6,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   936
              label='Options:', name='staticText6', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   937
              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
   938
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   939
        self.DS302 = wx.CheckBox(id=ID_CREATENODEDIALOGGENSYNC,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   940
              label='DS-302 Profile', name='DS302', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   941
              pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   942
        self.DS302.SetValue(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   943
        #self.DS302.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   944
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   945
        self.GenSYNC = wx.CheckBox(id=ID_CREATENODEDIALOGGENSYNC,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   946
              label='Generate SYNC', name='GenSYNC', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   947
              pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   948
        self.GenSYNC.SetValue(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   949
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   950
        self.Emergency = wx.CheckBox(id=ID_CREATENODEDIALOGEMERGENCY,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   951
              label='Emergency support', name='Emergency',
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   952
              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
   953
        self.Emergency.SetValue(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   954
        self.Emergency.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   955
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   956
        self.SaveConfig = wx.CheckBox(id=ID_CREATENODEDIALOGSAVECONFIG,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   957
              label='Save Configuration', name='SaveConfig', parent=self, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   958
              pos=wx.Point(0, 0), size=wx.Size(0, 24), style=0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   959
        self.SaveConfig.SetValue(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   960
        self.SaveConfig.Enable(False)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   961
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   962
        self.StoreEDS = wx.CheckBox(id=ID_CREATENODEDIALOGSTOREEDS,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   963
              label='Store EDS', name='StoreEDS', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   964
              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
   965
        self.StoreEDS.SetValue(False)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   966
        self.StoreEDS.Hide()
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   967
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   968
        self.staticText7 = wx.StaticText(id=ID_CREATENODEDIALOGSTATICTEXT7,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   969
              label='Description:', name='staticText7', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   970
              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
   971
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   972
        self.Description = wx.TextCtrl(id=ID_CREATENODEDIALOGDESCRIPTION, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   973
              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
   974
              size=wx.Size(0, 24), style=0, value='')
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   975
259
fefaeb965850 Bugs fixed on objdictedit dialogs
lbessard
parents: 258
diff changeset
   976
        self.Spacer = wx.Panel(id=ID_CREATENODEDIALOGSPACER,
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   977
              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
   978
              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
   979
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   980
        self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   981
        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
   982
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   983
        self._init_sizers()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   984
258
8f7725451453 Some bugs fixed:
lbessard
parents: 254
diff changeset
   985
    def __init__(self, parent):
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   986
        self._init_ctrls(parent)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
   987
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   988
        self.NodeID.SetValue("0x00")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   989
        self.Type.Append("master")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   990
        self.Type.Append("slave")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   991
        self.Type.SetStringSelection("slave")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   992
        self.Description.SetValue("")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   993
        self.ListProfile = {"None" : ""}
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   994
        self.Profile.Append("None")
258
8f7725451453 Some bugs fixed:
lbessard
parents: 254
diff changeset
   995
        self.Directory = os.path.join(ScriptDirectory, "config")
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   996
        listfiles = os.listdir(self.Directory)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   997
        listfiles.sort()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   998
        for item in listfiles:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
   999
            name, extend = os.path.splitext(item)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1000
            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
  1001
                self.ListProfile[name] = os.path.join(self.Directory, item)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1002
                self.Profile.Append(name)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1003
        self.Profile.Append("Other")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1004
        self.Profile.SetStringSelection("None")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1005
        self.Name.SetFocus()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1006
        
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1007
    def OnOK(self, event):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1008
        name = self.Name.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1009
        message = ""
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1010
        if name != "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1011
            good = not name[0].isdigit()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1012
            for item in name.split("_"):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1013
                good &= item.isalnum()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1014
            if not good:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1015
                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
  1016
        if message != "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1017
            try:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1018
                nodeid = int(self.NodeID.GetValue(), 16)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1019
            except:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1020
                message = "Node ID must be an integer!"
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1021
        if message != "":
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1022
            message = wx.MessageDialog(self, message, "ERROR", wx.OK|wx.ICON_ERROR)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1023
            message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1024
            message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1025
            self.Name.SetFocus()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1026
        else:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1027
            self.EndModal(wx.ID_OK)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1028
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1029
    def GetValues(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1030
        name = self.Name.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1031
        nodeid = 0
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1032
        if self.NodeID.GetValue() != "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1033
            nodeid = int(self.NodeID.GetValue(), 16)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1034
        type = self.Type.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1035
        description = self.Description.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1036
        return name, nodeid, type, description
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1037
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1038
    def GetProfile(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1039
        name = self.Profile.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1040
        return name, self.ListProfile[name]
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1041
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1042
    def GetNMTManagement(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1043
        if self.NMT_None.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1044
            return "None"
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1045
        elif self.NMT_NodeGuarding.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1046
            return "NodeGuarding"
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1047
        elif self.NMT_Heartbeat.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1048
            return "Heartbeat"
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1049
        return None
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1050
    
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1051
    def GetOptions(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1052
        options = []
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1053
        if self.DS302.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1054
            options.append("DS302")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1055
        if self.GenSYNC.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1056
            options.append("GenSYNC")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1057
        if self.Emergency.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1058
            options.append("Emergency")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1059
        if self.SaveConfig.GetValue():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1060
            options.append("SaveConfig")
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1061
        if self.StoreEDS.GetValue():
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1062
            options.append("StoreEDS")
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1063
        return options
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1064
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1065
    def OnProfileChoice(self, event):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1066
        if self.Profile.GetStringSelection() == "Other":
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1067
            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
  1068
            dialog.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1069
            filepath = dialog.GetPath()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1070
            dialog.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1071
            if os.path.isfile(filepath):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1072
                name = os.path.splitext(os.path.basename(filepath))[0]
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1073
                self.ListProfile[name] = filepath
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1074
                length = self.Profile.GetCount()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1075
                self.Profile.Insert(name, length - 2)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1076
                self.Profile.SetStringSelection(name)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1077
            else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1078
                self.Profile.SetStringSelection("None")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1079
        event.Skip()
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
#-------------------------------------------------------------------------------
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1083
#                            ADD Slave to NodeList Dialog
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1084
#-------------------------------------------------------------------------------
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1085
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1086
[ID_ADDSLAVEDIALOG, ID_ADDSLAVEDIALOGSLAVENAME, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1087
 ID_ADDSLAVEDIALOGSLAVENODEID, ID_ADDSLAVEDIALOGEDSFILE, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1088
 ID_ADDSLAVEDIALOGIMPORTEDS, ID_ADDSLAVEDIALOGSTATICTEXT1, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1089
 ID_ADDSLAVEDIALOGSTATICTEXT2, ID_ADDSLAVEDIALOGSTATICTEXT3, 
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1090
] = [wx.NewId() for _init_ctrls in range(8)]
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1091
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1092
class AddSlaveDialog(wx.Dialog):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1093
    def _init_coll_flexGridSizer1_Items(self, parent):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1094
        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
  1095
        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
  1096
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1097
    def _init_coll_flexGridSizer1_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1098
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1099
        parent.AddGrowableRow(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1100
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1101
    def _init_coll_MainSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1102
        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
  1103
        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
  1104
        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
  1105
        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
  1106
        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
  1107
        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
  1108
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1109
    def _init_coll_BottomSizer_Items(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1110
        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
  1111
        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
  1112
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1113
    def _init_coll_BottomSizer_Growables(self, parent):
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1114
        parent.AddGrowableCol(0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1115
        parent.AddGrowableRow(0)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1116
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1117
    def _init_sizers(self):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1118
        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
  1119
        self.MainSizer = wx.BoxSizer(wx.VERTICAL)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1120
        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
  1121
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1122
        self._init_coll_flexGridSizer1_Items(self.flexGridSizer1)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1123
        self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1124
        self._init_coll_MainSizer_Items(self.MainSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1125
        self._init_coll_BottomSizer_Items(self.BottomSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1126
        self._init_coll_BottomSizer_Growables(self.BottomSizer)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1127
        
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1128
        self.SetSizer(self.flexGridSizer1)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1129
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1130
    def _init_ctrls(self, prnt):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1131
        wx.Dialog.__init__(self, id=ID_ADDSLAVEDIALOG,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1132
              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
  1133
              size=wx.Size(300, 250), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1134
              title='Add a slave to nodelist')
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1135
        self.SetClientSize(wx.Size(300, 250))
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1136
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1137
        self.staticText1 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT1,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1138
              label='Slave Name:', name='staticText1', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1139
              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
  1140
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1141
        self.SlaveName = wx.TextCtrl(id=ID_ADDSLAVEDIALOGSLAVENAME,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1142
              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
  1143
              size=wx.Size(0, 24), style=0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1144
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1145
        self.staticText2 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT2,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1146
              label='Slave Node ID:', name='staticText2', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1147
              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
  1148
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1149
        self.SlaveNodeID = wx.TextCtrl(id=ID_ADDSLAVEDIALOGSLAVENODEID,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1150
              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
  1151
              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
  1152
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1153
        self.staticText3 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT3,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1154
              label='EDS File:', name='staticText3', parent=self,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1155
              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
  1156
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1157
        self.EDSFile = wx.Choice(id=ID_ADDSLAVEDIALOGEDSFILE,
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1158
              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
  1159
              size=wx.Size(0, 24), style=0)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1160
        
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1161
        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
  1162
              name='ImportEDS', parent=self, pos=wx.Point(0, 0),
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1163
              size=wx.Size(100, 32), style=0)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1164
        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
  1165
              id=ID_ADDSLAVEDIALOGIMPORTEDS)
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1166
        
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1167
        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
  1168
        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
  1169
    
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1170
        self._init_sizers()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1171
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1172
    def __init__(self, parent):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1173
        self._init_ctrls(parent)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1174
        
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1175
        self.SlaveNodeID.SetValue("0x00")
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1176
            
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1177
    def OnOK(self, event):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1178
        error = []
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1179
        if self.SlaveName.GetValue() == "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1180
            error.append("Slave Name")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1181
        if self.SlaveNodeID.GetValue() == "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1182
            error.append("Slave Node ID")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1183
        if self.EDSFile.GetStringSelection() == "":
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1184
            error.append("EDS File")
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1185
        if len(error) > 0:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1186
            text = ""
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1187
            for i, item in enumerate(error):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1188
                if i == 0:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1189
                    text += item
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1190
                elif i == len(error) - 1:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1191
                    text += " and %s"%item
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1192
                else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1193
                    text += ", %s"%item 
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1194
            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
  1195
            message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1196
            message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1197
        else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1198
            try:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1199
                nodeid = self.SlaveNodeID.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1200
                if nodeid.find("x") != -1:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1201
                    nodeid = int(nodeid, 16)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1202
                else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1203
                    nodeid = int(nodeid)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1204
            except:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1205
                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
  1206
                message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1207
                message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1208
                return
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1209
            if not 0 <= nodeid <= 127:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1210
                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
  1211
                message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1212
                message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1213
            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
  1214
                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
  1215
                message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1216
                message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1217
            else:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1218
                self.EndModal(wx.ID_OK)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1219
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1220
    def OnImportEDSButton(self, event):
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1221
        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
  1222
        if dialog.ShowModal() == wx.ID_OK:
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1223
            filepath = dialog.GetPath()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1224
            if os.path.isfile(filepath):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1225
                result = self.NodeList.ImportEDSFile(filepath)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1226
                if result:
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1227
                    message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1228
                    message.ShowModal()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1229
                    message.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1230
        dialog.Destroy()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1231
        self.RefreshEDSFile()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1232
        event.Skip()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1233
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1234
    def RefreshEDSFile(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1235
        selection = self.EDSFile.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1236
        self.EDSFile.Clear()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1237
        for option in self.NodeList.EDSNodes.keys():
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1238
            self.EDSFile.Append(option)
254
f2b0acb54e65 Cleaning code for using only wxPython 2.6 class naming
lbessard
parents: 206
diff changeset
  1239
        if self.EDSFile.FindString(selection) != wx.NOT_FOUND:
205
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1240
            self.EDSFile.SetStringSelection(selection)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1241
    
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1242
    def SetNodeList(self, nodelist):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1243
        self.NodeList = nodelist
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1244
        self.RefreshEDSFile()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1245
    
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1246
    def GetValues(self):
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1247
        values = {}
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1248
        values["slaveName"] = self.SlaveName.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1249
        nodeid = self.SlaveNodeID.GetValue()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1250
        if nodeid.find("x") != -1:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1251
            values["slaveNodeID"] = int(nodeid, 16)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1252
        else:
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1253
            values["slaveNodeID"] = int(nodeid)
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1254
        values["edsFile"] = self.EDSFile.GetStringSelection()
dac0f9b4e3f8 Adding program for network management
lbessard
parents:
diff changeset
  1255
        return values