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