Esempio n. 1
0
    def populate_owned_games(self):
        self.statusBar.showMessage("Waiting for Desura... Please Wait")
        try:
            if not self.set_current_account():
                if len(self.desuraAccountName_input.text()) > 0:
                    self.statusBar.showMessage("Invalid Desura Account")
                else:
                    self.statusBar.showMessage("")
                return
            self.ownedGames_list.clear()
            self.loading_dialog.setAccount(
                gameslist.username_from_profile_id(self.current_profileid))
            QApplication.processEvents()
            self.loading_dialog.setMaximum(
                len(gameslist.GamesList(self.current_profileid).get_games()))
            QApplication.processEvents()
            for game in gameslist.GamesList(
                    self.current_profileid).get_games():
                self.populate_qlistwidget(game, self.ownedGames_list, True)
                QApplication.processEvents()
                self.loading_dialog.increment(1, game.name)
                QApplication.processEvents()
                self.logger.info("Added Game {0}".format(game.name))
                self.statusBar.showMessage("Added Game {0}".format(game.name))
        except gameslist.PrivateProfileError:
            self.logger.error("Failed to load games -  Private Desura Profile")
            self.statusBar.showMessage(
                "Failed to load games - Private Desura Profiles not supported")

            error_message(
                "The Desura Profile {0} is set to Private. <br/>DesuraTools works only with public Desura Profiles."
                .format(self.current_profileid)).exec_()
            return

        except gameslist.NoSuchProfileError:
            self.logger.error(
                "Failed to load games - Desura account not found")
            self.statusBar.showMessage(
                "Failed to load games - Desura account not found")
            return
        except gameslist.InvalidDesuraProfileError:
            self.logger.error(
                "Failed to load games - Desura Profile ID invalid")

        self.ownedGames_list.customContextMenuRequested.connect(
            self.show_game_context)
        self.ownedGames_list.doubleClicked.connect(self.install_game)
        self.statusBar.showMessage(
            "All owned Desura games loaded for account {0}".format(
                gameslist.username_from_profile_id(self.current_profileid)))
        self.logger.info(
            "All owned Desura games loaded for Desura profile id {0}".format(
                self.current_profileid))
Esempio n. 2
0
    def verify_user(self, profileid=None):
        if profileid is None:
            profileid = self.current_profileid
        if len(profileid) == 0:
            return False

        try:
            username = gameslist.username_from_profile_id(profileid)
        except gameslist.NoSuchProfileError:
            return False

        if windows.desura_running(username):
            return True

        verify_dialog = QMessageBox()
        verify_dialog.setText(
            "<b>Verify your identity</b><br />Sign in to Desura to continue with account <b>{0}</b> to confirm your identity"
            .format(username))
        verify_dialog.setInformativeText(
            "<i>Waiting for Desura sign-in...</i>")
        verify_dialog.setWindowTitle("Sign into Desura to continue")
        verify_dialog.setStandardButtons(QMessageBox.Cancel)
        verify_dialog.setIcon(QMessageBox.Information)
        verify_dialog.setWindowFlags(Qt.CustomizeWindowHint
                                     | Qt.WindowTitleHint)
        desurawaiter = DesuraWaiter(username)
        desurawaiter.finished.connect(verify_dialog.close)
        desurawaiter.start()
        verify_dialog.exec_()
        if windows.desura_running(username):
            return True
        else:
            desurawaiter.terminate()
            return False
Esempio n. 3
0
    def verify_user(self, profileid=None):
        if profileid is None:
            profileid=self.current_profileid
        if len(profileid) == 0:
            return False

        try:
            username = gameslist.username_from_profile_id(profileid)
        except gameslist.NoSuchProfileError:
            return False

        if windows.desura_running(username):
            return True

        verify_dialog = QMessageBox()
        verify_dialog.setText("<b>Verify your identity</b><br />Sign in to Desura to continue with account <b>{0}</b> to confirm your identity".format(username))
        verify_dialog.setInformativeText("<i>Waiting for Desura sign-in...</i>")
        verify_dialog.setWindowTitle("Sign into Desura to continue")
        verify_dialog.setStandardButtons(QMessageBox.Cancel)
        verify_dialog.setIcon(QMessageBox.Information)
        verify_dialog.setWindowFlags(Qt.CustomizeWindowHint | Qt.WindowTitleHint)
        desurawaiter = DesuraWaiter(username)
        desurawaiter.finished.connect(verify_dialog.close)
        desurawaiter.start()
        verify_dialog.exec_()
        if windows.desura_running(username):
            return True
        else:
            desurawaiter.terminate()
            return False
Esempio n. 4
0
    def populate_owned_games(self):
        self.statusBar.showMessage("Waiting for Desura... Please Wait")
        try:
            if not self.set_current_account():
                if len(self.desuraAccountName_input.text()) > 0:
                    self.statusBar.showMessage("Invalid Desura Account")
                else:
                    self.statusBar.showMessage("")
                return
            self.ownedGames_list.clear()
            self.loading_dialog.setAccount(gameslist.username_from_profile_id(self.current_profileid))
            QApplication.processEvents()
            self.loading_dialog.setMaximum(len(gameslist.GamesList(self.current_profileid).get_games()))
            QApplication.processEvents()
            for game in gameslist.GamesList(self.current_profileid).get_games():
                self.populate_qlistwidget(game, self.ownedGames_list, True)
                QApplication.processEvents()
                self.loading_dialog.increment(1, game.name)
                QApplication.processEvents()
                self.logger.info("Added Game {0}".format(game.name))
                self.statusBar.showMessage("Added Game {0}".format(game.name))
        except gameslist.PrivateProfileError:
            self.logger.error("Failed to load games -  Private Desura Profile")
            self.statusBar.showMessage("Failed to load games - Private Desura Profiles not supported")

            error_message(
                "The Desura Profile {0} is set to Private. <br/>DesuraTools works only with public Desura Profiles."
                .format(self.current_profileid)
            ).exec_()
            return

        except gameslist.NoSuchProfileError:
            self.logger.error("Failed to load games - Desura account not found")
            self.statusBar.showMessage("Failed to load games - Desura account not found")
            return
        except gameslist.InvalidDesuraProfileError:
            self.logger.error("Failed to load games - Desura Profile ID invalid")

        self.ownedGames_list.customContextMenuRequested.connect(self.show_game_context)
        self.ownedGames_list.doubleClicked.connect(self.install_game)
        self.statusBar.showMessage("All owned Desura games loaded for account {0}".format(
            gameslist.username_from_profile_id(self.current_profileid))
        )
        self.logger.info("All owned Desura games loaded for Desura profile id {0}".format(self.current_profileid))
Esempio n. 5
0
 def set_current_account(self, profileid=None):
     if profileid is None:
         profileid = self.desuraAccountName_input.text()
     if not self.verify_user(profileid):
         return False
     try:
         gameslist.GamesList(profileid)
     except gameslist.InvalidDesuraProfileError:
         raise
     self.current_profileid = profileid
     self.logger.info("Set current profileid to {0}".format(self.current_profileid))
     self.setWindowTitle("DesuraTools - {0}".format(gameslist.username_from_profile_id(self.current_profileid)))
     return True
Esempio n. 6
0
 def set_current_account(self, profileid=None):
     if profileid is None:
         profileid = self.desuraAccountName_input.text()
     if not self.verify_user(profileid):
         return False
     try:
         gameslist.GamesList(profileid)
     except gameslist.InvalidDesuraProfileError:
         raise
     self.current_profileid = profileid
     self.logger.info("Set current profileid to {0}".format(
         self.current_profileid))
     self.setWindowTitle("DesuraTools - {0}".format(
         gameslist.username_from_profile_id(self.current_profileid)))
     return True