Compare commits

...

10 Commits
v2.9 ... v2.9.3

Author SHA1 Message Date
kramo
35acb56a62 v2.9.3 2024-07-18 11:39:58 +02:00
Hosted Weblate
adacdefdb9 Translated using Weblate (Persian)
Currently translated at 100.0% (140 of 140 strings)

Co-authored-by: آوید <avds+git@disroot.org>
Translate-URL: https://hosted.weblate.org/projects/cartridges/cartridges/fa/
Translation: Cartridges/Cartridges
2024-07-18 09:30:35 +00:00
kramo
7367e40cb3 Fix #281 2024-07-18 11:30:28 +02:00
kramo
7efa17915f v2.9.2 2024-07-11 01:34:13 +02:00
kramo
bdcded93f3 v2.9.1 2024-07-11 01:22:08 +02:00
kramo
b3a65c3d23 Move ApplicationDelegate to separate module 2024-07-11 01:18:26 +02:00
kramo
06730248a9 Build without WebP TIFF compression in macOS CI 2024-07-10 22:34:42 +02:00
kramo
b46faa951f Improve macOS menu bar 2024-07-10 22:17:59 +02:00
kramo
43a04e7d44 Quote game names in search URLs 2024-07-10 22:00:40 +02:00
kramo
d74c8aba1a Use menu bar on macOS 2024-07-10 21:56:02 +02:00
9 changed files with 199 additions and 45 deletions

View File

@@ -73,11 +73,11 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: | run: |
brew install meson pygobject3 libadwaita adwaita-icon-theme desktop-file-utils pyinstaller pillow brew install meson pygobject3 libadwaita adwaita-icon-theme desktop-file-utils pyinstaller pillow
pip3 install --break-system-packages requests PyYAML pip3 install --break-system-packages requests PyYAML pyobjc
- name: Meson Build - name: Meson Build
run: | run: |
meson setup _build meson setup _build -Dtiff_compression=jpeg
ninja install -C _build ninja install -C _build
- name: PyInstaller - name: PyInstaller

View File

@@ -0,0 +1,121 @@
# application_delegate.py
#
# Copyright 2024 kramo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""A set of methods that manage your apps life cycle and its interaction
with common system services."""
from typing import Any
from AppKit import NSApp, NSApplication, NSMenu, NSMenuItem # type: ignore
from Foundation import NSObject # type: ignore
from gi.repository import Gio # type: ignore
from cartridges import shared
class ApplicationDelegate(NSObject): # type: ignore
"""A set of methods that manage your apps life cycle and its interaction
with common system services."""
def applicationDidFinishLaunching_(self, *_args: Any) -> None:
main_menu = NSApp.mainMenu()
add_game_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"Add Game", "add:", "n"
)
import_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"Import", "import:", "i"
)
file_menu = NSMenu.alloc().init()
file_menu.addItem_(add_game_menu_item)
file_menu.addItem_(import_menu_item)
file_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"File", None, ""
)
file_menu_item.setSubmenu_(file_menu)
main_menu.addItem_(file_menu_item)
show_hidden_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"Show Hidden", "hidden:", "h"
)
windows_menu = NSMenu.alloc().init()
view_menu = NSMenu.alloc().init()
view_menu.addItem_(show_hidden_menu_item)
view_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"View", None, ""
)
view_menu_item.setSubmenu_(view_menu)
main_menu.addItem_(view_menu_item)
windows_menu = NSMenu.alloc().init()
windows_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"Window", None, ""
)
windows_menu_item.setSubmenu_(windows_menu)
main_menu.addItem_(windows_menu_item)
NSApp.setWindowsMenu_(windows_menu)
keyboard_shortcuts_menu_item = (
NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"Keyboard Shortcuts", "shortcuts:", "?"
)
)
help_menu = NSMenu.alloc().init()
help_menu.addItem_(keyboard_shortcuts_menu_item)
help_menu_item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
"Help", None, ""
)
help_menu_item.setSubmenu_(help_menu)
main_menu.addItem_(help_menu_item)
NSApp.setHelpMenu_(help_menu)
def add_(self, *_args: Any) -> None:
if (not shared.win) or (not (app := shared.win.get_application())):
return
app.lookup_action("add_game").activate()
def import_(self, *_args: Any) -> None:
if (not shared.win) or (not (app := shared.win.get_application())):
return
app.lookup_action("import").activate()
def hidden_(self, *_args: Any) -> None:
if not shared.win:
return
shared.win.lookup_action("show_hidden").activate()
def shortcuts_(self, *_args: Any) -> None:
if (not shared.win) or (not (overlay := shared.win.get_help_overlay())):
return
overlay.present()

View File

@@ -59,8 +59,15 @@ class DetailsDialog(Adw.Dialog):
cover_changed: bool = False cover_changed: bool = False
is_open = False
def __init__(self, game: Optional[Game] = None, **kwargs: Any): def __init__(self, game: Optional[Game] = None, **kwargs: Any):
super().__init__(**kwargs) super().__init__(**kwargs)
# Make it so only one dialog can be open at a time
self.__class__.is_open = True
self.connect("closed", lambda *_: self.set_is_open(False))
self.game: Game = game self.game: Game = game
self.game_cover: GameCover = GameCover({self.cover}) self.game_cover: GameCover = GameCover({self.cover})
@@ -325,3 +332,6 @@ class DetailsDialog(Adw.Dialog):
def choose_cover(self, *_args: Any) -> None: def choose_cover(self, *_args: Any) -> None:
self.image_file_dialog.open(self.get_root(), None, self.set_cover) self.image_file_dialog.open(self.get_root(), None, self.set_cover)
def set_is_open(self, is_open: bool) -> None:
self.__class__.is_open = is_open

View File

@@ -24,6 +24,7 @@ import shlex
import sys import sys
from time import time from time import time
from typing import Any, Optional from typing import Any, Optional
from urllib.parse import quote
import gi import gi
@@ -57,6 +58,12 @@ from cartridges.store.store import Store
from cartridges.utils.run_executable import run_executable from cartridges.utils.run_executable import run_executable
from cartridges.window import CartridgesWindow from cartridges.window import CartridgesWindow
if sys.platform == "darwin":
from AppKit import NSApp # type: ignore
from PyObjCTools import AppHelper
from cartridges.application_delegate import ApplicationDelegate
class CartridgesApplication(Adw.Application): class CartridgesApplication(Adw.Application):
state = shared.AppState.DEFAULT state = shared.AppState.DEFAULT
@@ -87,9 +94,16 @@ class CartridgesApplication(Adw.Application):
self.add_main_option_entries((search, launch)) self.add_main_option_entries((search, launch))
if sys.platform == "darwin" and (settings := Gtk.Settings.get_default()): if sys.platform == "darwin":
if settings := Gtk.Settings.get_default():
settings.props.gtk_decoration_layout = "close,minimize,maximize:" settings.props.gtk_decoration_layout = "close,minimize,maximize:"
def setup_app_delegate() -> None:
NSApp.setDelegate_(ApplicationDelegate.alloc().init()) # type: ignore
AppHelper.runEventLoop() # type: ignore
GLib.Thread.new(None, setup_app_delegate)
def do_activate(self) -> None: # pylint: disable=arguments-differ def do_activate(self) -> None: # pylint: disable=arguments-differ
"""Called on app creation""" """Called on app creation"""
@@ -287,7 +301,7 @@ class CartridgesApplication(Adw.Application):
_parameter: Any = None, _parameter: Any = None,
page_name: Optional[str] = None, page_name: Optional[str] = None,
expander_row: Optional[str] = None, expander_row: Optional[str] = None,
) -> CartridgesWindow: ) -> Optional[CartridgesPreferences]:
if CartridgesPreferences.is_open: if CartridgesPreferences.is_open:
return return
@@ -310,6 +324,9 @@ class CartridgesApplication(Adw.Application):
DetailsDialog(shared.win.active_game).present(shared.win) DetailsDialog(shared.win.active_game).present(shared.win)
def on_add_game_action(self, *_args: Any) -> None: def on_add_game_action(self, *_args: Any) -> None:
if DetailsDialog.is_open:
return
DetailsDialog().present(shared.win) DetailsDialog().present(shared.win)
def on_import_action(self, *_args: Any) -> None: def on_import_action(self, *_args: Any) -> None:
@@ -352,7 +369,7 @@ class CartridgesApplication(Adw.Application):
self.on_remove_game_action() self.on_remove_game_action()
def search(self, uri: str) -> None: def search(self, uri: str) -> None:
Gio.AppInfo.launch_default_for_uri(f"{uri}{shared.win.active_game.name}") Gio.AppInfo.launch_default_for_uri(f"{uri}{quote(shared.win.active_game.name)}")
def on_igdb_search_action(self, *_args: Any) -> None: def on_igdb_search_action(self, *_args: Any) -> None:
self.search("https://www.igdb.com/search?type=1&q=") self.search("https://www.igdb.com/search?type=1&q=")
@@ -382,7 +399,11 @@ class CartridgesApplication(Adw.Application):
if action[1:2]: if action[1:2]:
self.set_accels_for_action( self.set_accels_for_action(
f"app.{action[0]}" if scope == self else f"win.{action[0]}", f"app.{action[0]}" if scope == self else f"win.{action[0]}",
tuple(s.replace("<primary>", "<meta>") for s in action[1]), (
tuple(s.replace("<primary>", "<meta>") for s in action[1])
if sys.platform == "darwin"
else action[1]
),
) )
scope.add_action(simple_action) scope.add_action(simple_action)

View File

@@ -15,6 +15,7 @@ install_subdir('logging', install_dir: moduledir)
install_subdir('errors', install_dir: moduledir) install_subdir('errors', install_dir: moduledir)
install_data( install_data(
[ [
'application_delegate.py',
'main.py', 'main.py',
'window.py', 'window.py',
'preferences.py', 'preferences.py',

View File

@@ -450,6 +450,9 @@ class CartridgesWindow(Adw.ApplicationWindow):
self.navigation_view.pop_to_page(self.library_page) self.navigation_view.pop_to_page(self.library_page)
def on_show_hidden_action(self, *_args: Any) -> None: def on_show_hidden_action(self, *_args: Any) -> None:
if self.navigation_view.get_visible_page() == self.hidden_library_page:
return
self.navigation_view.push(self.hidden_library_page) self.navigation_view.push(self.hidden_library_page)
def on_sort_action(self, action: Gio.SimpleAction, state: GLib.Variant) -> None: def on_sort_action(self, action: Gio.SimpleAction, state: GLib.Variant) -> None:

View File

@@ -54,6 +54,13 @@
</screenshots> </screenshots>
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<releases> <releases>
<release version="2.9.3" date="2024-07-18">
<description translate="no">
<ul>
<li>Fixed incorrect modifiers being used for keyboard shortcuts</li>
</ul>
</description>
</release>
<release version="2.9" date="2024-07-10"> <release version="2.9" date="2024-07-10">
<description translate="no"> <description translate="no">
<ul> <ul>
@@ -62,13 +69,6 @@
</ul> </ul>
</description> </description>
</release> </release>
<release version="2.8.5" date="2024-05-25">
<description translate="no">
<ul>
<li>Steam runtimes and Proton should stop being imported again</li>
</ul>
</description>
</release>
<release version="2.8" date="2024-03-20"> <release version="2.8" date="2024-03-20">
<description translate="no"> <description translate="no">
<ul> <ul>

View File

@@ -1,6 +1,6 @@
project( project(
'cartridges', 'cartridges',
version: '2.9', version: '2.9.3',
meson_version: '>= 0.59.0', meson_version: '>= 0.59.0',
default_options: [ default_options: [
'warning_level=2', 'warning_level=2',

View File

@@ -3,13 +3,14 @@
# This file is distributed under the same license as the Cartridges package. # This file is distributed under the same license as the Cartridges package.
# سید حسین موسوی فرد <shmf1385@protonmail.com>, 2023. # سید حسین موسوی فرد <shmf1385@protonmail.com>, 2023.
# Danial Behzadi <dani.behzi@ubuntu.com>, 2023. # Danial Behzadi <dani.behzi@ubuntu.com>, 2023.
# آوید <avds+git@disroot.org>, 2024.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Cartridges\n" "Project-Id-Version: Cartridges\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-14 12:48+0200\n" "POT-Creation-Date: 2024-04-14 12:48+0200\n"
"PO-Revision-Date: 2023-09-24 16:04+0000\n" "PO-Revision-Date: 2024-07-14 20:09+0000\n"
"Last-Translator: Danial Behzadi <dani.behzi@ubuntu.com>\n" "Last-Translator: آوید <avds+git@disroot.org>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/cartridges/" "Language-Team: Persian <https://hosted.weblate.org/projects/cartridges/"
"cartridges/fa/>\n" "cartridges/fa/>\n"
"Language: fa\n" "Language: fa\n"
@@ -17,7 +18,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n" "Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.1-dev\n" "X-Generator: Weblate 5.7-dev\n"
#: data/page.kramo.Cartridges.desktop.in:3 #: data/page.kramo.Cartridges.desktop.in:3
#: data/page.kramo.Cartridges.metainfo.xml.in:9 #: data/page.kramo.Cartridges.metainfo.xml.in:9
@@ -74,7 +75,7 @@ msgstr "لغو"
#: data/gtk/details-dialog.blp:46 #: data/gtk/details-dialog.blp:46
msgid "New Cover" msgid "New Cover"
msgstr "طرج جلد جدید" msgstr "طرح جلد جدید"
#: data/gtk/details-dialog.blp:65 #: data/gtk/details-dialog.blp:65
msgid "Delete Cover" msgid "Delete Cover"
@@ -98,7 +99,7 @@ msgstr "گزینش پرونده"
#: data/gtk/details-dialog.blp:120 #: data/gtk/details-dialog.blp:120
msgid "More Info" msgid "More Info"
msgstr "اطّلاعات بیشتر" msgstr "اطلاعات بیشتر"
#: data/gtk/game.blp:102 data/gtk/game.blp:110 data/gtk/window.blp:443 #: data/gtk/game.blp:102 data/gtk/game.blp:110 data/gtk/window.blp:443
msgid "Edit" msgid "Edit"
@@ -127,7 +128,7 @@ msgstr "جست‌وجو"
#: data/gtk/help-overlay.blp:24 data/gtk/window.blp:543 #: data/gtk/help-overlay.blp:24 data/gtk/window.blp:543
msgid "Keyboard Shortcuts" msgid "Keyboard Shortcuts"
msgstr "میان‌برهیا صفحه‌کلید" msgstr "میان‌برهای صفحه‌کلید"
#: data/gtk/help-overlay.blp:29 cartridges/game.py:103 #: data/gtk/help-overlay.blp:29 cartridges/game.py:103
#: cartridges/preferences.py:134 cartridges/importer/importer.py:394 #: cartridges/preferences.py:134 cartridges/importer/importer.py:394
@@ -182,7 +183,7 @@ msgstr "طرح جلد بازی را اجرا می‌کند"
#: data/gtk/preferences.blp:21 #: data/gtk/preferences.blp:21
msgid "Swaps the behavior of the cover image and the play button" msgid "Swaps the behavior of the cover image and the play button"
msgstr "تعویض رفتار تصویر جلد و دکمهٔ بازی کردن" msgstr "تغییر رفتار تصویر جلد و دکمهٔ بازی کردن"
#: data/gtk/preferences.blp:26 cartridges/details_dialog.py:82 #: data/gtk/preferences.blp:26 cartridges/details_dialog.py:82
msgid "Images" msgid "Images"
@@ -194,7 +195,7 @@ msgstr "عکس‌های با کیفیت بالا"
#: data/gtk/preferences.blp:30 #: data/gtk/preferences.blp:30
msgid "Save game covers losslessly at the cost of storage" msgid "Save game covers losslessly at the cost of storage"
msgstr "ذخیرهٔ طرح جلدهای بدون اتلاف به فیمت ذخیره‌سازی" msgstr "ذخیرهٔ طرح جلدهای بدون اتلاف به قیمت ذخیره‌سازی"
#: data/gtk/preferences.blp:35 #: data/gtk/preferences.blp:35
msgid "Danger Zone" msgid "Danger Zone"
@@ -206,7 +207,7 @@ msgstr "حذف کردن همهٔ بازی‌ها"
#: data/gtk/preferences.blp:120 #: data/gtk/preferences.blp:120
msgid "Remove Uninstalled Games" msgid "Remove Uninstalled Games"
msgstr "برداشن بازی‌های نصب نشده" msgstr "برداشتن بازی‌های نصبنشده"
#: data/gtk/preferences.blp:125 #: data/gtk/preferences.blp:125
msgid "Sources" msgid "Sources"
@@ -254,7 +255,7 @@ msgstr "درون‌ریزی بازی‌های آمازون"
#: data/gtk/preferences.blp:228 #: data/gtk/preferences.blp:228
msgid "Import Sideloaded Games" msgid "Import Sideloaded Games"
msgstr "درون‌ریزی بازی‌های نصب شده" msgstr "درون‌ریزی بازی‌های نصبشده"
#: data/gtk/preferences.blp:233 cartridges/importer/bottles_source.py:86 #: data/gtk/preferences.blp:233 cartridges/importer/bottles_source.py:86
msgid "Bottles" msgid "Bottles"
@@ -278,15 +279,13 @@ msgstr "فلت‌پک"
#. The location of the system-wide data directory #. The location of the system-wide data directory
#: data/gtk/preferences.blp:351 #: data/gtk/preferences.blp:351
#, fuzzy
msgid "System Location" msgid "System Location"
msgstr "تنظیم مکان" msgstr "مکان سامانه"
#. The location of the user-specific data directory #. The location of the user-specific data directory
#: data/gtk/preferences.blp:369 #: data/gtk/preferences.blp:369
#, fuzzy
msgid "User Location" msgid "User Location"
msgstr "تنظیم مکان" msgstr "مکان کاربر"
#: data/gtk/preferences.blp:386 #: data/gtk/preferences.blp:386
msgid "Import Game Launchers" msgid "Import Game Launchers"
@@ -322,20 +321,19 @@ msgstr "ترجیح به تصویرهای رسمی"
#: data/gtk/preferences.blp:427 #: data/gtk/preferences.blp:427
msgid "Prefer Animated Images" msgid "Prefer Animated Images"
msgstr "ترچیح تصویرهای پویا" msgstr "ترجیح تصویرهای پویا"
#: data/gtk/preferences.blp:433 #: data/gtk/preferences.blp:433
#, fuzzy
msgid "Update Covers" msgid "Update Covers"
msgstr "حذف طرح جلد" msgstr "به‌روزرسانی طرح جلد"
#: data/gtk/preferences.blp:434 #: data/gtk/preferences.blp:434
msgid "Fetch covers for games already in your library" msgid "Fetch covers for games already in your library"
msgstr "" msgstr "دریافت طرح جلد بازی‌های کنونی کتاب‌خانه‌تان"
#: data/gtk/preferences.blp:439 #: data/gtk/preferences.blp:439
msgid "Update" msgid "Update"
msgstr "" msgstr "به‌روزرسانی"
#: data/gtk/window.blp:6 data/gtk/window.blp:14 #: data/gtk/window.blp:6 data/gtk/window.blp:14
msgid "No Games Found" msgid "No Games Found"
@@ -359,7 +357,7 @@ msgstr "بدون بازی نهفته"
#: data/gtk/window.blp:41 #: data/gtk/window.blp:41
msgid "Games you hide will appear here" msgid "Games you hide will appear here"
msgstr "بازی‌هایی که پنهان می‌کنید، این‌جا ظاهر خواهند شد" msgstr "بازی‌هایی که پنهان می‌کنید، این‌جا نمایان خواهند شد"
#: data/gtk/window.blp:76 data/gtk/window.blp:111 cartridges/main.py:228 #: data/gtk/window.blp:76 data/gtk/window.blp:111 cartridges/main.py:228
msgid "All Games" msgid "All Games"
@@ -407,7 +405,7 @@ msgstr "قدیمی‌ترین"
#: data/gtk/window.blp:528 #: data/gtk/window.blp:528
msgid "Last Played" msgid "Last Played"
msgstr "آخرین بازی شده" msgstr "آخرین بازیشده"
#: data/gtk/window.blp:535 #: data/gtk/window.blp:535
msgid "Show Hidden" msgid "Show Hidden"
@@ -419,15 +417,15 @@ msgstr "دربارهٔ کارتریج‌ها"
#: data/gtk/window.blp:561 #: data/gtk/window.blp:561
msgid "IGDB" msgid "IGDB"
msgstr "" msgstr "IGDB"
#: data/gtk/window.blp:563 #: data/gtk/window.blp:563
msgid "ProtonDB" msgid "ProtonDB"
msgstr "" msgstr "ProtonDB"
#: data/gtk/window.blp:565 #: data/gtk/window.blp:565
msgid "HowLongToBeat" msgid "HowLongToBeat"
msgstr "" msgstr "HowLongToBeat"
#. The variable is the title of the game #. The variable is the title of the game
#: cartridges/main.py:205 cartridges/game.py:125 #: cartridges/main.py:205 cartridges/game.py:125
@@ -451,7 +449,7 @@ msgstr "هرگز"
#. The variable is the date when the game was last played #. The variable is the date when the game was last played
#: cartridges/window.py:380 #: cartridges/window.py:380
msgid "Last played: {}" msgid "Last played: {}"
msgstr "آخرین بازی شده: {}" msgstr "آخرین بازیشده: {}"
#: cartridges/details_dialog.py:73 #: cartridges/details_dialog.py:73
msgid "Apply" msgid "Apply"
@@ -555,11 +553,11 @@ msgstr ""
#: cartridges/preferences.py:196 #: cartridges/preferences.py:196
msgid "Downloading covers…" msgid "Downloading covers…"
msgstr "" msgstr "در حال دریافت طرح‌های جلد…"
#: cartridges/preferences.py:215 #: cartridges/preferences.py:215
msgid "Covers updated" msgid "Covers updated"
msgstr "" msgstr "طرح‌های جلد به‌روزرسانی شد"
#: cartridges/preferences.py:360 #: cartridges/preferences.py:360
msgid "Installation Not Found" msgid "Installation Not Found"
@@ -599,7 +597,7 @@ msgstr "هیچ بازی جدیدی پیدا نشد"
#: cartridges/importer/importer.py:379 #: cartridges/importer/importer.py:379
msgid "1 game imported" msgid "1 game imported"
msgstr "۱ بازی درون‌ریخته شد" msgstr "یک بازی درون‌ریخته شد"
#. The variable is the number of games #. The variable is the number of games
#: cartridges/importer/importer.py:383 #: cartridges/importer/importer.py:383