commit-gnue
[Top][All Lists]
Advanced

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

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


From: reinhard
Subject: [gnue] r8902 - trunk/gnue-forms/src
Date: Mon, 23 Oct 2006 02:30:38 -0500 (CDT)

Author: reinhard
Date: 2006-10-23 02:30:37 -0500 (Mon, 23 Oct 2006)
New Revision: 8902

Modified:
   trunk/gnue-forms/src/GFInstance.py
Log:
Source code reformatting.


Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2006-10-21 22:21:09 UTC (rev 8901)
+++ trunk/gnue-forms/src/GFInstance.py  2006-10-23 07:30:37 UTC (rev 8902)
@@ -22,62 +22,66 @@
 # $Id$
 
 """
-GFInstance manages forms instances in a 1:N relationship. It sits between the
-UI and the form and passes events between the two in a semi-intelligent
-manner.
+Classes that manage a running instance of GNUe Forms.
 """
 
 import os
-import sys
-import dircache
 
 from gnue import paths
-from gnue.forms.GFForm import *
-from gnue.forms.GFParser import loadFile
-from gnue.forms.input import GFKeyMapper
+from gnue.common import events
 from gnue.common.apps import i18n, errors
 from gnue.common.datasources.GDataSource import getAppserverResource
-from gnue.common import events
-from gnue.common.utils.FileUtils import dyn_import
-from gnue.common.utils.FileUtils import openResource, openBuffer
 from gnue.common.utils import CaselessDict
-from gnue.common.logic.language import AbortRequest
+from gnue.common.utils import FileUtils
 
+from gnue.forms import GFForm
+from gnue.forms.GFParser import loadFile
+from gnue.forms.input import GFKeyMapper
 
+
 # =============================================================================
 # Exceptions
 # =============================================================================
 
-class FileOpenError (errors.UserError):
-  def __init__ (self, message):
-    msg = u_("Unable to open file: %s") % message
-    errors.UserError.__init__ (self, msg)
+class FileOpenError(errors.UserError):
+    """
+    The form definition file could not be opened.
+    """
+    def __init__(self, message):
+        msg = u_("Unable to open file: %s") % message
+        errors.UserError.__init__ (self, msg)
 
 
-
 # =============================================================================
 # Forms instance manager class
 # =============================================================================
 
-class GFInstance (events.EventAware):
+class GFInstance(events.EventAware):
+    """
+    A running GNUe Forms instance.
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    This class handles loading of the forms definitions, building up the object
+    tree for the forms, and starting the main form, as well as ending the
+    application when the last form is closed.
+    """
 
-  def __init__ (self, manager, connections, ui, disableSplash = False,
-      parameters = None, parentContainer = None, moduleName = None):
-    # moduleName is here only for Designer to be able to pass it in
-    #when debugging a form.
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, manager, connections, ui, disableSplash=False,
+            parameters=None, parentContainer=None, moduleName=None):
+        # moduleName is here only for Designer to be able to pass it in
+        #when debugging a form.
     
-    assert gEnter (4)
+        assert gEnter(4)
 
-    # Configure event handling
-    assert gDebug (4, "Initializing event handling")
+        # Configure event handling
+        assert gDebug(4, "Initializing event handling")
 
-    self.eventController = events.EventController ()
-    events.EventAware.__init__ (self, self.eventController)
-    self.registerEventListeners ({
+        self.eventController = events.EventController()
+        events.EventAware.__init__(self, self.eventController)
+        self.registerEventListeners({
                 # First, all events are passed to the focus widget
                 '__before__'          : self.__beforeEvent,
 
@@ -127,242 +131,243 @@
                 'requestUSERCOMMAND'  : self.__execute_user_command,
                 'requestEXIT'         : self.__execute_exit})
 
-    self.connections = connections       # Link to the GBaseApp's GConnections
-    self.manager = manager               # Link to the GBaseApp Instance that
-                                         #   created this GFInstance
-    self._uimodule = ui                  # The UI created in the GBaseApp
-    self._disableSplash = disableSplash  # Disable splashscreen
+        self.connections = connections  # Link to the GBaseApp's GConnections
+        self.manager = manager          # Link to the GBaseApp Instance that
+                                        #   created this GFInstance
+        self._uimodule = ui             # The UI created in the GBaseApp
+        self._disableSplash = disableSplash  # Disable splashscreen
 
-    # The parameters passed to the GBaseApp instance
-    if parameters is None:
-       self._parameters = CaselessDict.CaselessDict ()
-    else:
-      self._parameters = parameters
-    self._formsDictionary = {}           # A dictionary containing all the
-                                         # forms loaded from a file
+        # The parameters passed to the GBaseApp instance
+        if parameters is None:
+            self._parameters = CaselessDict.CaselessDict()
+        else:
+            self._parameters = parameters
+        self._formsDictionary = {}      # A dictionary containing all the
+                                        # forms loaded from a file
 
-    self._parentContainer = parentContainer
+        self._parentContainer = parentContainer
 
-    # Load user customized key mappings
-    options = gConfigDict()
-    mapping = {}
+        # Load user customized key mappings
+        options = gConfigDict()
+        mapping = {}
 
-    for key in options.keys ():
-      if key.lower ().startswith ('key_'):
-        mapping [key [4:]] = options [key]
+        for key in options.keys():
+            if key.lower().startswith('key_'):
+                mapping[key[4:]] = options[key]
 
-    GFKeyMapper.KeyMapper.loadUserKeyMap (mapping)
+        GFKeyMapper.KeyMapper.loadUserKeyMap(mapping)
 
-    # Construct an instance of the UI driver if an UI module is available
-    if self._uimodule is not None:
-      assert gDebug (4, "Initializing user interface driver")
-      self._uiinstance = self._uimodule.GFUserInterface (self.eventController,
-                                       disableSplash   = self._disableSplash,
-                                       parentContainer = self._parentContainer,
-                                       moduleName = moduleName)
+        # Construct an instance of the UI driver if an UI module is available
+        if self._uimodule is not None:
+            assert gDebug(4, "Initializing user interface driver")
+            self._uiinstance = self._uimodule.GFUserInterface(
+                    self.eventController, disableSplash=self._disableSplash,
+                    parentContainer=self._parentContainer,
+                    moduleName=moduleName)
 
-    assert gLeave (4)
+        assert gLeave(4)
 
 
-  # ---------------------------------------------------------------------------
-  # Load a form from a buffer
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Load a form from a buffer
+    # -------------------------------------------------------------------------
 
-  def addFormFromBuffer (self, buffer):
-    """
-    Loads a GObj based form tree when passed a string containing gfd markup.
+    def addFormFromBuffer(self, buffer):
+        """
+        Loads a GObj based form tree when passed a string containing gfd 
markup.
 
-    @param buffer: A string containing the forms definition (gfd)
-    """
+        @param buffer: A string containing the forms definition (gfd)
+        """
 
-    try:
-      fileHandle = openBuffer (buffer)
-      self.addFormFromFilehandle (fileHandle)
-      fileHandle.close ()
+        try:
+            fileHandle = FileUtils.openBuffer(buffer)
+            self.addFormFromFilehandle(fileHandle)
+            fileHandle.close()
 
-    except IOError:
-      raise FileOpenError, errors.getException () [2]
+        except IOError:
+            raise FileOpenError, errors.getException()[2]
 
 
-  # ---------------------------------------------------------------------------
-  # Load a form from a file specified by it's filename
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Load a form from a file specified by it's filename
+    # -------------------------------------------------------------------------
 
-  def addFormFromFile (self, fileName):
-    """
-    Loads a GObj based form tree when passed a file name.
+    def addFormFromFile(self, fileName):
+        """
+        Loads a GObj based form tree when passed a file name.
 
-    @param fileName: A string containing a URI
-    """
+        @param fileName: A string containing a URI
+        """
 
-    try:
-      if fileName [:12] == 'appserver://':
-        # (w, h) = self._uimodule.getMaxFormSize ()
-        param = {'language': i18n.language, 'formwidth': 80, 'formheight': 20}
-        fileHandle = getAppserverResource (fileName, param, self.connections)
-      else:
-        fileHandle = openResource (fileName)
+        try:
+            if fileName[:12] == 'appserver://':
+                param = {'language': i18n.language, 'formwidth': 80,
+                        'formheight': 20}
+                fileHandle = getAppserverResource(fileName, param,
+                        self.connections)
+            else:
+                fileHandle = FileUtils.openResource(fileName)
 
-      self.addFormFromFilehandle (fileHandle, fileName)
-      fileHandle.close ()
+            self.addFormFromFilehandle(fileHandle, fileName)
+            fileHandle.close()
 
-    except IOError:
-      raise FileOpenError, errors.getException () [2]
+        except IOError:
+            raise FileOpenError, errors.getException()[2]
 
 
-  # ---------------------------------------------------------------------------
-  # Add a form from a file-like object specified by it's filehandle
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Add a form from a file-like object specified by it's filehandle
+    # -------------------------------------------------------------------------
 
-  def addFormFromFilehandle (self, fileHandle, url = None):
-    """
-    Loads a GObj based form tree when passed a valid python file handle.
+    def addFormFromFilehandle(self, fileHandle, url=None):
+        """
+        Loads a GObj based form tree when passed a valid python file handle.
 
-    A copy of the instance is passed into the parser so that it can work with
-    things like the GConnections stored in the base app.
+        A copy of the instance is passed into the parser so that it can work
+        with things like the GConnections stored in the base app.
 
-    @param fileHandle: A python file handle.
-    """
+        @param fileHandle: A python file handle.
+        """
 
-    # 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
-    form = loadFile (fileHandle, self, initialize = 0, url = url)
+        # 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
+        form = loadFile(fileHandle, self, initialize=0, url=url)
 
-    # Extract the child <dialog>s from the main form tree
-    self.reapSubforms (form)
+        # Extract the child <dialog>s from the main form tree
+        self.reapSubforms(form)
 
-    # Add the main form into the dictionary
-    self._formsDictionary [form.name] = form
+        # Add the main form into the dictionary
+        self._formsDictionary[form.name] = form
 
 
-  # ---------------------------------------------------------------------------
-  # Remove sub-forms from the main tree
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Remove sub-forms from the main tree
+    # -------------------------------------------------------------------------
 
-  def reapSubforms (self, formTree):
+    def reapSubforms(self, formTree):
 
-    for child in formTree._children [:]:
-      if isinstance (child, GFForm):
-        child.setParent (None)
-        self._formsDictionary [child.name] = child
-        formTree._children.remove (child)
+        for child in formTree._children[:]:
+            if isinstance(child, GFForm.GFForm):
+                child.setParent(None)
+                self._formsDictionary[child.name] = child
+                formTree._children.remove(child)
 
 
-  # ---------------------------------------------------------------------------
-  # Initialize the UI and activate the main form
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Initialize the UI and activate the main form
+    # -------------------------------------------------------------------------
 
-  def activate (self):
+    def activate(self):
 
-    assert gEnter (4)
+        assert gEnter(4)
 
-    assert gDebug (4, "Initializing user interface driver object")
-    self._uiinstance.initialize ()
+        assert gDebug(4, "Initializing user interface driver object")
+        self._uiinstance.initialize()
 
-    main_form = self._formsDictionary ['__main__']
+        main_form = self._formsDictionary['__main__']
 
-    # Load standard menu and merge it into main form
-    assert gDebug (4, "Loading standard menu and toolbar")
+        # 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 = openResource (filename)
-        default_form = loadFile (filehandle, self, initialize=0, url=filename)
-        filehandle.close ()
+        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__'
+            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)
+            # 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
+            # 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")
+        # Initialize all the forms loaded into memory
+        assert gDebug(4, "Initializing form objects")
 
-    for formObject in self._formsDictionary.values ():
-        if getattr(self._uimodule, '__rearrange_boxes__', False):
-            for page in formObject.findChildrenOfType('GFPage', False, True):
-                page.rearrange_boxes()
+        for formObject in self._formsDictionary.values():
+            if getattr(self._uimodule, '__rearrange_boxes__', False):
+                for page in formObject.findChildrenOfType('GFPage', False,
+                        True):
+                    page.rearrange_boxes()
 
-        formObject.phaseInit ()
+            formObject.phaseInit()
 
-    # Bring up the main form
-    if main_form.style == 'dialog':
-      # we assume a dialog to be modal by definition and that program execution
-      # stops here until the dialog get's closed. So do *not* enter another
-      # main loop
-      assert gDebug (4, "Activating main form as dialog")
-      self.activateForm ('__main__', self._parameters, modal = True)
+        # Bring up the main form
+        if main_form.style == 'dialog':
+            # we assume a dialog to be modal by definition and that program
+            # execution stops here until the dialog get's closed. So do *not*
+            # enter another main loop
+            assert gDebug(4, "Activating main form as dialog")
+            self.activateForm('__main__', self._parameters, modal = True)
+        else:
+            assert gDebug(4, "Activating main form")
+            self.activateForm('__main__', self._parameters)
+            assert gDebug(4, "Startup complete")
+            assert gDebug(4, "Entering main loop")
+            self._uiinstance.mainLoop()
+            assert gDebug(4, "Returning from main loop")
 
-    else:
-      assert gDebug (4, "Activating main form")
-      self.activateForm ('__main__', self._parameters)
+        assert gLeave(4)
 
-      assert gDebug (4, "Startup complete")
-      assert gDebug (4, "Entering main loop")
-      self._uiinstance.mainLoop ()
-      assert gDebug (4, "Returning from main loop")
 
-    assert gLeave (4)
+    # -------------------------------------------------------------------------
+    # Activate a given form
+    # -------------------------------------------------------------------------
 
+    def activateForm(self, formName='__main__', parameters=None, modal=False):
 
-  # ---------------------------------------------------------------------------
-  # Activate a given form
-  # ---------------------------------------------------------------------------
+        assert gEnter(4)
+        self._formsDictionary[formName].execute_open(parameters, modal)
+        assert gLeave(4)
 
-  def activateForm (self, formName = '__main__', parameters = None, modal = 
False):
 
-    assert gEnter (4)
-    self._formsDictionary[formName].execute_open(parameters, modal)
-    assert gLeave (4)
+    # -------------------------------------------------------------------------
+    # Build a user interface for a form tree
+    # -------------------------------------------------------------------------
 
+    def buildForm(self, formName='__main__'):
 
-  # ---------------------------------------------------------------------------
-  # Build a user interface for a form tree
-  # ---------------------------------------------------------------------------
+        form = self._formsDictionary[formName]
+        self._uiinstance.buildForm(form, formName)
 
-  def buildForm (self, formName = '__main__'):
 
-    form = self._formsDictionary [formName]
-    self._uiinstance.buildForm (form, formName)
+    # -------------------------------------------------------------------------
+    # Show an exception
+    # -------------------------------------------------------------------------
 
+    def show_exception(self, group=None, name=None, message=None, detail=None):
+        """
+        This function shows the last exception raised.
 
-  # ---------------------------------------------------------------------------
-  # Show an exception
-  # ---------------------------------------------------------------------------
+        The exact way of showing the message depends on the exception group.
+        """
+        if (group, name, message, detail) == (None, None, None, None):
+            (group, name, message, detail) = errors.getException()
+        if group == 'user':
+            self._uiinstance._ui_show_error_(message)
+        else:
+            self._uiinstance._ui_show_exception_(group, name, message, detail)
 
-  def show_exception(self, group=None, name=None, message=None, detail=None):
-    """
-    This function shows the last exception raised.
 
-    The exact way of showing the message depends on the exception group.
-    """
-    if (group, name, message, detail) == (None, None, None, None):
-      (group, name, message, detail) = errors.getException()
-    if group == 'user':
-      self._uiinstance._ui_show_error_(message)
-    else:
-      self._uiinstance._ui_show_exception_(group, name, message, detail)
+    # -------------------------------------------------------------------------
+    # Exit the application if the last form has been closed
+    # -------------------------------------------------------------------------
 
-
-  # ---------------------------------------------------------------------------
-  # Exit the application if the last form has been closed
-  # ---------------------------------------------------------------------------
-
-  def maybe_exit(self):
+    def maybe_exit(self):
         """
         Exit the application if the last form has been closed
 
@@ -378,285 +383,282 @@
             self._uiinstance._ui_exit_()
 
 
-  # ===========================================================================
-  # EVENT FUNCTIONS
-  # ===========================================================================
+    # =========================================================================
+    # EVENT FUNCTIONS
+    # =========================================================================
   
-  # From here down should be nothing but eventListeners listed in the __init__
-  # above.
+    # -------------------------------------------------------------------------
+    # Handle an event before it's sent to usual event processing
+    # -------------------------------------------------------------------------
 
-  # ---------------------------------------------------------------------------
-  # Handle an event before it's sent to usual event processing
-  # ---------------------------------------------------------------------------
+    def __beforeEvent(self, event):
+        """
+        This is called before any normal event processing is done. This method
+        passes the event to the current focus widget and sees if that widget
+        wants to handle that event.
 
-  def __beforeEvent (self, event):
-    """
-    This is called before any normal event processing is done. This method
-    passes the event to the current focus widget and sees if that widget wants
-    to handle that event.
+        @param event: The event currently being processed.
+        """
 
-    @param event: The event currently being processed.
-    """
+        if not hasattr(event, '_form'):
+            return
 
-    if hasattr (event, '_form') and event._form._currentEntry:
+        entry = event._form._currentEntry
+        if entry is None:
+            return
 
-      # If the display will need to be refreshed, then the proxied event should
-      # set this to 1
-      event.refreshDisplay = 0
+        # If the display will need to be refreshed, then the proxied event
+        # should set this to 1
+        event.refreshDisplay = 0
 
-      # Pass off the event to the current entry's event handler
-      event._form._currentEntry.subEventHandler.dispatchEvent (event)
+        # Pass off the event to the current entry's event handler
+        entry.subEventHandler.dispatchEvent(event)
 
-      # Refresh entry display if appropriate
-      if event.refreshDisplay:
-        # FIXME: This is not clean. Maybe the event should set event.__after__?
-        if hasattr (event._form._currentEntry, '_displayHandler'):
-          event._form._currentEntry._displayHandler.generateRefreshEvent ()
+        # Refresh entry display if appropriate
+        if event.refreshDisplay:
+            # FIXME: This is not clean. Maybe the event should set
+            # event.__after__?
+            if hasattr (entry, '_displayHandler'):
+                entry._displayHandler.generateRefreshEvent()
 
-        event._form.refreshUIEvents ()
+            event._form.refreshUIEvents()
 
-      # If the entry needs an error message displayed, then the proxied event
-      # should set this to the message text
-      if event.__errortext__:
-        event._form.show_message(event.__errortext__, 'Error')
+        # If the entry needs an error message displayed, then the proxied event
+        # should set this to the message text
+        if event.__errortext__:
+            event._form.show_message(event.__errortext__, 'Error')
 
 
-  # ---------------------------------------------------------------------------
-  # Focus movement
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Focus movement
+    # -------------------------------------------------------------------------
 
-  def __execute_nextEntry(self, event):
+    def __execute_nextEntry(self, event):
 
         event._form.next_entry()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_previousEntry(self, event):
+    def __execute_previousEntry(self, event):
 
         event._form.previous_entry()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_nextBlock(self,event):
+    def __execute_nextBlock(self,event):
 
         event._form.next_block()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_previousBlock(self, event):
+    def __execute_previousBlock(self, event):
 
         event._form.previous_block()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_nextPage(self, event):
+    def __execute_nextPage(self, event):
 
         event._form.next_page()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_previousPage(self, event):
+    def __execute_previousPage(self, event):
 
         event._form.previous_page()
 
 
-  # ---------------------------------------------------------------------------
-  # Clipboard and selection
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Clipboard and selection
+    # -------------------------------------------------------------------------
 
-  def __execute_cut(self, event):
+    def __execute_cut(self, event):
 
         event._form.cut()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_copy(self, event):
+    def __execute_copy(self, event):
 
         event._form.copy()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_paste(self, event):
+    def __execute_paste(self, event):
 
         event._form.paste()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_selectAll(self, event):
+    def __execute_selectAll(self, event):
 
         event._form.select_all()
 
-  # ---------------------------------------------------------------------------
-  # Record navigation
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Record navigation
+    # -------------------------------------------------------------------------
 
-  def __execute_firstRecord(self, event):
+    def __execute_firstRecord(self, event):
 
-    event._form.first_record()
+        event._form.first_record()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_prevRecord(self, event):
+    def __execute_prevRecord(self, event):
 
-    event._form.prev_record()
+        event._form.prev_record()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_nextRecord(self, event):
+    def __execute_nextRecord(self, event):
 
-    event._form.next_record()
+        event._form.next_record()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_lastRecord(self, event):
+    def __execute_lastRecord(self, event):
 
-    event._form.last_record()
+        event._form.last_record()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_jumpPrompt(self,event):
+    def __execute_jumpPrompt(self,event):
 
-    event._form.ask_record()
+        event._form.ask_record()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_jumpRowsUp(self, event):
+    def __execute_jumpRowsUp(self, event):
 
-    if event._form._currentEntry._rows > 1:
-      count = -event._form._currentEntry._rows + 1
+        if event._form._currentEntry._rows > 1:
+            count = -event._form._currentEntry._rows + 1
+        elif event._form._currentBlock._rows > 1:
+            count = -event._form._currentBlock._rows + 1
+        else:
+            count = 0
+        if count:
+            event._form.jump_records(count)
 
-    elif event._form._currentBlock._rows >1:
-      count = -event._form._currentBlock._rows + 1
+    # -------------------------------------------------------------------------
 
-    else:
-      count = 0
+    def __execute_jumpRowsDown (self, event):
 
-    if count:
-      event._form.jump_records(count)
+        if event._form._currentEntry._rows > 1:
+            count = event._form._currentEntry._rows - 1
+        elif event._form._currentBlock._rows > 1:
+            count = event._form._currentBlock._rows - 1
+        else:
+            count = 0
+        if count:
+            event._form.jump_records(count)
 
-  # ---------------------------------------------------------------------------
 
-  def __execute_jumpRowsDown (self, event):
+    # -------------------------------------------------------------------------
+    # Record insertion/deletion
+    # -------------------------------------------------------------------------
 
-    if event._form._currentEntry._rows > 1:
-      count = event._form._currentEntry._rows - 1
+    def __execute_newRecord(self, event):
 
-    elif event._form._currentBlock._rows >1:
-      count = event._form._currentBlock._rows - 1
+        event._form.new_record()
 
-    else:
-      count = 0
+    # -------------------------------------------------------------------------
 
-    if count:
-      event._form.jump_records(count)
+    def __execute_markForDelete(self, event):
 
+        event._form.delete_record()
 
-  # ---------------------------------------------------------------------------
-  # Record insertion/deletion
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_newRecord(self, event):
+    def __execute_undeleteRecord(self, event):
 
-    event._form.new_record()
+        event._form.undelete_record()
 
-  # ---------------------------------------------------------------------------
 
-  def __execute_markForDelete(self, event):
+    # -------------------------------------------------------------------------
+    # Queries
+    # -------------------------------------------------------------------------
 
-    event._form.delete_record()
+    def __execute_enterQuery(self, event):
 
-  # ---------------------------------------------------------------------------
+        event._form.init_query()
 
-  def __execute_undeleteRecord(self, event):
+    # -------------------------------------------------------------------------
 
-    event._form.undelete_record()
+    def __execute_copyQuery(self, event):
 
+        event._form.copy_query()
 
-  # ---------------------------------------------------------------------------
-  # Queries
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_enterQuery(self, event):
+    def __execute_cancelQuery(self, event):
 
-    event._form.init_query()
+        event._form.cancel_query()
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __execute_copyQuery(self, event):
+    def __execute_execQuery(self, event):
 
-    event._form.copy_query()
+        event._form.execute_query()
 
-  # ---------------------------------------------------------------------------
 
-  def __execute_cancelQuery(self, event):
+    # -------------------------------------------------------------------------
+    # Transactions
+    # -------------------------------------------------------------------------
 
-    event._form.cancel_query()
+    def __execute_commit(self, event):
 
-  # ---------------------------------------------------------------------------
+        event._form.commit()
 
-  def __execute_execQuery(self, event):
+    # -------------------------------------------------------------------------
 
-    event._form.execute_query()
+    def __execute_rollback(self, event):
 
+        event._form.rollback()
 
-  # ---------------------------------------------------------------------------
-  # Transactions
-  # ---------------------------------------------------------------------------
 
-  def __execute_commit(self, event):
+    # -------------------------------------------------------------------------
+    # Toggle insert mode
+    # -------------------------------------------------------------------------
 
-    event._form.commit()
+    def __execute_modeToggle(self, event):
 
-  # ---------------------------------------------------------------------------
+        event._form.toggle_insert_mode()
 
-  def __execute_rollback(self, event):
 
-    event._form.rollback()
+    # -------------------------------------------------------------------------
+    # Display the about dialog
+    # -------------------------------------------------------------------------
 
+    def __execute_about(self, event):
 
-  # ---------------------------------------------------------------------------
-  # Toggle insert mode
-  # ---------------------------------------------------------------------------
+        event._form.show_about()
 
-  def __execute_modeToggle(self, event):
 
-    event._form.toggle_insert_mode()
+    # -------------------------------------------------------------------------
+    # Fire a trigger named 'process-printout' (if it exists)
+    # -------------------------------------------------------------------------
 
+    def __execute_printout(self, event):
 
-  # ---------------------------------------------------------------------------
-  # Display the about dialog
-  # ---------------------------------------------------------------------------
+        event._form.printout()
 
-  def __execute_about(self, event):
 
-    event._form.show_about()
+    # -------------------------------------------------------------------------
+    # Execute user command
+    # -------------------------------------------------------------------------
 
+    def __execute_user_command(self, event):
 
-  # ---------------------------------------------------------------------------
-  # Fire a trigger named 'process-printout' (if it exists)
-  # ---------------------------------------------------------------------------
+        try:
+            event._form.fireTrigger("KEY-%s" % event.triggerName.upper())
+        except KeyError:
+            pass
 
-  def __execute_printout(self, event):
 
-    event._form.printout()
+    # -------------------------------------------------------------------------
+    # Verify state of data and exit form
+    # -------------------------------------------------------------------------
 
+    def __execute_exit(self, event):
 
-  # ---------------------------------------------------------------------------
-  # Execute user command
-  # ---------------------------------------------------------------------------
-
-  def __execute_user_command(self, event):
-
-    try:
-      event._form.fireTrigger("KEY-%s" % event.triggerName.upper())
-    except KeyError:
-      pass
-
-
-  # ---------------------------------------------------------------------------
-  # Verify state of data and exit form
-  # ---------------------------------------------------------------------------
-
-  def __execute_exit(self, event):
-
         event._form.close()





reply via email to

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