Compare commits

..

5 Commits

Author SHA1 Message Date
kramo
9b24f7c473 v2.6.2 2023-11-03 17:15:06 +01:00
Weblate (bot)
644bf10713 Translations update from Hosted Weblate (#208)
* Translated using Weblate (Belarusian)

Currently translated at 100.0% (136 of 136 strings)

Co-authored-by: Yahor <k1llo2810@protonmail.com>
Translate-URL: https://hosted.weblate.org/projects/cartridges/cartridges/be/
Translation: Cartridges/Cartridges

* Translated using Weblate (Ukrainian)

Currently translated at 100.0% (136 of 136 strings)

Co-authored-by: Andrii Murha <flat.assembly@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://hosted.weblate.org/projects/cartridges/cartridges/uk/
Translation: Cartridges/Cartridges

---------

Co-authored-by: Yahor <k1llo2810@protonmail.com>
Co-authored-by: Andrii Murha <flat.assembly@gmail.com>
2023-11-03 17:14:15 +01:00
kramo
2962988727 Fix old games not showing up in search provider 2023-11-03 17:11:25 +01:00
kramo
6d3d6e6a8f Use local options for command line 2023-10-27 14:54:59 +02:00
kramo
9557caecbc Use Blueprint menu item shorthands 2023-10-22 22:36:14 +02:00
8 changed files with 86 additions and 131 deletions

View File

@@ -66,10 +66,27 @@ class CartridgesApplication(Adw.Application):
def __init__(self) -> None:
shared.store = Store()
super().__init__(
application_id=shared.APP_ID,
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
)
super().__init__(application_id=shared.APP_ID)
search = GLib.OptionEntry()
search.long_name = "search"
search.short_name = ord("s")
search.flags = 0
search.arg = int(GLib.OptionArg.STRING)
search.arg_data = None
search.description = "Open the app with this term in the search entry"
search.arg_description = "TERM"
launch = GLib.OptionEntry()
launch.long_name = "launch"
launch.short_name = ord("l")
launch.flags = 0
launch.arg = int(GLib.OptionArg.STRING)
launch.arg_data = None
launch.description = "Run a game with the given game_id"
launch.arg_description = "GAME_ID"
self.add_main_option_entries((search, launch))
def do_activate(self) -> None: # pylint: disable=arguments-differ
"""Called on app creation"""
@@ -159,47 +176,40 @@ class CartridgesApplication(Adw.Application):
shared.win.present()
def do_command_line(self, command_line) -> int:
for index, arg in enumerate(args := command_line.get_arguments()):
if arg == "--search":
try:
self.init_search_term = args[index + 1]
except IndexError:
pass
break
if arg == "--launch":
try:
game_id = args[index + 1]
data = json.load(
(path := shared.games_dir / (game_id + ".json")).open(
"r", encoding="utf-8"
)
def do_handle_local_options(self, options: GLib.VariantDict) -> int:
if search := options.lookup_value("search"):
self.init_search_term = search.get_string()
elif game_id := options.lookup_value("launch"):
try:
data = json.load(
(path := shared.games_dir / (game_id.get_string() + ".json")).open(
"r", encoding="utf-8"
)
executable = (
shlex.join(data["executable"])
if isinstance(data["executable"], list)
else data["executable"]
)
name = data["name"]
run_executable(executable)
data["last_played"] = int(time())
json.dump(data, path.open("w", encoding="utf-8"))
except (IndexError, KeyError, OSError, json.decoder.JSONDecodeError):
return 1
notification = Gio.Notification.new(_("Cartridges"))
notification.set_body(_("{} launched").format(name))
self.send_notification(
"launch",
notification,
)
return 0
self.activate()
return 0
executable = (
shlex.join(data["executable"])
if isinstance(data["executable"], list)
else data["executable"]
)
name = data["name"]
run_executable(executable)
data["last_played"] = int(time())
json.dump(data, path.open("w", encoding="utf-8"))
except (IndexError, KeyError, OSError, json.decoder.JSONDecodeError):
return 1
self.register()
notification = Gio.Notification.new(_("Cartridges"))
notification.set_body(_("{} launched").format(name))
self.send_notification(
"launch",
notification,
)
return 0
return -1
def load_games_from_disk(self) -> None:
if shared.games_dir.is_dir():

View File

@@ -99,38 +99,16 @@ template $Game : Box {
menu game_options {
section {
item {
label: _("Edit");
action: "app.edit_game";
}
item {
label: _("Hide");
action: "app.hide_game";
}
item {
label: _("Remove");
action: "app.remove_game";
}
item (_("Edit"), "app.edit_game")
item (_("Hide"), "app.hide_game")
item (_("Remove"), "app.remove_game")
}
}
menu hidden_game_options {
section {
item {
label: _("Edit");
action: "app.edit_game";
}
item {
label: _("Unhide");
action: "app.hide_game";
}
item {
label: _("Remove");
action: "app.remove_game";
}
item (_("Edit"), "app.edit_game")
item (_("Unhide"), "app.hide_game")
item (_("Remove"), "app.remove_game")
}
}

View File

@@ -511,36 +511,19 @@ menu primary_menu {
}
section {
item {
label: _("Preferences");
action: "app.preferences";
}
item {
label: _("Keyboard Shortcuts");
action: "win.show-help-overlay";
}
item {
label: _("About Cartridges");
action: "app.about";
}
item (_("Preferences"), "app.preferences")
item (_("Keyboard Shortcuts"), "win.show-help-overlay")
item (_("About Cartridges"), "app.about")
}
}
menu add_games {
section {
item {
label: _("Add Game");
action: "app.add_game";
}
item (_("Add Game"), "app.add_game")
}
section {
item {
label: _("Import");
action: "app.import";
}
item (_("Import"), "app.import")
}
}
@@ -548,29 +531,10 @@ menu search {
section {
label: "Search on…";
item {
label: "IGDB";
action: "app.igdb_search";
}
item {
label: "SteamGridDB";
action: "app.sgdb_search";
}
item {
label: "ProtonDB";
action: "app.protondb_search";
}
item {
label: "Lutris";
action: "app.lutris_search";
}
item {
label: "HowLongToBeat";
action: "app.hltb_search";
}
item (_("IGDB"), "app.igdb_search")
item (_("SteamGridDB"), "app.sgdb_search")
item (_("ProtonDB"), "app.protondb_search")
item (_("Lutris"), "app.lutris_search")
item (_("HowLongToBeat"), "app.hltb_search")
}
}

View File

@@ -44,12 +44,11 @@
</screenshots>
<content_rating type="oars-1.1" />
<releases>
<release version="2.6.1" date="2023-10-21">
<release version="2.6.2" date="2023-11-03">
<description translatable="no">
<ul>
<li>"The" will be ignored when sorting games</li>
<li>The last played date is updated even if the game is luanched via the GNOME search provider</li>
<li>Various UX improvements</li>
<li>Fixed an issue with some games not showing up in GNOME search</li>
<li>Command line options are now properly supported</li>
</ul>
</description>
</release>

View File

@@ -1,5 +1,5 @@
project('cartridges',
version: '2.6.1',
version: '2.6.2',
meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2', 'werror=false', ],
)

View File

@@ -3,13 +3,14 @@
# This file is distributed under the same license as the Cartridges package.
# Yahor <k1llo2810@gmail.com>, 2023.
# Yahor <g_egor98@tut.by>, 2023.
# Yahor <k1llo2810@protonmail.com>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: Cartridges\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-10 22:22+0200\n"
"PO-Revision-Date: 2023-10-20 17:54+0000\n"
"Last-Translator: Yahor <g_egor98@tut.by>\n"
"PO-Revision-Date: 2023-11-01 17:02+0000\n"
"Last-Translator: Yahor <k1llo2810@protonmail.com>\n"
"Language-Team: Belarusian <https://hosted.weblate.org/projects/cartridges/"
"cartridges/be/>\n"
"Language: be\n"
@@ -18,7 +19,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.1\n"
"X-Generator: Weblate 5.2-dev\n"
#: data/hu.kramo.Cartridges.desktop.in:3
#: data/hu.kramo.Cartridges.metainfo.xml.in:6
@@ -50,7 +51,7 @@ msgid ""
"necessary. You can sort and hide games or download cover art from "
"SteamGridDB."
msgstr ""
"Картрыджы - гэта простая праграма для запуску ўсіх вашых гульняў. Ён "
"Картрыджы - гэта простая праграма для запуску ўсіх вашых гульняў. Яна "
"падтрымлівае імпарт гульняў з Steam, Lutris, Heroic і іншых без неабходнасці "
"ўваходу ў сістэму. Вы можаце сартаваць і хаваць гульні або спампоўваць "
"вокладку з SteamGridDB."

View File

@@ -11,7 +11,7 @@ msgstr ""
"Project-Id-Version: cartridges\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-10 22:22+0200\n"
"PO-Revision-Date: 2023-10-05 19:10+0000\n"
"PO-Revision-Date: 2023-10-24 17:02+0000\n"
"Last-Translator: Andrii Murha <flat.assembly@gmail.com>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/cartridges/"
"cartridges/uk/>\n"
@@ -21,7 +21,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.1-dev\n"
"X-Generator: Weblate 5.1.1-dev\n"
#: data/hu.kramo.Cartridges.desktop.in:3
#: data/hu.kramo.Cartridges.metainfo.xml.in:6
@@ -145,7 +145,7 @@ msgstr "Вийти"
#: data/gtk/help-overlay.blp:39 data/gtk/window.blp:88 data/gtk/window.blp:164
msgid "Toggle Sidebar"
msgstr "Перкключити бічну панель"
msgstr "Переключити бічну панель"
#: data/gtk/help-overlay.blp:44 data/gtk/window.blp:177 data/gtk/window.blp:236
msgid "Main Menu"

View File

@@ -165,7 +165,11 @@ class SearchCartridgesService(Server, Gio.Application):
continue
try:
if any({data["hidden"], data["blacklisted"], data["removed"]}):
# Use .get for compatibility with pre-2.0 games
if any(
{data.get("hidden"), data.get("blacklisted"), data.get("removed")}
):
print(f"Skipped {game_file.name}")
continue
self.games[data["game_id"]] = (data["name"], data["developer"])
@@ -272,7 +276,6 @@ class SearchCartridgesService(Server, Gio.Application):
search = " ".join(terms).lower()
try:
for game_id, data in self.games.items():
print(game_id, data)
if search in data[0].lower():
game_ids.append(game_id)
continue