Package fife :: Package extensions :: Module basicapplication :: Class ApplicationBase
[hide private]
[frames] | no frames]

Class ApplicationBase

source code

builtins.object --+
                  |
                 ApplicationBase

ApplicationBase is an extendable class that provides a basic environment for a FIFE-based client. This kind of application base does not offer GUI support.

The unextended application reads in and initializes engine settings, sets up a simple event listener, and pumps the engine while listening for a quit message. Specialized applications can modify settings.py to change initial engine settings. They can provide their own event listener by overriding createListener. And they can override the _pump method to define runtime behavior of the application.

Instance Methods [hide private]
 
__init__(self, setting=None) source code
 
loadSettings(self)
Load the settings from a python file and load them into the engine.
source code
 
initLogging(self)
Initialize the LogManager.
source code
 
createListener(self)
This creates a default event listener, which will just close the program after pressing ESC.
source code
 
run(self)
Initialize the event listener and event loop - and start it.
source code
 
mainLoop(self)
The programs main loop.
source code
 
breakFromMainLoop(self, returnValue)
Break from the currently running mainLoop.
source code
 
_pump(self)
Application pump.
source code
 
quit(self)
Quit the application.
source code
Method Details [hide private]

loadSettings(self)

source code 

Load the settings from a python file and load them into the engine. Called in the ApplicationBase constructor.

createListener(self)

source code 

This creates a default event listener, which will just close the program after pressing ESC.

You should override this method to provide your own event handling.

mainLoop(self)

source code 

The programs main loop.

Do not override this, instead provide your own _pump method. You can call this recursively, e.g. to provide synchronous Dialogs :-) and break out of the current mainLoop by calling breakFromMainLoop. It will return the argument passed to breakFromMainLoop.

breakFromMainLoop(self, returnValue)

source code 

Break from the currently running mainLoop.

The passed argument will be returned by the mainLoop.

_pump(self)

source code 

Application pump.

Derived classes can specialize this for unique behavior. This is called every frame.

quit(self)

source code 

Quit the application. Really!