dabo Commit
Revision 4957
Date: 2009-01-23 18:10:48 -0800 (Fri, 23 Jan 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/4957

Changed:
U   trunk/ide/ClassDesignerMenu.py
U   trunk/ide/CxnEditor.py
U   trunk/ide/Editor.py

Log:
Updated these classes to work with the new MenuID/ItemID format for menus.

Diff:
Modified: trunk/ide/ClassDesignerMenu.py
===================================================================
--- trunk/ide/ClassDesignerMenu.py      2009-01-24 02:09:52 UTC (rev 4956)
+++ trunk/ide/ClassDesignerMenu.py      2009-01-24 02:10:48 UTC (rev 4957)
@@ -19,86 +19,130 @@
                mb = None
        if mb:
                app = target.Controller
-               fm = mb.getMenu(_("File"))
-               em = mb.getMenu(_("Edit"))
-               vm = mb.getMenu(_("View"))
+               fm = mb.getMenu("base_file")
+               em = mb.getMenu("base_edit")
+               vm = mb.getMenu("base_view")
                
-               app.barShowPropSheet = vm.append(_("Hide Object Info Form"),  
-                               OnHit=app.onTogglePropSheet, 
+               app.barShowPropSheet = vm.append(_("Hide Object Info Form"),
+                               OnHit=app.onTogglePropSheet,
+                               ItemID="view_objinfo",
                                help=_("Show/hide the Object Info form"))
-               app.barShowEditor = vm.append(_("Hide Code Editor"),  
-                               OnHit=app.onToggleEditor, 
+               app.barShowEditor = vm.append(_("Hide Code Editor"),
+                               OnHit=app.onToggleEditor,
+                               ItemID="view_codeeditor",
                                help=_("Show/hide the Code Editor"))
-               app.barShowPalette = vm.append(_("Show Tool Palette"),  
-                               OnHit=app.onTogglePalette, 
+               app.barShowPalette = vm.append(_("Show Tool Palette"),
+                               OnHit=app.onTogglePalette,
+                               ItemID="view_toolpalette",
                                help=_("Show/hide the Tool Palette"))
-               app.barShowSizerPalette = vm.append(_("Show Sizer Palette"),  
-                               OnHit=app.onToggleSizerPalette, 
+               app.barShowSizerPalette = vm.append(_("Show Sizer Palette"),
+                               OnHit=app.onToggleSizerPalette,
+                               ItemID="view_sizerpalette",
                                help=_("Show/hide the Sizer Palette"))
                # Add some hotkeys for displaying the various PemObject panels
                vm.appendSeparator()
-               vm.append(_("Display Properties"), HotKey="Ctrl+Shift+P", 
+               vm.append(_("Display Properties"), HotKey="Ctrl+Shift+P",
                                OnHit=app.onShowProp,
+                               ItemID="view_properties",
                                help=_("Display the property editing page"))
-               vm.append(_("Display Object Tree"), HotKey="Ctrl+Shift+O", 
+               vm.append(_("Display Object Tree"), HotKey="Ctrl+Shift+O",
                                OnHit=app.onShowObjTree,
+                               ItemID="view_objecttree",
                                help=_("Display the object tree page"))
-               vm.append(_("Display Methods"), HotKey="Ctrl+Shift+M", 
+               vm.append(_("Display Methods"), HotKey="Ctrl+Shift+M",
                                OnHit=app.onShowMethods,
+                               ItemID="view_methods",
                                help=_("Display the method selection page"))
-               vm.append(_("Select Prior Object"), HotKey="Ctrl+PgUp", 
+               vm.append(_("Select Prior Object"), HotKey="Ctrl+PgUp",
                                OnHit=app.onPriorObj,
+                               ItemID="view_priorobj",
                                help=_("Select the object on the previous node 
of the object tree"))
                vm.append(_("Select Next Object"), HotKey="Ctrl+PgDn",
                                OnHit=app.onNextObj,
+                               ItemID="view_nextobj",
                                help=_("Select the object on the next node of 
the object tree"))
                
                
-               # Add a separator and the 'Run...' item after the 
+               # Add a separator and the 'Run...' item after the
                # Open/Save items. Since we are prepending, we need
                # to prepend them in reverse order.
                fm.prependSeparator()
-               fm.prepend(_("&Run..."), HotKey="Ctrl+Shift+R", 
OnHit=app.onRunDesign, 
+               fm.prepend(_("&Run..."), HotKey="Ctrl+Shift+R",
+                               OnHit=app.onRunDesign,
+                               ItemID="file_run",
                                help=_("Test your design by running the form"))
                fm.prependSeparator()
-               fm.prepend(_("Revert to Saved"), OnHit=app.onRevert, 
+               fm.prepend(_("Revert to Saved"),
+                               OnHit=app.onRevert,
+                               ItemID="file_revert",
                                help=_("Re-load the form from disk, losing any 
pending changes"))
-               fm.prepend(_("Save Runnable App"), OnHit=app.onSaveRunnable, 
+               fm.prepend(_("Save Runnable App"),
+                               OnHit=app.onSaveRunnable,
+                               ItemID="file_saverunnable",
                                help=_("Create a mini app to run your form"))
                fm.prependSeparator()
-               itm = fm.prepend(_("&Import Declarations..."), HotKey="Ctrl-I", 
OnHit=app.onDeclareImports, 
+               itm = fm.prepend(_("&Import Declarations..."),
+                               HotKey="Ctrl-I",
+                               OnHit=app.onDeclareImports,
+                               ItemID="file_import",
                                help=_("Edit the import statements for the code 
for this class"))
-               itm = fm.prepend(_("Single &File for Layout and Code"), 
OnHit=app.onToggleSaveType,
+               itm = fm.prepend(_("Single &File for Layout and Code"),
+                               OnHit=app.onToggleSaveType,
+                               ItemID="file_singlefile",
                                help=_("Toggle whether you want code saved in 
the XML or in a separate file"),
                                menutype="check")
                itm.Checked = 
target.Application.getUserSetting("saveCodeInXML", False)
-               itm = fm.prepend(_("Save as C&lass"), HotKey="Ctrl+Shift+S", 
OnHit=app.onSaveClassDesign, 
+               itm = fm.prepend(_("Save as C&lass"),
+                               HotKey="Ctrl+Shift+S",
+                               OnHit=app.onSaveClassDesign,
+                               ItemID="file_saveasclass",
                                help=_("Save the ClassDesigner contents as a 
class"))
                itm.DynamicEnabled = app.shouldEnableSaveAsClass
-               fm.prepend(_("&Save"), HotKey="Ctrl+S", OnHit=app.onSaveDesign, 
+               fm.prepend(_("&Save"),
+                               HotKey="Ctrl+S",
+                               OnHit=app.onSaveDesign,
+                               ItemID="file_save",
                                help=_("Save the ClassDesigner contents as a 
form"))
-               fm.prepend(_("&Open"), HotKey="Ctrl+O", OnHit=app.onOpenDesign, 
+               fm.prepend(_("&Open"),
+                               HotKey="Ctrl+O",
+                               OnHit=app.onOpenDesign,
+                               ItemID="file_open",
                                help=_("Open a saved design file"))
-               fm.prepend(_("&New Class..."), HotKey="Ctrl+N", 
OnHit=app.onNewDesign, 
+               fm.prepend(_("&New Class..."),
+                               HotKey="Ctrl+N",
+                               OnHit=app.onNewDesign,
+                               ItemID="file_new",
                                help=_("Create a new design file"))
                                        
-               alignMenu = dabo.ui.dMenu(Caption=_("Align"))
-               itm = alignMenu.append(_("Align Top Edges"), 
OnHit=app.onAlignTopEdge,
+               alignMenu = dabo.ui.dMenu(Caption=_("Align"), 
MenuID="base_align")
+               itm = alignMenu.append(_("Align Top Edges"),
+                               OnHit=app.onAlignTopEdge,
+                               ItemID="align_top",
                                help=_("Align controls by their top edge"))
                itm.DynamicEnabled = app.shouldEnableAlignControls
-               itm = alignMenu.append(_("Align Bottom Edges"), 
OnHit=app.onAlignBottomEdge,
+               itm = alignMenu.append(_("Align Bottom Edges"),
+                               OnHit=app.onAlignBottomEdge,
+                               ItemID="align_bottom",
                                help=_("Align controls by their bottom edge"))
                itm.DynamicEnabled = app.shouldEnableAlignControls
-               itm = alignMenu.append(_("Align Left Edges"), 
OnHit=app.onAlignLeftEdge,
+               itm = alignMenu.append(_("Align Left Edges"),
+                               OnHit=app.onAlignLeftEdge,
+                               ItemID="align_left",
                                help=_("Align controls by their left edge"))
                itm.DynamicEnabled = app.shouldEnableAlignControls
-               itm = alignMenu.append(_("Align Right Edges"), 
OnHit=app.onAlignRightEdge,
+               itm = alignMenu.append(_("Align Right Edges"),
+                               OnHit=app.onAlignRightEdge,
+                               ItemID="align_right",
                                help=_("Align controls by their right edge"))
                itm.DynamicEnabled = app.shouldEnableAlignControls
-               itm = alignMenu.append(_("Bring to Front"), 
OnHit=app.onBringToFront,
+               itm = alignMenu.append(_("Bring to Front"),
+                               OnHit=app.onBringToFront,
+                               ItemID="align_bringtofront",
                                help=_("Move control to the top of the visible 
stack"))
                itm.DynamicEnabled = app.shouldEnableZOrdering
-               itm = alignMenu.append(_("Send to Back"), 
OnHit=app.onSendToBack,
+               itm = alignMenu.append(_("Send to Back"),
+                               OnHit=app.onSendToBack,
+                               ItemID="align_sendtoback",
                                help=_("Move control to the bottom of the 
visible stack"))
                itm.DynamicEnabled = app.shouldEnableZOrdering
                
@@ -112,7 +156,7 @@
                        isMain = False
                if isMain:
                        cm = mb.append(_("Controls"))
-                       ctlList = [(ct["order"], ct["name"]) 
+                       ctlList = [(ct["order"], ct["name"])
                                        for ct in app.designerControls]
                        ctlList.sort()
                        for ctl in ctlList:

Modified: trunk/ide/CxnEditor.py
===================================================================
--- trunk/ide/CxnEditor.py      2009-01-24 02:09:52 UTC (rev 4956)
+++ trunk/ide/CxnEditor.py      2009-01-24 02:10:48 UTC (rev 4957)
@@ -41,8 +41,12 @@
        
        def createMenu(self):
                mb = self.MenuBar
-               fm = mb.getMenu("File")
-               fm.prepend(_("Open Connection File..."), HotKey="Ctrl+O", 
OnHit=self.onOpenFile)
+               fm = mb.getMenu("base_file")
+               fm.prepend(_("Open Connection File..."),
+                               HotKey="Ctrl+O",
+                               OnHit=self.onOpenFile
+                               ItemID="file_open",
+                               help=_("Open an existing connection file"))
        
        
        def onOpenFile(self, evt):

Modified: trunk/ide/Editor.py
===================================================================
--- trunk/ide/Editor.py 2009-01-24 02:09:52 UTC (rev 4956)
+++ trunk/ide/Editor.py 2009-01-24 02:10:48 UTC (rev 4957)
@@ -560,107 +560,113 @@
        def fillMenu(self):
                app = self.Application
                mb = self.MenuBar
-               fileMenu = mb.getMenu(_("File"))
+               fileMenu = mb.getMenu("base_file")
                app.onMenuOpenMRU(fileMenu)
                
-               editMenu = mb.getMenu(_("Edit"))
-               mb.remove(mb.getMenuIndex(_("View")))
-               runMenu = dabo.ui.dMenu(Caption=_("&Run"))
-               mb.insertMenu(3, runMenu)               
+               editMenu = mb.getMenu("base_edit")
+               mb.remove(mb.getMenuIndex("base_view"))
+               runMenu = dabo.ui.dMenu(Caption=_("&Run"), MenuID="base_run")
+               mb.insertMenu(3, runMenu)
                dIcons = dabo.ui.dIcons
                                
                fileMenu.prependSeparator()
-               itm = fileMenu.prepend(_("Reload from Disk"), 
OnHit=self.onFileReload, 
+               itm = fileMenu.prepend(_("Reload from Disk"), 
OnHit=self.onFileReload, ItemID="file_reload",
                                help=_("Refresh the editor with the current 
version of the file on disk"))
                itm.DynamicEnabled = self.hasFile
                
                fileMenu.prependSeparator()
                fileMenu.prepend(_("Save &As"), HotKey="Ctrl+Shift+S", 
OnHit=self.onFileSaveAs, bmp="saveAs", 
-                               help=_("Save under a different file name"))
-               fileMenu.prepend(_("&Save"), HotKey="Ctrl+S", 
OnHit=self.onFileSave, 
+                               ItemID="file_saveas", help=_("Save under a 
different file name"))
+               fileMenu.prepend(_("&Save"), HotKey="Ctrl+S", 
OnHit=self.onFileSave, ItemID="file_save", 
                                
DynamicEnabled=lambda:self.CurrentEditor.Modified, bmp="save", help=_("Save 
file"))
-               cPos = fileMenu.getItemIndex(_("Close Window"))
-               if cPos is not None:
-                       fileMenu.remove(cPos)
+               clsItem = fileMenu.getItem("file_close")
+               if clsItem is not None:
+                       fileMenu.remove(clsItem)
                fileMenu.prepend(_("&Close Editor"), HotKey="Ctrl+W", 
OnHit=self.onFileClose, bmp="close",
-                               help=_("Close file"))
+                               ItemID="file_close_editor", help=_("Close 
file"))
                fileMenu.prepend(_("&Open"), HotKey="Ctrl+O", 
OnHit=self.onFileOpen, bmp="open",
-                               help=_("Open file"))
+                               ItemID="file_open", help=_("Open file"))
                fileMenu.prepend(_("&New"), HotKey="Ctrl+N", 
OnHit=self.onFileNew, bmp="new",
-                               help=_("New file"))
+                               ItemID="file_new", help=_("New file"))
 
                editMenu.appendSeparator()
                editMenu.append(_("&Jump to line..."), HotKey="Ctrl+J", 
OnHit=self.onEditJumpToLine, 
-                               bmp="", help=_("Jump to line"))
+                               bmp="", ItemID="edit_jump", help=_("Jump to 
line"))
                editMenu.appendSeparator()
                editMenu.append(_("Co&mment Line"), HotKey="Ctrl+M", 
OnHit=self.onCommentLine,
-                               bmp="", help=_("Comment out selection"))
+                               bmp="", ItemID="edit_comment", help=_("Comment 
out selection"))
                editMenu.append(_("&Uncomment Line"), HotKey="Ctrl+Shift+M", 
-                               OnHit=self.onUncommentLine, bmp="", 
+                               OnHit=self.onUncommentLine, bmp="", 
ItemID="edit_uncomment", 
                                help=_("Uncomme&nt selection"))
                editMenu.append(_("&AutoComplete"), HotKey="F5", 
-                               OnHit=self.onAutoComplete, bmp="", 
+                               OnHit=self.onAutoComplete, bmp="", 
ItemID="edit_autocomplete", 
                                help=_("Auto-complete the current text"))
                self._autoAutoItem = editMenu.append(_("Automa&tic 
AutoComplete"), 
                                OnHit=self.onAutoAutoComp, bmp="", 
help=_("Toggle Automatic Autocomplete"), 
-                               menutype="check")
+                               ItemID="edit_autoautocomplete", 
menutype="check")
                editMenu.appendSeparator()
-               moveMenu = dabo.ui.dMenu(Caption=_("Move..."))
+               moveMenu = dabo.ui.dMenu(Caption=_("Move..."), 
MenuID="edit_move")
                editMenu.appendMenu(moveMenu)
                moveMenu.append(_("Previous Page"), HotKey="Alt+Left", 
OnHit=self.onPrevPage, 
-                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", help=_("Switch to the 
tab to the left"))
+                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", 
+                               ItemID="move_prev", help=_("Switch to the tab 
to the left"))
                moveMenu.append(_("Next Page"), HotKey="Alt+Right", 
OnHit=self.onNextPage, 
-                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", help=_("Switch to the 
tab to the right"))
+                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", 
+                               ItemID="move_next", help=_("Switch to the tab 
to the right"))
                moveMenu.append(_("Move Page Left"), HotKey="Alt+Shift+Left", 
OnHit=self.onMovePageLeft, 
-                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", help=_("Move this 
editor tab to the left"))
+                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", 
+                               ItemID="move_pageleft", help=_("Move this 
editor tab to the left"))
                moveMenu.append(_("Move Page Right"), HotKey="Alt+Shift+Right", 
OnHit=self.onMovePageRight, 
-                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", help=_("Move this 
editor tab to the right"))
+                               
DynamicEnabled=lambda:self.pgfEditor.PageCount>1, bmp="", 
+                               ItemID="move_pageright", help=_("Move this 
editor tab to the right"))
                moveMenu.append(_("Next Block"), HotKey="Ctrl+Shift+K", 
OnHit=self.onMoveUpBlock, 
-                               
DynamicEnabled=lambda:self.CurrentEditor.Language=="python", bmp="", 
help=_("Move to the next 'def' or 'class' statement"))
+                               
DynamicEnabled=lambda:self.CurrentEditor.Language=="python", bmp="", 
+                               ItemID="move_nextblock", help=_("Move to the 
next 'def' or 'class' statement"))
                moveMenu.append(_("Previous Block"), HotKey="Ctrl+Shift+D", 
OnHit=self.onMoveDownBlock, 
-                               
DynamicEnabled=lambda:self.CurrentEditor.Language=="python", bmp="", 
help=_("Move to the previous 'def' or 'class' statement"))
+                               
DynamicEnabled=lambda:self.CurrentEditor.Language=="python", bmp="", 
+                               ItemID="move_prevblock", help=_("Move to the 
previous 'def' or 'class' statement"))
 
                editMenu.appendSeparator()
                self._wrapItem = editMenu.append(_("&Word Wrap"), 
HotKey="Ctrl+Shift+W", OnHit=self.onWordWrap, 
-                               bmp="", help=_("Toggle WordWrap"), 
menutype="check")
+                               bmp="", ItemID="edit_wordwrap", help=_("Toggle 
WordWrap"), menutype="check")
                self._synColorItem = editMenu.append(_("S&yntax Coloring"), 
HotKey="Ctrl+Shift+Y", 
-                               OnHit=self.onSyntaxColoring, bmp="", 
help=_("Toggle Syntax Coloring"), 
-                               menutype="check")
+                               OnHit=self.onSyntaxColoring, bmp="", 
ItemID="edit_syntaxcolor", 
+                               help=_("Toggle Syntax Coloring"), 
menutype="check")
                
                runMenu.append(_("&Run Script"), HotKey="F7", 
OnHit=self.onRunScript,
-                               bmp="", help=_("Run Script"))           
+                               bmp="", ItemID="run_script", help=_("Run 
Script"))              
                self._showOutItem = runMenu.append(_("Hide/Show Output"), 
HotKey="F8", OnHit=self.onOutput, bmp="",
-                               help=_("Toggle the visibility of the Output 
pane"), menutype="check")
+                               ItemID="run_output", help=_("Toggle the 
visibility of the Output pane"), menutype="check")
                runMenu.append(_("Clear Output"), OnHit=self.onClearOutput, 
bmp="",
-                               help=_("Clear the contents of the Output pane"))
+                               ItemID="run_clear", help=_("Clear the contents 
of the Output pane"))
 
-               fontMenu = dabo.ui.dMenu(Caption=_("Fo&nt"))
+               fontMenu = dabo.ui.dMenu(Caption=_("Fo&nt"), MenuID="base_font")
                mb.insertMenu(4, fontMenu)
-               fontMenu.append(_("Set Font Size"), OnHit=self.onFontSize, 
+               fontMenu.append(_("Set Font Size"), OnHit=self.onFontSize, 
ItemID="font_setsize", 
                                help=_("Set Default Font Size"))
                fontMenu.appendSeparator()
                fontMenu.append(_("Zoom &In"), HotKey="Ctrl++", 
OnHit=self.onViewZoomIn, 
-                               bmp="zoomIn", help=_("Zoom In"))
+                               bmp="zoomIn", ItemID="font_zoomin", 
help=_("Zoom In"))
                fontMenu.append(_("&Normal Zoom"), HotKey="Ctrl+/", 
OnHit=self.onViewZoomNormal, 
-                               bmp="zoomNormal", help=_("Normal Zoom"))
+                               bmp="zoomNormal", ItemID="font_zoomnormal", 
help=_("Normal Zoom"))
                fontMenu.append(_("Zoom &Out"), HotKey="Ctrl+-", 
OnHit=self.onViewZoomOut, 
-                               bmp="zoomOut", help=_("Zoom Out"))
+                               bmp="zoomOut", ItemID="font_zoomout", 
help=_("Zoom Out"))
                fonts = dabo.ui.getAvailableFonts()
                fontMenu.appendSeparator()
                for font in fonts:
                        fontMenu.append(font, OnHit=self.onFontSelection, 
-                                       menutype="Radio")
+                                       ItemID="font_%s" % font.replace(" ", 
"_"), menutype="Radio")
                
-               vp = mb.getMenuIndex(_("Font"))
-               editorMenu = mb.insert(vp+1, _("E&ditors"))
+               vp = mb.getMenuIndex("base_font")
+               editorMenu = mb.insert(vp+1, _("E&ditors"), 
MenuID="base_editors")
                editorMenu.bindEvent(dEvents.MenuHighlight, self.onMenuOpen)
                
                # On non-Mac platforms, we may need to move the Help Menu
                # to the end.
                if app.Platform != "Mac":
-                       hlp = mb.getMenu(_("Help"))
+                       hlp = mb.getMenu("base_help")
                        if hlp:
-                               mb.remove(mb.getMenuIndex(_("Help")), False)
+                               mb.remove(hlp, False)
                                mb.appendMenu(hlp)                              
                
        



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to