当前位置: 首页>>代码示例>>Python>>正文


Python packagemanager.get_package_manager函数代码示例

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


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

示例1: test_vtl_files

 def test_vtl_files(self):
     from vistrails.tests.utils import run_file
     for root, dirs, file_names in os.walk(self.vtl_path):
         for file_name in sorted(file_names):
             if file_name.endswith('.vtl'):
                 # update available packages
                 from vistrails.core.packagemanager import get_package_manager
                 get_package_manager().build_available_package_names_list()
                 f = os.path.join(root, file_name)
                 locator = FileLocator(f)
                 version = locator._vnode
                 # if there is a version specified try to execute it,
                 # else just load the pipeline
                 if version:
                     errors = run_file(f, lambda x: x == version)
                     self.assertEqual(errors, [], 'Errors processing %s: %s' % (f, str(errors)))
                 else:
                     import vistrails.core.db.io
                     from vistrails.core.vistrail.controller import \
                         VistrailController
                     loaded_objs = vistrails.core.db.io.load_vistrail(locator)
                     controller = VistrailController(loaded_objs[0],
                                                     locator,
                                                     *loaded_objs[1:])
                     controller.change_selected_version(
                         controller.vistrail.get_latest_version())
                     self.assertTrue(controller.current_pipeline.is_valid,
                                     "Latest pipeline is invalid: %s" % f)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:28,代码来源:locator.py

示例2: operation_added

 def operation_added(self, operation):
     pm = get_package_manager()
     package = pm.get_package(operation.package_identifier)
     item = OperationItem(operation, package.name,
                          operation.wizard is not None)
     self._operations[operation] = item
     self._list.addItem(item, package.name)
开发者ID:VisTrails,项目名称:DAT,代码行数:7,代码来源:operations.py

示例3: load_package

 def load_package(self, identifier, codepath):
     packages = self.get_packages()
     if identifier not in packages:
         pm = get_package_manager()
         pm.late_enable_package(codepath)
         self._packages = None
     return self.get_package(identifier)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:7,代码来源:api.py

示例4: package_dependencies

def package_dependencies():
    pm = get_package_manager()
    spreadsheet_identifier = 'org.vistrails.vistrails.spreadsheet'
    if pm.has_package(spreadsheet_identifier):
        return [spreadsheet_identifier]
    else: # pragma: no cover
        return []
开发者ID:remram44,项目名称:tabledata-backport,代码行数:7,代码来源:__init__.py

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

示例6: new_package

    def new_package(self, package_identifier, prepend=False):
        """Called when a package is loaded in VisTrails.

        Discovers and registers Plots and VariableLoaders.
        """
        pm = get_package_manager()
        package = pm.get_package(package_identifier)
        if hasattr(package.init_module, '_plots'):
            for plot in package.init_module._plots:
                if not isinstance(plot, Plot):
                    warnings.warn(
                        "Package %s (%s) declares in _plots something "
                        "that is not a plot: %r" % (
                            package_identifier, package.codepath, plot))
                    continue
                plot.package_identifier = package_identifier

                # Resolve the port types
                for port in plot.ports:
                    port.type = resolve_descriptor(port.type,
                                                   package_identifier)

                # Read and check the metadata from the workflow
                try:
                    plot._read_metadata(package_identifier)
                except Exception, e:
                    warnings.warn("In package '%s'\n"
                                  "Couldn't read plot subworkflow for '%s':\n"
                                  "%s" % (package_identifier, plot.name, e))
                else:
                    self._add_plot(plot)
开发者ID:VisTrails,项目名称:DAT,代码行数:31,代码来源:global_data.py

示例7: createFailedPackage

    def createFailedPackage(self):
        """ Failed package is created so that the user can remove
        it manually using package submenu """
        pm = get_package_manager()
        if pm.has_package(self.signature):
            # do nothing
            return
        reg = vistrails.core.modules.module_registry.get_module_registry()

        # create a document hash integer from the cached sax tree
        # "name" is what suds use as the cache key
        name = '%s-%s' % (abs(hash(self.address)), "wsdl")
        self.wsdlHash = '0'

        package_id = reg.idScope.getNewId(Package.vtType)
        package = Package(id=package_id,
                          load_configuration=False,
                          name="SUDS#" + self.address,
                          identifier=self.signature,
                          version=self.wsdlHash,
                          )
        suds_package = reg.get_package_by_name(identifier)
        package._module = suds_package.module
        package._init_module = suds_package.init_module
        self.package = package
        reg.add_package(package)
        reg.signals.emit_new_package(self.signature)
        self.module = new_module(Module, str(self.signature))
        reg.add_module(self.module, **{'package':self.signature,
                                       'package_version':self.wsdlHash,
                                       'abstract':True})
        self.service = -1
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:32,代码来源:init.py

示例8: package_configuration

 def package_configuration():
     """
     Create a shortcut to Edit->Preferences->Module Package->Enabled Packages->Configure in menu.
     """
     pkgmgr = get_package_manager()
     package = pkgmgr.get_package(identifier)
     dlg = QPackageConfigurationDialog(None, package)
     dlg.exec_()
开发者ID:KenSuber,项目名称:cwsl-mas,代码行数:8,代码来源:init.py

示例9: setUpClass

 def setUpClass(cls):
     from vistrails.core.packagemanager import get_package_manager
     from vistrails.core.modules.module_registry import MissingPackage
     pm = get_package_manager()
     try:
         pm.get_package('org.vistrails.vistrails.http')
     except MissingPackage:
         pm.late_enable_package('URL')
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:8,代码来源:init.py

示例10: setUp

    def setUp(cls):
        cls._application = dat.tests.setup_application()

        pm = get_package_manager()

        pm.late_enable_package(
            'pkg_test_operations',
            {'pkg_test_operations': 'dat.tests.'})
开发者ID:VisTrails,项目名称:DAT,代码行数:8,代码来源:test_operations.py

示例11: reload_current_package_finisher

 def reload_current_package_finisher(self, codepath, reverse_deps, prefix_dictionary):
     # REENABLES the current package and all reverse dependencies
     pm = get_package_manager()
     try:
         pm.reload_package_enable(reverse_deps, prefix_dictionary)
     except Package.InitializationFailed, e:
         debug.critical("Re-initialization of package '%s' failed" % 
                         codepath, str(e))
         raise
开发者ID:cjh1,项目名称:VisTrails,代码行数:9,代码来源:preferences.py

示例12: choose_operation

def choose_operation(typecasts, source_descriptor, expected_descriptor,
                     parent=None):
    _ = translate('typecast_dialog')

    dialog = QtGui.QDialog(parent)
    dialog.setWindowTitle(_("Type casting"))
    layout = QtGui.QVBoxLayout()

    label = QtGui.QLabel(_(
        "A {actual} variable was put in a {expected} port. These are not "
        "compatible, but the following operations can do the "
        "conversion:").format(
            actual="%s (%s)" % (source_descriptor.module.__name__,
                                source_descriptor.identifier),
            expected="%s (%s)" % (expected_descriptor.module.__name__,
                                  expected_descriptor.identifier)))
    label.setWordWrap(True)
    layout.addWidget(label)
    list_widget = CategorizedListWidget()
    list_widget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
    pm = get_package_manager()
    for operation in typecasts:
        package = pm.get_package(operation.package_identifier)
        item = OperationItem(operation, package.name)
        list_widget.addItem(item, item.category)
    layout.addWidget(list_widget)

    buttons = QtGui.QHBoxLayout()
    ok = QtGui.QPushButton(_("Typecast", "Accept typecast dialog button"))
    QtCore.QObject.connect(ok, QtCore.SIGNAL('clicked()'),
                           dialog, QtCore.SLOT('accept()'))
    buttons.addWidget(ok)
    cancel = QtGui.QPushButton(_("Cancel", "Reject typecast dialog button"))
    QtCore.QObject.connect(cancel, QtCore.SIGNAL('clicked()'),
                           dialog, QtCore.SLOT('reject()'))
    buttons.addWidget(cancel)
    layout.addLayout(buttons)

    def check_selection():
        selection = list_widget.selectedItems()
        if selection:
            item = selection[0]
            if isinstance(item, OperationItem):
                ok.setEnabled(True)
                return
        ok.setEnabled(False)
    QtCore.QObject.connect(
        list_widget, QtCore.SIGNAL('itemSelectionChanged()'),
        check_selection)
    check_selection()

    dialog.setLayout(layout)
    if dialog.exec_() == QtGui.QDialog.Accepted:
        return list_widget.selectedItems()[0].operation
    else:
        raise CancelExecution
开发者ID:VisTrails,项目名称:DAT,代码行数:56,代码来源:typecast_dialog.py

示例13: reload_current_package

 def reload_current_package(self):
     # DISABLES the current package and all reverse dependencies
     inst = self._enabled_packages_list
     item = inst.currentItem()
     pm = get_package_manager()
     codepath = str(item.text())
     
     palette = QModulePalette.instance()
     palette.setUpdatesEnabled(False)
     pm.reload_package_disable(codepath)
开发者ID:cjh1,项目名称:VisTrails,代码行数:10,代码来源:preferences.py

示例14: enablePackage

 def enablePackage(self):
     """ enablePackge() -> None
     Tries to enable the controlflow package through the controller.
     """
     pm = get_package_manager()
     cf_pkg_id = 'org.vistrails.vistrails.control_flow'
     if not pm.has_package(cf_pkg_id):
         dep_graph = pm.build_dependency_graph([cf_pkg_id])
         if not self.controller.try_to_enable_package(cf_pkg_id, dep_graph):
             raise MissingPackage(cf_pkg_id)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:10,代码来源:controlflow_assist.py

示例15: reload_current_package

    def reload_current_package(self):
        if self._enabled_packages_list.currentItem() is not None:
            # Disables the selected package (which was enabled) and all its
            # reverse dependencies, then enables it all again
            item = self._enabled_packages_list.currentItem()
            pm = get_package_manager()
            codepath = str(item.text())

            palette = QModulePalette.instance()
            palette.setUpdatesEnabled(False)
            pm.reload_package_disable(codepath)
        elif self._available_packages_list.currentItem() is not None:
            # Reloads the selected package's (which was not enabled) __init__
            # module
            item = self._available_packages_list.currentItem()
            pm = get_package_manager()
            codepath = str(item.text())
            pm._available_packages.pop(codepath).unload()
            self.selected_available_list()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:19,代码来源:preferences.py


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