Commit 914216a3 authored by Roman Alifanov's avatar Roman Alifanov

unnecessary function removed

parent 3dfa9d39
......@@ -41,35 +41,26 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.search_dropdown.connect("notify::selected", self.on_filter_changed)
self.choice_listbox.set_filter_func(self.listbox_filter_func)
self.loading_count = 0 # Track loading operations
self.load_applications()
self.update_ui()
def show_loading_spinner(self):
self.loading_spinner.set_visible(True)
self.choice_listbox.set_visible(False) # Скрыть группу настроек во время загрузки
self.loading_count += 1 # Increment loading counter
def hide_loading_spinner(self):
self.loading_count -= 1 # Decrement loading counter
if self.loading_count == 0:
self.loading_spinner.set_visible(False)
self.choice_listbox.set_visible(True)
def load_applications(self):
self.show_loading_spinner()
ApplicationManager.get_available_applications(self.on_applications_loaded)
self.loading_spinner.set_visible(False)
self.choice_listbox.set_visible(True)
def on_applications_loaded(self, applications, error=None):
if error:
print(f"Error: {error}")
else:
self.applications = applications
self.update_ui()
self.hide_loading_spinner() # Move this to ensure it waits for installation loading too
def update_ui(self):
self.show_loading_spinner() # Show loading again for installed apps
ApplicationManager.get_available_applications(self.on_applications_loaded)
ApplicationManager.get_installed_applications(self.on_installed_apps_loaded)
self.choice_listbox.invalidate_filter()
......@@ -83,8 +74,7 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
self.checkboxes = {}
for app in self.applications:
self.add_application_row(app)
self.hide_loading_spinner() # Now only hides after both loads are done
self.hide_loading_spinner()
def clear_choice_listbox(self):
self.choice_listbox.remove_all()
......@@ -191,10 +181,6 @@ class EepmPlayGuiWindow(Adw.ApplicationWindow):
dialog.present(self)
# Создание и передача функции обратного вызова для обновления UI
runner = CommandRunner(on_done=self.update_ui_after_log)
runner = CommandRunner(on_done=self.update_ui)
runner.run_command(command, dialog)
def update_ui_after_log(self):
self.update_ui() # Обновление UI после закрытия диалога
self.hide_loading_spinner() # Скрыть сообщение о загрузке после закрытия диалога
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