IDEFrame.py
changeset 2177 10aa87518401
parent 2169 baa0c5111457
child 2233 32445e3c9cfc
equal deleted inserted replaced
2176:748017ca4151 2177:10aa87518401
   209         path = base64.decodestring(path)
   209         path = base64.decodestring(path)
   210     return unicode(path, sys.getfilesystemencoding())
   210     return unicode(path, sys.getfilesystemencoding())
   211 
   211 
   212 
   212 
   213 def AppendMenu(parent, help, id, kind, text):
   213 def AppendMenu(parent, help, id, kind, text):
   214     """
   214     parent.Append(help=help, id=id, kind=kind, text=text)
   215     Compatibility function for wx versions < 2.6
       
   216     """
       
   217     if wx.VERSION >= (2, 6, 0):
       
   218         parent.Append(help=help, id=id, kind=kind, text=text)
       
   219     else:
       
   220         parent.Append(helpString=help, id=id, kind=kind, item=text)
       
   221 
   215 
   222 
   216 
   223 [
   217 [
   224     TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE,
   218     TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE,
   225     POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES
   219     POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES
   339 UNEDITABLE_NAMES_DICT = dict([(_(n), n) for n in UNEDITABLE_NAMES])
   333 UNEDITABLE_NAMES_DICT = dict([(_(n), n) for n in UNEDITABLE_NAMES])
   340 
   334 
   341 
   335 
   342 class IDEFrame(wx.Frame):
   336 class IDEFrame(wx.Frame):
   343     """IDEFrame Base Class"""
   337     """IDEFrame Base Class"""
   344     # Compatibility function for wx versions < 2.6
       
   345     if wx.VERSION < (2, 6, 0):
       
   346         def Bind(self, event, function, id=None):
       
   347             if id is not None:
       
   348                 event(self, id, function)
       
   349             else:
       
   350                 event(self, function)
       
   351 
   338 
   352     def _init_coll_MenuBar_Menus(self, parent):
   339     def _init_coll_MenuBar_Menus(self, parent):
   353         parent.Append(menu=self.FileMenu, title=_(u'&File'))
   340         parent.Append(menu=self.FileMenu, title=_(u'&File'))
   354         parent.Append(menu=self.EditMenu, title=_(u'&Edit'))
   341         parent.Append(menu=self.EditMenu, title=_(u'&Edit'))
   355         parent.Append(menu=self.DisplayMenu, title=_(u'&Display'))
   342         parent.Append(menu=self.DisplayMenu, title=_(u'&Display'))
  2127 
  2114 
  2128     def ResetEditorToolBar(self):
  2115     def ResetEditorToolBar(self):
  2129         EditorToolBar = self.Panes["EditorToolBar"]
  2116         EditorToolBar = self.Panes["EditorToolBar"]
  2130 
  2117 
  2131         for item in self.CurrentEditorToolBar:
  2118         for item in self.CurrentEditorToolBar:
  2132             if wx.VERSION >= (2, 6, 0):
  2119             self.Unbind(wx.EVT_MENU, id=item)
  2133                 self.Unbind(wx.EVT_MENU, id=item)
       
  2134             else:
       
  2135                 self.Disconnect(id=item, eventType=wx.wxEVT_COMMAND_MENU_SELECTED)
       
  2136 
  2120 
  2137             if EditorToolBar:
  2121             if EditorToolBar:
  2138                 EditorToolBar.DeleteTool(item)
  2122                 EditorToolBar.DeleteTool(item)
  2139 
  2123 
  2140         if EditorToolBar:
  2124         if EditorToolBar: