Update Lutris cover art location - Fixes #233

This commit is contained in:
kramo
2024-02-17 14:26:01 +01:00
parent 6155ace0ec
commit 8efce829ca
3 changed files with 9 additions and 37 deletions

View File

@@ -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,
)
)

View File

@@ -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()

View File

@@ -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 [