objdictgen/objdictedit.py
changeset 209 2cb34a4ac65a
parent 206 6787754b251b
child 219 dbf69fd1fe6f
equal deleted inserted replaced
208:05d95c45b388 209:2cb34a4ac65a
   486         window = self.FileOpened.GetPage(selected)
   486         window = self.FileOpened.GetPage(selected)
   487         window.RefreshIndexList()
   487         window.RefreshIndexList()
   488 
   488 
   489     def RefreshStatusBar(self):
   489     def RefreshStatusBar(self):
   490         if self.HelpBar:
   490         if self.HelpBar:
   491             window = self.FileOpened.GetPage(self.FileOpened.GetSelection())
   491             selected = self.FileOpened.GetSelection()
   492             selection = window.GetSelection()
   492             if selected >= 0:
   493             if selection:
   493                 window = self.FileOpened.GetPage(selected)
   494                 index, subIndex = selection
   494                 selection = window.GetSelection()
   495                 if self.Manager.IsCurrentEntry(index):
   495                 if selection:
   496                     self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0)
   496                     index, subIndex = selection
   497                     self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1)
   497                     if self.Manager.IsCurrentEntry(index):
   498                     entryinfos = self.Manager.GetEntryInfos(index)
   498                         self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0)
   499                     name = entryinfos["name"]
   499                         self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1)
   500                     category = "Optional"
   500                         entryinfos = self.Manager.GetEntryInfos(index)
   501                     if entryinfos["need"]:
   501                         name = entryinfos["name"]
   502                         category = "Mandatory"
   502                         category = "Optional"
   503                     struct = "VAR"
   503                         if entryinfos["need"]:
   504                     number = ""
   504                             category = "Mandatory"
   505                     if entryinfos["struct"] & OD_IdenticalIndexes:
   505                         struct = "VAR"
   506                         number = " possibly defined %d times"%entryinfos["nbmax"]
   506                         number = ""
   507                     if entryinfos["struct"] & OD_IdenticalSubindexes:
   507                         if entryinfos["struct"] & OD_IdenticalIndexes:
   508                         struct = "REC"
   508                             number = " possibly defined %d times"%entryinfos["nbmax"]
   509                     elif entryinfos["struct"] & OD_MultipleSubindexes:
   509                         if entryinfos["struct"] & OD_IdenticalSubindexes:
   510                         struct = "ARRAY"
   510                             struct = "REC"
   511                     text = "%s: %s entry of struct %s%s."%(name,category,struct,number)
   511                         elif entryinfos["struct"] & OD_MultipleSubindexes:
   512                     self.HelpBar.SetStatusText(text, 2)
   512                             struct = "ARRAY"
       
   513                         text = "%s: %s entry of struct %s%s."%(name,category,struct,number)
       
   514                         self.HelpBar.SetStatusText(text, 2)
       
   515                     else:
       
   516                         for i in xrange(3):
       
   517                             self.HelpBar.SetStatusText("", i)
   513                 else:
   518                 else:
   514                     for i in xrange(3):
   519                     for i in xrange(3):
   515                         self.HelpBar.SetStatusText("", i)
   520                         self.HelpBar.SetStatusText("", i)
   516             else:
       
   517                 for i in xrange(3):
       
   518                     self.HelpBar.SetStatusText("", i)
       
   519 
   521 
   520     def RefreshMainMenu(self):
   522     def RefreshMainMenu(self):
   521         if self.FileMenu:
   523         if self.FileMenu:
   522             if self.FileOpened.GetPageCount() > 0:
   524             if self.FileOpened.GetPageCount() > 0:
   523                 self.menuBar1.EnableTop(1, True)
   525                 self.menuBar1.EnableTop(1, True)