commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms/src GFForm.py GFInstance.py


From: James Thompson
Subject: gnue/forms/src GFForm.py GFInstance.py
Date: Tue, 03 Dec 2002 10:51:15 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/12/03 10:51:15

Modified files:
        forms/src      : GFForm.py GFInstance.py 

Log message:
        syncing cvs to prep for ai processing

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.215&tr2=1.216&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.71&tr2=1.72&r1=text&r2=text

Patches:
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.215 gnue/forms/src/GFForm.py:1.216
*** gnue/forms/src/GFForm.py:1.215      Sun Dec  1 17:53:04 2002
--- gnue/forms/src/GFForm.py    Tue Dec  3 10:51:15 2002
***************
*** 87,93 ****
  
  
      # The "None" init gives datasources time to setup master/detail
!     self._inits = [self.primaryInit, None, self.secondaryInit, 
self.reapDialogs]
  
      #
      # New trigger support
--- 87,93 ----
  
  
      # The "None" init gives datasources time to setup master/detail
!     self._inits = [self.primaryInit, None, self.secondaryInit]
  
      #
      # New trigger support
***************
*** 198,203 ****
--- 198,204 ----
    #
    def primaryInit(self):
      # Initialize our events system
+     print "Init ", self
      events.EventAware.__init__(self, self._instance.eventController)
  
      # Find the logic and layout controllers
***************
*** 223,244 ****
      # Set initial focus
      self.findAndChangeFocus(self)
      self.processTrigger('On-Startup')
! 
! 
!   #
!   # removes the dialog forms from the main tree before
!   # any UI stuff is constructed
!   #
!   def reapDialogs(self):
!     #print self.showTree()
!     for child in self._children:
!       if isinstance(child, GFForm):
!         # TODO : Might init them at this stage
!         self._parent = None
!         self._dialogDictionary[child.name] = child
!         self._children.remove(child)
!     print "GFForm dialogs"
!     print self._dialogDictionary
    #
    # Get a user parameter. If parameter not specified, pull default value
    #
--- 224,230 ----
      # Set initial focus
      self.findAndChangeFocus(self)
      self.processTrigger('On-Startup')
!     
    #
    # Get a user parameter. If parameter not specified, pull default value
    #
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.71 gnue/forms/src/GFInstance.py:1.72
*** gnue/forms/src/GFInstance.py:1.71   Thu Nov 28 01:07:59 2002
--- gnue/forms/src/GFInstance.py        Tue Dec  3 10:51:15 2002
***************
*** 125,130 ****
--- 125,133 ----
      self._disableSplash = disableSplash  # Disable splashscreen
      self._parameters = parameters        # The parameters passed to the
                                           # GBaseApp instance
+     self._dialogDictionary = {}          # A dictionary containing all the
+                                          # dialog forms that were originally
+                                          # in the loaded form
  
      #
      # Load user customized key mappings
***************
*** 138,144 ****
          
      GFKeyMapper.KeyMapper.loadUserKeyMap(mapping)
  
- 
    #
    # addFormFromFile
    #
--- 141,146 ----
***************
*** 148,161 ****
    # the base app
    #
    def addFormFromFile(self,fileName):
      try:
        fileHandle=openResource(fileName)
!       self._form = loadFile (fileHandle, self)
        fileHandle.close()
-       print self.manager
      except IOError, mesg:
        self.manager.handleStartupError(_("Unable to open file\n\n     
%s")%mesg)
  
    #
    #  Activate the instance
    #
--- 150,209 ----
    # the base app
    #
    def addFormFromFile(self,fileName):
+     #
+     # Load the file bypassing the initialization
+     # We bypass the initialization because <dialog>s are
+     # really <form>s and they don't like being children
+     # of another form
+     #
      try:
        fileHandle=openResource(fileName)
!       self._form = loadFile (fileHandle, self, initialize=0)
        fileHandle.close()
      except IOError, mesg:
        self.manager.handleStartupError(_("Unable to open file\n\n     
%s")%mesg)
  
+ 
+     #
+     # Extract the child <dialog>s from the main form tree
+     #
+     self.reapDialogs(self._form)
+ 
+     #
+     # Initialize the main form then the dialogs
+     #
+     self._form.phaseInit(self.countInits(self._form))
+     print 'main', self._form._currentEntry
+     
+     for dialog in self._dialogDictionary.keys():
+       
self._dialogDictionary[dialog].phaseInit(self.countInits(self._dialogDictionary[dialog]))
+       print "Inited to ", self._dialogDictionary[dialog]._currentEntry
+       
+   #
+   # countInits functions
+   #
+   # Since we are bypassing the GParser call to phaseInit we
+   # need to figure out how many passes phaseInit must make
+   #
+   def countInits(self,form):
+     self.initCount = 0
+     form.walk(self._countInitsWalker)
+     return self.initCount
+   def _countInitsWalker(self, object):
+     if hasattr(object,'_inits'):
+       self.initCount = max(self.initCount,len(object._inits))
+       
+   #
+   # removes the dialog forms from the main tree before
+   # any UI stuff is constructed
+   #
+   def reapDialogs(self,formTree):
+     for child in formTree._children:
+       if isinstance(child, GFForm):
+         child._parent = None
+         self._dialogDictionary[child.name] = child
+         formTree._children.remove(child)
+                                                               
    #
    #  Activate the instance
    #




reply via email to

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