diff -r 05d95c45b388 -r 2cb34a4ac65a objdictgen/objdictedit.py --- a/objdictgen/objdictedit.py Tue Jun 05 16:41:38 2007 +0200 +++ b/objdictgen/objdictedit.py Tue Jun 05 17:34:33 2007 +0200 @@ -488,34 +488,36 @@ def RefreshStatusBar(self): if self.HelpBar: - window = self.FileOpened.GetPage(self.FileOpened.GetSelection()) - selection = window.GetSelection() - if selection: - index, subIndex = selection - if self.Manager.IsCurrentEntry(index): - self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0) - self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1) - entryinfos = self.Manager.GetEntryInfos(index) - name = entryinfos["name"] - category = "Optional" - if entryinfos["need"]: - category = "Mandatory" - struct = "VAR" - number = "" - if entryinfos["struct"] & OD_IdenticalIndexes: - number = " possibly defined %d times"%entryinfos["nbmax"] - if entryinfos["struct"] & OD_IdenticalSubindexes: - struct = "REC" - elif entryinfos["struct"] & OD_MultipleSubindexes: - struct = "ARRAY" - text = "%s: %s entry of struct %s%s."%(name,category,struct,number) - self.HelpBar.SetStatusText(text, 2) + selected = self.FileOpened.GetSelection() + if selected >= 0: + window = self.FileOpened.GetPage(selected) + selection = window.GetSelection() + if selection: + index, subIndex = selection + if self.Manager.IsCurrentEntry(index): + self.HelpBar.SetStatusText("Index: 0x%04X"%index, 0) + self.HelpBar.SetStatusText("Subindex: 0x%02X"%subIndex, 1) + entryinfos = self.Manager.GetEntryInfos(index) + name = entryinfos["name"] + category = "Optional" + if entryinfos["need"]: + category = "Mandatory" + struct = "VAR" + number = "" + if entryinfos["struct"] & OD_IdenticalIndexes: + number = " possibly defined %d times"%entryinfos["nbmax"] + if entryinfos["struct"] & OD_IdenticalSubindexes: + struct = "REC" + elif entryinfos["struct"] & OD_MultipleSubindexes: + struct = "ARRAY" + text = "%s: %s entry of struct %s%s."%(name,category,struct,number) + self.HelpBar.SetStatusText(text, 2) + else: + for i in xrange(3): + self.HelpBar.SetStatusText("", i) else: for i in xrange(3): self.HelpBar.SetStatusText("", i) - else: - for i in xrange(3): - self.HelpBar.SetStatusText("", i) def RefreshMainMenu(self): if self.FileMenu: