[fix][ui] using the sleep function wrongly within the Qt threads

This commit is contained in:
Vinicius Moreira
2020-06-25 14:48:50 -03:00
parent 9d86c97a80
commit 89989ab79d
6 changed files with 25 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
import datetime
import logging
import logging
import operator
import time
@@ -507,11 +507,7 @@ class ManageWindow(QWidget):
def stop_notifying_package_states(self):
if self.thread_notify_pkgs_ready.isRunning():
self.signal_stop_notifying.emit()
expires_at = datetime.datetime.now() + datetime.timedelta(seconds=5)
while datetime.datetime.now() < expires_at and self.thread_notify_pkgs_ready.isRunning():
time.sleep(0.1)
self.thread_notify_pkgs_ready.wait(1000)
def _update_table_and_upgrades(self, pkgs_info: dict):
self._update_table(pkgs_info=pkgs_info, signal=True)