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

Python configuration.get_vistrails_persistent_configuration函数代码示例

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

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



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

示例1: load_running_jobs

 def load_running_jobs(self):
     conf = configuration.get_vistrails_configuration()
     if conf.has('runningJobsList') and conf.runningJobsList:
         for url in conf.runningJobsList.split(';'):
             loc, version = url.split('?')
             locator = BaseLocator.from_url(loc)
             msgBox = QtGui.QMessageBox(QtGui.QMessageBox.Question,
                                        "Running Job Found",
                                        "Running Job Found:\n    %s\n"
                                        "Continue now?" % url)
             msgBox.addButton("Later", msgBox.ActionRole)
             delete = msgBox.addButton("Delete", msgBox.ActionRole)
             yes = msgBox.addButton("Yes", msgBox.ActionRole)
             msgBox.exec_()
             if msgBox.clickedButton() == yes:
                 from vistrails.gui.vistrails_window import _app
                 _app.open_vistrail_without_prompt(locator,
                                                int(version.split('=')[1]))
                 _app.get_current_view().execute()
             if msgBox.clickedButton() == delete:
                 conf_jobs = conf.runningJobsList.split(';')
                 conf_jobs.remove(url)
                 conf.runningJobsList = ';'.join(conf_jobs)
                 configuration.get_vistrails_persistent_configuration(
                                   ).runningJobsList = conf.runningJobsList
     else:
         conf.runningJobsList = ''
         configuration.get_vistrails_persistent_configuration(
                                   ).runningJobsList = conf.runningJobsList
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:29,代码来源:job_monitor.py


示例2: tab_changed

 def tab_changed(self, index):
     """ tab_changed(index: int) -> None
     Keep general and advanced configurations in sync
     
     """
     self._configuration_tab.configuration_changed(
                                    get_vistrails_persistent_configuration(),
                                    get_vistrails_configuration())
     self._general_tab.update_state(
                                    get_vistrails_persistent_configuration(),
                                    get_vistrails_configuration())
开发者ID:tacaswell,项目名称:VisTrails,代码行数:11,代码来源:preferences.py


示例3: clicked_on_login

    def clicked_on_login(self):
        """
        Attempts to log into web repository
        stores auth cookie for session
        """
        from vistrails.gui.application import get_vistrails_application

        self.dialog.loginUser = self.loginUser.text()
        params = urllib.urlencode({'username':self.dialog.loginUser,
                                   'password':self.loginPassword.text()})
        self.dialog.cookiejar = cookielib.CookieJar()

        # set base url used for cookie
        self.dialog.cookie_url = self.config.webRepositoryURL

        self.loginOpener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.dialog.cookiejar))

        # FIXME doesn't use https
        login_url = "%s/account/login/" % self.config.webRepositoryURL
        request = urllib2.Request(login_url, params)
        url = self.loginOpener.open(request)

        # login failed
        if not 'sessionid' in [cookie.name for cookie in self.dialog.cookiejar]:
            debug.critical("Incorrect username or password")
            self.dialog.cookiejar = None
        else: # login successful

            self._login_status = "login successful"

            self.loginUser.setEnabled(False)
            self.loginPassword.setEnabled(False)
            self._login_button.setEnabled(False)
            self.saveLogin.setEnabled(False)

            # add association between VisTrails user and web repository user
            if self.saveLogin.checkState():
                if not (self.config.check('webRepositoryLogin') and self.config.webRepositoryLogin == self.loginUser.text()):
                    self.config.webRepositoryLogin = str(self.loginUser.text())
                    pers_config = get_vistrails_persistent_configuration()
                    pers_config.webRepositoryLogin = self.config.webRepositoryLogin
                    get_vistrails_application().save_configuration()

            # remove association between VisTrails user and web repository user
            else:
                if self.config.check('webRepositoryLogin') and self.config.webRepositoryLogin:
                    self.config.webRepositoryLogin = ""
                    pers_config = get_vistrails_persistent_configuration()
                    pers_config.webRepositoryLogin = ""
                    get_vistrails_application().save_configuration()
            self.close_dialog(0)
开发者ID:cjh1,项目名称:VisTrails,代码行数:51,代码来源:repository.py


示例4: __init__

    def __init__(self, parent):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle('VisTrails Preferences')
        layout = QtGui.QHBoxLayout(self)
        layout.setMargin(0)
        layout.setSpacing(0)
        self.setLayout(layout)

        f = QtGui.QFrame()
        layout.addWidget(f)
        
        l = QtGui.QVBoxLayout(f)
        f.setLayout(l)
        
        self._tab_widget = QtGui.QTabWidget(f)
        l.addWidget(self._tab_widget)
        self._tab_widget.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                       QtGui.QSizePolicy.Expanding)

        tabs = [("General", ["General", "Packages"]),
                ("Interface", ["Interface", "Startup"]),
                ("Paths && URLs", ["Paths", "Web Sharing"]),
                ("Advanced", ["Upgrades", "Thumbnails", "Advanced"]),
                ]
        for (tab_name, categories) in tabs:
            tab = QConfigurationPane(self, 
                                     get_vistrails_persistent_configuration(),
                                     get_vistrails_configuration(),
                                     [(c, base_config[c]) for c in categories])
            self._tab_widget.addTab(tab, tab_name)

        output_tab = QOutputConfigurationPane(self,
                                    get_vistrails_persistent_configuration(), 
                                    get_vistrails_configuration())
        self._tab_widget.addTab(output_tab, "Output")

        self._packages_tab = self.create_packages_tab()
        self._tab_widget.addTab(self._packages_tab, 'Packages')
        
        self._configuration_tab = self.create_configuration_tab()
        self._tab_widget.addTab(self._configuration_tab, 'Expert')

        self.connect(self._tab_widget,
                     QtCore.SIGNAL('currentChanged(int)'),
                     self.tab_changed)

        self.connect(self._configuration_tab._tree.treeWidget,
                     QtCore.SIGNAL('configuration_changed'),
                     self.configuration_changed)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:49,代码来源:preferences.py


示例5: py_import

def py_import(module_name, dependency_dictionary, store_in_config=False):
    """Tries to import a python module, installing if necessary.

    If the import doesn't succeed, we guess which system we are running on and
    install the corresponding package from the dictionary. We then run the
    import again.
    If the installation fails, we won't try to install that same module again
    for the session.
    """
    try:
        result = _vanilla_import(module_name)
        return result
    except ImportError:
        if not getattr(get_vistrails_configuration(), 'installBundles'):
            raise

    if module_name in _previously_failed_pkgs:
        raise PyImportException("Import of Python module '%s' failed again, "
                                "not triggering installation" % module_name)
    if store_in_config:
        ignored_packages_list = getattr(get_vistrails_configuration(),
                                        'bundleDeclinedList',
                                        None)
        if ignored_packages_list:
            ignored_packages = set(ignored_packages_list.split(';'))
        else:
            ignored_packages = set()
        if module_name in ignored_packages:
            raise PyImportException("Import of Python module '%s' failed "
                                    "again, installation disabled by "
                                    "configuration" % module_name)
    debug.warning("Import of python module '%s' failed. "
                  "Will try to install bundle." % module_name)

    success = vistrails.core.bundles.installbundle.install(
            dependency_dictionary)

    if store_in_config:
        if bool(success):
            ignored_packages.discard(module_name)
        else:
            ignored_packages.add(module_name)
        setattr(get_vistrails_configuration(),
                'bundleDeclinedList',
                ';'.join(sorted(ignored_packages)))
        setattr(get_vistrails_persistent_configuration(),
                'bundleDeclinedList',
                ';'.join(sorted(ignored_packages)))

    if not success:
        _previously_failed_pkgs.add(module_name)
        raise PyImportException("Installation of Python module '%s' failed." %
                                module_name)
    try:
        result = _vanilla_import(module_name)
        return result
    except ImportError, e:
        _previously_failed_pkgs.add(module_name)
        raise PyImportBug("Installation of package '%s' succeeded, but import "
                          "still fails." % module_name)
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:60,代码来源:pyimport.py


示例6: create_thumbs_tab

 def create_thumbs_tab(self):
     """ create_thumbs_tab() -> QThumbnailConfiguration
     
     """
     return QThumbnailConfiguration(self,
                                    get_vistrails_persistent_configuration(),
                                    get_vistrails_configuration())
开发者ID:tacaswell,项目名称:VisTrails,代码行数:7,代码来源:preferences.py


示例7: create_general_tab

 def create_general_tab(self):
     """ create_general_tab() -> QGeneralConfiguration
     
     """
     return QGeneralConfiguration(self,
                                  get_vistrails_persistent_configuration(),
                                  get_vistrails_configuration())
开发者ID:tacaswell,项目名称:VisTrails,代码行数:7,代码来源:preferences.py


示例8: tab_changed

    def tab_changed(self, index):
        """ tab_changed(index: int) -> None
        Keep general and advanced configurations in sync
        
        """

        # FIXME Need to fix this
        self._configuration_tab.configuration_changed(
                                       get_vistrails_persistent_configuration(),
                                       get_vistrails_configuration())
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:10,代码来源:preferences.py


示例9: setUpClass

    def setUpClass(cls):
        get_vistrails_configuration().jobAutorun = True
        get_vistrails_persistent_configuration().jobAutorun = True
        QJobView.instance().set_refresh()
        cls.filename = (vistrails.core.system.vistrails_root_directory() +
                        '/tests/resources/jobs.vt')

        pm = vistrails.core.packagemanager.get_package_manager()
        if pm.has_package('org.vistrails.vistrails.myjobs'):
            return
        d = {'myjob': 'vistrails.tests.resources.'}
        pm.late_enable_package('myjob', d)
开发者ID:anukat2015,项目名称:VisTrails,代码行数:12,代码来源:job_monitor.py


示例10: get_load_file_locator_from_gui

def get_load_file_locator_from_gui(parent, obj_type):
    suffixes = "*" + " *".join(suffix_map[obj_type])
    fileName = QtGui.QFileDialog.getOpenFileName(
        parent,
        "Open %s..." % obj_type.capitalize(),
        vistrails.core.system.vistrails_file_directory(),
        "VisTrails files (%s)\nOther files (*)" % suffixes)
    if not fileName:
        return None
    filename = os.path.abspath(str(QtCore.QFile.encodeName(fileName)))
    dirName = os.path.dirname(filename)
    setattr(get_vistrails_persistent_configuration(), 'fileDirectory', dirName)
    setattr(get_vistrails_configuration(), 'fileDirectory', dirName)
    vistrails.core.system.set_vistrails_file_directory(dirName)
    return FileLocator(filename)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:15,代码来源:locator.py


示例11: get_save_file_locator_from_gui

def get_save_file_locator_from_gui(parent, obj_type, locator=None):
    # Ignore current locator for now
    # In the future, use locator to guide GUI for better starting directory

    suffixes = "*" + " *".join(suffix_map[obj_type])
    fileName = QtGui.QFileDialog.getSaveFileName(
        parent,
        "Save Vistrail...",
        vistrails.core.system.vistrails_file_directory(),
        filter="VisTrails files (%s)" % suffixes, # filetypes.strip()
        options=QtGui.QFileDialog.DontConfirmOverwrite)
    if not fileName:
        return None
    f = str(QtCore.QFile.encodeName(fileName))

    # check for proper suffix
    found_suffix = False
    for suffix in suffix_map[obj_type]:
        if f.endswith(suffix):
            found_suffix = True
            break
    if not found_suffix:
        if obj_type == 'vistrail':
            f += get_vistrails_configuration().defaultFileType
        else:
            f += suffix_map[obj_type][0]

    if os.path.isfile(f):
        msg = QtGui.QMessageBox(QtGui.QMessageBox.Question,
                                "VisTrails",
                                "File exists. Overwrite?",
                                (QtGui.QMessageBox.Yes |
                                 QtGui.QMessageBox.No),
                                parent)
        if msg.exec_() == QtGui.QMessageBox.No:
            return None
    dirName = os.path.dirname(f)
    setattr(get_vistrails_persistent_configuration(), 'fileDirectory', dirName)
    setattr(get_vistrails_configuration(), 'fileDirectory', dirName)
    vistrails.core.system.set_vistrails_file_directory(dirName)
    return FileLocator(f)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:41,代码来源:locator.py


示例12: __init__

    def __init__(self):
        Module.__init__(self)

        config = get_vistrails_persistent_configuration()
        if config.check('webRepositoryURL'):
            self.base_url = config.webRepositoryURL
        else:
            raise ModuleError(self,
                              ("No webRepositoryURL value defined"
                               " in the Expert Configuration"))

        # check if we are running in server mode
        # this effects how the compute method functions
        if config.check('isInServerMode'):
            self.is_server = bool(config.isInServerMode)
        else:
            self.is_server = False

        # TODO: this '/' check should probably be done in core/configuration.py
        if self.base_url[-1] == '/':
            self.base_url = self.base_url[:-1]
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:21,代码来源:init.py


示例13: delete_job

 def delete_job(self, controller, version_id=None, all=False):
     if all:
         for k in self.workflowItems.keys():
             workflow = self.workflowItems[k]
             if workflow.controller is controller:
                 self.jobView.takeTopLevelItem(
                     self.jobView.indexOfTopLevelItem(
                         self.workflowItems[k]))
                 del self.workflowItems[k]
         return
     if not version_id:
         version_id = controller.current_version
     if controller.locator:
         conf = configuration.get_vistrails_configuration()
         if not conf.has('runningJobsList') or not conf.runningJobsList:
             conf_jobs = []
         else:
             conf_jobs = conf.runningJobsList.split(';')
         if not conf_jobs:
             conf_jobs = []
         url = controller.locator.to_url()
         if '?' in url:
             url += '&workflow=%s' % version_id
         else:
             url += '?workflow=%s' % version_id
         if url in conf_jobs:
             conf_jobs.remove(url)
             conf.runningJobsList = ';'.join(conf_jobs)
             configuration.get_vistrails_persistent_configuration(
                 ).runningJobsList = conf.runningJobsList
         name = controller.vistrail.locator.short_name
     else:
         name = 'Untitled.vt'
     if (name, version_id) in self.workflowItems:
         self.jobView.takeTopLevelItem(
             self.jobView.indexOfTopLevelItem(
                 self.workflowItems[(name, version_id)]))
         del self.workflowItems[(name, version_id)]
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:38,代码来源:job_monitor.py


示例14: set_refresh

    def set_refresh(self, refresh=0):
        """Changes the timer time.

        Called when the QComboBox self.interval changes. Updates the
        configuration and restarts the timer.
        """
        self.updating_now = True
        refresh = str(refresh) if refresh else '0'
        if refresh in dict(refresh_states):
            refresh = dict(refresh_states)[refresh]
            self.interval.setEditText(str(refresh))
        else:
            refresh = int(refresh)
        if refresh:
            if self.timer_id is not None:
                self.killTimer(self.timer_id)
            self.timer_id = self.startTimer(refresh*1000)
        else:
            if self.timer_id:
                self.killTimer(self.timer_id)
                self.timer_id = None
        get_vistrails_configuration().jobCheckInterval = refresh
        get_vistrails_persistent_configuration().jobCheckInterval = refresh
        self.updating_now = False
开发者ID:anukat2015,项目名称:VisTrails,代码行数:24,代码来源:job_monitor.py


示例15: create_configuration_tab

 def create_configuration_tab(self):
     return QConfigurationWidget(self,
                                 get_vistrails_persistent_configuration(),
                                 get_vistrails_configuration())
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:4,代码来源:preferences.py


示例16: add_job

    def add_job(self, controller, error, prev='', workflow=None):
        """ Adds job recursively """
        added = False
        if not prev:
            if controller.vistrail.locator:
                name = controller.vistrail.locator.short_name
            else:
                name = 'Untitled.vt'
            version_id = controller.current_version
            if (name, version_id) not in self.workflowItems:
                workflow = QWorkflowItem(controller, error, self.jobView)
                self.jobView.addTopLevelItem(workflow)
                self.workflowItems[(name, version_id)] = workflow

                # save job to configuration
                if controller.vistrail.locator:
                    conf = configuration.get_vistrails_configuration()
                    if not conf.has('runningJobsList') or not conf.runningJobsList:
                        conf_jobs = []
                    else:
                        conf_jobs = conf.runningJobsList.split(';')
                    if not conf_jobs:
                        conf_jobs = []
                    url = controller.vistrail.locator.to_url()
                    if '?' in url:
                        url += '&workflow=%d' % version_id
                    else:
                        url += '?workflow=%d' % version_id
                    if not url in conf_jobs:
                        conf_jobs.append(str(url))
                        conf.runningJobsList = ';'.join(conf_jobs)
                        configuration.get_vistrails_persistent_configuration(
                                      ).runningJobsList = conf.runningJobsList
            else:
                workflow = self.workflowItems[(name, version_id)]
        job_name = ((prev+'.') if prev else '') + error.module.__class__.__name__

        if not error.children:
            if not error.queue:
                # We allow jobs without queue objects, but they will
                # have to be checked by re-executing the entire workflow
                workflow.has_queue = False
                workflow.setIcon(0, theme.get_current_theme().JOB_SCHEDULED)
                workflow.setToolTip(0, 'To check this workflow it must be re-executed. Make sure "Run To Check" is checked.')

                #return False
            # remove any previous instance of this job, if name is shorter
            if id(error) in workflow.jobs and \
               len(job_name) > len(workflow.jobs[id(error)].text(0)):
                workflow.takeChild(workflow.indexOfChild(
                  workflow.jobs[id(error)]))
                del workflow.jobs[id(error)]
            # if we did not keep an already existing job, add it
            if id(error) not in workflow.jobs:
                job = QJobItem(job_name, error)
                workflow.addChild(job)
                workflow.jobs[id(error)] = job
                workflow.countJobs()
                return True
        else:
            for child in error.children:
                result = self.add_job(controller, child, job_name, workflow)
                if result:
                    added = True
        return added
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:65,代码来源:job_monitor.py


示例17: autorunToggled

 def autorunToggled(self, value):
     get_vistrails_configuration().jobAutorun = value
     get_vistrails_persistent_configuration().jobAutorun = value
开发者ID:anukat2015,项目名称:VisTrails,代码行数:3,代码来源:job_monitor.py


示例18: get_global_setting

 def get_global_setting(cls, k):
     config = get_vistrails_persistent_configuration().outputDefaultSettings
     return cls.get_from_config(config, k)
开发者ID:Nikea,项目名称:VisTrails,代码行数:3,代码来源:output_modules.py


示例19: show_question

def show_question(which_files, has_distro_pkg, has_pip):
    if isinstance(which_files, basestring):
        which_files = [which_files]
    if qt_available():
        from PyQt4 import QtCore, QtGui
        dialog = QtGui.QDialog()
        dialog.setWindowTitle("Required packages missing")
        layout = QtGui.QVBoxLayout()

        label = QtGui.QLabel(
                "One or more required packages are missing: %s. VisTrails can "
                "automatically install them. If you click OK, VisTrails will "
                "need administrator privileges, and you might be asked for "
                "the administrator password." % (" ".join(which_files)))
        label.setWordWrap(True)
        layout.addWidget(label)

        if pip_installed and has_pip:
            use_pip = QtGui.QCheckBox("Use pip")
            use_pip.setChecked(
                not has_distro_pkg or (
                    has_pip and
                    getattr(get_vistrails_configuration(),
                            'installBundlesWithPip')))
            use_pip.setEnabled(has_distro_pkg and has_pip)
            layout.addWidget(use_pip)

            remember_align = QtGui.QHBoxLayout()
            remember_align.addSpacing(20)
            remember_pip = QtGui.QCheckBox("Remember my choice")
            remember_pip.setChecked(False)
            remember_pip.setEnabled(use_pip.isEnabled())
            remember_align.addWidget(remember_pip)
            layout.addLayout(remember_align)
        elif has_pip:
            label = QtGui.QLabel("pip package is available but pip is not installed")
            layout.addWidget(label)
        buttons = QtGui.QDialogButtonBox(
                QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
        QtCore.QObject.connect(buttons, QtCore.SIGNAL('accepted()'),
                               dialog, QtCore.SLOT('accept()'))
        QtCore.QObject.connect(buttons, QtCore.SIGNAL('rejected()'),
                               dialog, QtCore.SLOT('reject()'))
        layout.addWidget(buttons)

        dialog.setLayout(layout)
        hide_splash_if_necessary()
        if dialog.exec_() != QtGui.QDialog.Accepted:
            return False
        else:
            if pip_installed and has_pip:
                if remember_pip.isChecked():
                    setattr(get_vistrails_persistent_configuration(),
                            'installBundlesWithPip',
                            use_pip.isChecked())

                if use_pip.isChecked():
                    return 'pip'
            return 'distro'
    else:
        print "\nRequired package(s) missing: %s" % (" ".join(which_files))
        print ("A required package is missing, but VisTrails can "
               "automatically install it. "
               "If you say Yes, VisTrails will need "
               "administrator privileges, and you "
               "might be asked for the administrator password.")
        if has_distro_pkg:
            print "(VisTrails will use your distribution's package manager)"
        else:
            print "(VisTrails will use the 'pip' installer)"
        print "Give VisTrails permission to try to install package? (y/N)"
        v = raw_input().upper()
        if v == 'Y' or v == 'YES':
            if has_distro_pkg:
                return 'distro'
            else:
                return 'pip'
开发者ID:hjanime,项目名称:VisTrails,代码行数:77,代码来源:installbundle.py


示例20: showEdits

 def showEdits(self, checked):
     get_vistrails_configuration().showInlineParameterWidgets = checked
     get_vistrails_persistent_configuration().showInlineParameterWidgets = checked
     scene = self.controller.current_pipeline_scene
     scene.setupScene(self.controller.current_pipeline)
开发者ID:Nikea,项目名称:VisTrails,代码行数:5,代码来源:module_info.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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