commit-gnue
[Top][All Lists]
Advanced

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

r6676 - trunk/gnue-forms/src


From: kilo
Subject: r6676 - trunk/gnue-forms/src
Date: Fri, 12 Nov 2004 16:37:30 -0600 (CST)

Author: kilo
Date: 2004-11-12 16:37:29 -0600 (Fri, 12 Nov 2004)
New Revision: 6676

Modified:
   trunk/gnue-forms/src/GFForm.py
Log:
Added comments.

Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2004-11-12 14:56:40 UTC (rev 6675)
+++ trunk/gnue-forms/src/GFForm.py      2004-11-12 22:37:29 UTC (rev 6676)
@@ -18,16 +18,13 @@
 #
 # Copyright 2000-2004 Free Software Foundation
 #
-# FILE:
-# GFForm.py
+# DESCRIPTION:
+# Class that contains the internal python object representation of a GNUe Form
+# built from GFObjects
 #
-# DESCRIPTION:
-"""
-Class that contains the internal python object representation of a GNUe Form
-built from GFObjects
-"""
 # NOTES:
 #
+# $Id$
 
 import sys
 import string
@@ -44,16 +41,25 @@
 from gnue.forms import GFParser
 
 
+#-----------------------------------------------------------------------------
 # Defines which objects are "Tab Stops"
+#-----------------------------------------------------------------------------
 TabStops = ('GFEntry','GFButton')
 
-#
+
+#-----------------------------------------------------------------------------
 # GFForm
-#
-# instance is passed into the initializer so that
-# designer can pass that in
-#
+#-----------------------------------------------------------------------------
 class GFForm(GRootObj, GFObj, events.EventAware):
+  """
+  Contains the internal python object representation of a GNUe Form
+  built from GFObjects
+  """
+
+  #---------------------------------------------------------------------------
+  # instance is passed into the initializer so that
+  # designer can pass that in
+  #---------------------------------------------------------------------------
   def __init__(self, parent=None, instance=None):
   # TODO: with a little tweaking we can now stop passing  
GFParser.getXMLelements
     GRootObj.__init__(self, 'form', GFParser.getXMLelements, GFParser)
@@ -84,7 +90,6 @@
     # Hackery until proper layout support is added
     self._standardnamespaces = {'Char': 'GNUe:Forms:Char'}
 
-
     # The "None" init gives datasources time to setup master/detail
     self._inits = [self.primaryInit, None, self.secondaryInit]
 
@@ -131,9 +136,9 @@
                               
'showMessage':{'function':self.triggerShowMessageBox,
                                              'global': True,
                                              },
-                              'messageBox': {
-                                   'function': self.triggerMessageBox,
-                                   'global': True},
+                              'messageBox': {'function':self.triggerMessageBox,
+                                             'global': True
+                                             },
                               'commit':{'function':self.commit,
                                         'global': True,
                                         },
@@ -173,12 +178,13 @@
 
     self._in_trigger_lock = False
 
-  #
-  # primaryInit
-  #
+  #---------------------------------------------------------------------------
   # Called during phaseInit startup by GParser.
-  #
+  #---------------------------------------------------------------------------
   def primaryInit(self):
+    """
+    Called automatically during phaseInit() startup of GParser.
+    """
     # Initialize our events system
     events.EventAware.__init__(self, self._instance.eventController)
 
@@ -198,11 +204,14 @@
     ## TODO
 
 
-  #
-  # Secondary init (stuff that must happen
-  # after all our children have init'ed)
-  #
+  #---------------------------------------------------------------------------
+  # Secondary init-stuff that must happen after all our children have init'ed
+  #---------------------------------------------------------------------------
   def secondaryInit(self):
+    """
+    Called automatically during phaseInit().
+    It must happen after all children have init'ed.
+    """
     # create the first records
     for key in self._datasourceDictionary.keys():
       if not self._datasourceDictionary[key].hasMaster():
@@ -212,10 +221,16 @@
     self.findAndChangeFocus(self)
     self.processTrigger('On-Startup')
 
-  #
+
+  #---------------------------------------------------------------------------
   # Get a user parameter. If parameter not specified, pull default value
-  #
+  #---------------------------------------------------------------------------
   def getParameter(self, parameter):
+    """
+    Gets a user parameter. If parameter is not specified, pulls default value.
+    @param parameter: case-insensitive name of parameter
+    @return: parameter value or None
+    """
     param = string.lower(parameter)
     try:
       return self._parameters[param]
@@ -228,32 +243,35 @@
           break
     return rv
 
-  ###################################################################
-  #
+
+  #===========================================================================
   # Focus functions
-  #
-  #
+  #===========================================================================
 
-  #
-  # findAndChangeFocus
-  #
-  # Runs findFocus and then runs
-  # changeFocus with that value.
-  #
+  #---------------------------------------------------------------------------
+  # Runs findFocus and then runs changeFocus with that value.
+  #---------------------------------------------------------------------------
   def findAndChangeFocus(self, object):
+    """
+    Find focus and change it to new entry.
+    @param: object
+    @return: None
+    """
     entry = self.findFocus(object)
     if entry:
       self.changeFocus(entry)
 
-  #
-  # Find focus
-  #
-  # Find the next focusable item given
-  # an item of type Page, Block, or Entry
-  #
+
+  #---------------------------------------------------------------------------
+  # Find the next focusable item given an item of type Page, Block, or Entry
   # Only called by findAndChangeFocus
-  #
+  #---------------------------------------------------------------------------
   def findFocus(self, object):
+    """
+    Finds the next focusable item of a page, a block or an entry.
+    @param: object (page, block or entry) to find next focus for.
+    @return: None or entry with next focus
+    """
 
     if object._type == 'GFField':
       gDebug (0, "GFField was passed to 'findFocus'.")
@@ -287,12 +305,14 @@
 
     return entry
 
-  #
-  #
-  #
+
+  #---------------------------------------------------------------------------
+  # Returns the editing mode of the current record
+  #---------------------------------------------------------------------------
   def getCurrentMode(self):
     """
     Returns the editing mode of the current record
+    @return: 'query', 'new' or 'edit'
     """
     if self._currentBlock:
       if self._currentBlock.mode == 'query':
@@ -304,13 +324,15 @@
     else:
       return 'new'
 
-  #
-  # changeFocus
-  #
-  # changes to the requested entry object requested by
-  # an event source
-  #
-  def changeFocus(self, widget, fireFocusTriggers=1):
+  #---------------------------------------------------------------------------
+  # Changes to the requested entry object requested by an event source
+  #---------------------------------------------------------------------------
+  def changeFocus(self, widget, fireFocusTriggers=True):
+    """
+    Changes focus to the requested entry object.
+    @param widget: entry to put focus on
+    @param fireFocusTriggers: whether to fire focus-change trigger?
+    """
 
     message = None
 
@@ -422,26 +444,43 @@
     return message
 
 
-  #
-  #
+  #===========================================================================
   # Events
   #
-  #
-
-  #
   # Incoming Event handlers
-  #
+  #===========================================================================
 
+  #---------------------------------------------------------------------------
+  # Create a new, empty record.
+  #---------------------------------------------------------------------------
   def newRecord(self):
+    """
+    Creates a new, empty record.
+    """
     if not self.readonly:
       self._currentBlock.newRecord()
 
+
+  #---------------------------------------------------------------------------
+  # Delete the actual record.
+  #---------------------------------------------------------------------------
   def deleteRecord(self):
+    """
+    Deletes the actual record.
+    """
     if not self.readonly:
       self._currentBlock.deleteRecord()
       self.refreshUIEvents()
 
+
+  #---------------------------------------------------------------------------
+  # Check all blocks in the form whether they are saved (committed) or not.
+  #---------------------------------------------------------------------------
   def isSaved(self):
+    """
+    Checks all block in the form whether they are saved (committed) or not.
+    @return: boolean, True if all the blocks are committed.
+    """
     if (self._currentEntry._type != 'GFButton' and \
         self._currentEntry._displayHandler.isPending()):
       return False
@@ -452,7 +491,15 @@
 
     return True
 
+
+  #---------------------------------------------------------------------------
+  # Enter the form into Query mode
+  #---------------------------------------------------------------------------
   def initQuery(self):
+    """
+    Enters the form into Query mode.
+    @return: None if all went well, error message in case of error.
+    """
     message = None
     if self._currentBlock.mode != 'query':
 
@@ -469,7 +516,7 @@
     for block in self._logic._blockList:
       block.processRollback()
       for entry in block._entryList:
-        if hasattr(entry,'queryDefault'):
+        if hasattr(entry, 'queryDefault'):
           gDebug (1, "%s will be set to %s" % (entry.name, entry.queryDefault))
           entry.setValue(entry.queryDefault)
 
@@ -487,30 +534,52 @@
     return message
 
 
+  #---------------------------------------------------------------------------
+  # Cancel Query mode
+  #---------------------------------------------------------------------------
   def cancelQuery(self):
+    """
+    Cancels Query mode.
+    @return: None
+    """
     self.dispatchEvent('endENTERQUERY', _form=self)
     #self._instance.dispatchEvent('endENTERQUERY', _form=self)
-    message = None
+    message = None  #TODO: not used here and in return line /kilo/
     for block in self._logic._blockList:
       block.cancelQuery()
 
     self.triggerSetStatusText(_('Query canceled.'))
     return message
 
+
+  #---------------------------------------------------------------------------
+  # Copy Query, ie bring back conditions from the last query
+  #---------------------------------------------------------------------------
   def copyQuery(self):
+    """
+    Copies the Query, ie brings back conditions from the last query.
+    @return: None
+    """
     if self._currentBlock.mode != 'query':
       self.initQuery()
 
     self.dispatchEvent('endENTERQUERY', _form=self);
     #self._instance.dispatchEvent('endENTERQUERY', _form=self);
-    message = None
+    message = None  #TODO: not used here and in return line /kilo/
     for block in self._logic._blockList:
       block.copyQuery()
 
     return message
 
 
+  #---------------------------------------------------------------------------
+  # Run the query
+  #---------------------------------------------------------------------------
   def executeQuery (self):
+    """
+    Runs the query.
+    @return: None if all went well, error message if there was an error
+    """
     if self._currentBlock.mode != 'query':
       return _("Form not in query mode")
 
@@ -540,13 +609,14 @@
     return message
 
 
-
-
-  # ---------------------------------------------------------------------------
+  #---------------------------------------------------------------------------
   # Commit all pending changes
-  # ---------------------------------------------------------------------------
-
+  #---------------------------------------------------------------------------
   def commit(self):
+    """
+    Commits all pending changes.
+    @return: None if all went well, error message otherwise
+    """
     message = None
     self.dispatchEvent ('beginWAIT', _form = self)
 
@@ -603,9 +673,14 @@
     return message
 
 
-
-
+  #---------------------------------------------------------------------------
+  # Rolls back any uncommitted transatcion
+  #---------------------------------------------------------------------------
   def rollback (self, recover = False):
+    """
+    Rolls back any uncommitted transaction.
+    @return: None
+    """
     self.endEditing()
 
     # First get all different connections
@@ -627,41 +702,56 @@
     self.dispatchEvent ('cannotCOMMIT')
     self.dispatchEvent ('cannotROLLBACK')
 
-  #
-  # fireTrigger
-  #
+
+  #---------------------------------------------------------------------------
+  # Launch a trigger
+  #---------------------------------------------------------------------------
   def fireTrigger(self, triggerName):
+    """
+    Launches a trigger.
+    @param triggerName: name of  the trigger to be launched.
+    @return: None
+    """
     self._triggerDictionary[triggerName](self)
 
 
-  #
-  #
-  #
-  def updateUIEntry(self,field):
+  #---------------------------------------------------------------------------
+  # Updates every UI entry of a field.
+  #---------------------------------------------------------------------------
+  def updateUIEntry(self, field):
+    """
+    Updates every UI entry of a field.
+    @param field: the field object whose ui is to be refreshed
+    @return: None
+    """
     for entry in field._entryList:
-      self.dispatchEvent('updateENTRY',entry, _form=self)
+      self.dispatchEvent('updateENTRY', entry, _form=self)
       #self._instance.dispatchEvent('updateENTRY',entry, _form=self)
 
 
-  #
-  # nextEntry
-  #
+  #---------------------------------------------------------------------------
   # Called whenever an event source has requested that the
   # focus change to the next data entry object
-  #
+  #---------------------------------------------------------------------------
   def nextEntry(self, reverse=False, first=False, onlyInBlock=False):
-
+    """
+    Called whenever an event source has requested that the focus change
+    to the next data entry object.
+    @param reverse: boolean, step focus in reverse direction?
+    @param first: boolean, change focus to the first entry in the block?
+    @param onlyInBlock: boolean, can jump out of block to next block?
+    @return: None
+    """
     currentBlock = self._currentBlock
     mode = self.getCurrentMode()
 
-
     if currentBlock.transparent and not ( \
           onlyInBlock or \
           currentBlock.autoNextRecord and not ( \
               currentBlock.isEmpty() or \
               (not reverse and currentBlock.isLastRecord() and \
                    not (currentBlock.autoCreate and \
-                        currentBlock.editable in ('Y','new')) or \
+                        currentBlock.editable in ('Y', 'new')) or \
               (reverse and currentBlock.isFirstRecord()) \
           ))):
       source = self._currentEntry._page.getFocusOrder()
@@ -736,14 +826,14 @@
 
         if reverse:
           try:
-            dest = self._layout._pageList[i-1]
+            dest = self._layout._pageList[i - 1]
           except IndexError:
             dest = self._layout._pageList[-1]
           # TODO: this fails if last entry is not navigable
           self.findAndChangeFocus(dest._entryList[-1])
         else:
           try:
-            dest = self._layout._pageList[i+1]
+            dest = self._layout._pageList[i + 1]
           except IndexError:
             dest = self._layout._pageList[0]
           self.findAndChangeFocus(dest)
@@ -753,33 +843,49 @@
     else:
       self.changeFocus(nextEntry)
 
-  #
-  # previousEntry
-  #
+
+  #---------------------------------------------------------------------------
   # Called whenever an event source has requested that the
-  # focus change to the next data entry object
-  #
+  # focus change to the previous data entry object
+  #---------------------------------------------------------------------------
   def previousEntry(self):
+    """
+    Called whenever an event source has requested that the focus change
+    to the previous data entry object.
+    @return: None
+    """
     return self.nextEntry(reverse=True)
 
-  #
-  # refreshDisplay
-  #
-  # Refreshes all the UI fields to match
-  # the virtual form's fields
-  #
+
+  #---------------------------------------------------------------------------
+  # Refreshes all the UI fields to match the virtual form's fields
+  #---------------------------------------------------------------------------
   def refreshDisplay(self, block):
+    """
+    Refreshes all the UI fields to match the virtual form's fields.
+    @param block: block object containing fields to refresh
+    @return: None
+    """
     block.walk(self.__refreshDisplay)
     self.refreshUIEvents()
 
+
+  #---------------------------------------------------------------------------
+  # Refresh a given data entry object's UI
+  #---------------------------------------------------------------------------
   def __refreshDisplay(self, object):
     if object._type in ('GFEntry', "GFImage"):
       self.dispatchEvent('updateENTRY',object, _form=self)
 
-  #
+
+  #---------------------------------------------------------------------------
   # Signal the UI Drivers of navigation button relevance
-  #
+  #---------------------------------------------------------------------------
   def refreshUIEvents(self):
+    """
+    Signals the UI drivers of navigation button relevance.
+    @return: None
+    """
     block = self._currentBlock
     if not block: return
 
@@ -833,114 +939,175 @@
         dispatchEvent('canLASTRECORD')
         dispatchEvent('canNEWRECORD')
 
-  #
-  # nextBlock
-  #
+
+  #---------------------------------------------------------------------------
   # Called whenever an event source has requested that the
   # focus change to the next data entry block
-  #
+  #---------------------------------------------------------------------------
   def nextBlock(self):
-
+    """
+    Change focus to the next data entry block.
+    @return: None
+    """
     try:
-      nextBlock = 
self._logic._blockList[self._logic._blockList.index(self._currentBlock)+1]
+      nextBlock = 
self._logic._blockList[self._logic._blockList.index(self._currentBlock) + 1]
     except IndexError:
       nextBlock = self._logic._blockList[0]
     self.findAndChangeFocus(nextBlock)
 
 
-
-  #
-  # findPreviousBlock
-  #
+  #---------------------------------------------------------------------------
   # Convenience routine to find the previous block
-  #
+  #---------------------------------------------------------------------------
   def findPreviousBlock(self):
+    """
+    Finds the previous block.
+    @return: the block found
+    """
     try:
-      return 
self._logic._blockList[self._logic._blockList.index(self._currentBlock)-1]
+      return 
self._logic._blockList[self._logic._blockList.index(self._currentBlock) - 1]
     except IndexError:
       return self._logic._blockList[-1]
 
 
-  #
-  # previousBlock
-  #
+  #---------------------------------------------------------------------------
   # Called whenever an event source has requested that the
-  # focus change to the next data entry block
-  #
+  # focus change to the previous data entry block
+  #---------------------------------------------------------------------------
   def previousBlock(self):
+    """
+    Change focus to the previous data entry block.
+    @return: None
+    """
     self.findAndChangeFocus(self.findPreviousBlock())
 
 
-  #
-  # endEditing
-  #
+  #---------------------------------------------------------------------------
   # Signal to the current Entry to stop editing
   # mode and save it's value to the virtual form
-  #
+  #---------------------------------------------------------------------------
   def endEditing(self):
-    event = events.Event('endEDITMODE',None, _form=self)
+    """
+    Signals the current entry to stop editing mode and
+    save it's value to the virtual form.
+    @return: Boolean, True if succeeded, False if failed.
+    """
+    event = events.Event('endEDITMODE', None, _form=self)
     self.dispatchEvent(event)
     return not event.__error__
 
 
+  #---------------------------------------------------------------------------
+  # Step to previous record in block.
+  #---------------------------------------------------------------------------
   def prevRecord(self):
+    """
+    Steps to the previous record in the current block.
+    @return: None
+    """
     if self._currentBlock.mode == 'query':
       self.triggerSetStatusText(_('You cannot do that in query mode.'))
       return
     self._currentBlock.prevRecord()
 
+
+  #---------------------------------------------------------------------------
+  # Jump to first record in block.
+  #---------------------------------------------------------------------------
   def firstRecord(self):
+    """
+    Jumps to the first record in the current block.
+    @return: None
+    """
     if self._currentBlock.mode == 'query':
       self.triggerSetStatusText(_('You cannot do that in query mode.'))
       return
     self._currentBlock.firstRecord()
 
+
+  #---------------------------------------------------------------------------
+  # Jump to last record in block.
+  #---------------------------------------------------------------------------
   def lastRecord(self):
+    """
+    Jumps to the last record in the current block.
+    @return: None
+    """
     if self._currentBlock.mode == 'query':
       self.triggerSetStatusText(_('You cannot do that in query mode.'))
       return
     self._currentBlock.lastRecord()
 
+
+  #---------------------------------------------------------------------------
+  # Step to next record in block.
+  #---------------------------------------------------------------------------
   def nextRecord(self):
+    """
+    Steps to the next record in the current block.
+    @return: None
+    """
     if self._currentBlock.mode == 'query':
       self.triggerSetStatusText(_('You cannot do that in query mode.'))
       return
     self._currentBlock.nextRecord()
 
-  def jumpRecord(self,count):
+
+  #---------------------------------------------------------------------------
+  # Jumpt to a given record in block.
+  #---------------------------------------------------------------------------
+  def jumpRecord(self, count):
+    """
+    Jumps to a given record in the current block.
+    @param count: ordinal of the record
+    @return: None
+    """
     if self._currentBlock.mode == 'query':
       self.triggerSetStatusText(_('You cannot do that in query mode.'))
       return
     self._currentBlock.jumpRecord(count)
 
+
+  #---------------------------------------------------------------------------
+  # Toggles insert mode
+  #---------------------------------------------------------------------------
   def toggleInsertMode(self):
+    """
+    Toggles insert mode.
+    @return: None
+    """
     self._insertMode = not self._insertMode
 
 
-  ###################################################################
-  #
+  #===========================================================================
   # Trigger functions
   #
   # The following functions are only used to implement
   # functions exposed in the trigger namespace.
-  #
-  #
+  #===========================================================================
 
-  #
-  # triggerShowMessageBox
-  #
+  #---------------------------------------------------------------------------
   # display a standard message box
-  #
+  #---------------------------------------------------------------------------
   def triggerShowMessageBox (self, msgtxt, caption='GNUe Message',
       title='Information', kind = 'Info', cancel = False):
+    """
+    Displays a standard message box.
+    @param msgtxt: text to be displayed
+    @param caption: caption to be displayed, default='GNUe Message'
+    @param title: title of messagebox, default='Information'
+    @param kind: 'Question', 'Info', 'Warning', or 'Error', default='Info'
+    @param cancel: Flag whether to include a Cancel button, default='False'
+    @return: True for <Yes> or <Ok> button, False for <No> button, None for
+        <Cancel> button.
+    """
     return self._instance.displayMessageBox (msgtxt, kind, cancel, caption,
                                              title)
 
 
-  # ---------------------------------------------------------------------------
+  # --------------------------------------------------------------------------
   # Show a message box using the given message
-  # ---------------------------------------------------------------------------
-
+  # --------------------------------------------------------------------------
   def triggerMessageBox (self, message, kind = None, title = None,
       cancel = False):
     """
@@ -954,13 +1121,15 @@
     """
     return self._instance.displayMessageBox (message, kind, cancel, '', title)
 
-  #
-  # triggerSetFocus
-  #
-  # allow the trigger to switch input focus
-  # to a specfic entry widget
-  #
-  def triggerSetFocus(self,object):
+
+  #---------------------------------------------------------------------------
+  # Switch input focus to a specfic entry widget
+  #---------------------------------------------------------------------------
+  def triggerSetFocus(self, object):
+    """
+    Switches input focus to a specific widget.
+    @param object: the widget that should get the focus
+    """
     # add global focus locking
     if self._in_trigger_lock:
       print "Already called by a trigger"
@@ -969,7 +1138,7 @@
     self._in_trigger_lock = True
 
     focus = object._object
-    if focus._type=='GFField':
+    if focus._type == 'GFField':
       try:
         focus = focus._entryList[0]
       except KeyError:
@@ -978,11 +1147,11 @@
     if focus._type != 'GFEntry':
       raise "setFocus failed: Can just switch to GFEntry objects. " +\
             "You passed a '%s' object." % focus._type
-    self.changeFocus(focus,1)
-    self.dispatchEvent('gotoENTRY',object=self._currentEntry,_form=self)
-
+    self.changeFocus(focus, 1)
+    self.dispatchEvent('gotoENTRY', object=self._currentEntry, _form=self)
     self._in_trigger_lock = False
 
+
 #   #
 #   # allow the trigger to get a handle to
 #   # an actual GFEntry object
@@ -1014,38 +1183,49 @@
 #   def triggerGetCurrentPage(self):
 #     return self._currentPage
 
-  #
-  # triggerSetStatusText
-  #
-  # Allows the trigger to display a custom message
-  # on the forms status bar
-  #
-  def triggerSetStatusText(self,tip=''):
+
+  #---------------------------------------------------------------------------
+  # Display a custom message on the form's status bar
+  #---------------------------------------------------------------------------
+  def triggerSetStatusText(self, tip=''):
+    """
+    Displays a custom message on the form's status bar.
+    @param tip: message to be displayed
+    @return: None
+    """
     self._instance.updateStatusBar(tip=tip, form=self)
 
-  #
-  # triggerRunForm
-  #
-  # Allows the trigger to launch a new instance
-  # of gnue-forms running a different form.
-  #
+
+  #---------------------------------------------------------------------------
+  # Launch a new instance of gnue-forms running a different form.
+  #---------------------------------------------------------------------------
   def triggerRunForm(self, fileName, parameters={}):
+    """
+    Launches a new instance of GNUe-Forms, running a different form.
+    @param fileName: the name of the .gfd file to be displayed
+    @param parameters: dictionary of parameters to be passed
+                        to the newly run form
+    @return: None
+    """
     from GFInstance import GFInstance
     instance = GFInstance(self._instance.manager,
                           self._instance.connections,
-                          self._instance._uimodule,  1, 
-                         parameters=parameters)
+                          self._instance._uimodule,
+                          1,
+                          parameters=parameters)
     instance.addFormFromFile(fileName)
     instance.activate()
 
-  #
-  # triggerRunReport
-  #
-  # Allows the trigger to launch a new instance
-  # of gnue-reports running a new report.
-  #
+
+  #---------------------------------------------------------------------------
+  # Launch a new instance of gnue-reports running a new report.
+  #---------------------------------------------------------------------------
   def triggerRunReport(self, reportFile, parameters={}, **parms):
     """
+    Launches a new instance of GNUe-Reports, running a new report.
+    @param reportFile: the name of the .grd file to be processed
+    @param parameters:
+    @param **params:
       These roughly correspond to the ./gnue-reports options
               destination
               destinationType
@@ -1056,87 +1236,127 @@
               sortoption
               includeStructuralComments
               omitGNUeXML
+    @return: None
     """
     from gnue.reports.base.GREngine import GREngine
     from gnue.reports.base import GRFilters, GRExceptions
     rep_engine = GREngine(self._instance.connections)
     rep_engine.processReport(reportFile, parameters=parameters, **parms)
 
-  #
-  # triggerActivateDialog
-  #
-  # Allows the trigger to launch a standard or custom
-  # dialog.  Values can be passed back and forth thru
-  # the parameters dictionary
-  #
-  def triggerActivateDialog(self,dialogName, parameters={}, modal=0):
+
+  #---------------------------------------------------------------------------
+  # Launch a standard or custom dialog
+  # Values can be passed back and forth thru the parameters dictionary
+  #---------------------------------------------------------------------------
+  def triggerActivateDialog(self, dialogName, parameters={}, modal=0):
+    """
+    Launches a standard or a custom dialog.
+    @param dialogName: name of the dialog to be displayed
+    @param parameters: dictionary of parameters used to pass values
+                        back and forth
+    @param modal: whether the dialog should be modal or not
+    @return: None
+    """
     if dialogName == '_about' and \
-      hasattr (self._instance._uiinstance, 'aboutBox'):
-      self._instance._uiinstance.aboutBox (parameters, self)
+      hasattr(self._instance._uiinstance, 'aboutBox'):
+      self._instance._uiinstance.aboutBox(parameters, self)
     else:
-      self._instance.activateForm(dialogName,parameters, modal)
+      self._instance.activateForm(dialogName, parameters, modal)
 
-  #
-  # triggerClose
-  #
-  # Allows the trigger to close this copy of gnue-forms
-  #
+
+  #---------------------------------------------------------------------------
+  # Close this copy of gnue-forms
+  #---------------------------------------------------------------------------
   def triggerClose(self):
+    """
+    Closes this copy of GNUe-Forms.
+    @return: None, or 1 if error
+    """
     event = events.Event('requestEXIT', _form=self)
     #self._instance.dispatchEvent(event)
     self.dispatchEvent(event)
     if event.__error__:
       return 1
 
-  #
-  # triggerSetFeature
-  #
-  # Allows the trigger to set feature values
-  # Features are things like toolbars, menubars, and statusbar
-  #
+
+  #---------------------------------------------------------------------------
+  # Set feature values. Features are like toolbars, menubars, and statusbar
+  #---------------------------------------------------------------------------
   def triggerSetFeature(self, feature, value):
+    """
+    Sets feature values.
+    Features are things like toolbars, menubars and statusbar.
+    @param feature: 'GUI:MENUBAR:SUPPRESS' or 'GUI:TOOLBAR:SUPPRESS' or
+                        'GUI:STATUSBAR:SUPPRESS'
+    @param value: True or False
+    @return: None
+    """
     if not self._features.has_key(feature):
       raise KeyError, "Trigger attempted to set unknown feature %s" % feature
     else:
       self._features[feature] = value
 
-  #
-  # triggerGetFeature
-  #
-  # Allows the trigger to get feature values
-  # Features are things like toolbars, menubars, and statusbar
-  #
+
+  #---------------------------------------------------------------------------
+  # Get feature values. Features are like toolbars, menubars, and statusbar
+  #---------------------------------------------------------------------------
   def triggerGetFeature(self, feature):
+    """
+    Gets feature values.
+    Features are things like toolbars, menubars and statusbar.
+    @param feature: 'GUI:MENUBAR:SUPPRESS' or 'GUI:TOOLBAR:SUPPRESS' or
+                        'GUI:STATUSBAR:SUPPRESS'
+    @return:    Boolean
+    """
     try:
       return self._features[feature]
     except KeyError:
       raise KeyError, "Trigger attempted to get unknown feature %s" % feature
 
-  #
-  # triggerGetAuthenticatedUser
-  #
+
+  #---------------------------------------------------------------------------
   # TODO: Description
-  #
+  #---------------------------------------------------------------------------
   def triggerGetAuthenticatedUser(self, connection=None):
+    """
+    Gets authenticated user.
+    """
     return self._instance.connections.getAuthenticatedUser(connection)
 
-  #
-  # triggerSetTitle
-  #
-  # TODO: Description
-  #
+
+  #---------------------------------------------------------------------------
+  # Set the title of the form.
+  #---------------------------------------------------------------------------
   def triggerSetTitle(self, title):
-    self.title = title # assignment of title value passed to form
+    """
+    Sets and displays the title of the form.
+    @param title: new title
+    """
+    self.title = title
     # code to fire event to update the display goes here
-    self.dispatchEvent('setTitle',title=title, _form=self);
+    self.dispatchEvent('setTitle', title=title, _form=self);
 
 
-  #
+  #---------------------------------------------------------------------------
   # Set a user parameter.
-  #
+  #---------------------------------------------------------------------------
   def triggerSetParameter(self, parameter, value):
+    """
+    Sets a user parameter.
+    @param parameter: the (case-insensitive) name of the parameter to be set
+    @value: new value for parameter
+    """
     param = string.lower(parameter)
-    self._parameters[param]=value
+    self._parameters[param] = value
 
-  def triggerActivateTrigger(self,name):
+
+  #---------------------------------------------------------------------------
+  # Runs another trigger.
+  #---------------------------------------------------------------------------
+  def triggerActivateTrigger(self, name):
+    """
+    Runs another trigger.
+    @param name: name of the trigger to be run
+    """
     self.processTrigger (name, False)
+





reply via email to

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