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


Python system.vistrails_root_directory函数代码示例

本文整理汇总了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)
开发者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


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