Exemple #1
0
    def handle(self):
        try:
            dialogs = UserDialogsFacade()
            basePath = dialogs.getExistingDirectory(
                self._model.gui, self.tr("Choose a repository base path"))

            if not basePath:
                raise Exception(
                    self.
                    tr("You haven't chosen existent directory. Operation canceled."
                       ))

            #QFileDialog returns forward slashes in windows! Because of this path should be normalized
            basePath = os.path.normpath(basePath)
            self._model.repo = RepoMgr(basePath)
            self._model.user = None
            self._model.loginRecentUser()

            stats.sendEvent("main_window.open_repo")

        except LoginError:
            self.__letUserLoginByHimself()

        except Exception as ex:
            show_exc_info(self._model.gui, ex)
Exemple #2
0
    def handle(self):
        try:
            action = self.sender()
            repoBasePath = action.repoBasePath

            currentUser = self._model.user
            assert currentUser is not None

            self._model.repo = RepoMgr(repoBasePath)

            try:
                self._model.loginUser(currentUser.login, currentUser.password)
                self._emitHandlerSignal(
                    HandlerSignals.STATUS_BAR_MESSAGE,
                    self.tr("Repository opened. Login succeded."),
                    STATUSBAR_TIMEOUT)

            except LoginError:
                self._model.user = None
                self._emitHandlerSignal(
                    HandlerSignals.STATUS_BAR_MESSAGE,
                    self.tr("Repository opened. Login failed."),
                    STATUSBAR_TIMEOUT)

            stats.sendEvent("main_window.open_favorite_repo")

        except Exception as ex:
            show_exc_info(self._model.gui, ex)
Exemple #3
0
    def setUp(self):
        self.repoBasePath = tests_context.TEST_REPO_BASE_PATH
        self.copyOfRepoBasePath = tests_context.COPY_OF_TEST_REPO_BASE_PATH

        if (os.path.exists(self.copyOfRepoBasePath)):
            shutil.rmtree(self.copyOfRepoBasePath)
        shutil.copytree(self.repoBasePath, self.copyOfRepoBasePath)

        self.repo = RepoMgr(self.copyOfRepoBasePath)