]>
jfr.im git - erebus.git/blob - ctlmod.py
5 def isloaded(modname
): return modname
in modules
6 def modhas(modname
, attname
): return getattr(self
.modules
[modname
], attname
, None) is not None
8 def load(parent
, modname
):
9 if not isloaded(modname
):
10 mod
= __import__(modname
)
11 modules
[modname
] = mod
12 ret
= mod
.modstart(parent
)
19 def unload(parent
, modname
):
21 self
.modules
[modname
].modstop(parent
)
25 def reloadmod(parent
, modname
):
27 if modhas(modname
, 'modrestart'): self
.modules
[modname
].modrestart(parent
)
28 else: self
.modules
[modname
].modstop(parent
)
30 reload(self
.modules
[modname
])
32 if modhas(modname
, 'modrestarted'): self
.modules
[modname
].modrestarted(parent
)
33 else: self
.modules
[modname
].modstart(parent
)
38 def loadall(parent
, modlist
):
39 for m
in modlist
: load(parent
, m
)
40 def unloadall(parent
, modlist
):
41 for m
in modlist
: unload(parent
, m
)
42 def reloadall(parent
, modlist
):
43 for m
in modlist
: reloadmod(parent
, m
)
45 sys
.path
.append('modules')