本文整理汇总了Python中vistrails.core.modules.module_registry.get_module_registry函数的典型用法代码示例。如果您正苦于以下问题:Python get_module_registry函数的具体用法?Python get_module_registry怎么用?Python get_module_registry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_module_registry函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, value):
self.value = value
if isinstance(self.value, basestring):
self.type = get_module_registry().get_descriptor_by_name(
'org.vistrails.vistrails.basic',
'String')
else: # isinstance(value, float):
self.type = get_module_registry().get_descriptor_by_name(
'org.vistrails.vistrails.basic',
'Float')
开发者ID:VisTrails,项目名称:DAT,代码行数:10,代码来源:execution.py
示例2: updateModule
def updateModule(self, module):
if self.updateLocked: return
self.check_need_save_changes()
self.module = module
self.confWidget.setUpdatesEnabled(False)
self.confWidget.setVisible(False)
self.confWidget.clear()
if module and self.controller:
registry = get_module_registry()
getter = registry.get_configuration_widget
widgetType = None
try:
widgetType = \
getter(module.package, module.name, module.namespace)
except ModuleRegistryException:
pass
if not widgetType:
widgetType = DefaultModuleConfigurationWidget
widget = widgetType(module, self.controller)
self.confWidget.setUpWidget(widget)
self.connect(widget, QtCore.SIGNAL("doneConfigure"),
self.configureDone)
self.connect(widget, QtCore.SIGNAL("stateChanged"),
self.stateChanged)
self.confWidget.setUpdatesEnabled(True)
self.confWidget.setVisible(True)
self.hasChanges = False
# we need to reset the title in case there were changes
self.setWindowTitle("Module Configuration")
开发者ID:hjanime,项目名称:VisTrails,代码行数:30,代码来源:module_configuration.py
示例3: register_self
def register_self(cls, **kwargs):
registry = get_module_registry()
def resolve_type(t):
if isinstance(t, tuple):
return registry.get_descriptor_by_name(*t).module
elif isinstance(t, type):
return t
else:
assert False, ("Unknown type " + str(type(t)))
registry.add_module(cls, **kwargs)
try:
ips = cls.input_ports
except AttributeError:
pass
else:
for (port_name, types) in ips:
registry.add_input_port(cls,
port_name,
list(resolve_type(t) for t in types))
try:
ops = cls.output_ports
except AttributeError:
pass
else:
for (port_name, types) in ops:
registry.add_output_port(cls,
port_name,
list(resolve_type(t) for t in types))
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:30,代码来源:inspectors.py
示例4: init
def init(self):
"""Initial setup of the Manager.
Discovers plots and variable loaders from packages and registers
notifications for packages loaded in the future.
"""
app = get_vistrails_application()
# dat_new_plot(plot: Plot)
app.create_notification('dat_new_plot')
# dat_removed_plot(plot: Plot)
app.create_notification('dat_removed_plot')
# dat_new_loader(loader: BaseVariableLoader)
app.create_notification('dat_new_loader')
# dat_removed_loader(loader: BaseVariableLoader)
app.create_notification('dat_removed_loader')
# dat_new_operation(loader: VariableOperation)
app.create_notification('dat_new_operation')
# dat_removed_operation(loader: VariableOperation)
app.create_notification('dat_removed_operation')
app.register_notification("reg_new_package", self.new_package)
app.register_notification("reg_deleted_package", self.deleted_package)
# Load the Plots and VariableLoaders from the packages
registry = get_module_registry()
for package in registry.package_list:
self.new_package(package.identifier)
开发者ID:VisTrails,项目名称:DAT,代码行数:28,代码来源:global_data.py
示例5: collectParameterActions
def collectParameterActions(self):
""" collectParameterActions() -> list
Return a list of action lists corresponding to each dimension
"""
if not self.pipeline:
return None
reg = get_module_registry()
parameterValues = [[], [], [], []]
counts = self.label.getCounts()
for i in xrange(self.layout().count()):
pEditor = self.layout().itemAt(i).widget()
if pEditor and isinstance(pEditor, QParameterSetEditor):
for paramWidget in pEditor.paramWidgets:
editor = paramWidget.editor
interpolator = editor.stackedEditors.currentWidget()
paramInfo = paramWidget.param
dim = paramWidget.getDimension()
if dim in [0, 1, 2, 3]:
count = counts[dim]
values = interpolator.get_values(count)
if not values:
return None
pId = paramInfo.id
pType = paramInfo.dbtype
parentType = paramInfo.parent_dbtype
parentId = paramInfo.parent_id
function = self.pipeline.db_get_object(parentType,
parentId)
old_param = self.pipeline.db_get_object(pType,pId)
pName = old_param.name
pAlias = old_param.alias
pIdentifier = old_param.identifier
actions = []
tmp_id = -1L
for v in values:
getter = reg.get_descriptor_by_name
desc = getter(paramInfo.identifier,
paramInfo.type,
paramInfo.namespace)
if not isinstance(v, str):
str_value = desc.module.translate_to_string(v)
else:
str_value = v
new_param = ModuleParam(id=tmp_id,
pos=old_param.pos,
name=pName,
alias=pAlias,
val=str_value,
type=paramInfo.type,
identifier=pIdentifier
)
action_spec = ('change', old_param, new_param,
parentType, function.real_id)
action = vistrails.core.db.action.create_action([action_spec])
actions.append(action)
parameterValues[dim].append(actions)
tmp_id -= 1
return [zip(*p) for p in parameterValues]
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:60,代码来源:pe_table.py
示例6: __subclasscheck__
def __subclasscheck__(self, other):
if not issubclass(other, type):
raise TypeError
if not isinstance(other, ModuleClass):
return False
reg = get_module_registry()
return reg.is_descriptor_subclass(self.descriptor, other.descriptor)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:7,代码来源:api.py
示例7: __init__
def __init__(self, param, size, parent=None):
""" QParameterWidget(param: ParameterInfo, size: int, parent: QWidget)
-> QParameterWidget
"""
QtGui.QWidget.__init__(self, parent)
self.param = param
self.prevWidget = 0
hLayout = QtGui.QHBoxLayout(self)
hLayout.setMargin(0)
hLayout.setSpacing(0)
self.setLayout(hLayout)
hLayout.addSpacing(5+16+5)
self.label = QtGui.QLabel(param.spec.module)
self.label.setFixedWidth(50)
hLayout.addWidget(self.label)
registry = get_module_registry()
module = param.spec.descriptor.module
assert issubclass(module, Constant)
self.editor = QParameterEditor(param, size)
hLayout.addWidget(self.editor)
self.selector = QDimensionSelector()
self.connect(self.selector.radioButtons[4],
QtCore.SIGNAL('toggled(bool)'),
self.disableParameter)
hLayout.addWidget(self.selector)
开发者ID:cjh1,项目名称:VisTrails,代码行数:31,代码来源:pe_table.py
示例8: get_module_registry
def get_module_registry():
global _registry
if _registry is None:
from vistrails.core.modules.module_registry import get_module_registry
_registry = get_module_registry()
return _registry
开发者ID:VisTrails,项目名称:VisTrails,代码行数:7,代码来源:__init__.py
示例9: update_output_modules
def update_output_modules(self, *args, **kwargs):
# need to find all currently loaded output modes (need to
# check after modules are loaded and spin through registery)
# and display them here
reg = get_module_registry()
output_d = reg.get_descriptor_by_name(get_vistrails_basic_pkg_id(),
"OutputModule")
sublist = reg.get_descriptor_subclasses(output_d)
modes = {}
for d in sublist:
if hasattr(d.module, '_output_modes_dict'):
for mode_type, (mode, _) in (d.module._output_modes_dict
.iteritems()):
modes[mode_type] = mode
found_modes = set()
for mode_type, mode in modes.iteritems():
found_modes.add(mode_type)
if mode_type not in self.mode_widgets:
mode_config = None
output_settings = self.persistent_config.outputDefaultSettings
if output_settings.has(mode_type):
mode_config = getattr(output_settings, mode_type)
widget = OutputModeConfigurationWidget(mode, mode_config)
widget.fieldChanged.connect(self.field_was_changed)
self.inner_layout.addWidget(widget)
self.mode_widgets[mode_type] = widget
for mode_type, widget in self.mode_widgets.items():
if mode_type not in found_modes:
self.inner_layout.removeWidget(self.mode_widgets[mode_type])
del self.mode_widgets[mode_type]
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:32,代码来源:preferences.py
示例10: can_convert
def can_convert(cls, sub_descs, super_descs):
from vistrails.core.modules.module_registry import get_module_registry
from vistrails.core.system import get_vistrails_basic_pkg_id
reg = get_module_registry()
basic_pkg = get_vistrails_basic_pkg_id()
variant_desc = reg.get_descriptor_by_name(basic_pkg, 'Variant')
desc = reg.get_descriptor(cls)
def check_types(sub_descs, super_descs):
for (sub_desc, super_desc) in izip(sub_descs, super_descs):
if (sub_desc == variant_desc or super_desc == variant_desc):
continue
if not reg.is_descriptor_subclass(sub_desc, super_desc):
return False
return True
in_port = reg.get_port_spec_from_descriptor(
desc,
'in_value', 'input')
if (len(sub_descs) != len(in_port.descriptors()) or
not check_types(sub_descs, in_port.descriptors())):
return False
out_port = reg.get_port_spec_from_descriptor(
desc,
'out_value', 'output')
if (len(out_port.descriptors()) != len(super_descs)
or not check_types(out_port.descriptors(), super_descs)):
return False
return True
开发者ID:pombredanne,项目名称:VisTrails,代码行数:30,代码来源:vistrails_module.py
示例11: handle_module_upgrade_request
def handle_module_upgrade_request(controller, module_id, pipeline):
old_module = pipeline.modules[module_id]
if old_module.name == "JSONFile" and old_module.version != "0.1.5" and old_module.namespace == "read":
from vistrails.core.db.action import create_action
from vistrails.core.modules.module_registry import get_module_registry
from .read.read_json import JSONObject
reg = get_module_registry()
new_desc = reg.get_descriptor(JSONObject)
new_module = controller.create_module_from_descriptor(new_desc, old_module.location.x, old_module.location.y)
actions = UpgradeWorkflowHandler.replace_generic(controller, pipeline, old_module, new_module)
new_function = controller.create_function(new_module, "key_name", ["_key"])
actions.append(create_action([("add", new_function, "module", new_module.id)]))
return actions
module_remap = {
"read|csv|CSVFile": [(None, "0.1.1", "read|CSVFile", {"src_port_remap": {"self": "value"}})],
"read|numpy|NumPyArray": [(None, "0.1.1", "read|NumPyArray", {"src_port_remap": {"self": "value"}})],
"read|CSVFile": [("0.1.1", "0.1.2", None, {"src_port_remap": {"self": "value"}}), ("0.1.3", "0.1.5", None, {})],
"read|NumPyArray": [("0.1.1", "0.1.2", None, {"src_port_remap": {"self": "value"}})],
"read|ExcelSpreadsheet": [
("0.1.1", "0.1.2", None, {"src_port_remap": {"self": "value"}}),
("0.1.3", "0.1.4", None, {}),
],
"read|JSONFile": [(None, "0.1.5", "read|JSONObject")],
}
return UpgradeWorkflowHandler.remap_module(controller, module_id, pipeline, module_remap)
开发者ID:remram44,项目名称:tabledata-backport,代码行数:29,代码来源:init.py
示例12: find_descriptor
def find_descriptor(controller, pipeline, module_id, desired_version=''):
reg = get_module_registry()
get_descriptor = reg.get_descriptor_by_name
pm = get_package_manager()
invalid_module = pipeline.modules[module_id]
mpkg, mname, mnamespace, mid = (invalid_module.package,
invalid_module.name,
invalid_module.namespace,
invalid_module.id)
pkg = pm.get_package(mpkg)
desired_version = ''
d = None
# don't check for abstraction/subworkflow since the old module
# could be a subworkflow
if reg.has_abs_upgrade(*invalid_module.descriptor_info):
return reg.get_abs_upgrade(*invalid_module.descriptor_info)
try:
try:
d = get_descriptor(mpkg, mname, mnamespace, '', desired_version)
except MissingModule, e:
r = None
if pkg.can_handle_missing_modules():
r = pkg.handle_missing_module(controller, module_id,
pipeline)
d = get_descriptor(mpkg, mname, mnamespace, '',
desired_version)
if not r:
raise e
except MissingModule, e:
return None
开发者ID:tacaswell,项目名称:VisTrails,代码行数:32,代码来源:upgradeworkflow.py
示例13: updateController
def updateController(self, controller):
""" updateController(controller: VistrailController) -> None
Construct input forms for a controller's variables
"""
# we shouldn't do this whenver the controller changes...
if self.controller != controller:
self.controller = controller
if self.updateLocked: return
self.vWidget.clear()
if controller:
reg = module_registry.get_module_registry()
for var in [v for v in controller.vistrail.vistrail_vars]:
try:
descriptor = reg.get_descriptor_by_name(var.package,
var.module,
var.namespace)
except module_registry.ModuleRegistryException:
debug.critical("Missing Module Descriptor for vistrail"
" variable %s\nPackage: %s\nType: %s"
"\nNamespace: %s" % \
(var.name, var.package, var.module,
var.namespace))
continue
self.vWidget.addVariable(var.uuid, var.name, descriptor,
var.value)
self.vWidget.showPromptByChildren()
else:
self.vWidget.showPrompt(False)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:29,代码来源:variable_dropbox.py
示例14: check_port_spec
def check_port_spec(module, port_name, port_type, descriptor=None,
sigstring=None):
basic_pkg = get_vistrails_basic_pkg_id()
reg = get_module_registry()
found = False
try:
if descriptor is not None:
s = reg.get_port_spec_from_descriptor(descriptor, port_name,
port_type)
found = True
spec_tuples = parse_port_spec_string(sigstring, basic_pkg)
for i in xrange(len(spec_tuples)):
spec_tuple = spec_tuples[i]
port_pkg = reg.get_package_by_name(spec_tuple[0])
if port_pkg.identifier != spec_tuple[0]:
# we have an old identifier
spec_tuples[i] = (port_pkg.identifier,) + spec_tuple[1:]
sigstring = create_port_spec_string(spec_tuples)
# sigstring = expand_port_spec_string(sigstring, basic_pkg)
if s.sigstring != sigstring:
msg = ('%s port "%s" of module "%s" exists, but '
'signatures differ "%s" != "%s"') % \
(port_type.capitalize(), port_name, module.name,
s.sigstring, sigstring)
raise UpgradeWorkflowError(msg, module, port_name, port_type)
except MissingPort:
pass
if not found and \
not module.has_portSpec_with_name((port_name, port_type)):
msg = '%s port "%s" of module "%s" does not exist.' % \
(port_type.capitalize(), port_name, module.name)
raise UpgradeWorkflowError(msg, module, port_name, port_type)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:35,代码来源:upgradeworkflow.py
示例15: inspect_spreadsheet_cells
def inspect_spreadsheet_cells(self, pipeline):
""" inspect_spreadsheet_cells(pipeline: Pipeline) -> None
Inspect the pipeline to see how many cells is needed
"""
registry = get_module_registry()
self.spreadsheet_cells = []
if not pipeline: return
def find_spreadsheet_cells(pipeline, root_id=None):
if root_id is None:
root_id = []
# Sometimes we run without the spreadsheet!
spreadsheet_pkg = \
'%s.spreadsheet' % get_vistrails_default_pkg_prefix()
if registry.has_module(spreadsheet_pkg, 'SpreadsheetCell'):
# First pass to check cells types
cellType = \
registry.get_descriptor_by_name(spreadsheet_pkg,
'SpreadsheetCell').module
for mId, module in pipeline.modules.iteritems():
desc = registry.get_descriptor_by_name(module.package,
module.name,
module.namespace)
if issubclass(desc.module, cellType):
self.spreadsheet_cells.append(root_id + [mId])
for subworkflow_id in self.find_subworkflows(pipeline):
subworkflow = pipeline.modules[subworkflow_id]
if subworkflow.pipeline is not None:
find_spreadsheet_cells(subworkflow.pipeline,
root_id + [subworkflow_id])
find_spreadsheet_cells(pipeline)
开发者ID:cjh1,项目名称:VisTrails,代码行数:34,代码来源:inspector.py
示例16: _get_base_descriptor
def _get_base_descriptor(self):
if self._base_descriptor is None and self.base_descriptor_id >= 0:
from vistrails.core.modules.module_registry import get_module_registry
reg = get_module_registry()
self._base_descriptor = \
reg.descriptors_by_id[self.base_descriptor_id]
return self._base_descriptor
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:7,代码来源:module_descriptor.py
示例17: _get_module_descriptor
def _get_module_descriptor(self):
if self._module_descriptor is None or \
self._module_descriptor() is None:
reg = get_module_registry()
self._module_descriptor = \
weakref.ref(reg.get_descriptor_by_name(*self.descriptor_info))
return self._module_descriptor()
开发者ID:sguzwf,项目名称:VisTrails,代码行数:7,代码来源:module.py
示例18: make_port_specs
def make_port_specs(self):
self._port_specs = {}
self._input_port_specs = []
self._output_port_specs = []
self._input_remap = {}
self._output_remap = {}
if self.pipeline is None:
return
registry = get_module_registry()
for module in self.pipeline.module_list:
if module.name == 'OutputPort' and module.package == basic_pkg:
(port_name, sigstring, optional, depth, _) = \
self.get_port_spec_info(module)
port_spec = registry.create_port_spec(port_name, 'output',
None, sigstring,
optional, depth=depth)
self._port_specs[(port_name, 'output')] = port_spec
self._output_port_specs.append(port_spec)
self._output_remap[port_name] = module
elif module.name == 'InputPort' and module.package == basic_pkg:
(port_name, sigstring, optional, depth, _) = \
self.get_port_spec_info(module)
port_spec = registry.create_port_spec(port_name, 'input',
None, sigstring,
optional, depth=depth)
self._port_specs[(port_name, 'input')] = port_spec
self._input_port_specs.append(port_spec)
self._input_remap[port_name] = module
开发者ID:Nikea,项目名称:VisTrails,代码行数:29,代码来源:group.py
示例19: compute
def compute(self):
params = self.readInputs()
signature = self.getId(params)
jm = JobMonitor.getInstance()
# use cached job if it exist
cache = jm.getCache(signature)
if cache:
self.setResults(cache.parameters)
return
# check if job is running
job = jm.getJob(signature)
if job:
params = job.parameters
else:
# start job
params = self.startJob(params)
# set visible name
# check custom name
m = self.interpreter._persistent_pipeline.modules[self.id]
if '__desc__' in m.db_annotations_key_index:
name = m.get_annotation_by_key('__desc__').value.strip()
else:
reg = get_module_registry()
name = reg.get_descriptor(self.__class__).name
jm.addJob(signature, params, name)
# call method to check job
jm.checkJob(self, signature, self.getMonitor(params))
# job is finished, set outputs
params = self.finishJob(params)
self.setResults(params)
cache = jm.setCache(signature, params)
开发者ID:cjh1,项目名称:VisTrails,代码行数:31,代码来源:job.py
示例20: loadWidget
def loadWidget( self, pipeline):
from PyQt4 import QtGui
aliases = pipeline.aliases
widget = QtGui.QWidget()
layout = QtGui.QVBoxLayout()
hidden_aliases = self.plot.computeHiddenAliases()
for name, (type, oId, parentType, parentId, mId) in aliases.iteritems():
if name not in hidden_aliases:
p = pipeline.db_get_object(type, oId)
if p.identifier == '':
idn = 'edu.utah.sci.vistrails.basic'
else:
idn = p.identifier
reg = get_module_registry()
p_module = reg.get_module_by_name(idn, p.type, p.namespace)
if p_module is not None:
widget_type = get_widget_class(p_module)
else:
widget_type = StandardConstantWidget
p_widget = widget_type(p, None)
a_layout = QtGui.QHBoxLayout()
label = QtGui.QLabel(name)
a_layout.addWidget(label)
a_layout.addWidget(p_widget)
layout.addLayout(a_layout)
self.alias_widgets[name] = p_widget
widget.setLayout(layout)
return widget
开发者ID:benbu,项目名称:uvcdat-gui,代码行数:30,代码来源:plot_configuration.py
注:本文中的vistrails.core.modules.module_registry.get_module_registry函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论