diff --git a/libflatpak_query.py b/libflatpak_query.py index d53c6c2..0a3faa9 100755 --- a/libflatpak_query.py +++ b/libflatpak_query.py @@ -469,11 +469,13 @@ class AppstreamSearcher: self.collection_results = [] # Initialize empty list self.installed_results = [] # Initialize empty list self.updates_results = [] # Initialize empty list + self.all_apps = [] # Initialize empty list total_categories = sum(len(categories) for categories in self.category_groups.values()) current_category = 0 # Search for each app in local repositories searcher = get_reposearcher(system, refresh) + self.all_apps = searcher.get_all_apps() json_path = "collections_data.json" search_result = [] @@ -559,7 +561,7 @@ class AppstreamSearcher: except (IOError, json.JSONDecodeError) as e: print(f"Error loading collections data: {str(e)}") # make sure to reset these to empty before refreshing. - return self.category_results, self.collection_results, self.installed_results, self.updates_results + return self.category_results, self.collection_results, self.installed_results, self.updates_results, self.all_apps def install_flatpak(app: AppStreamPackage, repo_name=None, system=False) -> tuple[bool, str]: """ diff --git a/main.py b/main.py index 4e3551f..91f1691 100755 --- a/main.py +++ b/main.py @@ -14,6 +14,7 @@ class MainWindow(Gtk.Window): super().__init__() # Store search results as an instance variable + self.all_apps = [] self.category_results = [] # Initialize empty list self.collection_results = [] # Initialize empty list self.installed_results = [] # Initialize empty list @@ -207,11 +208,12 @@ class MainWindow(Gtk.Window): # Define thread target function def refresh_target(): try: - category_results, collection_results, installed_results, updates_results = searcher.retrieve_metadata(self.system_mode) + category_results, collection_results, installed_results, updates_results, all_apps = searcher.retrieve_metadata(self.system_mode) self.category_results = category_results self.collection_results = collection_results self.installed_results = installed_results self.updates_results = updates_results + self.all_apps = all_apps except Exception as e: message_type = Gtk.MessageType.ERROR dialog = Gtk.MessageDialog( @@ -432,6 +434,11 @@ class MainWindow(Gtk.Window): def on_search_changed(self, searchentry): """Handle search text changes""" + pass # Don't perform search on every keystroke + + + def on_search_activate(self, searchentry): + """Handle Enter key press in search""" search_term = searchentry.get_text().lower() if not search_term: # Reset to showing all categories when search is empty @@ -454,10 +461,6 @@ class MainWindow(Gtk.Window): # Show search results self.show_search_results(filtered_apps) - def on_search_activate(self, searchentry): - """Handle Enter key press in search""" - self.on_search_changed(searchentry) - def show_search_results(self, apps): """Display search results in the right panel""" # Clear existing content @@ -467,8 +470,8 @@ class MainWindow(Gtk.Window): # Display each application for app in apps: details = app.get_details() - is_installed = details['id'] in installed_package_ids - is_updatable = details['id'] in updatable_package_ids + is_installed = details['id'] in self.installed_results + is_updatable = details['id'] in self.updates_results # Create application container app_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)