Author: johannes
Date: 2007-05-24 09:41:07 -0500 (Thu, 24 May 2007)
New Revision: 9616
Modified:
trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py
Log:
Do not create two Help menus, and move the About and Exit menu items to the
proper places accoding to Apples HIG (on OS X only of course)
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2007-05-24 13:25:08 UTC (rev 9615)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2007-05-24 14:41:07 UTC (rev 9616)
@@ -135,6 +135,7 @@
self.main_window.SetTitle(self._form.title)
self.main_window.SetIcons(self.__load_icons())
+ self._menubar_ = None
if not self.__embedded:
self.main_window.Bind(wx.EVT_CLOSE, self.__on_close,
self.main_window)
@@ -202,6 +203,10 @@
def __update_sizer (self):
+ if self._menubar_ is not None:
+ self.main_window.SetMenuBar(self._menubar_)
+ self._menubar_ = None
+
if not isinstance(self.main_window, wx.Dialog) and \
self.main_window.GetToolBar():
self.main_window.GetToolBar().Realize()
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py 2007-05-24 13:25:08 UTC (rev 9615)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py 2007-05-24 14:41:07 UTC (rev 9616)
@@ -49,15 +49,20 @@
# Menu bar of the form
widget = wx.MenuBar()
if isinstance(self._uiForm.main_window, wx.Frame):
- self._uiForm.main_window.SetMenuBar(widget)
+ self._uiForm._menubar_ = widget
else:
# Submenu or popup menu
widget = wx.Menu()
+ if self._gfObject.name == '__help__' and 'wxMac' in wx.PlatformInfo:
+ lb = '&Help'
+ else:
+ lb = self._gfObject.label
+
if isinstance(event.container, wx.Menu):
- event.container.AppendMenu(wx.ID_ANY, self._gfObject.label,
- widget)
+ event.container.AppendMenu(wx.ID_ANY, lb, widget)
+
elif isinstance(event.container, wx.MenuBar):
- event.container.Append(widget, self._gfObject.label)
+ event.container.Append(widget, lb)
self._container = widget
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py 2007-05-24 13:25:08 UTC (rev 9615)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py 2007-05-24 14:41:07 UTC (rev 9616)
@@ -61,7 +61,16 @@
text = label + u"\t" + hotkey
else:
text = label
- widget = wx.MenuItem(event.container, wx.ID_ANY, text,
+
+ if self._gfObject.name == '__show_about__':
+ mid = wx.ID_ABOUT
+
+ elif self._gfObject.name == '__close__':
+ mid = wx.ID_EXIT
+ else:
+ mid = wx.ID_ANY
+
+ widget = wx.MenuItem(event.container, mid, text,
description or u"", kind)
if icon_file and not check:
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.