21 |
__date__ = "Wed Nov 11 2002" |
__date__ = "Wed Nov 11 2002" |
22 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
23 |
|
|
24 |
|
import sys |
25 |
|
|
26 |
class Module: |
class Module: |
27 |
"""Base module class to be inherited by plugin modules""" |
"""Base module class to be inherited by plugin modules""" |
45 |
|
|
46 |
# overloaded |
# overloaded |
47 |
def load(self): |
def load(self): |
48 |
# Should raise an exception here (And on unload) if this isnt overloaded |
# Should raise an exception here (And on unload) if this isnt |
49 |
print "This method should be overloaded by the plugin" |
# overloaded |
50 |
|
sys.stderr.write("This method should be overloaded by the plugin\n") |
51 |
|
|
52 |
# overloaded |
# overloaded |
53 |
def unload(self): |
def unload(self): |
54 |
print "This method should be overloaded by the plugin" |
sys.stderr.write("This method should be overloaded by the plugin\n") |
55 |
|
|
56 |
def _load(self, config, display): |
def _load(self, config, display): |
57 |
print "Loading module:", self.__name__ |
sys.stderr.write("Loading module: " + self.__name__ + "\n") |
58 |
self.config = config |
self.config = config |
59 |
self.display = display |
self.display = display |
60 |
self.load() |
self.load() |
61 |
|
|
62 |
def _unload(self): |
def _unload(self): |
63 |
print "Unloading module:", self.__name__ |
sys.stderr.write("Unloading module: " + self.__name__ + "\n") |
64 |
self.unload() |
self.unload() |
65 |
|
|
66 |
|
def _handle_event(self, event): |
67 |
|
try: |
68 |
|
self.handle_event(event) |
69 |
|
except Exception, e: |
70 |
|
sys.stderr.write("Print exception summary here\n") |
71 |
|
|
72 |
def handle_exception(self, exception): |
def handle_exception(self, exception): |
73 |
print "Should print a summary of info about the module and the exception info here" |
sys.stderr.write("An exception occoured:\n") |
74 |
print "An exception occoured:" |
sys.stderr.write("Module: " + self.__name__ + "\n") |
|
print "Module:", self.__name__ |
|
75 |
|
|
76 |
|
|
77 |
|
|