From 8efce829ca988a59320c5d58181702050dfc6521 Mon Sep 17 00:00:00 2001 From: kramo Date: Sat, 17 Feb 2024 14:26:01 +0100 Subject: [PATCH] Update Lutris cover art location - Fixes #233 --- cartridges/importer/lutris_source.py | 24 +++++------------------- cartridges/preferences.py | 6 ++---- data/gtk/preferences.blp | 16 ++-------------- 3 files changed, 9 insertions(+), 37 deletions(-) diff --git a/cartridges/importer/lutris_source.py b/cartridges/importer/lutris_source.py index 8afb4e6..d19345f 100644 --- a/cartridges/importer/lutris_source.py +++ b/cartridges/importer/lutris_source.py @@ -51,7 +51,7 @@ class LutrisSourceIterable(SourceIterable): "import_steam": shared.schema.get_boolean("lutris-import-steam"), "import_flatpak": shared.schema.get_boolean("lutris-import-flatpak"), } - db_path = copy_db(self.source.locations.config["pga.db"]) + db_path = copy_db(self.source.locations.data["pga.db"]) connection = connect(db_path) cursor = connection.execute(request, params) @@ -71,7 +71,7 @@ class LutrisSourceIterable(SourceIterable): game = Game(values) # Get official image path - image_path = self.source.locations.cache["coverart"] / f"{row[2]}.jpg" + image_path = self.source.locations.data["coverart"] / f"{row[2]}.jpg" additional_data = {"local_image_path": image_path} yield (game, additional_data) @@ -81,8 +81,7 @@ class LutrisSourceIterable(SourceIterable): class LutrisLocations(NamedTuple): - config: Location - cache: Location + data: Location class LutrisSource(URLExecutableSource): @@ -94,8 +93,6 @@ class LutrisSource(URLExecutableSource): url_format = "lutris:rungameid/{game_id}" available_on = {"linux"} - # FIXME possible bug: config picks ~/.var... and cache picks ~/.local... - locations: LutrisLocations @property @@ -114,19 +111,8 @@ class LutrisSource(URLExecutableSource): ), paths={ "pga.db": LocationSubPath("pga.db"), - }, - invalid_subtitle=Location.DATA_INVALID_SUBTITLE, - ), - Location( - schema_key="lutris-cache-location", - candidates=( - shared.flatpak_dir / "net.lutris.Lutris" / "cache" / "lutris", - shared.cache_dir / "lutris", - shared.host_cache_dir / "lutris", - ), - paths={ "coverart": LocationSubPath("coverart", True), }, - invalid_subtitle=Location.CACHE_INVALID_SUBTITLE, - ), + invalid_subtitle=Location.DATA_INVALID_SUBTITLE, + ) ) diff --git a/cartridges/preferences.py b/cartridges/preferences.py index a0d158e..02ad966 100644 --- a/cartridges/preferences.py +++ b/cartridges/preferences.py @@ -63,10 +63,8 @@ class PreferencesWindow(Adw.PreferencesWindow): steam_data_file_chooser_button = Gtk.Template.Child() lutris_expander_row = Gtk.Template.Child() - lutris_config_action_row = Gtk.Template.Child() - lutris_config_file_chooser_button = Gtk.Template.Child() - lutris_cache_action_row = Gtk.Template.Child() - lutris_cache_file_chooser_button = Gtk.Template.Child() + lutris_data_action_row = Gtk.Template.Child() + lutris_data_file_chooser_button = Gtk.Template.Child() lutris_import_steam_switch = Gtk.Template.Child() lutris_import_flatpak_switch = Gtk.Template.Child() diff --git a/data/gtk/preferences.blp b/data/gtk/preferences.blp index 0badc13..a88cf40 100644 --- a/data/gtk/preferences.blp +++ b/data/gtk/preferences.blp @@ -154,22 +154,10 @@ template $PreferencesWindow : Adw.PreferencesWindow { icon-name: "lutris-source-symbolic"; } - Adw.ActionRow lutris_config_action_row { + Adw.ActionRow lutris_data_action_row { title: _("Install Location"); - Button lutris_config_file_chooser_button { - icon-name: "folder-symbolic"; - valign: center; - styles [ - "flat" - ] - } - } - - Adw.ActionRow lutris_cache_action_row { - title: _("Cache Location"); - - Button lutris_cache_file_chooser_button { + Button lutris_data_file_chooser_button { icon-name: "folder-symbolic"; valign: center; styles [