objdictgen/subindextable.py
changeset 237 5dcfc996e563
parent 206 6787754b251b
child 242 4864f7f01e1d
equal deleted inserted replaced
236:905677ed00f3 237:5dcfc996e563
   247 
   247 
   248 [wxID_EDITINGPANELINDEXLISTMENUITEMS0, wxID_EDITINGPANELINDEXLISTMENUITEMS1, 
   248 [wxID_EDITINGPANELINDEXLISTMENUITEMS0, wxID_EDITINGPANELINDEXLISTMENUITEMS1, 
   249  wxID_EDITINGPANELINDEXLISTMENUITEMS2, 
   249  wxID_EDITINGPANELINDEXLISTMENUITEMS2, 
   250 ] = [wx.NewId() for _init_coll_IndexListMenu_Items in range(3)]
   250 ] = [wx.NewId() for _init_coll_IndexListMenu_Items in range(3)]
   251 
   251 
   252 [wxID_EDITINGPANELMENU1ITEMS0, wxID_EDITINGPANELMENU1ITEMS1, 
   252 [wxID_EDITINGPANELMENU1ITEMS0, wxID_EDITINGPANELMENU1ITEMS1, wxID_EDITINGPANELMENU1ITEMS2,
   253 ] = [wx.NewId() for _init_coll_SubindexGridMenu_Items in range(2)]
   253 ] = [wx.NewId() for _init_coll_SubindexGridMenu_Items in range(3)]
   254 
   254 
   255 class EditingPanel(wx.SplitterWindow):
   255 class EditingPanel(wx.SplitterWindow):
   256     def _init_coll_AddToListSizer_Items(self, parent):
   256     def _init_coll_AddToListSizer_Items(self, parent):
   257         # generated method, don't edit
   257         # generated method, don't edit
   258 
   258 
   293 
   293 
   294         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS0,
   294         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS0,
   295               kind=wx.ITEM_NORMAL, text='Add')
   295               kind=wx.ITEM_NORMAL, text='Add')
   296         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS1,
   296         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS1,
   297               kind=wx.ITEM_NORMAL, text='Delete')
   297               kind=wx.ITEM_NORMAL, text='Delete')
       
   298         parent.Append(help='', id=wxID_EDITINGPANELMENU1ITEMS2,
       
   299               kind=wx.ITEM_NORMAL, text='Default Value')
   298         self.Bind(wx.EVT_MENU, self.OnAddSubindexMenu,
   300         self.Bind(wx.EVT_MENU, self.OnAddSubindexMenu,
   299               id=wxID_EDITINGPANELMENU1ITEMS0)
   301               id=wxID_EDITINGPANELMENU1ITEMS0)
   300         self.Bind(wx.EVT_MENU, self.OnDeleteSubindexMenu,
   302         self.Bind(wx.EVT_MENU, self.OnDeleteSubindexMenu,
   301               id=wxID_EDITINGPANELMENU1ITEMS1)
   303               id=wxID_EDITINGPANELMENU1ITEMS1)
       
   304         self.Bind(wx.EVT_MENU, self.OnDefaultValueSubindexMenu,
       
   305               id=wxID_EDITINGPANELMENU1ITEMS2)
   302 
   306 
   303     def _init_coll_IndexListMenu_Items(self, parent):
   307     def _init_coll_IndexListMenu_Items(self, parent):
   304         # generated method, don't edit
   308         # generated method, don't edit
   305 
   309 
   306         parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS0,
   310         parent.Append(help='', id=wxID_EDITINGPANELINDEXLISTMENUITEMS0,
   630             selected = self.IndexList.GetSelection()
   634             selected = self.IndexList.GetSelection()
   631             if selected != wxNOT_FOUND:
   635             if selected != wxNOT_FOUND:
   632                 index = self.ListIndex[selected]
   636                 index = self.ListIndex[selected]
   633                 if self.Manager.IsCurrentEntry(index):
   637                 if self.Manager.IsCurrentEntry(index):
   634                     infos = self.Manager.GetEntryInfos(index)
   638                     infos = self.Manager.GetEntryInfos(index)
   635                     if index >= 0x2000 and infos["struct"] & OD_MultipleSubindexes or infos["struct"] & OD_IdenticalSubindexes:
   639                     if 0x5fff >= index >= 0x2000 and infos["struct"] & OD_MultipleSubindexes or infos["struct"] & OD_IdenticalSubindexes:
   636                         self.PopupMenu(self.SubindexGridMenu)
   640                         # enable add and delet entries
       
   641                         self.SubindexGridMenu.FindItemById(wxID_EDITINGPANELMENU1ITEMS0).Enable(True)
       
   642                         self.SubindexGridMenu.FindItemById(wxID_EDITINGPANELMENU1ITEMS1).Enable(True)
       
   643                     else:
       
   644                         # disable add and delet entries
       
   645                         self.SubindexGridMenu.FindItemById(wxID_EDITINGPANELMENU1ITEMS0).Enable(False)
       
   646                         self.SubindexGridMenu.FindItemById(wxID_EDITINGPANELMENU1ITEMS1).Enable(False)
       
   647                     self.SubindexGrid.SetGridCursor(event.GetRow(), event.GetCol())
       
   648                     wxCallAfter(self.PopupMenu,self.SubindexGridMenu)
   637         event.Skip()
   649         event.Skip()
   638 
   650 
   639     def OnRenameIndexMenu(self, event):
   651     def OnRenameIndexMenu(self, event):
   640         if self.Editable:
   652         if self.Editable:
   641             selected = self.IndexList.GetSelection()
   653             selected = self.IndexList.GetSelection()
   723                             message.ShowModal()
   735                             message.ShowModal()
   724                             message.Destroy()
   736                             message.Destroy()
   725                     dialog.Destroy()
   737                     dialog.Destroy()
   726         event.Skip()
   738         event.Skip()
   727 
   739 
       
   740     def OnDefaultValueSubindexMenu(self, event):
       
   741         if self.Editable:
       
   742             selected = self.IndexList.GetSelection()
       
   743             if selected != wxNOT_FOUND:
       
   744                 index = self.ListIndex[selected]
       
   745                 if self.Manager.IsCurrentEntry(index):
       
   746                     self.Manager.ResetCurrentDefaultValue(index,self.SubindexGrid.GetGridCursorRow())
       
   747                     self.Parent.RefreshBufferState()
       
   748                     self.RefreshIndexList()
       
   749         event.Skip()
       
   750