本文整理汇总了Python中vistrails.core.system.vistrails_root_directory函数的典型用法代码示例。如果您正苦于以下问题:Python vistrails_root_directory函数的具体用法?Python vistrails_root_directory怎么用?Python vistrails_root_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vistrails_root_directory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: addButtonsToToolbar
def addButtonsToToolbar(self):
# button for toggling executions
eye_open_icon = \
QtGui.QIcon(os.path.join(vistrails_root_directory(),
'gui/resources/images/eye.png'))
self.portVisibilityAction = QtGui.QAction(eye_open_icon,
"Show/hide port visibility toggle buttons",
None,
triggered=self.showPortVisibility)
self.portVisibilityAction.setCheckable(True)
self.portVisibilityAction.setChecked(True)
self.toolWindow().toolbar.insertAction(self.toolWindow().pinAction,
self.portVisibilityAction)
self.showTypesAction = QtGui.QAction(letterIcon('T'),
"Show/hide type information",
None,
triggered=self.showTypes)
self.showTypesAction.setCheckable(True)
self.showTypesAction.setChecked(True)
self.toolWindow().toolbar.insertAction(self.toolWindow().pinAction,
self.showTypesAction)
self.showEditsAction = QtGui.QAction(
QtGui.QIcon(os.path.join(vistrails_root_directory(),
'gui/resources/images/pencil.png')),
"Show/hide parameter widgets",
None,
triggered=self.showEdits)
self.showEditsAction.setCheckable(True)
self.showEditsAction.setChecked(
get_vistrails_configuration().check('showInlineParameterWidgets'))
self.toolWindow().toolbar.insertAction(self.toolWindow().pinAction,
self.showEditsAction)
开发者ID:Nikea,项目名称:VisTrails,代码行数:33,代码来源:module_info.py
示例2: install_default_startupxml_if_needed
def install_default_startupxml_if_needed():
fname = os.path.join(self.temp_configuration.dotVistrails,
'startup.xml')
root_dir = system.vistrails_root_directory()
origin = os.path.join(root_dir, 'core','resources',
'default_vistrails_startup_xml')
def skip():
if os.path.isfile(fname):
try:
d = self.startup_dom()
v = str(d.getElementsByTagName('startup')[0].attributes['version'].value)
return LooseVersion('0.1') <= LooseVersion(v)
except Exception:
return False
else:
return False
if skip():
return
try:
shutil.copyfile(origin, fname)
debug.log('Succeeded!')
except Exception, e:
debug.critical("""Failed to copy default configuration
file to %s. This could be an indication of a
permissions problem. Please make sure '%s' is writable."""
% (fname,
self.temp_configuration.dotVistrails), e)
开发者ID:tacaswell,项目名称:VisTrails,代码行数:27,代码来源:startup.py
示例3: create_startupxml_if_needed
def create_startupxml_if_needed(self):
needs_create = True
fname = self.get_startup_xml_fname()
if os.path.isfile(fname):
try:
tree = ElementTree.parse(fname)
startup_version = \
vistrails.db.services.io.get_version_for_xml(tree.getroot())
version_list = version_string_to_list(startup_version)
if version_list >= [0,1]:
needs_create = False
except:
debug.warning("Unable to read startup.xml file, "
"creating a new one")
if needs_create:
root_dir = system.vistrails_root_directory()
origin = os.path.join(root_dir, 'core','resources',
'default_vistrails_startup_xml')
try:
shutil.copyfile(origin, fname)
debug.log('Succeeded!')
self.first_run = True
except:
debug.critical("""Failed to copy default configuration
file to %s. This could be an indication of a
permissions problem. Please make sure '%s' is writable."""
% (fname, self._dot_vistrails))
raise
开发者ID:alexmavr,项目名称:VisTrails,代码行数:29,代码来源:startup.py
示例4: getVersionSchemaDir
def getVersionSchemaDir(version=None):
if version is None:
version = currentVersion
versionName = get_version_name(version)
schemaDir = os.path.join(vistrails_root_directory(), 'db', 'versions',
versionName, 'schemas', 'sql')
return schemaDir
开发者ID:cjh1,项目名称:VisTrails,代码行数:7,代码来源:__init__.py
示例5: testParamexp
def testParamexp(self):
"""test translating parameter explorations from 1.0.3 to 1.0.2"""
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
(save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
os.path.join(vistrails_root_directory(),
'tests/resources/paramexp-1.0.3.vt'))
vistrail = translateVistrail(save_bundle.vistrail)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:9,代码来源:v1_0_3.py
示例6: linux_fedora_install
def linux_fedora_install(package_name):
qt = qt_available()
hide_splash_if_necessary()
if qt:
cmd = shell_escape(vistrails_root_directory() +
'/gui/bundles/linux_fedora_install.py')
else:
cmd = 'yum -y install'
return run_install_command(qt, cmd, package_name)
开发者ID:hjanime,项目名称:VisTrails,代码行数:11,代码来源:installbundle.py
示例7: testVistrailvars
def testVistrailvars(self):
"""test translating vistrail variables from 1.0.3 to 1.0.2"""
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
(save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
os.path.join(vistrails_root_directory(),
'tests/resources/visvar-1.0.3.vt'))
vistrail = translateVistrail(save_bundle.vistrail)
visvars = vistrail.db_annotations_key_index['__vistrail_vars__']
self.assertTrue(visvars.db_value)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:11,代码来源:v1_0_3.py
示例8: test_startup_update
def test_startup_update(self):
from vistrails.db.services.io import open_startup_from_xml
from vistrails.core.system import vistrails_root_directory
import os
startup_tmpl = os.path.join(vistrails_root_directory(),
'tests', 'resources',
'startup-0.1.xml.tmpl')
f = open(startup_tmpl, 'r')
template = string.Template(f.read())
startup_dir = tempfile.mkdtemp(prefix="vt_startup")
startup_fname = os.path.join(startup_dir, "startup.xml")
with open(startup_fname, 'w') as f:
f.write(template.substitute({'startup_dir': startup_dir}))
try:
# FIXME need to generate startup from local path
startup = open_startup_from_xml(startup_fname)
name_idx = startup.db_configuration.db_config_keys_name_index
self.assertNotIn('nologger', name_idx)
self.assertIn('executionLog', name_idx)
self.assertFalse(
name_idx['executionLog'].db_value.db_value.lower() == 'true')
self.assertNotIn('showMovies', name_idx)
self.assertIn('logDir', name_idx)
self.assertEqual(name_idx['logDir'].db_value.db_value, 'logs')
self.assertIn('userPackageDir', name_idx)
self.assertEqual(name_idx['userPackageDir'].db_value.db_value,
'userpackages')
self.assertIn('thumbs', name_idx)
thumbs_name_idx = \
name_idx['thumbs'].db_value.db_config_keys_name_index
self.assertIn('cacheDir', thumbs_name_idx)
self.assertEqual(thumbs_name_idx['cacheDir'].db_value.db_value,
'/path/to/thumbs')
self.assertIn('subworkflowsDir', name_idx)
self.assertEqual(name_idx['subworkflowsDir'].db_value.db_value,
'subworkflows')
# note: have checked with spreadsheet removed from all
# packages list, too
# TODO: make this a permanent test (new template?)
self.assertNotIn('fixedSpreadsheetCells', name_idx)
enabled_names = startup.db_enabled_packages.db_packages_name_index
self.assertIn('spreadsheet', enabled_names)
spreadsheet_config = enabled_names['spreadsheet'].db_configuration
self.assertIsNotNone(spreadsheet_config)
spreadsheet_name_idx = spreadsheet_config.db_config_keys_name_index
self.assertIn('fixedCellSize', spreadsheet_name_idx)
self.assertTrue(spreadsheet_name_idx['fixedCellSize'].db_value.db_value.lower() == "true")
self.assertIn('dumpfileType', spreadsheet_name_idx)
self.assertEqual(spreadsheet_name_idx['dumpfileType'].db_value.db_value, "PNG")
finally:
shutil.rmtree(startup_dir)
开发者ID:Nikea,项目名称:VisTrails,代码行数:54,代码来源:v1_0_3.py
示例9: testVistrailvars
def testVistrailvars(self):
"""test translating vistrail variables from 1.0.2 to 1.0.3"""
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
(save_bundle, vt_save_dir) = open_bundle_from_zip_xml(DBVistrail.vtType, \
os.path.join(vistrails_root_directory(),
'tests/resources/visvar-1.0.2.vt'))
vistrail = translateVistrail(save_bundle.vistrail)
visvars = vistrail.db_vistrailVariables
self.assertEqual(len(visvars), 2)
self.assertNotEqual(visvars[0].db_name, visvars[1].db_name)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:12,代码来源:v1_0_2.py
示例10: uvcdat_vistrails_branch
def uvcdat_vistrails_branch():
git_dir = os.path.join(vistrails_root_directory(), '..')
with Chdir(git_dir):
release = "update_before_release"
if vistrails.core.requirements.executable_file_exists('git'):
lines = []
result = execute_cmdline(['git', 'rev-parse', '--abbrev-ref', 'HEAD' ],
lines)
if len(lines) == 1:
if result == 0:
release = lines[0].strip()
return release
开发者ID:benbu,项目名称:uvcdat-gui,代码行数:12,代码来源:__init__.py
示例11: install_default_startup
def install_default_startup():
debug.log('Will try to create default startup script')
try:
root_dir = system.vistrails_root_directory()
default_file = os.path.join(root_dir,'core','resources',
'default_vistrails_startup')
user_file = os.path.join(self.temp_configuration.dotVistrails,
'startup.py')
shutil.copyfile(default_file,user_file)
debug.log('Succeeded!')
except:
debug.critical("""Failed to copy default file %s.
This could be an indication of a permissions problem.
Make sure directory '%s' is writable"""
% (user_file,self.temp_configuration.dotVistrails))
sys.exit(1)
开发者ID:cjh1,项目名称:VisTrails,代码行数:16,代码来源:startup.py
示例12: setUpClass
def setUpClass(cls):
# first make sure CLTools is loaded
pm = get_package_manager()
if 'CLTools' not in pm._package_list: # pragma: no cover # pragma: no branch
pm.late_enable_package('CLTools')
remove_all_scripts()
cls.testdir = os.path.join(packages_directory(), 'CLTools', 'test_files')
cls._tools = {}
for name in os.listdir(cls.testdir):
if not name.endswith(SUFFIX):
continue
_add_tool(os.path.join(cls.testdir, name))
toolname = os.path.splitext(name)[0]
cls._tools[toolname] = cl_tools[toolname]
cls._old_dir = os.getcwd()
os.chdir(vistrails_root_directory())
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:16,代码来源:init.py
示例13: testParamexp
def testParamexp(self):
"""test translating parameter explorations from 1.0.2 to 1.0.3"""
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
(save_bundle, vt_save_dir) = open_bundle_from_zip_xml(
DBVistrail.vtType, os.path.join(vistrails_root_directory(), "tests/resources/paramexp-1.0.2.vt")
)
vistrail = translateVistrail(save_bundle.vistrail)
pes = vistrail.db_get_parameter_explorations()
self.assertEqual(len(pes), 1)
funs = pes[0].db_functions
self.assertEqual(set([f.db_port_name for f in funs]), set(["SetCoefficients", "SetBackgroundWidget"]))
parameters = funs[0].db_parameters
self.assertEqual(len(parameters), 10)
开发者ID:pombredanne,项目名称:VisTrails,代码行数:16,代码来源:v1_0_2.py
示例14: uvcdat_revision
def uvcdat_revision():
"""uvcdat_revision() -> str
When run on a working copy, shows the current git hash else
shows the latest release revision
"""
git_dir = os.path.join(vistrails_root_directory(), '..')
with Chdir(git_dir):
release = "update_before_release"
if vistrails.core.requirements.executable_file_exists('git'):
lines = []
result = execute_cmdline(['git', 'describe', '--tags', ],
lines)
if len(lines) == 1:
if result == 0:
release = lines[0].strip()
return release
开发者ID:benbu,项目名称:uvcdat-gui,代码行数:17,代码来源:__init__.py
示例15: linux_debian_install
def linux_debian_install(package_name):
qt = qt_available()
try:
import apt
import apt_pkg
except ImportError:
qt = False
hide_splash_if_necessary()
if qt:
cmd = shell_escape(vistrails_root_directory() +
'/gui/bundles/linux_debian_install.py')
else:
cmd = '%s install -y' % ('aptitude'
if executable_is_in_path('aptitude')
else 'apt-get')
return run_install_command(qt, cmd, package_name)
开发者ID:hjanime,项目名称:VisTrails,代码行数:18,代码来源:installbundle.py
示例16: start_process
def start_process(condition, *args):
"""Executes a file and waits for a condition.
"""
prev_dir = os.getcwd()
os.chdir(os.path.join(vistrails_root_directory(), os.path.pardir))
try:
p = subprocess.Popen(args)
finally:
os.chdir(prev_dir)
if condition is None:
return p, None
else:
while True:
time.sleep(0.5)
if condition():
return p, None
res = p.poll()
if res is not None:
return None, res
开发者ID:alexmavr,项目名称:VisTrails,代码行数:19,代码来源:engine_manager.py
示例17: read_dotvistrails_option
def read_dotvistrails_option(self, optionsDict=None):
""" read_dotvistrails_option() -> None
Check if the user sets a new dotvistrails folder and updates
self.temp_configuration with the new value.
Also handles the 'spawned-mode' option, by using a temporary directory
as .vistrails directory, and a specific default configuration.
"""
if optionsDict is None:
optionsDict = {}
def get(opt):
return (optionsDict.get(opt) or
command_line.CommandLineParser().get_option(opt))
if get('spawned'):
# Here we are in 'spawned' mode, i.e. we are running
# non-interactively as a slave
# We are going to create a .vistrails directory as a temporary
# directory and copy a specific configuration file
# We don't want to load packages that the user might enabled in
# this machine's configuration file as it would slow down the
# startup time, but we'll load any needed package without
# confirmation
tmpdir = tempfile.mkdtemp(prefix='vt_spawned_')
@atexit.register
def clean_dotvistrails():
shutil.rmtree(tmpdir, ignore_errors=True)
self.temp_configuration.dotVistrails = tmpdir
if get('dotVistrails') is not None:
debug.warning("--startup option ignored since --spawned-mode "
"is used")
shutil.copyfile(os.path.join(system.vistrails_root_directory(),
'core', 'resources',
'spawned_startup_xml'),
os.path.join(tmpdir, 'startup.xml'))
self.temp_configuration.enablePackagesSilently = True
self.temp_configuration.nologfile = True
self.temp_configuration.singleInstance = False
elif get('dotVistrails') is not None:
self.temp_configuration.dotVistrails = get('dotVistrails')
开发者ID:tacaswell,项目名称:VisTrails,代码行数:40,代码来源:application.py
示例18: run_file
def run_file(filename, tag_filter=lambda x: True):
"""Loads a .vt file and runs all the tagged versions in it.
"""
import vistrails.core.db.io
from vistrails.core.db.locator import FileLocator
from vistrails.core.system import vistrails_root_directory
from vistrails.core.vistrail.controller import VistrailController
filename = os.path.join(vistrails_root_directory(), '..', filename)
locator = FileLocator(filename)
loaded_objs = vistrails.core.db.io.load_vistrail(locator)
controller = VistrailController(loaded_objs[0], locator, *loaded_objs[1:])
errors = []
for version, name in controller.vistrail.get_tagMap().iteritems():
if tag_filter(name):
controller.change_selected_version(version)
(result,), _ = controller.execute_current_workflow()
if result.errors:
errors.append(("%d: %s" % (version, name), result.errors))
return errors
开发者ID:sguzwf,项目名称:VisTrails,代码行数:22,代码来源:utils.py
示例19: test_load_old_startup_xml
def test_load_old_startup_xml(self):
# has old nested shell settings that don't match current naming
startup_tmpl = os.path.join(system.vistrails_root_directory(),
'tests', 'resources',
'startup-0.1.xml.tmpl')
f = open(startup_tmpl, 'r')
template = string.Template(f.read())
startup_dir = tempfile.mkdtemp(prefix="vt_startup")
old_startup_fname = os.path.join(startup_dir, "startup.xml")
with open(old_startup_fname, 'w') as f:
f.write(template.substitute({'startup_dir': startup_dir}))
startup1 = vistrails.core.db.io.load_startup(old_startup_fname)
(h, fname) = tempfile.mkstemp(suffix=".xml")
os.close(h)
try:
vistrails.core.db.io.save_startup(startup1, fname)
startup2 = vistrails.core.db.io.load_startup(fname)
self.assertEqual(startup1, startup2)
finally:
os.remove(fname)
shutil.rmtree(startup_dir)
开发者ID:alexmavr,项目名称:VisTrails,代码行数:24,代码来源:startup.py
示例20: test_infinite_looping_upgrade
def test_infinite_looping_upgrade(self):
"""Test that circular upgrades fail gracefully"""
# Expected actions are as follow:
# - loads workflow2.xml
# * pipeline is missing looping_fix.x version 0.1
# - enables looping_fix.x (version 0.2)
# * pipeline is still missing looping_fix.x version 0.1
# - runs upgrade for looping_fix.x, 0.1 -> 0.2
# - upgrade changes modules to package looping_fix.y version 0.1
# * pipeline is missing looping_fix.y version 0.1
# - enables looping_fix.y (version 0.2)
# * pipeline is still missing looping_fix.y version 0.1
# Loop 50 times:
# - runs upgrade for looping_fix.y, 0.1 -> 0.2
# - upgrade changes modules to package looping_fix.x version 0.1
# * pipeline is missing looping_fix.x version 0.1
# - runs upgrade for looping_fix.x, 0.1 -> 0.2
# - upgrade changes modules to package looping_fix.y version 0.1
# * pipeline is missing looping_fix.y version 0.1
# 50 calls to handle_invalid_pipeline()
# Pre-adds packages so that the package manager can find them
packages = ["pkg_x", "pkg_y"]
prefix = "vistrails.tests.resources.looping_upgrades."
pm = get_package_manager()
for pkg in packages:
pm.get_available_package(pkg, prefix=prefix)
# Hooks handle_invalid_pipeline()
from vistrails.core.vistrail.controller import VistrailController
orig_hip = VistrailController.handle_invalid_pipeline
count = [0]
def new_hip(*args, **kwargs):
count[0] += 1
return orig_hip(*args, **kwargs)
VistrailController.handle_invalid_pipeline = new_hip
try:
# Loads workflow.xml
from vistrails.core.db.io import load_vistrail
from vistrails.core.db.locator import FileLocator
from vistrails.core.system import vistrails_root_directory
locator = FileLocator(
os.path.join(vistrails_root_directory(), "tests", "resources", "looping_upgrades", "workflow2.xml")
)
loaded_objs = load_vistrail(locator)
controller = VistrailController(loaded_objs[0], locator, *loaded_objs[1:])
# Select version (triggers all the validation/upgrade/loading)
self.assertEqual(controller.get_latest_version_in_graph(), 1)
try:
controller.do_version_switch(1)
except InvalidPipeline:
pass
else:
self.fail("No InvalidPipeline exception raised!")
# Restores handle_invalid_pipeline()
finally:
VistrailController.handle_invalid_pipeline = orig_hip
# disable packages
for pkg in reversed(packages):
try:
pm.late_disable_package(pkg)
except MissingPackage:
pass
# make sure it looped 50 times before failing
max_loops = getattr(get_vistrails_configuration(), "maxPipelineFixAttempts", 50)
self.assertEqual(count[0], max_loops)
# Check that original version gets selected
self.assertEqual(1, controller.current_version)
开发者ID:VisTrails,项目名称:VisTrails,代码行数:75,代码来源:upgradeworkflow.py
注:本文中的vistrails.core.system.vistrails_root_directory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论