Skip to content

Commit

Permalink
Update Lutris cover art location - Fixes #233
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Feb 17, 2024
1 parent 6155ace commit 8efce82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 37 deletions.
24 changes: 5 additions & 19 deletions cartridges/importer/lutris_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __iter__(self):
"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)

Expand All @@ -71,7 +71,7 @@ def __iter__(self):
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)
Expand All @@ -81,8 +81,7 @@ def __iter__(self):


class LutrisLocations(NamedTuple):
config: Location
cache: Location
data: Location


class LutrisSource(URLExecutableSource):
Expand All @@ -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
Expand All @@ -114,19 +111,8 @@ def __init__(self) -> None:
),
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,
)
)
6 changes: 2 additions & 4 deletions cartridges/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
16 changes: 2 additions & 14 deletions data/gtk/preferences.blp
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 8efce82

Please sign in to comment.