Common

Loggable

class serge.common.Loggable[source]

Bases: object

A helper class that adds a logger to a class

Each instance of the class will have a log attribute and can use this to log output. The log attrbute is a logger with the usual debug, warn, info, and error methods.

addLogger()[source]

Add a logger

getLogger

registry.getLogger(name)

Return a named logger - mainly used when logging from a non-loggable object

EventAware

class serge.common.EventAware[source]

Bases: object

A mixin class that allows objects to respond to events

handleEvent(event)[source]

Handle an incoming event

initEvents()[source]

Initialise the events system

linkEvent(name, callback, arg=None)[source]

Link an event to a callback

processEvent(event)[source]

Process an incoming event

registerEvent(event)[source]

Register an event

registerEvents(events)[source]

Register a number of events

registerEventsFromModule(module)[source]

Register all events found in the module

Events must be strings and their name must be of the form E_THE_NAME

ie: Begins with an ‘E’ and is all uppercase

unlinkEvent(name, callback=None)[source]

Unlink an event from a callback

Serializable

class serge.serialize.Serializable[source]

Bases: object

A mixing class to help serialize and deserialize objects

asString()[source]

Return the properties of this object as a string

copy()[source]

Return another copy of this item

classmethod createInstance()[source]

Return an instance of the class with all default properties set

classmethod fromFile(filename)[source]

Return a new instance from a file

classmethod fromString(text)[source]

Return a new instance from a string

init()[source]

Implement this method to do any object initialization after unpickling

toFile(filename)[source]

Store this object in a file

GeneralStore

class serge.registry.GeneralStore[source]

Bases: serge.serialize.Serializable

Stores things

clearItems()[source]

Clear all the items

duplicateItem(name, new_name)[source]

Create a duplicate of the named item with a new name

getItem(name)[source]

Return an item

getItemDefinitions()[source]

Return all the item definitions

getItems()[source]

Return all the items

getNames()[source]

Return the names of all the items

hasItem(name)[source]

Return True if the named item is in the registry

init()[source]

Initialise from serialized form

registerItem(name, *args, **kw)[source]

Register an item

removeItem(name)[source]

Remove the named item

setPath(path)[source]

Set our base path to locate images