pyworkflow.plugin module¶
-
class
pyworkflow.plugin.
Domain
[source]¶ Bases:
object
Class to represent the application domain. It will allow to specify new objects, protocols, viewers and wizards through the registration of new plugins.
-
classmethod
findClass
(className)[source]¶ Find a class object given its name. The search will start with protocols and then with protocols.
-
classmethod
findViewers
(className, environment)[source]¶ Find the available viewers in this Domain for this class.
-
classmethod
findWizards
(protocol, environment)[source]¶ Find available wizards for this class, in this Domain. Params:
protocols: Protocol instance for which wizards will be search. environment: The environment name for wizards (e.g TKINTER)- Returns:
- a dict with the paramName and wizards for this class.
-
classmethod
getMapperDict
()[source]¶ Return a dictionary that can be used with subclasses of Mapper to store/retrieve objects (including protocols) defined in this Domain.
-
classmethod
getPreferredViewers
(className)[source]¶ Find and import the preferred viewers for this class.
-
classmethod
getProtocols
()[source]¶ Return all Protocol subclasses from all plugins for this domain.
-
static
importFromPlugin
(module, objects=None, errorMsg='', doRaise=False)[source]¶ - This method try to import either a list of objects from the
- module/plugin or the whole module/plugin and returns what is imported if not fails. When the import fails (due to the plugin or the object is not found), it prints a common message + optional errorMsg; or it raise an error with the same message, if doRaise is True.
-> Usages:
# Import the whole plugin ‘plugin1’ as ‘plug1’ plug1 = importFromPlugin(‘plugin1’)
# Import a plugin’s module pl1Cons = importFromPlugin(‘plug1.constants’)
# Import a single class from a plugin’s module p1prot1 = importFromPlugin(‘plug1.protocols’, ‘prot1’)
# Import some classes from a plugin’s module, # the returned tuple has the same length of the second argument pt1, pt2, … = importFromPlugin(‘plugin1.protocols’,
[‘pt1’, ‘pt2’, …])
-
classmethod
-
class
pyworkflow.plugin.
Plugin
[source]¶ Bases:
object
-
classmethod
getActiveVersion
(home=None, versions=None)[source]¶ Return the version of the binaries that are currently active. In the current implementation it will be inferred from the *_HOME variable, so it should contain the version number in it.
-
classmethod
getHome
(*paths)[source]¶ Return a path from the “home” of the package if the _homeVar is defined in the plugin.
-
classmethod