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


Python application.get_vistrails_application函数代码示例

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


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

示例1: switch_to_query_view

def switch_to_query_view():
    """switch_to_query_view():

    Changes current viewing mode to query view in the builder window.

    """
    get_vistrails_application().builderWindow.qactions['search'].trigger()
开发者ID:hjanime,项目名称:VisTrails,代码行数:7,代码来源:__init__.py

示例2: switch_to_mashup_view

def switch_to_mashup_view():
    """switch_to_mashup_view():

    Changes current viewing mode to mashup view in the builder window.

    """
    get_vistrails_application().builderWindow.qactions['mashup'].trigger()
开发者ID:hjanime,项目名称:VisTrails,代码行数:7,代码来源:__init__.py

示例3: copyAll

 def copyAll(self):
     """ copy all messages to clipboard """
     texts = []
     for i in range(self.list.count()):
         texts.append(self.list.item(i).data(32))
     text = "\n".join(texts)
     get_vistrails_application().clipboard().setText(text)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:7,代码来源:debug.py

示例4: switch_to_pipeline_view

def switch_to_pipeline_view():
    """switch_to_pipeline_view():

    Changes current viewing mode to pipeline view in the builder window.

    """
    get_vistrails_application().builderWindow.qactions['pipeline'].trigger()
开发者ID:hjanime,项目名称:VisTrails,代码行数:7,代码来源:__init__.py

示例5: 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

示例6: write

    def write(self, s):
        """write(s) -> None
        adds the string s to the message list and displays it
        """
        # adds the string s to the list and
        s = s.strip()
        msgs = s.split("\n")

        if len(msgs) <= 3:
            msgs.append("Error logging message: invalid log format")
            s += "\n" + msgs[3]
        if not len(msgs[3].strip()):
            msgs[3] = "Unknown Error"
            s = "\n".join(msgs)
        text = msgs[3]
        item = QtGui.QListWidgetItem(text)
        item.setData(32, s)
        item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
        self.list.addItem(item)
        item.setForeground(CurrentTheme.DEBUG_COLORS[msgs[0]])
        self.list.setItemHidden(item, not self.levels[msgs[0]].isChecked())
        alwaysShowDebugPopup = getattr(get_vistrails_configuration(), "alwaysShowDebugPopup", False)
        if msgs[0] == "CRITICAL":
            if self.isVisible() and not alwaysShowDebugPopup:
                self.raise_()
                self.activateWindow()
                modal = get_vistrails_application().activeModalWidget()
                if modal:
                    # need to beat modal window
                    self.showMessageBox(item)
            else:
                self.showMessageBox(item)
开发者ID:lumig242,项目名称:VisTrailsRecommendation,代码行数:32,代码来源:debug.py

示例7: test_new_vistrail_button_states

 def test_new_vistrail_button_states(self):
     assert get_vistrails_application().builderWindow.qactions['newVistrail'].isEnabled()
     assert not get_vistrails_application().builderWindow.qactions['closeVistrail'].isEnabled()
     assert not get_vistrails_application().builderWindow.qactions['saveFile'].isEnabled()
     assert not get_vistrails_application().builderWindow.qactions['saveFileAs'].isEnabled()
     view = new_vistrail()
     assert get_vistrails_application().builderWindow.qactions['newVistrail'].isEnabled()
     assert get_vistrails_application().builderWindow.qactions['closeVistrail'].isEnabled()
     self.assertEqual(get_vistrails_application().builderWindow.qactions['saveFile'].isEnabled(),
                      view.has_changes())
     assert get_vistrails_application().builderWindow.qactions['saveFileAs'].isEnabled()
开发者ID:hjanime,项目名称:VisTrails,代码行数:11,代码来源:__init__.py

示例8: get_current_vistrail_view

def get_current_vistrail_view():
    """get_current_vistrail():

    Returns the currently selected vistrail view.

    """
    view = get_vistrails_application().builderWindow.get_current_view()
    if view is None:
        raise NoVistrail
    return view    
开发者ID:hjanime,项目名称:VisTrails,代码行数:10,代码来源:__init__.py

示例9: get_builder_window

def get_builder_window():
    """get_builder_window():

    returns the main VisTrails GUI window

    raises NoGUI.

    """
    try:
        return get_vistrails_application().builderWindow
    except AttributeError:
        raise NoGUI
开发者ID:hjanime,项目名称:VisTrails,代码行数:12,代码来源:__init__.py

示例10: get_current_controller

def get_current_controller():
    """get_current_controller():

    returns the VistrailController of the currently selected vistrail.

    raises NoVistrail.

    """
    try:
        return get_vistrails_application().builderWindow.get_current_controller()
    except AttributeError:
        raise NoVistrail
开发者ID:hjanime,项目名称:VisTrails,代码行数:12,代码来源:__init__.py

示例11: getFileRelativeToCurrentVT

def getFileRelativeToCurrentVT(fname, curModule=None):
    #  This is three step approach:
    #  step 1: if fname exists assume it's the one we want and return it.
    #  step 2: Look for the file relative to the current VT.
    #        In effect loop through all the sibling and descendant folders
    #        of the vt file's parent directory and look for the base filename in each.
    #        If we find an identically named file hope for the best and return it.
    #  step 3: Do what we did in step 2 but relative to the current session folder.
    #
    #  If no fname is found in the above three steps raise an error.
    def couldntFindFile():
        msg = "Could not find file: " + fname + "\nPlease point to valid location for this file."
        if curModule is None:
            raise Exception(msg)
        else:
            raise ModuleError(curModule, msg)

    try:
        fname = fname.replace ("\\", "/")
        #  step 1
        if os.path.exists(fname):
            return fname
        elif fname == '':
            return fname

        #  step 2 (and then step3)
        try:
            app = application.get_vistrails_application()()
            curlocator = app.get_vistrail().locator.name
            curVTdir = os.path.split(curlocator)[0]
        except:
            curVTdir = ""

        root_dir, justfname = os.path.split(fname)
        if justfname.lower() == "hdr.adf":
            justfname = os.path.sep.join([os.path.split(root_dir)[1], justfname])
        for rootdir in [curVTdir, get_root_dir()]:
            if os.path.exists(os.path.join(rootdir, justfname)):
                return os.path.join(rootdir, justfname)
            for root, dirnames, filenames in os.walk(rootdir):
                for dirname in dirnames:
                    if os.path.exists(os.path.join(root, dirname, justfname)):
                        return os.path.join(root, dirname, justfname)

        #  we did our best but couldn't find the file
        couldntFindFile()

    except Exception, e:
        #  if something goes wrong we couldn't find the file throw an error
        couldntFindFile()
开发者ID:ColinTalbert,项目名称:GeoDataPortal,代码行数:50,代码来源:utils.py

示例12: write

    def write(self, s):
        """write(s) -> None
        adds the string s to the message list and displays it
        """
        # adds the string s to the list and 
        s = s.strip()
        msgs = s.split('\n')

        if len(msgs)<=3:
            msgs.append('Unknown Error')
            s += '\n' + msgs[3]
        if not len(msgs[3].strip()):
            msgs[3] = "Unknown Error"
            s = '\n'.join(msgs)
        text = msgs[3]
        item = QtGui.QListWidgetItem(text)
        item.setData(32, s)
        item.setFlags(item.flags()&~QtCore.Qt.ItemIsEditable)
        self.list.addItem(item)
        if msgs[0] == "INFO":
            item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_INFO_COLOR))
            self.list.setItemHidden(item, not self.infoFilter.isChecked())
        elif msgs[0] == "WARNING":
            item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_WARNING_COLOR))
            self.list.setItemHidden(item, not self.warningFilter.isChecked())
        elif msgs[0] == "CRITICAL":
            item.setForeground(QtGui.QBrush(CurrentTheme.DEBUG_CRITICAL_COLOR))
            self.list.setItemHidden(item, not self.criticalFilter.isChecked())
        if self.isVisible() and not \
          getattr(get_vistrails_configuration(),'alwaysShowDebugPopup',False):
            self.raise_()
            self.activateWindow()
            modal = get_vistrails_application().activeModalWidget()
            if modal:
                # need to beat modal window
                self.showMessageBox(item)
        else:
            self.showMessageBox(item)
开发者ID:cjh1,项目名称:VisTrails,代码行数:38,代码来源:debug.py

示例13: test_detach_vistrail

 def test_detach_vistrail(self):
     view = new_vistrail()
     get_vistrails_application().builderWindow.detach_view(view)
     get_vistrails_application().builderWindow.attach_view(view)
     close_vistrail(view)
开发者ID:hjanime,项目名称:VisTrails,代码行数:5,代码来源:__init__.py

示例14: new_vistrail

def new_vistrail():
    # Returns VistrailView - remember to be consistent about it..
    get_vistrails_application().builderWindow.new_vistrail(False)
    result = get_vistrails_application().builderWindow.get_current_view()
    return result
开发者ID:hjanime,项目名称:VisTrails,代码行数:5,代码来源:__init__.py

示例15: close_current_vistrail

def close_current_vistrail(quiet=False):
    get_vistrails_application().builderWindow.close_vistrail(get_current_vistrail_view(), quiet=quiet)
开发者ID:hjanime,项目名称:VisTrails,代码行数:2,代码来源:__init__.py


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