mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 05:54:15 +02:00
[ui] removing unused code
This commit is contained in:
@@ -470,37 +470,30 @@ class UpgradeSelected(AsyncAction):
|
|||||||
|
|
||||||
class RefreshApps(AsyncAction):
|
class RefreshApps(AsyncAction):
|
||||||
|
|
||||||
def __init__(self, manager: SoftwareManager, app: PackageView = None, pkg_types: Set[Type[SoftwarePackage]] = None):
|
def __init__(self, manager: SoftwareManager, pkg_types: Set[Type[SoftwarePackage]] = None):
|
||||||
super(RefreshApps, self).__init__()
|
super(RefreshApps, self).__init__()
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.app = app # app that should be on list top
|
|
||||||
self.pkg_types = pkg_types
|
self.pkg_types = pkg_types
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
res = self.manager.read_installed(pkg_types=self.pkg_types)
|
try:
|
||||||
refreshed_types = set()
|
res = self.manager.read_installed(pkg_types=self.pkg_types)
|
||||||
|
refreshed_types = set()
|
||||||
|
|
||||||
if res:
|
if res:
|
||||||
idx_found, app_found = None, None
|
for idx, ins in enumerate(res.installed):
|
||||||
for idx, ins in enumerate(res.installed):
|
if self.pkg_types:
|
||||||
if self.pkg_types:
|
refreshed_types.add(ins.__class__)
|
||||||
refreshed_types.add(ins.__class__)
|
|
||||||
|
|
||||||
if self.app and ins.get_type() == self.app.model.get_type() and ins.id == self.app.model.id:
|
elif self.pkg_types:
|
||||||
idx_found = idx
|
refreshed_types = self.pkg_types
|
||||||
app_found = ins
|
|
||||||
break
|
|
||||||
|
|
||||||
if app_found:
|
self.notify_finished({'installed': res.installed, 'total': res.total, 'types': refreshed_types})
|
||||||
del res.installed[idx_found]
|
except:
|
||||||
res.installed.insert(0, app_found)
|
traceback.print_exc()
|
||||||
|
self.notify_finished({'installed': [], 'total': 0, 'types': set()})
|
||||||
elif self.pkg_types:
|
finally:
|
||||||
refreshed_types = self.pkg_types
|
self.pkg_types = None
|
||||||
|
|
||||||
self.notify_finished({'installed': res.installed, 'total': res.total, 'types': refreshed_types})
|
|
||||||
self.app = None
|
|
||||||
self.pkg_types = None
|
|
||||||
|
|
||||||
|
|
||||||
class UninstallApp(AsyncAction):
|
class UninstallApp(AsyncAction):
|
||||||
|
|||||||
@@ -598,8 +598,7 @@ class ManageWindow(QWidget):
|
|||||||
self.checkbox_console.setChecked(False)
|
self.checkbox_console.setChecked(False)
|
||||||
self.textarea_output.hide()
|
self.textarea_output.hide()
|
||||||
|
|
||||||
def refresh_packages(self, keep_console: bool = True, top_app: PackageView = None, pkg_types: Set[Type[SoftwarePackage]] = None):
|
def refresh_packages(self, keep_console: bool = True, pkg_types: Set[Type[SoftwarePackage]] = None):
|
||||||
self.recent_installation = False
|
|
||||||
self.input_search.clear()
|
self.input_search.clear()
|
||||||
|
|
||||||
if not keep_console:
|
if not keep_console:
|
||||||
@@ -609,7 +608,6 @@ class ManageWindow(QWidget):
|
|||||||
self.ref_checkbox_only_apps.setVisible(False)
|
self.ref_checkbox_only_apps.setVisible(False)
|
||||||
self._begin_action(self.i18n['manage_window.status.refreshing'], keep_bt_installed=False, clear_filters=not self.recent_uninstall)
|
self._begin_action(self.i18n['manage_window.status.refreshing'], keep_bt_installed=False, clear_filters=not self.recent_uninstall)
|
||||||
|
|
||||||
self.thread_refresh.app = top_app # the app will be on top when refresh happens
|
|
||||||
self.thread_refresh.pkg_types = pkg_types
|
self.thread_refresh.pkg_types = pkg_types
|
||||||
self.thread_refresh.start()
|
self.thread_refresh.start()
|
||||||
|
|
||||||
@@ -1199,7 +1197,6 @@ class ManageWindow(QWidget):
|
|||||||
self.textarea_output.appendPlainText("[warning] Could not write install log file to '{}'".format(log_path))
|
self.textarea_output.appendPlainText("[warning] Could not write install log file to '{}'".format(log_path))
|
||||||
|
|
||||||
if res['success']:
|
if res['success']:
|
||||||
self.recent_installation = True
|
|
||||||
if self._can_notify_user():
|
if self._can_notify_user():
|
||||||
util.notify_user(msg='{} ({}) {}'.format(res['pkg'].model.name, res['pkg'].model.get_type(), self.i18n['installed']))
|
util.notify_user(msg='{} ({}) {}'.format(res['pkg'].model.name, res['pkg'].model.get_type(), self.i18n['installed']))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user