[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9276 - in trunk/gnue-forms/src: . uidrivers/html
From: |
reinhard |
Subject: |
[gnue] r9276 - in trunk/gnue-forms/src: . uidrivers/html |
Date: |
Fri, 12 Jan 2007 05:04:59 -0600 (CST) |
Author: reinhard
Date: 2007-01-12 05:04:58 -0600 (Fri, 12 Jan 2007)
New Revision: 9276
Modified:
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFInstance.py
trunk/gnue-forms/src/uidrivers/html/GFServer.py
Log:
Moved handling of subforms from GFInstance to GFForm.
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2007-01-12 11:01:10 UTC (rev 9275)
+++ trunk/gnue-forms/src/GFForm.py 2007-01-12 11:04:58 UTC (rev 9276)
@@ -76,7 +76,7 @@
# Constructor
# -------------------------------------------------------------------------
- def __init__(self, parent=None, instance=None):
+ def __init__(self, parent=None):
GRootObj.__init__(self, 'form', GFParser.getXMLelements, GFParser)
GFObj.__init__(self, parent, 'GFForm')
@@ -92,6 +92,9 @@
# Dictionary to locate actions
self._actions = {}
+ # Dictionary with all the subforms
+ self.__subforms = {}
+
# Dictionary to locate parameters
self.__parameter_dict = {}
@@ -107,7 +110,7 @@
# focusin/focusout triggers doesn't run endEditing and beginEditing
self.__editing_blocked = False
- self._instance = instance
+ self._instance = None
# Hackery until proper layout support is added
self._standardnamespaces = {'Char': 'GNUe:Forms:Char'}
@@ -256,6 +259,13 @@
if child._type == 'GFParameter':
self.__parameter_dict[child.name] = child
+ # Extract the child <dialog>s from the main form tree
+ for child in self._children[:]:
+ if isinstance(child, GFForm):
+ child.setParent(None)
+ self.__subforms[child.name] = child
+ self._children.remove(child)
+
return GFObj._buildObject(self)
@@ -263,7 +273,7 @@
# Merge default form into this form
# -------------------------------------------------------------------------
- def merge_defaults(self, default_form):
+ def initialize(self, default_form):
# 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
@@ -271,7 +281,14 @@
if self.findChildNamed('__main__', 'GFMenu'):
self.merge(default_form)
+ self.phaseInit()
+ for subform in self.__subforms.itervalues():
+ subform._instance = self._instance
+ subform._connections = self._connections
+ subform.initialize(default_form)
+
+
# -------------------------------------------------------------------------
# Phase 1 initialization
# -------------------------------------------------------------------------
@@ -586,7 +603,7 @@
@param modal: whether the dialog should be modal or not
@return: None
"""
- form = self._instance._formsDictionary[dialogName]
+ form = self.__subforms[dialogName]
if parameters is not None:
form.set_parameters(parameters)
form.execute_open(modal)
@@ -1831,12 +1848,17 @@
# -------------------------------------------------------------------------
- # Is this form visible?
+ # Is this form or any subform visible?
# -------------------------------------------------------------------------
def is_visible(self):
- return self.__visible
+ if self.__visible:
+ return True
+ for subform in self.__subforms.itervalues():
+ if subform.is_visible():
+ return True
+ return False
# -------------------------------------------------------------------------
Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py 2007-01-12 11:01:10 UTC (rev 9275)
+++ trunk/gnue-forms/src/GFInstance.py 2007-01-12 11:04:58 UTC (rev 9276)
@@ -142,9 +142,10 @@
# The parameters passed to the GBaseApp instance
self.__parameters = parameters
- # A dictionary containing all the forms loaded from a file
- self._formsDictionary = {}
+ self._main_form = None # Last loaded form
+ self.__loaded_forms = [] # All loaded forms
+
self._parentContainer = parentContainer
# Load user customized key mappings
@@ -241,21 +242,10 @@
# initialization because <dialog>s are really <form>s and they don't
# like being children of another form
form = loadFile(fileHandle, self, initialize=0, url=url)
+ self.__loaded_forms.append(form)
+ self._main_form = form
- # Extract the child <dialog>s from the main form tree
- for child in form._children[:]:
- 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
-
-
# -------------------------------------------------------------------------
# Initialize the UI and activate the main form
# -------------------------------------------------------------------------
@@ -264,7 +254,7 @@
assert gEnter(4)
- main_form = self._formsDictionary['__main__']
+ main_form = self._main_form
# Initialize all the forms loaded into memory
assert gDebug(4, "Initializing form objects")
@@ -274,8 +264,7 @@
if self.__parameters is not None:
main_form.set_parameters(self.__parameters)
- for formObject in self._formsDictionary.values():
- formObject.phaseInit()
+ main_form.initialize(self.__default_form)
# Bring up the main form
if main_form.style == 'dialog':
@@ -330,7 +319,7 @@
"""
any_form_open = False
- for form in self._formsDictionary.values():
+ for form in self.__loaded_forms:
if form.is_visible():
any_form_open = True
break
Modified: trunk/gnue-forms/src/uidrivers/html/GFServer.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/html/GFServer.py 2007-01-12 11:01:10 UTC
(rev 9275)
+++ trunk/gnue-forms/src/uidrivers/html/GFServer.py 2007-01-12 11:04:58 UTC
(rev 9276)
@@ -145,7 +145,7 @@
# id = int(args["id"])
event = args["event"]
e = events.Event(event, \
- _form=self.instances[uuid]._formsDictionary['__main__'])
+ _form=self.instances[uuid]._main_form)
self.instances[uuid].dispatchEvent(e)
updates = self.instances[uuid]._uiinstance._UIform.get_updates()
# updates.append(["alert","","Menuitem clicked"])
@@ -155,7 +155,7 @@
gfObject = self.instances[uuid]._uiinstance._WidgetToGFObj [id]
e = events.Event('requestREPLACEVALUE', text = text, \
- _form=self.instances[uuid]._formsDictionary['__main__'])
+ _form=self.instances[uuid]._main_form)
self.instances[uuid].dispatchEvent(e)
updates = self.instances[uuid]._uiinstance._UIform.get_updates()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9276 - in trunk/gnue-forms/src: . uidrivers/html,
reinhard <=