[gnue] r9626 - in trunk/gnue-forms: packaging/osx src/uidrivers/wx26/widgets

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: johannes
Date: 2007-05-25 01:53:50 -0500 (Fri, 25 May 2007)
New Revision: 9626

Modified:
   trunk/gnue-forms/packaging/osx/setup.py
   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:
Added comments for the latest changes on os x menuhandling


Modified: trunk/gnue-forms/packaging/osx/setup.py
===================================================================
--- trunk/gnue-forms/packaging/osx/setup.py	2007-05-24 21:22:29 UTC (rev 9625)
+++ trunk/gnue-forms/packaging/osx/setup.py	2007-05-25 06:53:50 UTC (rev 9626)
@@ -24,10 +24,10 @@
           CFBundleExecutable = app_name,
           CFBundleIdentifier = "com.gnuenterprise.forms",
           CFBundleDocumentTypes = [dict(
-              CFBundleTypeExtensions = "gfd",
-              CFBundleTypeName = "public.xml",
-              CFBundleTypeRole = "Viewer",
-              )],
+              CFBundleTypeExtensions = ["gfd"],
+              CFBundleTypeName = "GNU Enterprise Form Definition",
+              CFBundleTypeRole = "Viewer"),
+              ],
           ),
         ),
       ),

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py	2007-05-24 21:22:29 UTC (rev 9625)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py	2007-05-25 06:53:50 UTC (rev 9626)
@@ -203,6 +203,9 @@
 
     def __update_sizer (self):
 
+        # If a menubar has been created, it will be set for the main window.
+        # This 'deferred' method is needed so OS X can rearrange some
+        # items according to it's HIG.
         if self._menubar_ is not None:
             self.main_window.SetMenuBar(self._menubar_)
             self._menubar_ = None

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py	2007-05-24 21:22:29 UTC (rev 9625)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menu.py	2007-05-25 06:53:50 UTC (rev 9626)
@@ -48,11 +48,21 @@
                 and not self._form._features['GUI:MENUBAR:SUPPRESS']:
             # Menu bar of the form
             widget = wx.MenuBar()
+
+            # We do not set the menubar using main_window.SetMenuBar() here,
+            # because on OS X some menu items will get rearranged (like Quit,
+            # About, Help-menu ...).  This rearrangement won't work if the
+            # menubar is set before the items are created.
             if isinstance(self._uiForm.main_window, wx.Frame):
                 self._uiForm._menubar_ = widget
         else:
             # Submenu or popup menu
             widget = wx.Menu()
+
+            # On OS X the 'Help' and 'Window' menus will be added automatically
+            # to the menubar.  To avoid having two 'Help' menus we have to name
+            # the help-menu '&Help'.  This will be translated to the current
+            # language automatically then.
             if self._gfObject.name == '__help__' and 'wxMac' in wx.PlatformInfo:
                 lb = '&Help'
             else:

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py	2007-05-24 21:22:29 UTC (rev 9625)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/menuitem.py	2007-05-25 06:53:50 UTC (rev 9626)
@@ -62,6 +62,10 @@
             else:
                 text = label
 
+            # On OS X the menu items with the special IDs wx.ID_ABOUT,
+            # wx.ID_EXIT and wx.ID_PREFERENCES will get rearranged into the
+            # Application menu (according to Apples HIG).  On all other
+            # platforms it does nothing special with these menu items.
             if self._gfObject.name == '__show_about__':
                 mid = wx.ID_ABOUT
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.