• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python system.get_vistrails_basic_pkg_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vistrails.core.system.get_vistrails_basic_pkg_id函数的典型用法代码示例。如果您正苦于以下问题:Python get_vistrails_basic_pkg_id函数的具体用法?Python get_vistrails_basic_pkg_id怎么用?Python get_vistrails_basic_pkg_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_vistrails_basic_pkg_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: createEditor

    def createEditor(self, parent, option, index):
        registry = get_module_registry()
        if index.column()==2: #Depth type
            spinbox = QtGui.QSpinBox(parent)
            spinbox.setValue(0)
            return spinbox
        elif index.column()==1: #Port type
            combo = CompletingComboBox(parent)
            # FIXME just use descriptors here!!
            variant_desc = registry.get_descriptor_by_name(
                get_vistrails_basic_pkg_id(), 'Variant')
            for _, pkg in sorted(registry.packages.iteritems()):
                pkg_item = QtGui.QStandardItem("----- %s -----" % pkg.name)
                pkg_item.setData('', QtCore.Qt.UserRole)
                pkg_item.setFlags(pkg_item.flags() & ~(
                        QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable))
                font = pkg_item.font()
                font.setBold(True)
                pkg_item.setFont(font)
                combo.model().appendRow(pkg_item)
                for _, descriptor in sorted(pkg.descriptors.iteritems()):
                    if descriptor is variant_desc:
                        variant_index = combo.count()
                    combo.addItem("%s (%s)" % (descriptor.name,
                                               descriptor.identifier),
                                  descriptor.sigstring)

            combo.select_default_item(variant_index)
            return combo
        else:
            return QtGui.QItemDelegate.createEditor(self, parent, option, index)
开发者ID:hjanime,项目名称:VisTrails,代码行数:31,代码来源:tuple_configuration.py


示例2: 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


示例3: create_workflow

    def create_workflow(self, c):
        upgrade_test_pkg = "org.vistrails.vistrails.tests.upgrade"

        d1 = ModuleDescriptor(package=upgrade_test_pkg, name="TestUpgradeA", namespace="", package_version="0.8")
        m1 = c.create_module_from_descriptor(d1, use_desc_pkg_version=True)
        m1.is_valid = False
        c.add_module_action(m1)

        d2 = ModuleDescriptor(package=upgrade_test_pkg, name="TestUpgradeB", namespace="", package_version="0.8")
        m2 = c.create_module_from_descriptor(d2, use_desc_pkg_version=True)
        m2.is_valid = False
        c.add_module_action(m2)

        basic_pkg = get_vistrails_basic_pkg_id()
        psi = PortSpecItem(module="Float", package=basic_pkg, namespace="", pos=0)
        function_port_spec = PortSpec(name="a", type="input", items=[psi])
        f = c.create_function(m1, function_port_spec, [12])
        c.add_function_action(m1, f)

        conn_out_psi = PortSpecItem(module="Integer", package=basic_pkg, namespace="", pos=0)
        conn_out_spec = PortSpec(name="z", type="output", items=[conn_out_psi])
        conn_in_psi = PortSpecItem(module="Integer", package=basic_pkg, namespace="", pos=0)
        conn_in_spec = PortSpec(name="b", type="input", items=[conn_in_psi])
        conn = c.create_connection(m1, conn_out_spec, m2, conn_in_spec)
        c.add_connection_action(conn)
        return c.current_version
开发者ID:VisTrails,项目名称:VisTrails,代码行数:26,代码来源:upgradeworkflow.py


示例4: add_group_portSpecs_index

def add_group_portSpecs_index(workflow):
    basic_pkg = get_vistrails_basic_pkg_id()
    def process_group(group):
        def get_port_name(module):
            port_name = None
            for function in module.db_functions:
                if function.db_name == 'name':
                    port_name = function.db_parameters[0].db_val
            return port_name
        g_workflow = group.db_workflow
        group.db_portSpecs_name_index = {}
        for module in g_workflow.db_modules:
            if module.db_name == 'InputPort' and module.db_package == basic_pkg:
                port_name = get_port_name(module)
                # FIXME add sigstring to DBPortSpec
                group.db_portSpecs_name_index[(port_name, 'input')] = \
                    DBPortSpec(id=-1,
                               name=port_name,
                               type='input')
            elif module.db_name == 'OutputPort' and \
                    module.db_package == basic_package:
                port_name = get_port_name(module)
                # FIXME add sigstring to DBPortSpec
                group.db_portSpecs_name_index[(port_name, 'output')] = \
                    DBPortSpec(id=-1,
                               name=port_name,
                               type='output')
            elif module.db_name == 'Group' and module.db_package == basic_pkg:
                process_group(module)

    for module in workflow.db_modules:
        if module.vtType == DBGroup.vtType:
            process_group(module)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:33,代码来源:opm.py


示例5: 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


示例6: testValue

    def testValue(self):
        """ Test values returned by value() function """
        basic_pkg = get_vistrails_basic_pkg_id()

        p = ModuleParam()
        p.type = "Float"
        p.identifier = basic_pkg
        assert p.value() == 0.0
        p.strValue = "1.5"
        assert p.value() == 1.5

        p.type = "Integer"
        p.identifier = basic_pkg
        p.strValue = ""
        assert p.value() == 0
        p.strValue = "2"
        assert p.value() == 2

        p.type = "String"
        p.identifier = basic_pkg
        p.strValue = ""
        assert p.value() == ""
        p.strValue = "test"
        assert p.value() == "test"

        p.type = "Boolean"
        p.identifier = basic_pkg
        p.strValue = ""
        assert p.value() == False
        p.strValue = "False"
        assert p.value() == False
        p.strValue = "True"
        assert p.value() == True
开发者ID:jdrain,项目名称:VisTrails,代码行数:33,代码来源:module_param.py


示例7: test_registry_ports_can_connect

 def test_registry_ports_can_connect(self):
     """Test registry isPortSubType"""
     descriptor = self.registry.get_descriptor_by_name( \
                         get_vistrails_basic_pkg_id(), 'String')
     oport = self.registry.source_ports_from_descriptor(descriptor)[0]
     iport = self.registry.destination_ports_from_descriptor(descriptor)[0]
     assert self.registry.ports_can_connect(oport, iport)
开发者ID:Nikea,项目名称:VisTrails,代码行数:7,代码来源:port.py


示例8: 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


示例9: test_parse

    def test_parse(self):
        basic_pkg = get_vistrails_basic_pkg_id()

        p = ModuleParam(type='Integer', val='1.5')
        self.assertEqual(p.identifier, basic_pkg)
        self.assertEqual(p.type, 'Integer')
        self.assertFalse(p.namespace)
开发者ID:jdrain,项目名称:VisTrails,代码行数:7,代码来源:module_param.py


示例10: create_port

 def create_port(self, id_scope=IdScope()):
     port = Port(id=id_scope.getNewId(Port.vtType),
                 type='source',
                 moduleId=12L, 
                 moduleName='String', 
                 name='value',
                 signature='(%s:String)' % get_vistrails_basic_pkg_id())
     return port
开发者ID:Nikea,项目名称:VisTrails,代码行数:8,代码来源:port.py


示例11: create_port_spec_item

 def create_port_spec_item(self):
     return PortSpecItem(id=0, pos=0, 
                         module="String", 
                         package=get_vistrails_basic_pkg_id(), 
                         label="testLabel", 
                         default="abc", 
                         values=["abc", "def", "ghi"], 
                         entry_type="enum")
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:8,代码来源:port_spec_item.py


示例12: replace_group

 def replace_group(controller, pipeline, module_id, new_subpipeline):
     basic_pkg = get_vistrails_basic_pkg_id()
     old_group = pipeline.modules[module_id]
     new_group = controller.create_module(basic_pkg, 'Group', '', 
                                          old_group.location.x, 
                                          old_group.location.y)
     new_group.pipeline = new_subpipeline
     return UpgradeWorkflowHandler.replace_generic(controller, pipeline, 
                                                   old_group, new_group)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:9,代码来源:upgradeworkflow.py


示例13: parse_db_type

 def parse_db_type(self):
     if self.db_type:
         (self._identifier, self._type, self._namespace) = \
             parse_port_spec_item_string(self.db_type,
                                         get_vistrails_basic_pkg_id())
     else:
         self._identifier = None
         self._type = None
         self._namespace = None
开发者ID:jdrain,项目名称:VisTrails,代码行数:9,代码来源:module_param.py


示例14: __init__

 def __init__(self, param, parent=None):
     QtGui.QSpinBox.__init__(self, parent)
     ConstantWidgetMixin.__init__(self, param.strValue)
     assert param.type == 'Integer'
     assert param.identifier == get_vistrails_basic_pkg_id()
     
     self.connect(self, QtCore.SIGNAL('valueChanged(int)'),
                  self.change_val)
     self.setContents(param.strValue)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:9,代码来源:mashups_widgets.py


示例15: create_port_spec

 def create_port_spec(self, id_scope=IdScope()):
     # FIXME add a valid port spec
     port_spec = PortSpec(id=id_scope.getNewId(PortSpec.vtType),
                          name='SetValue',
                          type='input',
                          sigstring='(%s:String)' % \
                              get_vistrails_basic_pkg_id(),
                          )
     return port_spec
开发者ID:cjh1,项目名称:VisTrails,代码行数:9,代码来源:port_spec.py


示例16: createAliasWidget

 def createAliasWidget(alias, controller, parent=None):
     v = controller.vtController.vistrail
     p = v.db_get_object(alias.component.vttype, alias.component.vtid)
     if p.identifier == "":
         idn = get_vistrails_basic_pkg_id()
     else:
         idn = p.identifier
     reg = get_module_registry()
     p_module = reg.get_module_by_name(idn, p.type, p.namespace)
     widget_type = get_widget_class(p_module)
     p.strValue = alias.component.val
     return widget_type(p, parent)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:12,代码来源:alias_inspector.py


示例17: create_artifact_from_filename

def create_artifact_from_filename(filename, account, id_scope):
    parameter = DBParameter(id=-1,
                            pos=0,
                            type='%s:File' % get_vistrails_basic_pkg_id(),
                            val=filename)
    function = DBFunction(id=-1,
                          name="file",
                          pos=0,
                          parameters=[parameter])
    return DBOpmArtifact(id='a' + str(id_scope.getNewId(DBOpmArtifact.vtType)),
                         value=DBOpmArtifactValue(function),
                         accounts=[DBOpmAccountId(id=account.db_id)])
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:12,代码来源:opm.py


示例18: canonicalize

 def canonicalize(sig_item):
     if isinstance(sig_item, tuple):
         # assert len(sig_item) == 2
         # assert isinstance(sig_item[0], type)
         # assert isinstance(sig_item[1], str)
         descriptor = registry.get_descriptor(sig_item[0])
         label = sig_item[1]
         return (descriptor, label)
     elif isinstance(sig_item, list):
         descriptor = registry.get_descriptor_by_name(
             get_vistrails_basic_pkg_id(), 'List')
         return (descriptor, None)
     else:
         # isinstance(sig_item, type):
         return (registry.get_descriptor(sig_item), None)
开发者ID:cjh1,项目名称:VisTrails,代码行数:15,代码来源:port_spec.py


示例19: create_artifact_from_db_tuple

def create_artifact_from_db_tuple(db_tuple, account, id_scope):
    parameters = []
    for db_str in db_tuple:
        parameter = DBParameter(id=-1,
                                pos=0,
                                type='%s:String' % get_vistrails_basic_pkg_id(),
                                val=db_str)
        parameters.append(parameter)
    function = DBFunction(id=-1,
                          name="dbEntry",
                          pos=0,
                          parameters=parameters)
    return DBOpmArtifact(id='a' + str(id_scope.getNewId(DBOpmArtifact.vtType)),
                         value=DBOpmArtifactValue(function),
                         accounts=[DBOpmAccountId(id=account.db_id)])
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:15,代码来源:opm.py


示例20: test_create_from_items

 def test_create_from_items(self):
     basic_pkg = get_vistrails_basic_pkg_id()
     item_a = PortSpecItem(pos=0,
                           package=basic_pkg,
                           module="Integer",
                           label="a",
                           default="123")
     item_b = PortSpecItem(pos=1,
                           package=basic_pkg,
                           module="String",
                           label="b",
                           default="abc")
     port_spec = PortSpec(id=-1,
                          name="SetValue",
                          type='input',
                          portSpecItems=[item_a, item_b])
开发者ID:cjh1,项目名称:VisTrails,代码行数:16,代码来源:port_spec.py



注:本文中的vistrails.core.system.get_vistrails_basic_pkg_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python system.strftime函数代码示例发布时间:2022-05-26
下一篇:
Python packagemanager.get_package_manager函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap