dabo Commit
Revision 6145
Date: 2010-10-24 07:51:16 -0700 (Sun, 24 Oct 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6145
Changed:
U trunk/dabo/ui/uiwx/dBaseMenuBar.py
Log:
Added references for all the included menus and menuitems to the menu bar. This
will allow you to reference them in your code instead of having to constantly
locate them. So instead of having to type the following to get a reference to
the Undo menu item:
mb = self.MenuBar
em = mb.getMenu("Edit")
undoItem = em.getItem("Undo")
undoItem.Enabled = False
you can reference it directly:
self.MenuBar.undoMenuItem.Enabled = False
Diff:
Modified: trunk/dabo/ui/uiwx/dBaseMenuBar.py
===================================================================
--- trunk/dabo/ui/uiwx/dBaseMenuBar.py 2010-10-24 14:43:09 UTC (rev 6144)
+++ trunk/dabo/ui/uiwx/dBaseMenuBar.py 2010-10-24 14:51:16 UTC (rev 6145)
@@ -33,28 +33,31 @@
self.Caption = _("&File")
if self.Application.ShowCommandWindowMenu:
- self.commandWinMenuItem = self.append(_("Command
Win&dow"), HotKey="Ctrl+D",
+ self.Parent.commandWinMenuItem = self.append(_("Command
Win&dow"), HotKey="Ctrl+D",
OnHit=app.onCmdWin,
bmp="%s/apps/utilities-terminal.png" % iconPath,
ItemID="file_commandwin",
- help=_("Open up a command window for
debugging") )
+ help=_("Open up a command window for
debugging"))
- self.debugMenuItem = self.append(_("De&bug Output
Window"), HotKey="Ctrl+B",
- OnHit=app.onDebugWin,
bmp="%s/apps/utilities-terminal.png" % iconPath,
- ItemID="file_debugwin",
- menutype="check", help=_("Open up a
debug output window") )
-
+ self.Parent.debugMenuItem = self.append(_("De&bug
Output Window"), menutype="check",
+ bmp="%s/apps/utilities-terminal.png" %
iconPath, HotKey="Ctrl+B",
+ OnHit=app.onDebugWin,
ItemID="file_debugwin",
+ help=_("Open up a debug output window"))
+ self.Parent.debugMenuItem.Checked = True
+ dabo.ui.setAfterInterval(100,
self.Parent.debugMenuItem, "Checked", True)
+ dabo.ui.setAfterInterval(500,
self.Parent.debugMenuItem, "Checked", False)
+
prmpt = _("Close Windo&w")
- self.append(prmpt, HotKey="Ctrl+W", OnHit=app.onWinClose,
+ self.Parent.closeWindowMenuItem = self.append(prmpt,
HotKey="Ctrl+W", OnHit=app.onWinClose,
ItemID="file_close",
- help=_("Close the current window") )
+ help=_("Close the current window"))
self.appendSeparator()
prmpt = _("&Quit")
- self.append(prmpt, HotKey="Ctrl+Q", id=wx.ID_EXIT,
OnHit=app.onFileExit,
+ self.Parent.quitMenuItem = self.append(prmpt, HotKey="Ctrl+Q",
id=wx.ID_EXIT, OnHit=app.onFileExit,
bmp="%s/actions/system-log-out.png" % iconPath,
ItemID="file_quit",
- help=_("Exit the application") )
+ help=_("Exit the application"))
@@ -64,57 +67,54 @@
app = self.Application
self.Caption = _("&Edit")
- self.append(_("&Undo"), HotKey="Ctrl+Z", OnHit=app.onEditUndo,
+ self.Parent.undoMenuItem = self.append(_("&Undo"),
HotKey="Ctrl+Z", OnHit=app.onEditUndo,
bmp="%s/actions/edit-undo.png" % iconPath,
ItemID="edit_undo",
- help=_("Undo last action") )
+ help=_("Undo last action"))
- self.append(_("&Redo"), HotKey="Ctrl+R", OnHit=app.onEditRedo,
+ self.Parent.redoMenuItem = self.append(_("&Redo"),
HotKey="Ctrl+R", OnHit=app.onEditRedo,
bmp="%s/actions/edit-redo.png" % iconPath,
ItemID="edit_redo",
- help=_("Undo last undo") )
+ help=_("Undo last undo"))
self.appendSeparator()
- self.append(_("Cu&t"), HotKey="Ctrl+X", OnHit=app.onEditCut,
+ self.Parent.cutMenuItem = self.append(_("Cu&t"),
HotKey="Ctrl+X", OnHit=app.onEditCut,
bmp="%s/actions/edit-cut.png" % iconPath,
ItemID="edit_cut",
- help=_("Cut selected text") )
+ help=_("Cut selected text"))
- self.append(_("&Copy"), HotKey="Ctrl+C", OnHit=app.onEditCopy,
+ self.Parent.copyMenuItem = self.append(_("&Copy"),
HotKey="Ctrl+C", OnHit=app.onEditCopy,
bmp="%s/actions/edit-copy.png" % iconPath,
ItemID="edit_copy",
- help=_("Copy selected text") )
+ help=_("Copy selected text"))
- self.append(_("&Paste"), HotKey="Ctrl+V", OnHit=app.onEditPaste,
+ self.Parent.pasteMenuItem = self.append(_("&Paste"),
HotKey="Ctrl+V", OnHit=app.onEditPaste,
bmp="%s/actions/edit-paste.png" % iconPath,
ItemID="edit_paste",
- help=_("Paste text from clipboard") )
+ help=_("Paste text from clipboard"))
- self.append(_("Select &All"), HotKey="Ctrl+A",
OnHit=app.onEditSelectAll,
+ self.Parent.selectAllMenuItem = self.append(_("Select &All"),
HotKey="Ctrl+A", OnHit=app.onEditSelectAll,
bmp="%s/actions/edit-select-all.png" % iconPath,
ItemID="edit_selectall",
- help=_("Select all text") )
+ help=_("Select all text"))
self.appendSeparator()
# By default, the Find and Replace functions use a single
dialog. The
# commented lines below this enable the plain Find dialog call.
- self.append(_("&Find / Replace"), HotKey="Ctrl+F",
OnHit=app.onEditFind,
+ self.Parent.findReplaceMenuItem = self.append(_("&Find /
Replace"), HotKey="Ctrl+F", OnHit=app.onEditFind,
bmp="%s/actions/edit-find-replace.png" %
iconPath,
ItemID="edit_findreplace",
- help=_("Find or Replace text in the active
window") )
+ help=_("Find or Replace text in the active
window"))
-# self.append(_("Find"), HotKey="Shift+Ctrl+F",
OnHit=app.onEditFindAlone,
-# bmp="%s/actions/edit-find.png" % iconPath,
help=_("Find text in the active window") )
-
- self.append(_("Find A&gain"), HotKey="Ctrl+G",
OnHit=app.onEditFindAgain, bmp="",
+ self.Parent.findAgainMenuItem = self.append(_("Find A&gain"),
HotKey="Ctrl+G", OnHit=app.onEditFindAgain, bmp="",
ItemID="edit_findagain",
- help=_("Repeat the last search") )
+ help=_("Repeat the last search"))
self.appendSeparator()
- itm = self.append(_("Pr&eferences"),
OnHit=app.onEditPreferences,
+ self.Parent.preferencesMenuItem =
self.append(_("Pr&eferences"), OnHit=app.onEditPreferences,
bmp="%s/categories/preferences-system.png" %
iconPath,
ItemID="edit_preferences",
help=_("Set user preferences"), special="pref" )
@@ -127,16 +127,16 @@
app = self.Application
self.Caption = _("&View")
- self.append(_("Increase Font Size"), HotKey="Ctrl++",
+ self.Parent.increaseFontSizeMenuItem = self.append(_("Increase
Font Size"), HotKey="Ctrl++",
ItemID="view_zoomin", OnHit=app.fontZoomIn)
- self.append(_("Decrease Font Size"), HotKey="Ctrl+-",
+ self.Parent.decreaseFontSizeMenuItem = self.append(_("Decrease
Font Size"), HotKey="Ctrl+-",
ItemID="view_zoomout", OnHit=app.fontZoomOut)
- self.append(_("Normal Font Size"), HotKey="Ctrl+/",
+ self.Parent.normalFontSizeMenuItem = self.append(_("Normal Font
Size"), HotKey="Ctrl+/",
ItemID="view_zoomnormal",
OnHit=app.fontZoomNormal)
if app.ShowSizerLinesMenu:
self.appendSeparator()
- self.append(_("Show/Hide Sizer &Lines"),
HotKey="Ctrl+L",
+ self.Parent.sizerLinesMenuItem =
self.append(_("Show/Hide Sizer &Lines"), HotKey="Ctrl+L",
OnHit=app.onShowSizerLines,
menutype="check",
ItemID="view_showsizerlines",
help=_("Cool sizer visualizing feature;
check it out!"))
@@ -153,10 +153,10 @@
if appName:
caption += " %s" % appName
- itm = self.append(caption, id=wx.ID_ABOUT,
+ self.Parent.aboutMenuItem = self.append(caption, id=wx.ID_ABOUT,
OnHit=app.onHelpAbout,
ItemID="help_about",
- help=_("About this application") )
+ help=_("About this application"))
class dBaseMenuBar(dMenuBar):
@@ -173,10 +173,10 @@
"""
def _afterInit(self):
super(dBaseMenuBar, self)._afterInit()
- self.appendMenu(FileMenu(self, MenuID="base_file"))
- self.appendMenu(EditMenu(self, MenuID="base_edit"))
- self.appendMenu(ViewMenu(self, MenuID="base_view"))
- self.appendMenu(HelpMenu(self, MenuID="base_help"))
+ self.fileMenu = self.appendMenu(FileMenu(self,
MenuID="base_file"))
+ self.editMenu = self.appendMenu(EditMenu(self,
MenuID="base_edit"))
+ self.viewMenu = self.appendMenu(ViewMenu(self,
MenuID="base_view"))
+ self.helpMenu = self.appendMenu(HelpMenu(self,
MenuID="base_help"))
# Trying to expose menu atts as menubar atts. Not sure if this is a good idea
yet...
_______________________________________________
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]