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

Python core.get_vistrails_application函数代码示例

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

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



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

示例1: persist_configuration

 def persist_configuration(self, no_update=False):
     if self.load_configuration:
         if not no_update:
             self.persistent_configuration.update(self.configuration)
         # make sure startup is updated to reflect changes
         get_vistrails_application().startup.persist_pkg_configuration(
             self.codepath, self.persistent_configuration)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:7,代码来源:package.py


示例2: set_persistent_configuration

 def set_persistent_configuration(self):
     (dom, element) = self.find_own_dom_element()
     child = enter_named_element(element, 'configuration')
     if child:
         element.removeChild(child)
     self.configuration.write_to_dom(dom, element)
     get_vistrails_application().vistrailsStartup.write_startup_dom(dom)
     dom.unlink()
开发者ID:tacaswell,项目名称:VisTrails,代码行数:8,代码来源:package.py


示例3: configuration_changed

 def configuration_changed(self, item, new_value):
     """ configuration_changed(item: QTreeWidgetItem *, 
     new_value: QString) -> None
     Write the current session configuration to startup.xml.
     Note:  This is already happening on close to capture configuration
     items that are not set in preferences.  We are doing this here too, so
     we guarantee the changes were saved before VisTrails crashes.
     
     """
     from vistrails.gui.application import get_vistrails_application
     get_vistrails_application().save_configuration()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:11,代码来源:preferences.py


示例4: _move_package_node

 def _move_package_node(self, dom, where, node):
     doc = dom.documentElement
     packages = enter_named_element(doc, 'packages')
     oldpackages = enter_named_element(doc, 'disabledpackages')
     if where == 'enabled':
         oldpackages.removeChild(node)
         packages.appendChild(node)
     elif where == 'disabled':
         packages.removeChild(node)
         oldpackages.appendChild(node)
     else:
         raise ValueError
     get_vistrails_application().vistrailsStartup.write_startup_dom(dom)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:13,代码来源:package.py


示例5: initialize_packages

    def initialize_packages(self, prefix_dictionary={},
                            report_missing_dependencies=True):
        """initialize_packages(prefix_dictionary={}): None

        Initializes all installed packages. If prefix_dictionary is
        not {}, then it should be a dictionary from package names to
        the prefix such that prefix + package_name is a valid python
        import."""

        failed = []
        # import the modules
        app = get_vistrails_application()
        for package in self._package_list.itervalues():
            # print '+ initializing', package.codepath, id(package)
            if package.initialized():
                # print '- already initialized'
                continue
            try:
                prefix = prefix_dictionary.get(package.codepath)
                if prefix is None:
                    prefix = self._default_prefix_dict.get(package.codepath)
                package.load(prefix)
            except Package.LoadFailed, e:
                debug.critical("Package %s failed to load and will be "
                               "disabled" % package.name, e)
                # We disable the package manually to skip over things
                # we know will not be necessary - the only thing needed is
                # the reference in the package list
                self._startup.set_package_to_disabled(package.codepath)
                failed.append(package)
            except MissingRequirement, e:
                debug.critical("Package <codepath %s> is missing a "
                               "requirement: %s" % (
                                   package.codepath, e.requirement),
                               e)
开发者ID:Nikea,项目名称:VisTrails,代码行数:35,代码来源:packagemanager.py


示例6: remove_menu_items

 def remove_menu_items(self, pkg):
     """remove_menu_items(pkg: Package) -> None
     Send a signal with the pkg identifier. The builder window should
     catch this signal and remove the package menu items"""
     if pkg.menu_items():
         app = get_vistrails_application()
         app.send_notification("pm_remove_package_menu", pkg.identifier)
开发者ID:hjanime,项目名称:VisTrails,代码行数:7,代码来源:packagemanager.py


示例7: remove_own_dom_element

    def remove_own_dom_element(self):
        """Moves the node to the <disabledpackages> section.
        """
        dom = get_vistrails_application().vistrailsStartup.startup_dom()

        node, section = self._get_package_node(dom, create='disabled')
        if section == 'enabled':
            self._move_package_node(dom, 'disabled', node)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:8,代码来源:package.py


示例8: show_error_message

    def show_error_message(self, pkg, msg):
        """show_error_message(pkg: Package, msg: str) -> None
        Print a message to standard error output and emit a signal to the
        builder so if it is possible, a message box is also shown """

        debug.critical("Package %s (%s) says: %s" % (pkg.name, pkg.identifier, msg))
        app = get_vistrails_application()
        app.send_notification("pm_package_error_message", pkg.identifier, pkg.name, msg)
开发者ID:hjanime,项目名称:VisTrails,代码行数:8,代码来源:packagemanager.py


示例9: connect_registry_signals

 def connect_registry_signals(self):
     app = get_vistrails_application()
     app.register_notification("reg_new_module", self.newModule)
     app.register_notification("reg_new_package", self.newPackage)
     app.register_notification("reg_deleted_module", self.deletedModule)
     app.register_notification("reg_deleted_package", self.deletedPackage)
     app.register_notification("reg_show_module", self.showModule)
     app.register_notification("reg_hide_module", self.hideModule)
     app.register_notification("reg_module_updated", self.switchDescriptors)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:9,代码来源:module_palette.py


示例10: add_menu_items

 def add_menu_items(self, pkg):
     """add_menu_items(pkg: Package) -> None
     If the package implemented the function menu_items(),
     the package manager will emit a signal with the menu items to
     be added to the builder window """
     items = pkg.menu_items()
     if items:
         app = get_vistrails_application()
         app.send_notification("pm_add_package_menu", pkg.identifier, pkg.name, items)
开发者ID:hjanime,项目名称:VisTrails,代码行数:9,代码来源:packagemanager.py


示例11: remove_menu_items

    def remove_menu_items(self, pkg):
        """Emit the appropriate signal if the package has menu items.

        :type pkg: Package
        """
        if pkg.menu_items():
            app = get_vistrails_application()
            app.send_notification("pm_remove_package_menu",
                                   pkg.identifier)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:9,代码来源:packagemanager.py


示例12: execute_pipeline

def execute_pipeline(controller, pipeline,
                     reason, locator, version,
                     **kwargs):
    """Execute the pipeline while showing a progress dialog.
    """
    _ = translate('execute_pipeline')

    totalProgress = len(pipeline.modules)
    progress = QtGui.QProgressDialog(_("Executing..."),
                                     None,
                                     0, totalProgress)
    progress.setWindowTitle(_("Pipeline Execution"))
    progress.setWindowModality(QtCore.Qt.WindowModal)
    progress.show()

    def moduleExecuted(objId):
        progress.setValue(progress.value() + 1)
        QtCore.QCoreApplication.processEvents()

    if 'module_executed_hook' in kwargs:
        kwargs['module_executed_hook'].append(moduleExecuted)
    else:
        kwargs['module_executed_hook'] = [moduleExecuted]

    results, changed = controller.execute_workflow_list([(
        locator,        # locator
        version,        # version
        pipeline,       # pipeline
        DummyView(),    # view
        None,           # custom_aliases
        None,           # custom_params
        reason,         # reason
        None,           # sinks
        kwargs)])       # extra_info
    get_vistrails_application().send_notification('execution_updated')
    progress.setValue(totalProgress)
    progress.hide()
    progress.deleteLater()

    if not results[0].errors:
        return None
    else:
        module_id, error = next(results[0].errors.iteritems())
        return str(error)
开发者ID:chaosphere2112,项目名称:DAT,代码行数:44,代码来源:__init__.py


示例13: show_error_message

 def show_error_message(self, pkg, msg):
     """Print and emit a notification for an error message.
     """
     # TODO: isn't debug enough for the UI?
     debug.critical("Package %s (%s) says: %s"%(pkg.name,
                                                pkg.identifier,
                                                msg))
     app = get_vistrails_application()
     app.send_notification("pm_package_error_message", pkg.identifier,
                           pkg.name, msg)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:10,代码来源:packagemanager.py


示例14: late_disable_package

    def late_disable_package(self, codepath):
        """Disables a package 'late', i.e. after VisTrails initialization.

        Note that all the reverse dependencies need to already be disabled.
        """
        pkg = self.get_package_by_codepath(codepath)
        self.remove_package(codepath)
        app = get_vistrails_application()
        self._startup.set_package_to_disabled(codepath)
        self._startup.save_persisted_startup()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:10,代码来源:packagemanager.py


示例15: add_menu_items

    def add_menu_items(self, pkg):
        """Emit the appropriate signal if the package has menu items.

        :type pkg: Package
        """
        items = pkg.menu_items()
        if items:
            app = get_vistrails_application()
            app.send_notification("pm_add_package_menu", pkg.identifier,
                                  pkg.name, items)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:10,代码来源:packagemanager.py


示例16: find_own_dom_element

    def find_own_dom_element(self):
        """find_own_dom_element() -> (DOM, Node)

        Opens the startup DOM, looks for the element that belongs to the package,
        and returns DOM and node. Creates a new one in the <disabledpackages>
        section if none is found.
        """
        dom = get_vistrails_application().vistrailsStartup.startup_dom()

        node, section = self._get_package_node(dom, create='disabled')
        return (dom, node)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:11,代码来源:package.py


示例17: test_remove_package

    def test_remove_package(self):
        """ Tests if the package really gets deleted, and that it gets
            selected again in the available packages list.
        """
        
        pkg = "URL"
        _app = get_vistrails_application()
        builder = _app.builderWindow
        builder.showPreferences()
        prefs = builder.preferencesDialog
        packages = prefs._packages_tab
        prefs._tab_widget.setCurrentWidget(packages)
        QtGui.QApplication.processEvents()

        # check if package is loaded
        av = packages._available_packages_list
        try:
            item, = av.findItems(pkg, QtCore.Qt.MatchExactly)
            av.setCurrentItem(item)
            QtGui.QApplication.processEvents()
            QtGui.QApplication.processEvents()
            packages.enable_current_package()
        except ValueError:
            # Already enabled
            pass
        QtGui.QApplication.processEvents()
        QtGui.QApplication.processEvents()

        inst = packages._enabled_packages_list
        item, = inst.findItems(pkg, QtCore.Qt.MatchExactly)
        inst.setCurrentItem(item)
        QtGui.QApplication.processEvents()
        QtGui.QApplication.processEvents()
        packages.disable_current_package()
        QtGui.QApplication.processEvents()
        QtGui.QApplication.processEvents()

        # force delayed calls
        packages.populate_lists()
        packages.select_package_after_update_slot(pkg)
        QtGui.QApplication.processEvents()
        QtGui.QApplication.processEvents()

        # This does not work because the selection is delayed
        av = packages._available_packages_list
        items = av.selectedItems()
        self.assertEqual(len(items), 1, "No available items selected!")
        self.assertEqual(items[0].text(), unicode(pkg),
                         "Wrong available item selected: %s" % items[0].text())

        # check if configuration has been written correctly
        startup = _app.startup
        self.assertIn(pkg, startup.disabled_packages)
        self.assertNotIn(pkg, startup.enabled_packages)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:54,代码来源:preferences.py


示例18: test_remove_package

    def test_remove_package(self):
        """ Tests if the package really gets deleted, and that it gets
            selected again in the available packages list.
        """
        
        pkg = "dialogs"
        _app = get_vistrails_application()
        builder = _app.builderWindow
        builder.showPreferences()
        prefs = builder.preferencesDialog
        packages = prefs._packages_tab
        prefs._tab_widget.setCurrentWidget(packages)

        # check if package is loaded
        av = packages._available_packages_list
        for item in av.findItems(pkg, QtCore.Qt.MatchExactly):
            av.setCurrentItem(item)
            packages.enable_current_package()
            QtCore.QCoreApplication.processEvents()

        inst = packages._enabled_packages_list
        for item in inst.findItems(pkg, QtCore.Qt.MatchExactly):
            inst.setCurrentItem(item)
            packages.disable_current_package()
            QtCore.QCoreApplication.processEvents()

        # force delayed calls
        packages.populate_lists()
        packages.select_package_after_update_slot(pkg)
        QtCore.QCoreApplication.processEvents()

        # This does not work because the selection is delayed
        av = packages._available_packages_list
        items = av.selectedItems()
        self.assertEqual(len(items), 1, "No available items selected!")
        self.assertEqual(items[0].text(), unicode(pkg),
                         "Wrong available item selected: %s" % items[0].text())
        # check if configuration has been written correctly
        startup = _app.vistrailsStartup
        doc = startup.startup_dom().documentElement
        disabledpackages = enter_named_element(doc, 'disabledpackages')
        dpackage = None
        for package_node in named_elements(disabledpackages, 'package'):
            if str(package_node.attributes['name'].value) == pkg:
                dpackage = package_node
        self.assertIsNotNone(dpackage, "Removed package '%s' is not in unloaded packages list!" % pkg)

        epackages = enter_named_element(doc, 'packages')
        apackage = None
        for package_node in named_elements(epackages, 'package'):
            if str(package_node.attributes['name'].value) == pkg:
                apackage = package_node
        self.assertIsNone(apackage, "Removed package '%s' is still in loaded packages list!" % pkg)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:53,代码来源:preferences.py


示例19: reset_configuration

    def reset_configuration(self):
        """Reset package configuration to original package settings.
        """

        (dom, element) = self.find_own_dom_element()
        doc = dom.documentElement
        configuration = enter_named_element(element, 'configuration')
        if configuration:
            element.removeChild(configuration)
        self.configuration = copy.copy(self._initial_configuration)

        startup = get_vistrails_application().vistrailsStartup
        startup.write_startup_dom(dom)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:13,代码来源:package.py


示例20: _get_package_node

    def _get_package_node(self, dom, create):
        doc = dom.documentElement
        packages = enter_named_element(doc, 'packages')
        for package_node in named_elements(packages, 'package'):
            if package_node.attributes['name'].value == self.codepath:
                return package_node, 'enabled'
        oldpackages = enter_named_element(doc, 'disabledpackages')
        for package_node in named_elements(oldpackages, 'package'):
            if package_node.attributes['name'].value == self.codepath:
                return package_node, 'disabled'

        if create is None:
            return None, None
        else:
            package_node = dom.createElement('package')
            package_node.setAttribute('name', self.codepath)
            if create == 'enabled':
                packages.appendChild(package_node)
            elif create == 'disabled':
                oldpackages.appendChild(package_node)
            else:
                raise ValueError
            get_vistrails_application().vistrailsStartup.write_startup_dom(dom)
            return package_node, create
开发者ID:tacaswell,项目名称:VisTrails,代码行数:24,代码来源:package.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python configuration.get_vistrails_configuration函数代码示例发布时间:2022-05-26
下一篇:
Python transforms.translate函数代码示例发布时间: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