Merge branch 'main' into libadwaita-1.5

This commit is contained in:
kramo
2024-03-20 14:47:29 +01:00
committed by GitHub
22 changed files with 1632 additions and 483 deletions

View File

@@ -16,7 +16,7 @@ class LocationSubPath(NamedTuple):
class UnresolvableLocationError(Exception):
def __init__(self, optional):
def __init__(self, optional: Optional[bool] = False):
self.optional = optional

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 CartridgesPreferences(Adw.PreferencesDialog):
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()