pdk.Gui.Application ($Date: 2002/12/04 10:16:36 $)
index
pdk/Gui/Application.py

The pdk application class.

The pdkApp class features:

The strongest advantage in using this class is the integration with the application registry: if your app is called "foo", you can initialize the various XML data bases in the registry with plain XML files "foo_<db name>.xml", located in the same directory as the main .py file (e.g., "foo_gui.xml" is used to initialize the GUI layout data base). Note that the XML file is only used to update the registry if it was modified after the last time the application was run. In fact, once the registry has been initialized, your application will run perfectly fine without the XML files.

To register your own command line options, overwrite OnInit of pdkApp and call registerCmdLineOptions before you call OnInit of the pdkApp base class (see the pdk.Base.CmdLineOptionHandler class for the format of the arguments to this method).

The application options are declared in a tag named "Options" in the <app_name>_system.xml file and can then be accessed by the getOption and setOption methods.

Initialization and shutdown callbacks are registered with the registerInitCallback and registerShutdownCallback methods, which require overriding OnInit in the same way as registering command line options does.

If the GUI XML layout specifies a widget with the pdk ID string "SPLASHSCREEN", it is automatically created, posted and then withdrawn during application startup (see the pdk.Gui.Widgets.InitializationDialogs module for a pre-defined splashscreen class).

FOG 01.2000

 
Classes
            
pdk.ErrorClasses.pdkError(exceptions.StandardError)
pdkAppError
wxPython.wx.wxApp(wxPython.wx.wxPyApp)
pdkApp
 
class pdkApp(wxPython.wx.wxApp)
     
Purpose:base class for all pdk applications
Detail:provides a number of services: - access to all open data bases (.getDataBase method) - access to the global application options (.getOption, .setOption, .setOptions, and .getOptionNames methods - registration of command line options (.registerCmdLineOptions method - registration of initialization and shutdown callbacks (.registerInitCallback/.registerShutdownCallback methods, e.g. for devices)

 
  
Method resolution order:
pdkApp
wxPython.wx.wxApp
wxPython.wx.wxPyApp
wxPython.wx.wxPyAppPtr
wxPython.windows.wxEvtHandlerPtr
wxPython.misc.wxObjectPtr

Methods defined here:
MainLoop(self)
OnInit(self)
# the OnInit callback (called by wxPython): # (it is necessary to do our initializations here after wxPython has set # up its internal machinery)
__del__(self)
__init__(self, appName=None, ioToWindow=0, dataFileName='pdkregistry.shelf', logFileName=None)
escapeWasPressed(self)
returns True if the escape button was pressed.
getDataBase(self, dbName)
returns a reference to the data base specified by dbName.
getOption(self, optionName)
returns the value of the application option optionName.
getOptionNames(self)
returns a list of all option names.
getTopWindowId(self)
returns the wx ID of the top window of the appliation (the first toplevel window defined in the XML GUI layout).
onSignalClose(self, frame)
onSignalExit(self)
onSignalKeyPressed(self, keyCode)
registerCmdLineOptions(self, *optionT)
registers the options given in the tuple optionT. See the pdk.Util.CmdLineOptionHandler class for the formation of this tuple.
registerInitCallback(self, (callbackName, statusMsg, errorMsg))
use this to register callbacks you want to call during application startup. Expects a 3-tuple (callbackName,`statusMsg`,`errorMsg`), where callbackName is a name of a method of this class, statusMsg is the message to show during execution of the callback, and errorMsg the message to show when the callback fails.
registerShutdownCallback(self, (callbackName, statusMsg, errorMsg))
use this to register callbacks you want to call during application shutdown. Expects a 3-tuple (callbackName,`statusMsg`,`errorMsg`), where callbackName is a name of a method of this class, statusMsg is the message to show during execution of the callback, and errorMsg the message to show when the callback fails.
setOption(self, optionName, optionValue)
sets the value of the application option optionName to `optionValue.
setOptions(self, **optionD)
calls pdk.PropertyManagers.PropertyManager.configure on all key/value pairs supplied in optionD.

Data and non-method functions defined here:
OPTIONS = {'tracelevel': <pdk.Properties.EnumProperty instance>}
 
class pdkAppError(pdk.ErrorClasses.pdkError)
       
  
Method resolution order:
pdkAppError
pdk.ErrorClasses.pdkError
exceptions.StandardError
exceptions.Exception

Data and non-method functions defined here:
CODES = {'datafile_locked': ('the data base file is locked by another pdk application', '')}
DOMAIN = 'pdkApp'
 
Functions
            
run_application(appName, appClass, **optionD)
dispatch function to create the pdk application object and enter its main loop.
 
Author
            
$Author: gathmann $