From dfd987f1f4c92059fbe15d9b297af8a51540101e Mon Sep 17 00:00:00 2001 From: regeciovad Date: Mon, 26 Oct 2015 09:53:45 +0100 Subject: [PATCH] Gui - cleanupPage in ImportPage --- rpg/gui/wizard.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rpg/gui/wizard.py b/rpg/gui/wizard.py index 3056719..d2488a8 100644 --- a/rpg/gui/wizard.py +++ b/rpg/gui/wizard.py @@ -60,7 +60,7 @@ def __init__(self, base, parent=None): self.setPage(self.PageCoprDistro, CoprDistroPage(self)) self.setPage(self.PageCoprBuild, CoprBuildPage(self)) self.setPage(self.PageCoprFinal, CoprFinalPage(self)) - self.setStartId(self.PageImport) + self.setStartId(self.PageIntro) class IntroPage(QtWidgets.QWizardPage): @@ -235,16 +235,24 @@ def validatePage(self): self.base.target_distro = self.DistroEdit.currentText() self.base.load_project_from_url(self.importEdit.text().strip()) self.base.run_extracted_source_analysis() - new_thread = Thread( + self.new_thread = Thread( target=self.base.fetch_repos, args=(self.base.target_distro, self.base.target_arch)) - new_thread.start() + self.new_thread.start() self.importEdit.setStyleSheet("") return True else: self.importEdit.setStyleSheet(self.redQLineEdit) return False + def cleanupPage(self): + """ Stops the thread (there are no official way to stop thread. + This will unlocked thread and it will be stopped + with GUI - without error). """ + self.new_thread._tstate_lock = None + self.new_thread._stop() + self.new_thread.join() + def nextId(self): ''' [int] Function that determines the next page after the current one - returns integer value and then checks, which value is page"