コード例 #1
0
ファイル: repository.py プロジェクト: painter1/vistrails
    def clicked_on_login(self):
        """
        Attempts to log into web repository
        stores auth cookie for session
        """
        from gui.application import get_vistrails_application

        params = urllib.urlencode({
            'username': self.dialog.loginUser.text(),
            '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
        ]:
            self._login_status = "incorrect username or password"

        else:  # login successful
            self._login_status = "login successful"

            self.dialog.loginUser.setEnabled(False)
            self.loginPassword.setEnabled(False)
            self._login_button.setEnabled(False)
            self.saveLogin.setEnabled(False)
            self._logout_button.setEnabled(True)

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

            # remove assiciation 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.show_login_information()
コード例 #2
0
ファイル: preferences.py プロジェクト: CDAT/VisTrails
 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())
コード例 #3
0
ファイル: preferences.py プロジェクト: imclab/vistrails
 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())
コード例 #4
0
    def clicked_on_login(self):
        """
        Attempts to log into web repository
        stores auth cookie for session
        """
        from gui.application import get_vistrails_application

        params = urllib.urlencode({'username':self.dialog.loginUser.text(),
                                   '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]:
            self._login_status = "incorrect username or password"

        else: # login successful
            self._login_status = "login successful"

            self.dialog.loginUser.setEnabled(False)
            self.loginPassword.setEnabled(False)
            self._login_button.setEnabled(False)
            self.saveLogin.setEnabled(False)
            self._logout_button.setEnabled(True)

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

            # remove assiciation 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.show_login_information()
コード例 #5
0
ファイル: preferences.py プロジェクト: imclab/vistrails
 def create_thumbs_tab(self):
     """ create_thumbs_tab() -> QThumbnailConfiguration
     
     """
     return QThumbnailConfiguration(self,
                                    get_vistrails_persistent_configuration(),
                                    get_vistrails_configuration())
コード例 #6
0
ファイル: preferences.py プロジェクト: CDAT/VisTrails
 def create_thumbs_tab(self):
     """ create_thumbs_tab() -> QThumbnailConfiguration
     
     """
     return QThumbnailConfiguration(
         self, get_vistrails_persistent_configuration(),
         get_vistrails_configuration())
コード例 #7
0
ファイル: preferences.py プロジェクト: CDAT/VisTrails
 def create_general_tab(self):
     """ create_general_tab() -> QGeneralConfiguration
     
     """
     return QGeneralConfiguration(self,
                                  get_vistrails_persistent_configuration(),
                                  get_vistrails_configuration())
コード例 #8
0
ファイル: preferences.py プロジェクト: imclab/vistrails
 def create_general_tab(self):
     """ create_general_tab() -> QGeneralConfiguration
     
     """
     return QGeneralConfiguration(self,
                                  get_vistrails_persistent_configuration(),
                                  get_vistrails_configuration())
コード例 #9
0
    def uvcdatAutoExecuteActionTriggered(self, checked):
        """uvcdatAutoExecuteActionTriggered(checked: boolean) -> None
        When the check state changes the configuration needs to be updated.

        """
        from core.configuration import get_vistrails_persistent_configuration,\
            get_vistrails_configuration
        from gui.application import get_vistrails_application
        _app = get_vistrails_application()
        get_vistrails_persistent_configuration().uvcdat.autoExecute = checked
        get_vistrails_configuration().uvcdat.autoExecute = checked
        _app.save_configuration()
コード例 #10
0
 def uvcdatAutoExecuteActionTriggered(self, checked):
     """uvcdatAutoExecuteActionTriggered(checked: boolean) -> None 
     When the check state changes the configuration needs to be updated.
     
     """
     from core.configuration import get_vistrails_persistent_configuration,\
         get_vistrails_configuration
     from gui.application import get_vistrails_application
     _app = get_vistrails_application()
     get_vistrails_persistent_configuration().uvcdat.autoExecute = checked
     get_vistrails_configuration().uvcdat.autoExecute = checked
     _app.save_configuration()
コード例 #11
0
    def uvcdatMinimalThemeActionTriggered(self, checked):
        """uvcdatMinimalThemeActionTriggered(checked: boolean) -> None 
        When the check state changes the configuration needs to be updated.
        
        """

        from core.configuration import get_vistrails_persistent_configuration,\
            get_vistrails_configuration
        from gui.application import get_vistrails_application
        _app = get_vistrails_application()
        get_vistrails_persistent_configuration().uvcdat.theme = "Minimal"
        get_vistrails_configuration().uvcdat.theme = "Minimal"
        _app.save_configuration()
        self.uvcdat_show_changes_message()
コード例 #12
0
    def uvcdatMinimalThemeActionTriggered(self, checked):
        """uvcdatMinimalThemeActionTriggered(checked: boolean) -> None
        When the check state changes the configuration needs to be updated.

        """

        from core.configuration import get_vistrails_persistent_configuration,\
            get_vistrails_configuration
        from gui.application import get_vistrails_application
        _app = get_vistrails_application()
        get_vistrails_persistent_configuration().uvcdat.theme = "Minimal"
        get_vistrails_configuration().uvcdat.theme = "Minimal"
        _app.save_configuration()
        self.uvcdat_show_changes_message()
コード例 #13
0
ファイル: locator.py プロジェクト: painter1/vistrails
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(),
        core.system.vistrails_file_directory(),
        "VisTrails files (%s)\nOther files (*)" % suffixes)
    if fileName.isEmpty():
        return None
    filename = os.path.abspath(str(fileName))
    dirName = os.path.dirname(filename)
    setattr(get_vistrails_persistent_configuration(), 'fileDirectory', dirName)
    setattr(get_vistrails_configuration(), 'fileDirectory', dirName)
    core.system.set_vistrails_file_directory(dirName)
    return FileLocator(filename)
コード例 #14
0
    def __init__(self):
        HTTP.__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]
コード例 #15
0
ファイル: locator.py プロジェクト: painter1/vistrails
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...",
        core.system.vistrails_file_directory(),
        "VisTrails files (%s)" % suffixes, # filetypes.strip()
        None,
        QtGui.QFileDialog.DontConfirmOverwrite)
    if fileName.isEmpty():
        return None
    f = str(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(str(f))
    setattr(get_vistrails_persistent_configuration(), 'fileDirectory', dirName)
    setattr(get_vistrails_configuration(), 'fileDirectory', dirName)
    core.system.set_vistrails_file_directory(dirName)
    return FileLocator(f)
コード例 #16
0
ファイル: init.py プロジェクト: painter1/vistrails
    def __init__(self):
        HTTP.__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]
コード例 #17
0
ファイル: preferences.py プロジェクト: CDAT/VisTrails
 def create_configuration_tab(self):
     return QConfigurationWidget(self,
                                 get_vistrails_persistent_configuration(),
                                 get_vistrails_configuration(),
                                 self._status_bar)
コード例 #18
0
ファイル: preferences.py プロジェクト: imclab/vistrails
 def create_configuration_tab(self):
     return QConfigurationWidget(self,
                                 get_vistrails_persistent_configuration(),
                                 get_vistrails_configuration(),
                                 self._status_bar)