diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index ed430340..b0046a57 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -8,7 +8,7 @@ from pathlib import Path from typing import List, Type, Set, Tuple, Optional import requests -from PyQt5.QtCore import QThread, pyqtSignal +from PyQt5.QtCore import QThread, pyqtSignal, QObject from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QWidget @@ -1100,5 +1100,12 @@ class StartAsyncAction(QThread): signal_start = pyqtSignal() + def __init__(self, delay_in_milis: int = -1, parent: Optional[QObject] = None): + super(StartAsyncAction, self).__init__(parent=parent) + self.delay = delay_in_milis + def run(self): + if self.delay > 0: + self.msleep(self.delay) + self.signal_start.emit() diff --git a/bauh/view/qt/window.py b/bauh/view/qt/window.py index da30cc52..2d33c0c4 100755 --- a/bauh/view/qt/window.py +++ b/bauh/view/qt/window.py @@ -347,7 +347,7 @@ class ManageWindow(QWidget): self.thread_ignore_updates = IgnorePackageUpdates(manager=self.manager) self._bind_async_action(self.thread_ignore_updates, finished_call=self.finish_ignore_updates) - self.thread_reload = StartAsyncAction() + self.thread_reload = StartAsyncAction(delay_in_milis=5) self.thread_reload.signal_start.connect(self._reload) self.container_bottom = QWidget()