mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 04:44:15 +02:00
[ui] removing unused code
This commit is contained in:
@@ -470,37 +470,30 @@ class UpgradeSelected(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__()
|
||||
self.manager = manager
|
||||
self.app = app # app that should be on list top
|
||||
self.pkg_types = pkg_types
|
||||
|
||||
def run(self):
|
||||
res = self.manager.read_installed(pkg_types=self.pkg_types)
|
||||
refreshed_types = set()
|
||||
try:
|
||||
res = self.manager.read_installed(pkg_types=self.pkg_types)
|
||||
refreshed_types = set()
|
||||
|
||||
if res:
|
||||
idx_found, app_found = None, None
|
||||
for idx, ins in enumerate(res.installed):
|
||||
if self.pkg_types:
|
||||
refreshed_types.add(ins.__class__)
|
||||
if res:
|
||||
for idx, ins in enumerate(res.installed):
|
||||
if self.pkg_types:
|
||||
refreshed_types.add(ins.__class__)
|
||||
|
||||
if self.app and ins.get_type() == self.app.model.get_type() and ins.id == self.app.model.id:
|
||||
idx_found = idx
|
||||
app_found = ins
|
||||
break
|
||||
elif self.pkg_types:
|
||||
refreshed_types = self.pkg_types
|
||||
|
||||
if app_found:
|
||||
del res.installed[idx_found]
|
||||
res.installed.insert(0, app_found)
|
||||
|
||||
elif self.pkg_types:
|
||||
refreshed_types = self.pkg_types
|
||||
|
||||
self.notify_finished({'installed': res.installed, 'total': res.total, 'types': refreshed_types})
|
||||
self.app = None
|
||||
self.pkg_types = None
|
||||
self.notify_finished({'installed': res.installed, 'total': res.total, 'types': refreshed_types})
|
||||
except:
|
||||
traceback.print_exc()
|
||||
self.notify_finished({'installed': [], 'total': 0, 'types': set()})
|
||||
finally:
|
||||
self.pkg_types = None
|
||||
|
||||
|
||||
class UninstallApp(AsyncAction):
|
||||
|
||||
@@ -598,8 +598,7 @@ class ManageWindow(QWidget):
|
||||
self.checkbox_console.setChecked(False)
|
||||
self.textarea_output.hide()
|
||||
|
||||
def refresh_packages(self, keep_console: bool = True, top_app: PackageView = None, pkg_types: Set[Type[SoftwarePackage]] = None):
|
||||
self.recent_installation = False
|
||||
def refresh_packages(self, keep_console: bool = True, pkg_types: Set[Type[SoftwarePackage]] = None):
|
||||
self.input_search.clear()
|
||||
|
||||
if not keep_console:
|
||||
@@ -609,7 +608,6 @@ class ManageWindow(QWidget):
|
||||
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.thread_refresh.app = top_app # the app will be on top when refresh happens
|
||||
self.thread_refresh.pkg_types = pkg_types
|
||||
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))
|
||||
|
||||
if res['success']:
|
||||
self.recent_installation = True
|
||||
if self._can_notify_user():
|
||||
util.notify_user(msg='{} ({}) {}'.format(res['pkg'].model.name, res['pkg'].model.get_type(), self.i18n['installed']))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user