mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[view.qt] adding log statistics when filtering packages
This commit is contained in:
@@ -6,6 +6,7 @@ import traceback
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from datetime import datetime, timedelta
|
||||
from io import StringIO
|
||||
from logging import Logger
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
from typing import List, Type, Set, Tuple, Optional
|
||||
@@ -961,8 +962,9 @@ class ApplyFilters(AsyncAction):
|
||||
|
||||
signal_table = pyqtSignal(object)
|
||||
|
||||
def __init__(self, i18n: I18n, filters: dict = None, pkgs: List[PackageView] = None):
|
||||
def __init__(self, i18n: I18n, logger: Logger, filters: dict = None, pkgs: List[PackageView] = None):
|
||||
super(ApplyFilters, self).__init__(i18n=i18n)
|
||||
self.logger = logger
|
||||
self.pkgs = pkgs
|
||||
self.filters = filters
|
||||
self.wait_table_update = False
|
||||
@@ -972,6 +974,7 @@ class ApplyFilters(AsyncAction):
|
||||
|
||||
def run(self):
|
||||
if self.pkgs:
|
||||
ti = time.time()
|
||||
pkgs_info = commons.new_pkgs_info()
|
||||
|
||||
name_filtering = bool(self.filters['name'])
|
||||
@@ -987,6 +990,8 @@ class ApplyFilters(AsyncAction):
|
||||
|
||||
self.wait_table_update = True
|
||||
self.signal_table.emit(pkgs_info)
|
||||
tf = time.time()
|
||||
self.logger.info(f"Took {tf - ti:.4f} seconds to filter packages")
|
||||
|
||||
while self.wait_table_update:
|
||||
super(ApplyFilters, self).msleep(5)
|
||||
|
||||
@@ -344,7 +344,7 @@ class ManageWindow(QWidget):
|
||||
self.thread_custom_action = self._bind_async_action(CustomAction(manager=self.manager, i18n=self.i18n), finished_call=self._finish_execute_custom_action)
|
||||
self.thread_screenshots = self._bind_async_action(ShowScreenshots(i18n, self.manager), finished_call=self._finish_show_screenshots)
|
||||
|
||||
self.thread_apply_filters = ApplyFilters(i18n)
|
||||
self.thread_apply_filters = ApplyFilters(i18n=i18n, logger=logger)
|
||||
self.thread_apply_filters.signal_finished.connect(self._finish_apply_filters)
|
||||
self.thread_apply_filters.signal_table.connect(self._update_table_and_upgrades)
|
||||
self.signal_table_update.connect(self.thread_apply_filters.stop_waiting)
|
||||
|
||||
Reference in New Issue
Block a user