+ if self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
+ frames = self._GetWindowMenuFrameList(currentFrame)
+ max = WINDOW_MENU_NUM_ITEMS
+ if max > len(frames):
+ max = len(frames)
+ i = 0
+ for i in range(0, max):
+ frame = frames[i]
+ item = windowMenu.FindItemById(self._selectWinIds[i])
+ label = '&' + str(i + 1) + ' ' + frame.GetTitle()
+ if not item:
+ item = windowMenu.AppendCheckItem(self._selectWinIds[i], label)
+ else:
+ windowMenu.SetLabel(self._selectWinIds[i], label)
+ windowMenu.Check(self._selectWinIds[i], (frame == currentFrame))
+ if len(frames) > WINDOW_MENU_NUM_ITEMS: # Add the more items item
+ if not windowMenu.FindItemById(self.SELECT_MORE_WINDOWS_ID):
+ windowMenu.Append(self.SELECT_MORE_WINDOWS_ID, _("&More Windows..."))
+ else: # Remove any extra items
+ if windowMenu.FindItemById(self.SELECT_MORE_WINDOWS_ID):
+ windowMenu.Remove(self.SELECT_MORE_WINDOWS_ID)
+
+ for j in range(i + 1, WINDOW_MENU_NUM_ITEMS):
+ if windowMenu.FindItemById(self._selectWinIds[j]):
+ windowMenu.Remove(self._selectWinIds[j])
+
+ elif wx.GetApp().GetUseTabbedMDI():
+ notebook = wx.GetApp().GetTopWindow()._notebook
+ numPages = notebook.GetPageCount()
+
+ for id in self._selectWinIds:
+ item = windowMenu.FindItemById(id)
+ if item:
+ windowMenu.DeleteItem(item)
+ if numPages == 0 and self._sep:
+ windowMenu.DeleteItem(self._sep)
+ self._sep = None
+
+ if numPages > len(self._selectWinIds):
+ for i in range(len(self._selectWinIds), numPages):
+ self._selectWinIds.append(wx.NewId())
+ wx.EVT_MENU(currentFrame, self._selectWinIds[i], self.OnCtrlKeySelect)
+
+ for i in range(0, numPages):
+ if i == 0 and not self._sep:
+ self._sep = windowMenu.AppendSeparator()
+ if i < 9:
+ menuLabel = "%s\tCtrl+%s" % (notebook.GetPageText(i), i+1)
+ else:
+ menuLabel = notebook.GetPageText(i)
+ windowMenu.Append(self._selectWinIds[i], menuLabel)