commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9264 - trunk/gnue-forms/src


From: reinhard
Subject: [gnue] r9264 - trunk/gnue-forms/src
Date: Thu, 11 Jan 2007 15:31:52 -0600 (CST)

Author: reinhard
Date: 2007-01-11 15:31:52 -0600 (Thu, 11 Jan 2007)
New Revision: 9264

Modified:
   trunk/gnue-forms/src/GFForm.py
   trunk/gnue-forms/src/GFInstance.py
Log:
Moved merging of default menu and toolbar from GFInstance to GFForm.


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2007-01-11 20:38:23 UTC (rev 9263)
+++ trunk/gnue-forms/src/GFForm.py      2007-01-11 21:31:52 UTC (rev 9264)
@@ -258,7 +258,35 @@
 
         return GFObj._buildObject(self)
 
+
     # -------------------------------------------------------------------------
+    # Merge default menu and toolbar into the form
+    # -------------------------------------------------------------------------
+
+    def merge_defaults(self, default_form):
+
+        main_menu = self.findChildNamed('__main__', 'GFMenu')
+        # FIXME: for now, only merge standard menu if there is a menu defined
+        # in the form. Do all of this unconditionally after menu handling is
+        # finished.
+        if main_menu:
+            menu = default_form.findChildNamed('__main__', 'GFMenu')
+            menu.merge(main_menu)
+            main_menu.assign(menu, True)
+            main_menu.name = '__main__'
+
+            # Make sure that the Help menu ist the last one. If there is a
+            # better way to do this, please let me know. -- Reinhard
+            help_menu = main_menu.findChildNamed('__help__')
+            main_menu._children.remove(help_menu)
+            main_menu._children.append(help_menu)
+
+            # Merge all actions into the main form
+            for action in default_form.findChildrenOfType('GCAction'):
+                self._actions[action.name] = action
+
+
+    # -------------------------------------------------------------------------
     # Phase 1 initialization
     # -------------------------------------------------------------------------
 

Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2007-01-11 20:38:23 UTC (rev 9263)
+++ trunk/gnue-forms/src/GFInstance.py  2007-01-11 21:31:52 UTC (rev 9264)
@@ -165,6 +165,13 @@
                     parentContainer=self._parentContainer,
                     moduleName=moduleName)
 
+        assert gDebug(4, "Loading default menu and toolbar")
+        filename = os.path.join(paths.config, 'default.gfd')
+        filehandle = FileUtils.openResource(filename)
+        self.__default_form = loadFile(filehandle, self, initialize=0,
+                url=filename)
+        filehandle.close()
+
         assert gLeave(4)
 
 
@@ -239,8 +246,11 @@
             if isinstance(child, GFForm.GFForm):
                 child.setParent(None)
                 self._formsDictionary[child.name] = child
+                child.merge_defaults(self.__default_form)
                 form._children.remove(child)
 
+        form.merge_defaults(self.__default_form)
+
         # Add the main form into the dictionary
         self._formsDictionary[form.name] = form
 
@@ -255,35 +265,6 @@
 
         main_form = self._formsDictionary['__main__']
 
-        # Load standard menu and merge it into main form
-        assert gDebug(4, "Loading standard menu and toolbar")
-
-        main_menu = main_form.findChildNamed('__main__', 'GFMenu')
-        # FIXME: for now, only merge standard menu if there is a menu defined
-        # in the form. Do all of this unconditionally after menu handling is
-        # finished.
-        if main_menu:
-            filename = os.path.join(paths.config, 'default.gfd')
-            filehandle = FileUtils.openResource(filename)
-            default_form = loadFile(filehandle, self, initialize=0,
-                    url=filename)
-            filehandle.close()
-
-            menu = default_form.findChildNamed('__main__', 'GFMenu')
-            menu.merge(main_menu)
-            main_menu.assign(menu, True)
-            main_menu.name = '__main__'
-
-            # Make sure that the Help menu ist the last one. If there is a
-            # better way to do this, please let me know. -- Reinhard
-            help_menu = main_menu.findChildNamed('__help__')
-            main_menu._children.remove(help_menu)
-            main_menu._children.append(help_menu)
-
-            # Merge all actions into the main form
-            for action in default_form.findChildrenOfType('GCAction'):
-                main_form._actions[action.name] = action
-
         # Initialize all the forms loaded into memory
         assert gDebug(4, "Initializing form objects")
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]