Package conduit :: Module Module :: Class ModuleManager
[hide private]

Class ModuleManager

source code


Generic dynamic module loader for conduit. Given a path it loads all modules in that directory, keeping them in an internam array which may be returned via get_modules

Also manages dataprovider factories which make dataproviders available at runtime

Instance Methods [hide private]
 
__init__(self, dirs=None) source code
 
_on_dynamic_dataprovider_added(self, monitor, dpw, klass)
Store the ipod so it can be retrieved later by the treeview/model emit a signal so it is added to the GUI
source code
 
_on_dynamic_dataprovider_removed(self, monitor, key) source code
 
_emit_available(self, dataproviderWrapper) source code
 
_emit_unavailable(self, dataproviderWrapper) source code
 
_build_filelist_from_directories(self, directories=None)
Converts a given array of directories into a list containing the filenames of all qualified modules.
source code
 
_is_module(self, filename) source code
 
_is_module_dir(self, dirname) source code
 
_append_module(self, wrapper, klass) source code
 
_remove_module(self, key)
Looks for a given key in the class registry and attempts to remove it
source code
 
_import_file(self, filename)
Tries to import the specified file.
source code
 
_load_modules_in_file(self, filename)
Loads all modules in the given file
source code
 
load_all(self, whitelist, blacklist)
Loads all classes in the configured paths.
source code
conduit.ModuleManager.ModuleWrapper[]
get_all_modules(self)
Returns: All loaded modules
source code
 
get_modules_by_type(self, *type_filter)
Returns all loaded modules of type specified by type_filter or all if the filter is set to None.
source code
 
get_module_wrapper_with_instance(self, wrapperKey)
Returns a new ModuleWrapper with a dp instace described by wrapperKey
source code
 
make_modules_callable(self, type_filter)
If it is necesary to call the modules directly.
source code
 
quit(self) source code
Class Variables [hide private]
  __gsignals__ = {"dataprovider-available":(gobject.SIGNAL_RUN_L...
Method Details [hide private]

__init__(self, dirs=None)
(Constructor)

source code 
Parameters:
  • dirs (string[]) - A list of directories to search. Relative pathnames and paths containing ~ will be expanded. If dirs is None the ModuleLoader will not search for modules.

_build_filelist_from_directories(self, directories=None)

source code 
Converts a given array of directories into a list containing the filenames of all qualified modules. Recurses into directories and adds files if they have the same name as the directory in which they reside. This method is automatically invoked by the constructor.

_remove_module(self, key)

source code 
Looks for a given key in the class registry and attempts to remove it
Parameters:
  • key - The key of the class to remove

_import_file(self, filename)

source code 
Tries to import the specified file. Returns the python module on succes. Primarily for internal use. Note that the python module returned may actually contain several more loadable modules.

load_all(self, whitelist, blacklist)

source code 

Loads all classes in the configured paths.

If whitelist and blacklist are supplied then the name of the file is tested against them. Default policy is to load all modules unless

get_all_modules(self)

source code 
Returns: conduit.ModuleManager.ModuleWrapper[]
All loaded modules

make_modules_callable(self, type_filter)

source code 
If it is necesary to call the modules directly. This function creates those instances in wrappers of the specified type

Class Variable Details [hide private]

__gsignals__

Value:
{"dataprovider-available":(gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,\
 [gobject.TYPE_PYOBJECT]), "dataprovider-unavailable":(gobject.SIGNAL_\
RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]), "all-modules-lo\
aded":(gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []), "syncset-added\
":(gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [gobject.TYPE_PYOBJECT]\
),}