nico@207: nico@207: nico@207: CanFestival: /home/epimerde/documents/tc11/CanFestival-3/objdictgen/subindextable.py Source File nico@207: nico@207: nico@207: nico@207: nico@207:
nico@207:
nico@207:
nico@207:
nico@207:

/home/epimerde/documents/tc11/CanFestival-3/objdictgen/subindextable.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
nico@207: 00002 # -*- coding: utf-8 -*-
nico@207: 00003 
nico@207: 00004 #This file is part of CanFestival, a library implementing CanOpen Stack. 
nico@207: 00005 #
nico@207: 00006 #Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
nico@207: 00007 #
nico@207: 00008 #See COPYING file for copyrights details.
nico@207: 00009 #
nico@207: 00010 #This library is free software; you can redistribute it and/or
nico@207: 00011 #modify it under the terms of the GNU Lesser General Public
nico@207: 00012 #License as published by the Free Software Foundation; either
nico@207: 00013 #version 2.1 of the License, or (at your option) any later version.
nico@207: 00014 #
nico@207: 00015 #This library is distributed in the hope that it will be useful,
nico@207: 00016 #but WITHOUT ANY WARRANTY; without even the implied warranty of
nico@207: 00017 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
nico@207: 00018 #Lesser General Public License for more details.
nico@207: 00019 #
nico@207: 00020 #You should have received a copy of the GNU Lesser General Public
nico@207: 00021 #License along with this library; if not, write to the Free Software
nico@207: 00022 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
nico@207: 00023 
nico@207: 00024 from wxPython.wx import *
nico@207: 00025 from wxPython.grid import *
nico@207: 00026 import wx
nico@207: 00027 import wx.grid
nico@207: 00028 
nico@207: 00029 from types import *
nico@207: 00030 
nico@207: 00031 from node import OD_Subindex, OD_MultipleSubindexes, OD_IdenticalSubindexes, OD_IdenticalIndexes
nico@207: 00032 
nico@207: 00033 ColSizes = [75, 250, 150, 125, 100, 60, 250]
nico@207: 00034 ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_RIGHT, wxALIGN_CENTER, wxALIGN_CENTER, wxALIGN_LEFT]
nico@207: 00035 AccessList = "Read Only,Write Only,Read/Write"
nico@207: 00036 RAccessList = "Read Only,Read/Write"
nico@207: 00037 BoolList = "True,False"
nico@207: 00038 OptionList = "Yes,No"
nico@207: 00039 
nico@207: 00040 DictionaryOrganisation = [
nico@207: 00041     {"minIndex" : 0x0001, "maxIndex" : 0x0FFF, "name" : "Data Type Definitions"},
nico@207: 00042     {"minIndex" : 0x1000, "maxIndex" : 0x1029, "name" : "Communication Parameters"},
nico@207: 00043     {"minIndex" : 0x1200, "maxIndex" : 0x12FF, "name" : "SDO Parameters"},
nico@207: 00044     {"minIndex" : 0x1400, "maxIndex" : 0x15FF, "name" : "Receive PDO Parameters"},
nico@207: 00045     {"minIndex" : 0x1600, "maxIndex" : 0x17FF, "name" : "Receive PDO Mapping"},
nico@207: 00046     {"minIndex" : 0x1800, "maxIndex" : 0x19FF, "name" : "Transmit PDO Parameters"},
nico@207: 00047     {"minIndex" : 0x1A00, "maxIndex" : 0x1BFF, "name" : "Transmit PDO Mapping"},
nico@207: 00048     {"minIndex" : 0x1C00, "maxIndex" : 0x1FFF, "name" : "Other Communication Parameters"},
nico@207: 00049     {"minIndex" : 0x2000, "maxIndex" : 0x5FFF, "name" : "Manufacturer Specific"},
nico@207: 00050     {"minIndex" : 0x6000, "maxIndex" : 0x9FFF, "name" : "Standardized Device Profile"},
nico@207: 00051     {"minIndex" : 0xA000, "maxIndex" : 0xBFFF, "name" : "Standardized Interface Profile"}]
nico@207: 00052 
nico@207: 00053 class SubindexTable(wxPyGridTableBase):
nico@207: 00054     
nico@207: 00055     """
nico@207: 00056     A custom wxGrid Table using user supplied data
nico@207: 00057     """
nico@207: 00058     def __init__(self, parent, data, editors, colnames):
nico@207: 00059         # The base class must be initialized *first*
nico@207: 00060         wxPyGridTableBase.__init__(self)
nico@207: 00061         self.datadata = data
nico@207: 00062         self.editorseditors = editors
nico@207: 00063         self.CurrentIndexCurrentIndex = 0
nico@207: 00064         self.colnamescolnames = colnames
nico@207: 00065         self.ParentParent = parent
nico@207: 00066         self.EditableEditable = True
nico@207: 00067         # XXX
nico@207: 00068         # we need to store the row length and collength to
nico@207: 00069         # see if the table has changed size
nico@207: 00070         self._rows_rows = self.GetNumberRowsGetNumberRows()
nico@207: 00071         self._cols_cols = self.GetNumberColsGetNumberCols()
nico@207: 00072     
nico@207: 00073     def Disable(self):
nico@207: 00074         self.EditableEditable = False
nico@207: 00075         
nico@207: 00076     def Enable(self):
nico@207: 00077         self.EditableEditable = True
nico@207: 00078     
nico@207: 00079     def GetNumberCols(self):
nico@207: 00080         return len(self.colnamescolnames)
nico@207: 00081         
nico@207: 00082     def GetNumberRows(self):
nico@207: 00083         return len(self.datadata)
nico@207: 00084 
nico@207: 00085     def GetColLabelValue(self, col):
nico@207: 00086         if col < len(self.colnamescolnames):
nico@207: 00087             return self.colnamescolnames[col]
nico@207: 00088 
nico@207: 00089     def GetRowLabelValues(self, row):
nico@207: 00090         return row
nico@207: 00091 
nico@207: 00092     def GetValue(self, row, col):
nico@207: 00093         if row < self.GetNumberRowsGetNumberRows():
nico@207: 00094             value = self.datadata[row].get(self.GetColLabelValueGetColLabelValue(col), "")
nico@207: 00095             if (type(value) == UnicodeType):
nico@207: 00096                 return value
nico@207: 00097             else: 
nico@207: 00098                 return str(value)
nico@207: 00099     
nico@207: 00100     def GetEditor(self, row, col):
nico@207: 00101         if row < self.GetNumberRowsGetNumberRows():
nico@207: 00102             return self.editorseditors[row].get(self.GetColLabelValueGetColLabelValue(col), "")
nico@207: 00103     
nico@207: 00104     def GetValueByName(self, row, colname):
nico@207: 00105         return self.datadata[row].get(colname)
nico@207: 00106 
nico@207: 00107     def SetValue(self, row, col, value):
nico@207: 00108         if col < len(self.colnamescolnames):
nico@207: 00109             self.datadata[row][self.GetColLabelValueGetColLabelValue(col)] = value
nico@207: 00110         
nico@207: 00111     def ResetView(self, grid):
nico@207: 00112         """
nico@207: 00113         (wxGrid) -> Reset the grid view.   Call this to
nico@207: 00114         update the grid if rows and columns have been added or deleted
nico@207: 00115         """
nico@207: 00116         grid.BeginBatch()
nico@207: 00117         for current, new, delmsg, addmsg in [
nico@207: 00118             (self._rows_rows, self.GetNumberRowsGetNumberRows(), wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_NOTIFY_ROWS_APPENDED),
nico@207: 00119             (self._cols_cols, self.GetNumberColsGetNumberCols(), wxGRIDTABLE_NOTIFY_COLS_DELETED, wxGRIDTABLE_NOTIFY_COLS_APPENDED),
nico@207: 00120         ]:
nico@207: 00121             if new < current:
nico@207: 00122                 msg = wxGridTableMessage(self,delmsg,new,current-new)
nico@207: 00123                 grid.ProcessTableMessage(msg)
nico@207: 00124             elif new > current:
nico@207: 00125                 msg = wxGridTableMessage(self,addmsg,new-current)
nico@207: 00126                 grid.ProcessTableMessage(msg)
nico@207: 00127                 self.UpdateValuesUpdateValues(grid)
nico@207: 00128         grid.EndBatch()
nico@207: 00129 
nico@207: 00130         self._rows_rows = self.GetNumberRowsGetNumberRows()
nico@207: 00131         self._cols_cols = self.GetNumberColsGetNumberCols()
nico@207: 00132         # update the column rendering scheme
nico@207: 00133         self._updateColAttrs_updateColAttrs(grid)
nico@207: 00134 
nico@207: 00135         # update the scrollbars and the displayed part of the grid
nico@207: 00136         grid.AdjustScrollbars()
nico@207: 00137         grid.ForceRefresh()
nico@207: 00138 
nico@207: 00139 
nico@207: 00140     def UpdateValues(self, grid):
nico@207: 00141         """Update all displayed values"""
nico@207: 00142         # This sends an event to the grid table to update all of the values
nico@207: 00143         msg = wxGridTableMessage(self, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES)
nico@207: 00144         grid.ProcessTableMessage(msg)
nico@207: 00145 
nico@207: 00146     def _updateColAttrs(self, grid):
nico@207: 00147         """
nico@207: 00148         wxGrid -> update the column attributes to add the
nico@207: 00149         appropriate renderer given the column name.
nico@207: 00150 
nico@207: 00151         Otherwise default to the default renderer.
nico@207: 00152         """
nico@207: 00153         
nico@207: 00154         for col in range(self.GetNumberColsGetNumberCols()):
nico@207: 00155             attr = wxGridCellAttr()
nico@207: 00156             attr.SetAlignment(ColAlignements[col], wxALIGN_CENTRE)
nico@207: 00157             grid.SetColAttr(col, attr)
nico@207: 00158             grid.SetColSize(col, ColSizes[col])
nico@207: 00159         
nico@207: 00160         typelist = None
nico@207: 00161         maplist = None
nico@207: 00162         for row in range(self.GetNumberRowsGetNumberRows()):
nico@207: 00163             editors = self.editorseditors[row]
nico@207: 00164             for col in range(self.GetNumberColsGetNumberCols()):
nico@207: 00165                 editor = None
nico@207: 00166                 renderer = None
nico@207: 00167                 
nico@207: 00168                 colname = self.GetColLabelValueGetColLabelValue(col)
nico@207: 00169                 editortype = editors[colname]
nico@207: 00170                 if editortype and self.EditableEditable:
nico@207: 00171                     grid.SetReadOnly(row, col, False)
nico@207: 00172                     if editortype == "string":
nico@207: 00173                         editor = wxGridCellTextEditor()
nico@207: 00174                         renderer = wxGridCellStringRenderer()
nico@207: 00175                         if colname == "value" and "length" in editors:
nico@207: 00176                             editor.SetParameters(editors["length"]) 
nico@207: 00177                     elif editortype == "number":
nico@207: 00178                         editor = wxGridCellNumberEditor()
nico@207: 00179                         renderer = wxGridCellNumberRenderer()
nico@207: 00180                         if colname == "value" and "min" in editors and "max" in editors:
nico@207: 00181                             editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
nico@207: 00182                     elif editortype == "real":
nico@207: 00183                         editor = wxGridCellFloatEditor()
nico@207: 00184                         renderer = wxGridCellFloatRenderer()
nico@207: 00185                         if colname == "value" and "min" in editors and "max" in editors:
nico@207: 00186                             editor.SetParameters("%s,%s"%(editors["min"],editors["max"]))
nico@207: 00187                     elif editortype == "bool":
nico@207: 00188                         editor = wxGridCellChoiceEditor()
nico@207: 00189                         editor.SetParameters(BoolList)
nico@207: 00190                     elif editortype == "access":
nico@207: 00191                         editor = wxGridCellChoiceEditor()
nico@207: 00192                         editor.SetParameters(AccessList)
nico@207: 00193                     elif editortype == "raccess":
nico@207: 00194                         editor = wxGridCellChoiceEditor()
nico@207: 00195                         editor.SetParameters(RAccessList)
nico@207: 00196                     elif editortype == "option":
nico@207: 00197                         editor = wxGridCellChoiceEditor()
nico@207: 00198                         editor.SetParameters(OptionList)
nico@207: 00199                     elif editortype == "type":
nico@207: 00200                         editor = wxGridCellChoiceEditor()
nico@207: 00201                         if typelist == None:
nico@207: 00202                             typelist = self.ParentParent.Manager.GetCurrentTypeList()
nico@207: 00203                         editor.SetParameters(typelist)
nico@207: 00204                     elif editortype == "map":
nico@207: 00205                         editor = wxGridCellChoiceEditor()
nico@207: 00206                         if maplist == None:
nico@207: 00207                             maplist = self.ParentParent.Manager.GetCurrentMapList()
nico@207: 00208                         editor.SetParameters(maplist)
nico@207: 00209                     elif editortype == "time":
nico@207: 00210                         editor = wxGridCellTextEditor()
nico@207: 00211                         renderer = wxGridCellStringRenderer()
nico@207: 00212                     elif editortype == "domain":
nico@207: 00213                         editor = wxGridCellTextEditor()
nico@207: 00214                         renderer = wxGridCellStringRenderer()
nico@207: 00215                 else:
nico@207: 00216                     grid.SetReadOnly(row, col, True)
nico@207: 00217                     
nico@207: 00218                 grid.SetCellEditor(row, col, editor)
nico@207: 00219                 grid.SetCellRenderer(row, col, renderer)
nico@207: 00220                 
nico@207: 00221                 grid.SetCellBackgroundColour(row, col, wxWHITE)
nico@207: 00222     
nico@207: 00223     def SetData(self, data):
nico@207: 00224         self.datadata = data
nico@207: 00225         
nico@207: 00226     def SetEditors(self, editors):
nico@207: 00227         self.editorseditors = editors
nico@207: 00228     
nico@207: 00229     def GetCurrentIndex(self):
nico@207: 00230         return self.CurrentIndexCurrentIndex
nico@207: 00231     
nico@207: 00232     def SetCurrentIndex(self, index):
nico@207: 00233         self.CurrentIndexCurrentIndex = index
nico@207: 00234     
nico@207: 00235     def AppendRow(self, row_content):
nico@207: 00236         self.datadata.append(row_content)
nico@207: 00237 
nico@207: 00238     def Empty(self):
nico@207: 00239         self.datadata = []
nico@207: 00240         self.editorseditors = []
nico@207: 00241 
nico@207: 00242 [wxID_EDITINGPANEL, wxID_EDITINGPANELADDBUTTON, wxID_EDITINGPANELINDEXCHOICE, 
nico@207: 00243  wxID_EDITINGPANELINDEXLIST, wxID_EDITINGPANELINDEXLISTPANEL, wxID_EDITINGPANELPARTLIST, 
nico@207: 00244  wxID_EDITINGPANELSECONDSPLITTER, wxID_EDITINGPANELSUBINDEXGRID,
nico@207: 00245  wxID_EDITINGPANELSUBINDEXGRIDPANEL, wxID_EDITINGPANELCALLBACKCHECK,
nico@207: 00246 ] = [wx.NewId() for _init_ctrls in range(10)]
nico@207: 00247 
nico@207: 00248 [wxID_EDITINGPANELINDEXLISTMENUITEMS0, wxID_EDITINGPANELINDEXLISTMENUITEMS1, 
nico@207: 00249  wxID_EDITINGPANELINDEXLISTMENUITEMS2, 
nico@207: 00250 ] = [wx.NewId() for _init_coll_IndexListMenu_Items in range(3)]
nico@207: 00251 
nico@207: 00252 [wxID_EDITINGPANELMENU1ITEMS0, wxID_EDITINGPANELMENU1ITEMS1, 
nico@207: 00253 ] = [wx.NewId() for _init_coll_SubindexGridMenu_Items in range(2)]
nico@207: 00254 
nico@207: 00255 class EditingPanel(wx.SplitterWindow):
nico@207: 00256     def _init_coll_AddToListSizer_Items(self, parent):
nico@207: 00257         # generated method, don't edit
nico@207: 00258 
nico@207: 00259         parent.AddWindow(self.AddButtonAddButton, 0, border=0, flag=0)
nico@207: 00260         parent.AddWindow(self.IndexChoiceIndexChoice, 0, border=0, flag=wxGROW)
nico@207: 00261 
nico@207: 00262     def _init_coll_SubindexGridSizer_Items(self, parent):
nico@207: 00263         # generated method, don't edit
nico@207: 00264 
nico@207: 00265         parent.AddWindow(self.CallbackCheckCallbackCheck, 0, border=0, flag=0)
nico@207: 00266         parent.AddWindow(self.SubindexGridSubindexGrid, 0, border=0, flag=wxGROW)
nico@207: 00267 
nico@207: 00268     def _init_coll_IndexListSizer_Items(self, parent):
nico@207: 00269         # generated method, don't edit
nico@207: 00270 
nico@207: 00271         parent.AddWindow(self.IndexListIndexList, 0, border=0, flag=wxGROW)
nico@207: 00272         parent.AddSizer(self.AddToListSizer, 0, border=0, flag=wxGROW)
nico@207: 00273 
nico@207: 00274     def _init_coll_AddToListSizer_Growables(self, parent):
nico@207: 00275         # generated method, don't edit
nico@207: 00276 
nico@207: 00277         parent.AddGrowableCol(1)
nico@207: 00278 
nico@207: 00279     def _init_coll_SubindexGridSizer_Growables(self, parent):
nico@207: 00280         # generated method, don't edit
nico@207: 00281 
nico@207: 00282         parent.AddGrowableCol(0)
nico@207: 00283         parent.AddGrowableRow(1)
nico@207: 00284 
nico@207: 00285     def _init_coll_IndexListSizer_Growables(self, parent):
nico@207: 00286         # generated method, don't edit
nico@207: 00287 
nico@207: 00288         parent.AddGrowableCol(0)
nico@207: 00289         parent.AddGrowableRow(0)
nico@207: 00290 
nico@207: 00291     def _init_coll_SubindexGridMenu_Items(self, parent):
nico@207: 00292         # generated method, don't edit
nico@207: 00293 
nico@207: 00294         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS0,
nico@207: 00295               kind=wx.ITEM_NORMAL, text='Add')
nico@207: 00296         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS1,
nico@207: 00297               kind=wx.ITEM_NORMAL, text='Delete')
nico@207: 00298         self.Bind(wx.EVT_MENU, self.OnAddSubindexMenuOnAddSubindexMenu,
nico@207: 00299               id=wxID_EDITINGPANELMENU1ITEMS0)
nico@207: 00300         self.Bind(wx.EVT_MENU, self.OnDeleteSubindexMenuOnDeleteSubindexMenu,
nico@207: 00301               id=wxID_EDITINGPANELMENU1ITEMS1)
nico@207: 00302 
nico@207: 00303     def _init_coll_IndexListMenu_Items(self, parent):
nico@207: 00304         # generated method, don't edit
nico@207: 00305 
nico@207: 00306         parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS0,
nico@207: 00307               kind=wx.ITEM_NORMAL, text='Rename')
nico@207: 00308         parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS2,
nico@207: 00309               kind=wx.ITEM_NORMAL, text='Modify')
nico@207: 00310         parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS1,
nico@207: 00311               kind=wx.ITEM_NORMAL, text='Delete')
nico@207: 00312         self.Bind(wx.EVT_MENU, self.OnRenameIndexMenuOnRenameIndexMenu,
nico@207: 00313               id=wxID_EDITINGPANELINDEXLISTMENUITEMS0)
nico@207: 00314         self.Bind(wx.EVT_MENU, self.OnDeleteIndexMenuOnDeleteIndexMenu,
nico@207: 00315               id=wxID_EDITINGPANELINDEXLISTMENUITEMS1)
nico@207: 00316         self.Bind(wx.EVT_MENU, self.OnModifyIndexMenuOnModifyIndexMenu,
nico@207: 00317               id=wxID_EDITINGPANELINDEXLISTMENUITEMS2)
nico@207: 00318 
nico@207: 00319     def _init_utils(self):
nico@207: 00320         # generated method, don't edit
nico@207: 00321         self.IndexListMenu = wx.Menu(title='')
nico@207: 00322 
nico@207: 00323         self.SubindexGridMenu = wx.Menu(title='')
nico@207: 00324 
nico@207: 00325         self._init_coll_IndexListMenu_Items_init_coll_IndexListMenu_Items(self.IndexListMenu)
nico@207: 00326         self._init_coll_SubindexGridMenu_Items_init_coll_SubindexGridMenu_Items(self.SubindexGridMenu)
nico@207: 00327 
nico@207: 00328     def _init_sizers(self):
nico@207: 00329         # generated method, don't edit
nico@207: 00330         self.IndexListSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
nico@207: 00331 
nico@207: 00332         self.SubindexGridSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
nico@207: 00333 
nico@207: 00334         self.AddToListSizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
nico@207: 00335 
nico@207: 00336         self._init_coll_IndexListSizer_Growables_init_coll_IndexListSizer_Growables(self.IndexListSizer)
nico@207: 00337         self._init_coll_IndexListSizer_Items_init_coll_IndexListSizer_Items(self.IndexListSizer)
nico@207: 00338         self._init_coll_SubindexGridSizer_Growables_init_coll_SubindexGridSizer_Growables(self.SubindexGridSizer)
nico@207: 00339         self._init_coll_SubindexGridSizer_Items_init_coll_SubindexGridSizer_Items(self.SubindexGridSizer)
nico@207: 00340         self._init_coll_AddToListSizer_Growables_init_coll_AddToListSizer_Growables(self.AddToListSizer)
nico@207: 00341         self._init_coll_AddToListSizer_Items_init_coll_AddToListSizer_Items(self.AddToListSizer)
nico@207: 00342 
nico@207: 00343         self.SubindexGridPanelSubindexGridPanel.SetSizer(self.SubindexGridSizer)
nico@207: 00344         self.IndexListPanelIndexListPanel.SetSizer(self.IndexListSizer)
nico@207: 00345         
nico@207: 00346     def _init_ctrls(self, prnt):
nico@207: 00347         wx.SplitterWindow.__init__(self, id=wxID_EDITINGPANEL,
nico@207: 00348               name='MainSplitter', parent=prnt, point=wx.Point(0, 0),
nico@207: 00349               size=wx.Size(-1, -1), style=wx.SP_3D)
nico@207: 00350         self._init_utils_init_utils()
nico@207: 00351         self.SetNeedUpdating(True)
nico@207: 00352         self.SetMinimumPaneSize(1)
nico@207: 00353 
nico@207: 00354         self.PartListPartList = wx.ListBox(choices=[], id=wxID_EDITINGPANELPARTLIST,
nico@207: 00355               name='PartList', parent=self, pos=wx.Point(0, 0),
nico@207: 00356               size=wx.Size(-1, -1), style=0)
nico@207: 00357         self.PartListPartList.Bind(wx.EVT_LISTBOX, self.OnPartListBoxClickOnPartListBoxClick,
nico@207: 00358               id=wxID_EDITINGPANELPARTLIST)
nico@207: 00359 
nico@207: 00360         self.SecondSplitterSecondSplitter = wx.SplitterWindow(id=wxID_EDITINGPANELSECONDSPLITTER,
nico@207: 00361               name='SecondSplitter', parent=self, point=wx.Point(0,
nico@207: 00362               0), size=wx.Size(-1, -1), style=wx.SP_3D)
nico@207: 00363         self.SecondSplitterSecondSplitter.SetMinimumPaneSize(1)
nico@207: 00364         self.SplitHorizontally(self.PartListPartList, self.SecondSplitterSecondSplitter,
nico@207: 00365               110)
nico@207: 00366 
nico@207: 00367         self.SubindexGridPanelSubindexGridPanel = wx.Panel(id=wxID_EDITINGPANELSUBINDEXGRIDPANEL,
nico@207: 00368               name='SubindexGridPanel', parent=self.SecondSplitterSecondSplitter, pos=wx.Point(0,
nico@207: 00369               0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
nico@207: 00370 
nico@207: 00371         self.IndexListPanelIndexListPanel = wx.Panel(id=wxID_EDITINGPANELINDEXLISTPANEL,
nico@207: 00372               name='IndexListPanel', parent=self.SecondSplitterSecondSplitter, pos=wx.Point(0,
nico@207: 00373               0), size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL)
nico@207: 00374         self.SecondSplitterSecondSplitter.SplitVertically(self.IndexListPanelIndexListPanel,
nico@207: 00375               self.SubindexGridPanelSubindexGridPanel, 280)
nico@207: 00376 
nico@207: 00377         self.SubindexGridSubindexGrid = wx.grid.Grid(id=wxID_EDITINGPANELSUBINDEXGRID,
nico@207: 00378               name='SubindexGrid', parent=self.SubindexGridPanelSubindexGridPanel, pos=wx.Point(0,
nico@207: 00379               0), size=wx.Size(-1, -1), style=0)
nico@207: 00380         self.SubindexGridSubindexGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
nico@207: 00381               'Sans'))
nico@207: 00382         self.SubindexGridSubindexGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
nico@207: 00383               False, 'Sans'))
nico@207: 00384         self.SubindexGridSubindexGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
nico@207: 00385               self.OnSubindexGridCellChangeOnSubindexGridCellChange)
nico@207: 00386         self.SubindexGridSubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK,
nico@207: 00387               self.OnSubindexGridRightClickOnSubindexGridRightClick)
nico@207: 00388         self.SubindexGridSubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL,
nico@207: 00389               self.OnSubindexGridSelectCellOnSubindexGridSelectCell)
nico@207: 00390 
nico@207: 00391         self.CallbackCheckCallbackCheck = wx.CheckBox(id=wxID_EDITINGPANELCALLBACKCHECK,
nico@207: 00392               label='Have Callbacks', name='CallbackCheck',
nico@207: 00393               parent=self.SubindexGridPanelSubindexGridPanel, pos=wx.Point(0, 0), size=wx.Size(152,
nico@207: 00394               24), style=0)
nico@207: 00395         self.CallbackCheckCallbackCheck.Bind(wx.EVT_CHECKBOX, self.OnCallbackCheckOnCallbackCheck,
nico@207: 00396               id=wxID_EDITINGPANELCALLBACKCHECK)
nico@207: 00397 
nico@207: 00398         self.IndexListIndexList = wx.ListBox(choices=[], id=wxID_EDITINGPANELINDEXLIST,
nico@207: 00399               name='IndexList', parent=self.IndexListPanelIndexListPanel, pos=wx.Point(0, 0),
nico@207: 00400               size=wx.Size(-1, -1), style=0)
nico@207: 00401         self.IndexListIndexList.Bind(wx.EVT_LISTBOX, self.OnIndexListClickOnIndexListClick,
nico@207: 00402               id=wxID_EDITINGPANELINDEXLIST)
nico@207: 00403         self.IndexListIndexList.Bind(wx.EVT_RIGHT_UP, self.OnIndexListRightUpOnIndexListRightUp)
nico@207: 00404 
nico@207: 00405         self.AddButtonAddButton = wx.Button(id=wxID_EDITINGPANELADDBUTTON, label='Add',
nico@207: 00406               name='AddButton', parent=self.IndexListPanelIndexListPanel, pos=wx.Point(0, 0),
nico@207: 00407               size=wx.Size(50, 30), style=0)
nico@207: 00408         self.AddButtonAddButton.Bind(wx.EVT_BUTTON, self.OnAddButtonClickOnAddButtonClick,
nico@207: 00409               id=wxID_EDITINGPANELADDBUTTON)
nico@207: 00410 
nico@207: 00411         self.IndexChoiceIndexChoice = wx.Choice(choices=[], id=wxID_EDITINGPANELINDEXCHOICE,
nico@207: 00412               name='IndexChoice', parent=self.IndexListPanelIndexListPanel, pos=wx.Point(50,
nico@207: 00413               0), size=wx.Size(-1, 30), style=0)
nico@207: 00414 
nico@207: 00415         self._init_sizers_init_sizers()
nico@207: 00416 
nico@207: 00417     def __init__(self, parent, manager, editable = True):
nico@207: 00418         self._init_ctrls_init_ctrls(parent.GetNoteBook())
nico@207: 00419         self.ParentParent = parent
nico@207: 00420         self.ManagerManager = manager
nico@207: 00421         self.ListIndexListIndex = []
nico@207: 00422         self.ChoiceIndexChoiceIndex = []
nico@207: 00423         self.FirstCallFirstCall = False
nico@207: 00424         self.EditableEditable = editable
nico@207: 00425         self.IndexIndex = None
nico@207: 00426         
nico@207: 00427         for values in DictionaryOrganisation:
nico@207: 00428             text = "   0x%04X-0x%04X      %s"%(values["minIndex"],values["maxIndex"],values["name"])
nico@207: 00429             self.PartListPartList.Append(text)
nico@207: 00430         self.TableTable = SubindexTable(self, [], [], ["subindex", "name", "type", "value", "access", "save", "comment"])
nico@207: 00431         self.SubindexGridSubindexGrid.SetTable(self.TableTable)
nico@207: 00432         self.SubindexGridSubindexGrid.SetRowLabelSize(0)
nico@207: 00433         self.CallbackCheckCallbackCheck.Disable()
nico@207: 00434         self.TableTable.ResetView(self.SubindexGridSubindexGrid)
nico@207: 00435 
nico@207: 00436         if not self.EditableEditable:
nico@207: 00437             self.AddButtonAddButton.Disable()
nico@207: 00438             self.IndexChoiceIndexChoice.Disable()
nico@207: 00439             self.CallbackCheckCallbackCheck.Disable()
nico@207: 00440             self.TableTable.Disable()
nico@207: 00441 
nico@207: 00442     def GetIndex(self):
nico@207: 00443         return self.IndexIndex
nico@207: 00444     
nico@207: 00445     def SetIndex(self, index):
nico@207: 00446         self.IndexIndex = index
nico@207: 00447 
nico@207: 00448     def GetSelection(self):
nico@207: 00449         selected = self.IndexListIndexList.GetSelection()
nico@207: 00450         if selected != wxNOT_FOUND:
nico@207: 00451             index = self.ListIndexListIndex[selected]
nico@207: 00452             subIndex = self.SubindexGridSubindexGrid.GetGridCursorRow()
nico@207: 00453             return index, subIndex
nico@207: 00454         return None
nico@207: 00455 
nico@207: 00456     def OnAddButtonClick(self, event):
nico@207: 00457         if self.EditableEditable:
nico@207: 00458             self.SubindexGridSubindexGrid.SetGridCursor(0, 0)
nico@207: 00459             selected = self.IndexChoiceIndexChoice.GetStringSelection()
nico@207: 00460             if selected != "":
nico@207: 00461                 if selected == "User Type":
nico@207: 00462                     self.ParentParent.AddUserType()
nico@207: 00463                 elif selected == "SDO Server":
nico@207: 00464                     self.ManagerManager.AddSDOServerToCurrent()
nico@207: 00465                 elif selected == "SDO Client":
nico@207: 00466                     self.ManagerManager.AddSDOClientToCurrent()
nico@207: 00467                 elif selected == "PDO Receive":
nico@207: 00468                     self.ManagerManager.AddPDOReceiveToCurrent()
nico@207: 00469                 elif selected == "PDO Transmit":
nico@207: 00470                     self.ManagerManager.AddPDOTransmitToCurrent()
nico@207: 00471                 elif selected == "Map Variable":
nico@207: 00472                     self.ParentParent.AddMapVariable()
nico@207: 00473                 elif selected in [menu for menu, indexes in self.ManagerManager.GetCurrentSpecificMenu()]:
nico@207: 00474                     self.ManagerManager.AddSpecificEntryToCurrent(selected)
nico@207: 00475                 else:
nico@207: 00476                     index = self.ChoiceIndexChoiceIndex[self.IndexChoiceIndexChoice.GetSelection()]
nico@207: 00477                     self.ManagerManager.ManageEntriesOfCurrent([index], [])
nico@207: 00478                 self.ParentParent.RefreshBufferState()
nico@207: 00479                 self.RefreshIndexListRefreshIndexList()
nico@207: 00480         event.Skip()
nico@207: 00481 
nico@207: 00482     def OnPartListBoxClick(self, event):
nico@207: 00483         self.SubindexGridSubindexGrid.SetGridCursor(0, 0)
nico@207: 00484         self.RefreshIndexListRefreshIndexList()
nico@207: 00485         event.Skip()
nico@207: 00486 
nico@207: 00487     def OnIndexListClick(self, event):
nico@207: 00488         self.SubindexGridSubindexGrid.SetGridCursor(0, 0)
nico@207: 00489         self.RefreshTableRefreshTable()
nico@207: 00490         event.Skip()
nico@207: 00491 
nico@207: 00492     def OnSubindexGridSelectCell(self, event):
nico@207: 00493         wxCallAfter(self.ParentParent.RefreshStatusBar)
nico@207: 00494         event.Skip()
nico@207: 00495 
nico@207: 00496 #-------------------------------------------------------------------------------
nico@207: 00497 #                             Refresh Functions
nico@207: 00498 #-------------------------------------------------------------------------------
nico@207: 00499 
nico@207: 00500     def RefreshIndexList(self):
nico@207: 00501         selected = self.IndexListIndexList.GetSelection()
nico@207: 00502         choice = self.IndexChoiceIndexChoice.GetStringSelection()
nico@207: 00503         choiceindex = self.IndexChoiceIndexChoice.GetSelection()
nico@207: 00504         if selected != wxNOT_FOUND:
nico@207: 00505             selectedindex = self.ListIndexListIndex[selected]
nico@207: 00506         self.IndexListIndexList.Clear()
nico@207: 00507         self.IndexChoiceIndexChoice.Clear()
nico@207: 00508         i = self.PartListPartList.GetSelection()
nico@207: 00509         if i < len(DictionaryOrganisation):
nico@207: 00510             values = DictionaryOrganisation[i]
nico@207: 00511             self.ListIndexListIndex = []
nico@207: 00512             for name, index in self.ManagerManager.GetCurrentValidIndexes(values["minIndex"], values["maxIndex"]):
nico@207: 00513                 self.IndexListIndexList.Append("0x%04X   %s"%(index, name))
nico@207: 00514                 self.ListIndexListIndex.append(index)
nico@207: 00515             if self.EditableEditable:
nico@207: 00516                 self.ChoiceIndexChoiceIndex = []
nico@207: 00517                 if i == 0:
nico@207: 00518                     self.IndexChoiceIndexChoice.Append("User Type")
nico@207: 00519                     self.IndexChoiceIndexChoice.SetStringSelection("User Type")
nico@207: 00520                 elif i == 2:
nico@207: 00521                     self.IndexChoiceIndexChoice.Append("SDO Server")
nico@207: 00522                     self.IndexChoiceIndexChoice.Append("SDO Client")
nico@207: 00523                     if choiceindex != wxNOT_FOUND and choice == self.IndexChoiceIndexChoice.GetString(choiceindex):
nico@207: 00524                          self.IndexChoiceIndexChoice.SetStringSelection(choice)
nico@207: 00525                 elif i in (3, 4):
nico@207: 00526                     self.IndexChoiceIndexChoice.Append("PDO Receive")
nico@207: 00527                     self.IndexChoiceIndexChoice.SetStringSelection("PDO Receive")
nico@207: 00528                 elif i in (5, 6):
nico@207: 00529                     self.IndexChoiceIndexChoice.Append("PDO Transmit")
nico@207: 00530                     self.IndexChoiceIndexChoice.SetStringSelection("PDO Transmit")
nico@207: 00531                 elif i == 8:
nico@207: 00532                     self.IndexChoiceIndexChoice.Append("Map Variable")
nico@207: 00533                     self.IndexChoiceIndexChoice.SetStringSelection("Map Variable")
nico@207: 00534                 else:
nico@207: 00535                     for name, index in self.ManagerManager.GetCurrentValidChoices(values["minIndex"], values["maxIndex"]):
nico@207: 00536                         if index:
nico@207: 00537                             self.IndexChoiceIndexChoice.Append("0x%04X   %s"%(index, name))
nico@207: 00538                         else:
nico@207: 00539                             self.IndexChoiceIndexChoice.Append(name)
nico@207: 00540                         self.ChoiceIndexChoiceIndex.append(index)
nico@207: 00541                 if choiceindex != wxNOT_FOUND and choice == self.IndexChoiceIndexChoice.GetString(choiceindex):
nico@207: 00542                     self.IndexChoiceIndexChoice.SetStringSelection(choice)
nico@207: 00543         if self.EditableEditable:
nico@207: 00544             self.IndexChoiceIndexChoice.Enable(self.IndexChoiceIndexChoice.GetCount() != 0)
nico@207: 00545             self.AddButtonAddButton.Enable(self.IndexChoiceIndexChoice.GetCount() != 0)
nico@207: 00546         if selected == wxNOT_FOUND or selected >= len(self.ListIndexListIndex) or selectedindex != self.ListIndexListIndex[selected]:
nico@207: 00547             self.TableTable.Empty()
nico@207: 00548             self.CallbackCheckCallbackCheck.SetValue(False)
nico@207: 00549             self.CallbackCheckCallbackCheck.Disable()
nico@207: 00550             self.TableTable.ResetView(self.SubindexGridSubindexGrid)
nico@207: 00551             self.ParentParent.RefreshStatusBar()
nico@207: 00552         else:
nico@207: 00553             self.IndexListIndexList.SetSelection(selected)
nico@207: 00554             self.RefreshTableRefreshTable()
nico@207: 00555 
nico@207: 00556     def RefreshTable(self):
nico@207: 00557         selected = self.IndexListIndexList.GetSelection()
nico@207: 00558         if selected != wxNOT_FOUND:
nico@207: 00559             index = self.ListIndexListIndex[selected]
nico@207: 00560             if index > 0x260 and self.EditableEditable:
nico@207: 00561                 self.CallbackCheckCallbackCheck.Enable()
nico@207: 00562                 self.CallbackCheckCallbackCheck.SetValue(self.ManagerManager.HasCurrentEntryCallbacks(index))
nico@207: 00563             result = self.ManagerManager.GetCurrentEntryValues(index)
nico@207: 00564             if result != None:
nico@207: 00565                 self.TableTable.SetCurrentIndex(index)
nico@207: 00566                 data, editors = result
nico@207: 00567                 self.TableTable.SetData(data)
nico@207: 00568                 self.TableTable.SetEditors(editors)
nico@207: 00569                 self.TableTable.ResetView(self.SubindexGridSubindexGrid)
nico@207: 00570         self.ParentParent.RefreshStatusBar()
nico@207: 00571 
nico@207: 00572 #-------------------------------------------------------------------------------
nico@207: 00573 #                        Editing Table value function
nico@207: 00574 #-------------------------------------------------------------------------------
nico@207: 00575 
nico@207: 00576     def OnSubindexGridCellChange(self, event):
nico@207: 00577         if self.EditableEditable:
nico@207: 00578             index = self.TableTable.GetCurrentIndex()
nico@207: 00579             subIndex = event.GetRow()
nico@207: 00580             col = event.GetCol()
nico@207: 00581             name = self.TableTable.GetColLabelValue(col)
nico@207: 00582             value = self.TableTable.GetValue(subIndex, col)
nico@207: 00583             editor = self.TableTable.GetEditor(subIndex, col)
nico@207: 00584             self.ManagerManager.SetCurrentEntry(index, subIndex, value, name, editor)
nico@207: 00585             self.ParentParent.RefreshBufferState()
nico@207: 00586             wxCallAfter(self.RefreshTableRefreshTable)
nico@207: 00587         event.Skip()
nico@207: 00588 
nico@207: 00589     def OnCallbackCheck(self, event):
nico@207: 00590         if self.EditableEditable:
nico@207: 00591             index = self.TableTable.GetCurrentIndex()
nico@207: 00592             self.ManagerManager.SetCurrentEntryCallbacks(index, self.CallbackCheckCallbackCheck.GetValue())
nico@207: 00593             self.ParentParent.RefreshBufferState()
nico@207: 00594             wxCallAfter(self.RefreshTableRefreshTable)
nico@207: 00595         event.Skip()
nico@207: 00596 
nico@207: 00597 #-------------------------------------------------------------------------------
nico@207: 00598 #                          Contextual Menu functions
nico@207: 00599 #-------------------------------------------------------------------------------
nico@207: 00600 
nico@207: 00601     def OnIndexListRightUp(self, event):
nico@207: 00602         if self.EditableEditable:
nico@207: 00603             if not self.FirstCallFirstCall:
nico@207: 00604                 self.FirstCallFirstCall = True
nico@207: 00605                 selected = self.IndexListIndexList.GetSelection()
nico@207: 00606                 if selected != wxNOT_FOUND:
nico@207: 00607                     index = self.ListIndexListIndex[selected]
nico@207: 00608                     if index < 0x260:
nico@207: 00609                         self.IndexListMenu.FindItemByPosition(0).Enable(False)
nico@207: 00610                         self.IndexListMenu.FindItemByPosition(1).Enable(True)
nico@207: 00611                         self.PopupMenu(self.IndexListMenu)
nico@207: 00612                     elif 0x1000 <= index <= 0x1BFF:
nico@207: 00613                         self.IndexListMenu.FindItemByPosition(0).Enable(False)
nico@207: 00614                         self.IndexListMenu.FindItemByPosition(1).Enable(False)
nico@207: 00615                         self.PopupMenu(self.IndexListMenu)
nico@207: 00616                     elif 0x2000 <= index <= 0x5FFF:
nico@207: 00617                         self.IndexListMenu.FindItemByPosition(0).Enable(True)
nico@207: 00618                         self.IndexListMenu.FindItemByPosition(1).Enable(False)
nico@207: 00619                         self.PopupMenu(self.IndexListMenu)
nico@207: 00620                     elif index >= 0x6000:
nico@207: 00621                         self.IndexListMenu.FindItemByPosition(0).Enable(False)
nico@207: 00622                         self.IndexListMenu.FindItemByPosition(1).Enable(False)
nico@207: 00623                         self.PopupMenu(self.IndexListMenu)
nico@207: 00624             else:
nico@207: 00625                 self.FirstCallFirstCall = False
nico@207: 00626         event.Skip()
nico@207: 00627 
nico@207: 00628     def OnSubindexGridRightClick(self, event):
nico@207: 00629         if self.EditableEditable:
nico@207: 00630             selected = self.IndexListIndexList.GetSelection()
nico@207: 00631             if selected != wxNOT_FOUND:
nico@207: 00632                 index = self.ListIndexListIndex[selected]
nico@207: 00633                 if self.ManagerManager.IsCurrentEntry(index):
nico@207: 00634                     infos = self.ManagerManager.GetEntryInfos(index)
nico@207: 00635                     if index >= 0x2000 and infos["struct"] & OD_MultipleSubindexes or infos["struct"] & OD_IdenticalSubindexes:
nico@207: 00636                         self.PopupMenu(self.SubindexGridMenu)
nico@207: 00637         event.Skip()
nico@207: 00638 
nico@207: 00639     def OnRenameIndexMenu(self, event):
nico@207: 00640         if self.EditableEditable:
nico@207: 00641             selected = self.IndexListIndexList.GetSelection()
nico@207: 00642             if selected != wxNOT_FOUND:
nico@207: 00643                 index = self.ListIndexListIndex[selected]
nico@207: 00644                 if self.ManagerManager.IsCurrentEntry(index):
nico@207: 00645                     infos = self.ManagerManager.GetEntryInfos(index)
nico@207: 00646                     dialog = wxTextEntryDialog(self, "Give a new name for index 0x%04X"%index,
nico@207: 00647                                  "Rename an index", infos["name"], wxOK|wxCANCEL)
nico@207: 00648                     if dialog.ShowModal() == wxID_OK:
nico@207: 00649                         self.ManagerManager.SetCurrentEntryName(index, dialog.GetValue())
nico@207: 00650                         self.ParentParent.RefreshBufferState()
nico@207: 00651                         self.RefreshIndexListRefreshIndexList()
nico@207: 00652                     dialog.Destroy()
nico@207: 00653         event.Skip()
nico@207: 00654 
nico@207: 00655     def OnModifyIndexMenu(self, event):
nico@207: 00656         if self.EditableEditable:
nico@207: 00657             selected = self.IndexListIndexList.GetSelection()
nico@207: 00658             if selected != wxNOT_FOUND:
nico@207: 00659                 index = self.ListIndexListIndex[selected]
nico@207: 00660                 if self.ManagerManager.IsCurrentEntry(index) and index < 0x260:
nico@207: 00661                     values, valuetype = self.ManagerManager.GetCustomisedTypeValues(index)
nico@207: 00662                     dialog = UserTypeDialog(self)
nico@207: 00663                     dialog.SetTypeList(self.ManagerManager.GetCustomisableTypes(), values[1])
nico@207: 00664                     if valuetype == 0:
nico@207: 00665                         dialog.SetValues(min = values[2], max = values[3])
nico@207: 00666                     elif valuetype == 1:
nico@207: 00667                         dialog.SetValues(length = values[2])
nico@207: 00668                     if dialog.ShowModal() == wxID_OK:
nico@207: 00669                         type, min, max, length = dialog.GetValues()
nico@207: 00670                         self.ManagerManager.SetCurrentUserType(index, type, min, max, length)
nico@207: 00671                         self.ParentParent.RefreshBufferState()
nico@207: 00672                         self.RefreshIndexListRefreshIndexList()
nico@207: 00673         event.Skip()
nico@207: 00674         
nico@207: 00675     def OnDeleteIndexMenu(self, event):
nico@207: 00676         if self.EditableEditable:
nico@207: 00677             selected = self.IndexListIndexList.GetSelection()
nico@207: 00678             if selected != wxNOT_FOUND:
nico@207: 00679                 index = self.ListIndexListIndex[selected]
nico@207: 00680                 if self.ManagerManager.IsCurrentEntry(index):
nico@207: 00681                     self.ManagerManager.ManageEntriesOfCurrent([],[index])
nico@207: 00682                     self.ParentParent.RefreshBufferState()
nico@207: 00683                     self.RefreshIndexListRefreshIndexList()
nico@207: 00684         event.Skip()
nico@207: 00685 
nico@207: 00686     def OnAddSubindexMenu(self, event):
nico@207: 00687         if self.EditableEditable:
nico@207: 00688             selected = self.IndexListIndexList.GetSelection()
nico@207: 00689             if selected != wxNOT_FOUND:
nico@207: 00690                 index = self.ListIndexListIndex[selected]
nico@207: 00691                 if self.ManagerManager.IsCurrentEntry(index):
nico@207: 00692                     dialog = wxTextEntryDialog(self, "Number of subindexes to add:",
nico@207: 00693                                  "Add subindexes", "1", wxOK|wxCANCEL)
nico@207: 00694                     if dialog.ShowModal() == wxID_OK:
nico@207: 00695                         try:
nico@207: 00696                             number = int(dialog.GetValue())
nico@207: 00697                             self.ManagerManager.AddSubentriesToCurrent(index, number)
nico@207: 00698                             self.ParentParent.RefreshBufferState()
nico@207: 00699                             self.RefreshIndexListRefreshIndexList()
nico@207: 00700                         except:
nico@207: 00701                             message = wxMessageDialog(self, "An integer is required!", "ERROR", wxOK|wxICON_ERROR)
nico@207: 00702                             message.ShowModal()
nico@207: 00703                             message.Destroy()
nico@207: 00704                     dialog.Destroy()
nico@207: 00705         event.Skip()
nico@207: 00706 
nico@207: 00707     def OnDeleteSubindexMenu(self, event):
nico@207: 00708         if self.EditableEditable:
nico@207: 00709             selected = self.IndexListIndexList.GetSelection()
nico@207: 00710             if selected != wxNOT_FOUND:
nico@207: 00711                 index = self.ListIndexListIndex[selected]
nico@207: 00712                 if self.ManagerManager.IsCurrentEntry(index):
nico@207: 00713                     dialog = wxTextEntryDialog(self, "Number of subindexes to delete:",
nico@207: 00714                                  "Delete subindexes", "1", wxOK|wxCANCEL)
nico@207: 00715                     if dialog.ShowModal() == wxID_OK:
nico@207: 00716                         try:
nico@207: 00717                             number = int(dialog.GetValue())
nico@207: 00718                             self.ManagerManager.RemoveSubentriesFromCurrent(index, number)
nico@207: 00719                             self.ParentParent.RefreshBufferState()
nico@207: 00720                             self.RefreshIndexListRefreshIndexList()
nico@207: 00721                         except:
nico@207: 00722                             message = wxMessageDialog(self, "An integer is required!", "ERROR", wxOK|wxICON_ERROR)
nico@207: 00723                             message.ShowModal()
nico@207: 00724                             message.Destroy()
nico@207: 00725                     dialog.Destroy()
nico@207: 00726         event.Skip()
nico@207: 00727 
nico@207: 

Generated on Mon Jun 4 16:29:06 2007 for CanFestival by  nico@207: nico@207: doxygen 1.5.1
nico@207: nico@207: