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