mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[ui] improvement -> faster initialization dialog: improved the way it checks for finished tasks
This commit is contained in:
@@ -51,7 +51,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- Snap
|
- Snap
|
||||||
- full support refactored to use the Snapd socket instead of the Ubuntu's old Snap API (which was recently disabled). Now the 'read' operations are faster, a only the icon is cached to the disk.
|
- full support refactored to use the Snapd socket instead of the Ubuntu's old Snap API (which was recently disabled). Now the 'read' operations are faster, a only the icon is cached to the disk.
|
||||||
|
|
||||||
- minor UI improvements
|
- UI
|
||||||
|
- faster initialization dialog: improved the way it checks for finished tasks
|
||||||
|
- minor improvements
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- AppImage
|
- AppImage
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Prepare(QThread, TaskManager):
|
|||||||
signal_register = pyqtSignal(str, str, object)
|
signal_register = pyqtSignal(str, str, object)
|
||||||
signal_update = pyqtSignal(str, float, str)
|
signal_update = pyqtSignal(str, float, str)
|
||||||
signal_finished = pyqtSignal(str)
|
signal_finished = pyqtSignal(str)
|
||||||
signal_started = pyqtSignal()
|
signal_started = pyqtSignal(int)
|
||||||
signal_ask_password = pyqtSignal()
|
signal_ask_password = pyqtSignal()
|
||||||
signal_output = pyqtSignal(str, str)
|
signal_output = pyqtSignal(str, str)
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ class Prepare(QThread, TaskManager):
|
|||||||
self.context = context
|
self.context = context
|
||||||
self.waiting_password = False
|
self.waiting_password = False
|
||||||
self.password_response = None
|
self.password_response = None
|
||||||
|
self._registered = 0
|
||||||
|
|
||||||
def ask_password(self) -> Tuple[str, bool]:
|
def ask_password(self) -> Tuple[str, bool]:
|
||||||
self.waiting_password = True
|
self.waiting_password = True
|
||||||
@@ -58,7 +59,7 @@ class Prepare(QThread, TaskManager):
|
|||||||
QCoreApplication.exit(1)
|
QCoreApplication.exit(1)
|
||||||
|
|
||||||
self.manager.prepare(self, root_pwd, None)
|
self.manager.prepare(self, root_pwd, None)
|
||||||
self.signal_started.emit()
|
self.signal_started.emit(self._registered)
|
||||||
|
|
||||||
def update_progress(self, task_id: str, progress: float, substatus: str):
|
def update_progress(self, task_id: str, progress: float, substatus: str):
|
||||||
self.signal_update.emit(task_id, progress, substatus)
|
self.signal_update.emit(task_id, progress, substatus)
|
||||||
@@ -67,6 +68,7 @@ class Prepare(QThread, TaskManager):
|
|||||||
self.signal_output.emit(task_id, output)
|
self.signal_output.emit(task_id, output)
|
||||||
|
|
||||||
def register_task(self, id_: str, label: str, icon_path: str):
|
def register_task(self, id_: str, label: str, icon_path: str):
|
||||||
|
self._registered += 1
|
||||||
self.signal_register.emit(id_, label, icon_path)
|
self.signal_register.emit(id_, label, icon_path)
|
||||||
|
|
||||||
def finish_task(self, task_id: str):
|
def finish_task(self, task_id: str):
|
||||||
@@ -78,23 +80,19 @@ class CheckFinished(QThread):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(CheckFinished, self).__init__()
|
super(CheckFinished, self).__init__()
|
||||||
self.total = None
|
self.total = 0
|
||||||
self.finished = None
|
self.finished = 0
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.sleep(3)
|
|
||||||
while True:
|
while True:
|
||||||
if self.total == self.finished:
|
if self.total == self.finished:
|
||||||
break
|
break
|
||||||
|
|
||||||
self.msleep(10)
|
self.msleep(5)
|
||||||
|
|
||||||
self.signal_finished.emit()
|
self.signal_finished.emit()
|
||||||
|
|
||||||
def update(self, total: int, finished: int):
|
def update(self, finished: int):
|
||||||
if total is not None:
|
|
||||||
self.total = total
|
|
||||||
|
|
||||||
if finished is not None:
|
if finished is not None:
|
||||||
self.finished = finished
|
self.finished = finished
|
||||||
|
|
||||||
@@ -116,7 +114,7 @@ class EnableSkip(QThread):
|
|||||||
|
|
||||||
class PreparePanel(QWidget, TaskManager):
|
class PreparePanel(QWidget, TaskManager):
|
||||||
|
|
||||||
signal_status = pyqtSignal(object, object)
|
signal_status = pyqtSignal(int)
|
||||||
signal_password_response = pyqtSignal(str, bool)
|
signal_password_response = pyqtSignal(str, bool)
|
||||||
|
|
||||||
def __init__(self, context: ApplicationContext, manager: SoftwareManager, screen_size: QSize, i18n: I18n, manage_window: QWidget):
|
def __init__(self, context: ApplicationContext, manager: SoftwareManager, screen_size: QSize, i18n: I18n, manage_window: QWidget):
|
||||||
@@ -133,7 +131,7 @@ class PreparePanel(QWidget, TaskManager):
|
|||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.tasks = {}
|
self.tasks = {}
|
||||||
self.output = {}
|
self.output = {}
|
||||||
self.ntasks = 0
|
self.added_tasks = 0
|
||||||
self.ftasks = 0
|
self.ftasks = 0
|
||||||
self.self_close = False
|
self.self_close = False
|
||||||
|
|
||||||
@@ -259,23 +257,24 @@ class PreparePanel(QWidget, TaskManager):
|
|||||||
self.prepare_thread.start()
|
self.prepare_thread.start()
|
||||||
centralize(self)
|
centralize(self)
|
||||||
|
|
||||||
def start(self):
|
def start(self, tasks: int):
|
||||||
self.ref_bt_close.setVisible(True)
|
self.check_thread.total = tasks
|
||||||
self.check_thread.start()
|
self.check_thread.start()
|
||||||
self.skip_thread.start()
|
self.skip_thread.start()
|
||||||
|
|
||||||
self.ref_progress_bar.setVisible(True)
|
|
||||||
self.progress_thread.start()
|
self.progress_thread.start()
|
||||||
|
|
||||||
|
self.ref_bt_close.setVisible(True)
|
||||||
|
self.ref_progress_bar.setVisible(True)
|
||||||
|
|
||||||
def closeEvent(self, QCloseEvent):
|
def closeEvent(self, QCloseEvent):
|
||||||
if not self.self_close:
|
if not self.self_close:
|
||||||
QCoreApplication.exit()
|
QCoreApplication.exit()
|
||||||
|
|
||||||
def register_task(self, id_: str, label: str, icon_path: str):
|
def register_task(self, id_: str, label: str, icon_path: str):
|
||||||
self.ntasks += 1
|
self.added_tasks += 1
|
||||||
self.table.setRowCount(self.ntasks)
|
self.table.setRowCount(self.added_tasks)
|
||||||
|
task_row = self.added_tasks - 1
|
||||||
task_row = self.ntasks - 1
|
|
||||||
|
|
||||||
icon_widget = QWidget()
|
icon_widget = QWidget()
|
||||||
icon_widget.setLayout(QHBoxLayout())
|
icon_widget.setLayout(QHBoxLayout())
|
||||||
@@ -342,8 +341,6 @@ class PreparePanel(QWidget, TaskManager):
|
|||||||
'lb_sub': lb_sub,
|
'lb_sub': lb_sub,
|
||||||
'finished': False}
|
'finished': False}
|
||||||
|
|
||||||
self.signal_status.emit(self.ntasks, self.ftasks)
|
|
||||||
|
|
||||||
def update_progress(self, task_id: str, progress: float, substatus: str):
|
def update_progress(self, task_id: str, progress: float, substatus: str):
|
||||||
task = self.tasks[task_id]
|
task = self.tasks[task_id]
|
||||||
|
|
||||||
@@ -385,9 +382,9 @@ class PreparePanel(QWidget, TaskManager):
|
|||||||
self._resize_columns()
|
self._resize_columns()
|
||||||
|
|
||||||
self.ftasks += 1
|
self.ftasks += 1
|
||||||
self.signal_status.emit(self.ntasks, self.ftasks)
|
self.signal_status.emit(self.ftasks)
|
||||||
|
|
||||||
if self.ntasks == self.ftasks:
|
if self.table.rowCount() == self.ftasks:
|
||||||
self.label_top.setText(self.i18n['ready'].capitalize())
|
self.label_top.setText(self.i18n['ready'].capitalize())
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user