You need to sign in or sign up before continuing.
Commit 2387bd91 authored by Roman Alifanov's avatar Roman Alifanov

resetting the button status and lists immediately after command running

parent 112e365d
......@@ -121,6 +121,9 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.applications = applications
def update_ui(self):
self.installed_apps = None
self.applications = None
self.show_loading_spinner() # Show loading again for installed apps
self.update_button_status()
......@@ -128,8 +131,6 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
ApplicationManager.get_available_applications(self.on_applications_loaded)
ApplicationManager.get_installed_applications(self.on_installed_apps_loaded)
self.choice_listbox.invalidate_filter()
def on_installed_apps_loaded(self, installed_apps, error=None):
if error:
print(f"Error: {error}")
......@@ -140,6 +141,8 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.checkboxes = {}
for app in self.applications:
self.add_application_row(app)
self.choice_listbox.invalidate_filter()
self.hide_loading_spinner()
def clear_choice_listbox(self):
......@@ -213,6 +216,8 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
return matches_search # All
def on_apply_clicked(self, button):
commands = None
self.show_loading_spinner() # Показать сообщение о загрузке перед выполнением команды
to_install, to_remove = self.get_install_remove_lists()
commands = self.build_commands(to_install, to_remove)
......@@ -225,7 +230,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.dialog.run("pkexec epm play --update all", on_done=self.update_ui)
def get_install_remove_lists(self):
if self.checkboxes:
if self.installed_apps and self.checkboxes:
to_install = [app_name for app_name, row in self.checkboxes.items() if row.checkbox.get_active() and app_name not in self.installed_apps]
to_remove = [app_name for app_name, row in self.checkboxes.items() if not row.checkbox.get_active() and app_name in self.installed_apps]
return to_install, to_remove
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment