本文整理汇总了Python中vistrails.core.get_vistrails_application函数的典型用法代码示例。如果您正苦于以下问题:Python get_vistrails_application函数的具体用法?Python get_vistrails_application怎么用?Python get_vistrails_application使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_vistrails_application函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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()
示例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()
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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()
示例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)