25 |
# base imports |
# base imports |
26 |
import sys, os, string |
import sys, os, string |
27 |
# circus imports |
# circus imports |
28 |
import module, config, display |
import module, config, display, actions |
29 |
|
|
30 |
# Xlib imports |
# Xlib imports |
31 |
from Xlib import X, Xutil |
from Xlib import X, Xutil |
41 |
screen = None |
screen = None |
42 |
modules = {} |
modules = {} |
43 |
module_events = {} |
module_events = {} |
44 |
|
wm_actions = None |
45 |
|
|
46 |
def __init__(self, config, d = None): |
def __init__(self, config, d = None): |
47 |
|
|
48 |
self.config = config |
self.config = config |
49 |
|
self.wm_actions = actions.WmActions() |
50 |
|
|
51 |
if d: |
if d: |
52 |
self.display = display.Display(d) |
self.display = display.Display(d) |
125 |
sys.stderr.write("]\n") |
sys.stderr.write("]\n") |
126 |
|
|
127 |
|
|
|
|
|
128 |
def _import_name(self, modulename, name): |
def _import_name(self, modulename, name): |
129 |
"""Utility method to dynamically import modules. |
"""Utility method to dynamically import modules. |
130 |
|
|
170 |
except KeyError: |
except KeyError: |
171 |
self.module_events[e] = [module_name] |
self.module_events[e] = [module_name] |
172 |
|
|
173 |
self.modules[module_name].__name__ = module_name |
# Add module actions list to WmActions |
174 |
|
for k, v in self.modules[module_name].my_actions.items(): |
175 |
|
self.wm_actions.add_action(k, getattr(self.modules[module_name], v)) |
176 |
|
|
177 |
|
self.modules[module_name].name = module_name |
178 |
self.modules[module_name]._load(self.config, self.display) |
self.modules[module_name]._load(self.config, self.display) |
179 |
|
|
180 |
# XXX need to specify if the module was not found or if there was an |
# XXX need to specify if the module was not found or if there was an |
181 |
# error loading it. Currently either one raises this error |
# error loading it. Currently either one raises this error |
182 |
except Exception, e: |
except Exception, e: |
183 |
sys.stderr.write("Error while loading module '" + module_name + "':\n") |
sys.stderr.write("Error while loading module '" + module_name + "':\n") |
184 |
# FIXME: Need to switch this to sys.stderr.write somehow |
# FIXME: Need to switch this to sys.stderr.write somehow |