🎨 Improved Legendary source
- Fixed wrong library iteration - Fixed executable format - Added toggle in the preferences - Added legendary to on_import_action
This commit is contained in:
@@ -186,6 +186,20 @@ template $PreferencesWindow : Adw.PreferencesWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Adw.ExpanderRow legendary_expander_row {
|
||||||
|
title: _("Legendary");
|
||||||
|
show-enable-switch: true;
|
||||||
|
|
||||||
|
Adw.ActionRow legendary_action_row {
|
||||||
|
title: _("Legendary Install Location");
|
||||||
|
|
||||||
|
Button legendary_file_chooser_button {
|
||||||
|
icon-name: "folder-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,12 @@
|
|||||||
<key name="itch-location" type="s">
|
<key name="itch-location" type="s">
|
||||||
<default>"~/.var/app/io.itch.itch/config/itch/"</default>
|
<default>"~/.var/app/io.itch.itch/config/itch/"</default>
|
||||||
</key>
|
</key>
|
||||||
|
<key name="legendary" type="b">
|
||||||
|
<default>true</default>
|
||||||
|
</key>
|
||||||
|
<key name="legendary-location" type="s">
|
||||||
|
<default>"~/.config/legendary/"</default>
|
||||||
|
</key>
|
||||||
<key name="sgdb-key" type="s">
|
<key name="sgdb-key" type="s">
|
||||||
<default>""</default>
|
<default>""</default>
|
||||||
</key>
|
</key>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class LegendarySourceIterator(SourceIterator):
|
|||||||
"source": self.source.id,
|
"source": self.source.id,
|
||||||
"name": entry["title"],
|
"name": entry["title"],
|
||||||
"game_id": self.source.game_id_format.format(game_id=app_name),
|
"game_id": self.source.game_id_format.format(game_id=app_name),
|
||||||
"executable": self.source.game_id_format.format(app_name=app_name),
|
"executable": self.source.executable_format.format(app_name=app_name),
|
||||||
}
|
}
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
@@ -55,17 +55,19 @@ class LegendarySourceIterator(SourceIterator):
|
|||||||
# Open library
|
# Open library
|
||||||
file = self.source.location / "installed.json"
|
file = self.source.location / "installed.json"
|
||||||
try:
|
try:
|
||||||
library = json.load(file.open())
|
library: dict = json.load(file.open())
|
||||||
except (JSONDecodeError, OSError):
|
except (JSONDecodeError, OSError):
|
||||||
logging.warning("Couldn't open Legendary file: %s", str(file))
|
logging.warning("Couldn't open Legendary file: %s", str(file))
|
||||||
return
|
return
|
||||||
# Generate games from library
|
# Generate games from library
|
||||||
for entry in library:
|
for entry in library.values():
|
||||||
try:
|
try:
|
||||||
result = self.game_from_library_entry(entry)
|
result = self.game_from_library_entry(entry)
|
||||||
except KeyError:
|
except KeyError as error:
|
||||||
# Skip invalid games
|
# Skip invalid games
|
||||||
logging.warning("Invalid Legendary game skipped in %s", str(file))
|
logging.warning(
|
||||||
|
"Invalid Legendary game skipped in %s", str(file), exc_info=error
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
yield result
|
yield result
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ from src.importer.importer import Importer
|
|||||||
from src.importer.sources.bottles_source import BottlesLinuxSource
|
from src.importer.sources.bottles_source import BottlesLinuxSource
|
||||||
from src.importer.sources.heroic_source import HeroicLinuxSource, HeroicWindowsSource
|
from src.importer.sources.heroic_source import HeroicLinuxSource, HeroicWindowsSource
|
||||||
from src.importer.sources.itch_source import ItchLinuxSource, ItchWindowsSource
|
from src.importer.sources.itch_source import ItchLinuxSource, ItchWindowsSource
|
||||||
|
from src.importer.sources.legendary_source import LegendaryLinuxSource
|
||||||
from src.importer.sources.lutris_source import LutrisLinuxSource
|
from src.importer.sources.lutris_source import LutrisLinuxSource
|
||||||
from src.importer.sources.steam_source import SteamLinuxSource, SteamWindowsSource
|
from src.importer.sources.steam_source import SteamLinuxSource, SteamWindowsSource
|
||||||
from src.preferences import PreferencesWindow
|
from src.preferences import PreferencesWindow
|
||||||
@@ -202,6 +203,8 @@ class CartridgesApplication(Adw.Application):
|
|||||||
if shared.schema.get_boolean("itch"):
|
if shared.schema.get_boolean("itch"):
|
||||||
importer.add_source(ItchLinuxSource())
|
importer.add_source(ItchLinuxSource())
|
||||||
importer.add_source(ItchWindowsSource())
|
importer.add_source(ItchWindowsSource())
|
||||||
|
if shared.schema.get_boolean("legendary"):
|
||||||
|
importer.add_source(LegendaryLinuxSource())
|
||||||
importer.run()
|
importer.run()
|
||||||
|
|
||||||
def on_remove_game_action(self, *_args):
|
def on_remove_game_action(self, *_args):
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
itch_action_row = Gtk.Template.Child()
|
itch_action_row = Gtk.Template.Child()
|
||||||
itch_file_chooser_button = Gtk.Template.Child()
|
itch_file_chooser_button = Gtk.Template.Child()
|
||||||
|
|
||||||
|
legendary_expander_row = Gtk.Template.Child()
|
||||||
|
legendary_action_row = Gtk.Template.Child()
|
||||||
|
legendary_file_chooser_button = Gtk.Template.Child()
|
||||||
|
|
||||||
sgdb_key_group = Gtk.Template.Child()
|
sgdb_key_group = Gtk.Template.Child()
|
||||||
sgdb_key_entry_row = Gtk.Template.Child()
|
sgdb_key_entry_row = Gtk.Template.Child()
|
||||||
sgdb_switch = Gtk.Template.Child()
|
sgdb_switch = Gtk.Template.Child()
|
||||||
@@ -156,6 +160,9 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
# itch
|
# itch
|
||||||
self.create_preferences(self, "itch", "itch", True)
|
self.create_preferences(self, "itch", "itch", True)
|
||||||
|
|
||||||
|
# Legendary
|
||||||
|
self.create_preferences(self, "legendary", "Legendary", True)
|
||||||
|
|
||||||
# SteamGridDB
|
# SteamGridDB
|
||||||
def sgdb_key_changed(*_args):
|
def sgdb_key_changed(*_args):
|
||||||
shared.schema.set_string("sgdb-key", self.sgdb_key_entry_row.get_text())
|
shared.schema.set_string("sgdb-key", self.sgdb_key_entry_row.get_text())
|
||||||
|
|||||||
Reference in New Issue
Block a user