Rename to Cartridges

This commit is contained in:
kramo
2023-02-01 16:34:26 +01:00
parent de4fd79144
commit a9a5a1d3c2
28 changed files with 70 additions and 71 deletions

View File

@@ -1,8 +1,8 @@
<div align="center"> <div align="center">
<img src="data/icons/hicolor/scalable/apps/hu.kramo.GameShelf.svg" width="128" height="128"> <img src="data/icons/hicolor/scalable/apps/hu.kramo.Cartridges.svg" width="128" height="128">
# Game Shelf # Cartridges
A GTK4 + Libadwaita game launcher A GTK4 + Libadwaita game launcher
<img src="data/screenshot.webp"> <img src="data/screenshot.webp">
@@ -10,7 +10,7 @@
## The Project ## The Project
Game Shelf is a simple game launcher written in Python using GTK4 + Libadwaita. Cartridges is a simple game launcher written in Python using GTK4 + Libadwaita.
### Features ### Features
- Manually adding and editing games - Manually adding and editing games
- Importing games from Steam and Heroic - Importing games from Steam and Heroic
@@ -31,7 +31,7 @@ Game Shelf is a simple game launcher written in Python using GTK4 + Libadwaita.
### From Releases ### From Releases
1. Install `org.gnome.Platform` from the [gnome-nightly repository](https://wiki.gnome.org/Apps/Nightly) if needed. 1. Install `org.gnome.Platform` from the [gnome-nightly repository](https://wiki.gnome.org/Apps/Nightly) if needed.
2. Download the latest release from Releases. 2. Download the latest release from Releases.
3. Install it via GNOME Software or `flatpak install hu.kramo.GameShelf.flatpak`. 3. Install it via GNOME Software or `flatpak install hu.kramo.Cartridges.flatpak`.
### From GNOME Builder ### From GNOME Builder
Click the down arrow next to the hammer at the top of your GNOME Builder window, then click "Export". This will create a flatpak that then can be installed on your system. Click the down arrow next to the hammer at the top of your GNOME Builder window, then click "Export". This will create a flatpak that then can be installed on your system.
@@ -45,6 +45,6 @@ Fork the repository, make your changes, then create a pull request.
Currently, translations can be added manually with the following steps: Currently, translations can be added manually with the following steps:
1. Clone the repository. 1. Clone the repository.
2. If it isn't already there, add your language to `/po/LINGUAS`. 2. If it isn't already there, add your language to `/po/LINGUAS`.
3. Create a new translation from the `/po/gameshelf.pot` file with a program such as [Poedit](https://poedit.net/). 3. Create a new translation from the `/po/cartridges.pot` file with a program such as [Poedit](https://poedit.net/).
4. Save the file as `[YOUR LANGUAGE CODE].po` to `/po/`. 4. Save the file as `[YOUR LANGUAGE CODE].po` to `/po/`.
5. Create a pull request with your translations. 5. Create a pull request with your translations.

View File

@@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
Name=Game Shelf Name=Cartridges
Exec=gameshelf Exec=cartridges
Icon=hu.kramo.GameShelf Icon=hu.kramo.Cartridges
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Game; Categories=Game;

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="gameshelf"> <schemalist gettext-domain="cartridges">
<schema id="hu.kramo.GameShelf" path="/hu/kramo/GameShelf/"> <schema id="hu.kramo.Cartridges" path="/hu/kramo/Cartridges/">
<key name="exit-after-launch" type="b"> <key name="exit-after-launch" type="b">
<default>false</default> <default>false</default>
</key> </key>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application"> <component type="desktop-application">
<id>hu.kramo.GameShelf.desktop</id> <id>hu.kramo.Cartridges.desktop</id>
<metadata_license>CC0-1.0</metadata_license> <metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license> <project_license>GPL-3.0-or-later</project_license>
<name>Game Shelf</name> <name>Cartridges</name>
<summary>Launch all your games</summary> <summary>Launch all your games</summary>
<description> <description>
<p>Game Shelf is a simple game launcher. It has support for importing your games from Steam and Heroic with organizational features such as hiding and sorting by date added or last played.</p> <p>Cartridges is a simple game launcher. It has support for importing your games from Steam and Heroic with organizational features such as hiding and sorting by date added or last played.</p>
</description> </description>
<launchable type="desktop-id">hu.kramo.GameShelf.desktop</launchable> <launchable type="desktop-id">hu.kramo.Cartridges.desktop</launchable>
<developer_name>kramo</developer_name> <developer_name>kramo</developer_name>
</component> </component>

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 618 B

View File

@@ -1,4 +1,4 @@
application_id = 'hu.kramo.GameShelf' application_id = 'hu.kramo.Cartridges'
scalable_dir = join_paths('hicolor', 'scalable', 'apps') scalable_dir = join_paths('hicolor', 'scalable', 'apps')
install_data( install_data(

View File

@@ -1,6 +1,6 @@
desktop_file = i18n.merge_file( desktop_file = i18n.merge_file(
input: 'hu.kramo.GameShelf.desktop.in', input: 'hu.kramo.Cartridges.desktop.in',
output: 'hu.kramo.GameShelf.desktop', output: 'hu.kramo.Cartridges.desktop',
type: 'desktop', type: 'desktop',
po_dir: '../po', po_dir: '../po',
install: true, install: true,
@@ -13,8 +13,8 @@ if desktop_utils.found()
endif endif
appstream_file = i18n.merge_file( appstream_file = i18n.merge_file(
input: 'hu.kramo.GameShelf.metainfo.xml.in', input: 'hu.kramo.Cartridges.metainfo.xml.in',
output: 'hu.kramo.GameShelf.metainfo.xml', output: 'hu.kramo.Cartridges.metainfo.xml',
po_dir: '../po', po_dir: '../po',
install: true, install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo') install_dir: join_paths(get_option('datadir'), 'metainfo')
@@ -25,7 +25,7 @@ if appstream_util.found()
test('Validate appstream file', appstream_util, args: ['validate', appstream_file]) test('Validate appstream file', appstream_util, args: ['validate', appstream_file])
endif endif
install_data('hu.kramo.GameShelf.gschema.xml', install_data('hu.kramo.Cartridges.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
) )

View File

@@ -1,9 +1,9 @@
{ {
"app-id" : "hu.kramo.GameShelf", "app-id" : "hu.kramo.Cartridges",
"runtime" : "org.gnome.Platform", "runtime" : "org.gnome.Platform",
"runtime-version" : "master", "runtime-version" : "master",
"sdk" : "org.gnome.Sdk", "sdk" : "org.gnome.Sdk",
"command" : "gameshelf", "command" : "cartridges",
"finish-args" : [ "finish-args" : [
"--share=ipc", "--share=ipc",
"--socket=fallback-x11", "--socket=fallback-x11",
@@ -27,7 +27,7 @@
], ],
"modules" : [ "modules" : [
{ {
"name" : "gameshelf", "name" : "cartridges",
"builddir" : true, "builddir" : true,
"buildsystem" : "meson", "buildsystem" : "meson",
"sources" : [ "sources" : [

View File

@@ -1,4 +1,4 @@
project('gameshelf', project('cartridges',
version: '0.1.1', version: '0.1.1',
meson_version: '>= 0.59.0', meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2', 'werror=false', ], default_options: [ 'warning_level=2', 'werror=false', ],

View File

@@ -68,7 +68,7 @@ msgid "Games you hide will appear here."
msgstr "" msgstr ""
#: src/window.blp:29 #: src/window.blp:29
msgid "Game Shelf" msgid "Cartridges"
msgstr "" msgstr ""
#: src/window.blp:52 #: src/window.blp:52
@@ -124,7 +124,7 @@ msgid "Keyboard Shortcuts"
msgstr "" msgstr ""
#: src/window.blp:351 #: src/window.blp:351
msgid "About Game Shelf" msgid "About Cartridges"
msgstr "" msgstr ""
#: src/window.blp:360 #: src/window.blp:360

View File

@@ -69,7 +69,7 @@ msgid "Games you hide will appear here."
msgstr "A rejtett játékaid itt lesznek megtalálhatók." msgstr "A rejtett játékaid itt lesznek megtalálhatók."
#: src/window.blp:29 #: src/window.blp:29
msgid "Game Shelf" msgid "Cartridges"
msgstr "Játékpolc" msgstr "Játékpolc"
#: src/window.blp:52 #: src/window.blp:52
@@ -125,7 +125,7 @@ msgid "Keyboard Shortcuts"
msgstr "Billentyűparancsok" msgstr "Billentyűparancsok"
#: src/window.blp:351 #: src/window.blp:351
msgid "About Game Shelf" msgid "About Cartridges"
msgstr "A Játékpolcról" msgstr "A Játékpolcról"
#: src/window.blp:360 #: src/window.blp:360

View File

@@ -1 +1 @@
i18n.gettext('gameshelf', preset: 'glib') i18n.gettext('cartridges', preset: 'glib')

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<gresources> <gresources>
<gresource prefix="/hu/kramo/GameShelf"> <gresource prefix="/hu/kramo/Cartridges">
<file preprocess="xml-stripblanks">window.ui</file> <file preprocess="xml-stripblanks">window.ui</file>
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file> <file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
<file preprocess="xml-stripblanks">gtk/game.ui</file> <file preprocess="xml-stripblanks">gtk/game.ui</file>

View File

@@ -1,6 +1,6 @@
#!@PYTHON@ #!@PYTHON@
# gameshelf.in # cartridges.in
# #
# Copyright 2022 kramo # Copyright 2022 kramo
# #
@@ -31,16 +31,16 @@ localedir = '@localedir@'
sys.path.insert(1, pkgdatadir) sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL)
locale.bindtextdomain('gameshelf', localedir) locale.bindtextdomain('cartridges', localedir)
locale.textdomain('gameshelf') locale.textdomain('cartridges')
gettext.install('gameshelf', localedir) gettext.install('cartridges', localedir)
if __name__ == '__main__': if __name__ == '__main__':
import gi import gi
from gi.repository import Gio from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'gameshelf.gresource')) resource = Gio.Resource.load(os.path.join(pkgdatadir, 'cartridges.gresource'))
resource._register() resource._register()
from gameshelf import main from cartridges import main
sys.exit(main.main(VERSION)) sys.exit(main.main(VERSION))

View File

@@ -19,7 +19,7 @@
from gi.repository import Gtk from gi.repository import Gtk
@Gtk.Template(resource_path='/hu/kramo/GameShelf/gtk/game.ui') @Gtk.Template(resource_path='/hu/kramo/Cartridges/gtk/game.ui')
class game(Gtk.Box): class game(Gtk.Box):
__gtype_name__ = 'game' __gtype_name__ = 'game'

View File

@@ -24,7 +24,7 @@ gi.require_version("Adw", "1")
from gi.repository import Gtk, Gio, GLib, Adw from gi.repository import Gtk, Gio, GLib, Adw
from .window import GameShelfWindow from .window import CartridgesWindow
from .preferences import PreferencesWindow from .preferences import PreferencesWindow
from .toggle_hidden import toggle_hidden from .toggle_hidden import toggle_hidden
from .save_games import save_games from .save_games import save_games
@@ -33,9 +33,9 @@ from .steam_parser import steam_parser
from .heroic_parser import heroic_parser from .heroic_parser import heroic_parser
from .create_details_window import create_details_window from .create_details_window import create_details_window
class GameShelfApplication(Adw.Application): class CartridgesApplication(Adw.Application):
def __init__(self): def __init__(self):
super().__init__(application_id="hu.kramo.GameShelf", flags=Gio.ApplicationFlags.FLAGS_NONE) super().__init__(application_id="hu.kramo.Cartridges", flags=Gio.ApplicationFlags.FLAGS_NONE)
self.create_action("quit", self.on_quit_action, ["<primary>q"]) self.create_action("quit", self.on_quit_action, ["<primary>q"])
self.create_action("about", self.on_about_action) self.create_action("about", self.on_about_action)
self.create_action("preferences", self.on_preferences_action) self.create_action("preferences", self.on_preferences_action)
@@ -52,7 +52,7 @@ class GameShelfApplication(Adw.Application):
# Create the main window # Create the main window
win = self.props.active_window win = self.props.active_window
if not win: if not win:
win = GameShelfWindow(application=self) win = CartridgesWindow(application=self)
win.present() win.present()
@@ -70,8 +70,8 @@ class GameShelfApplication(Adw.Application):
def on_about_action(self, widget, callback=None): def on_about_action(self, widget, callback=None):
about = Adw.AboutWindow(transient_for=self.props.active_window, about = Adw.AboutWindow(transient_for=self.props.active_window,
application_name="Game Shelf", application_name="Cartridges",
application_icon="hu.kramo.GameShelf", application_icon="hu.kramo.Cartridges",
developer_name="kramo", developer_name="kramo",
version="0.1.1", version="0.1.1",
developers=["kramo"], developers=["kramo"],
@@ -119,7 +119,7 @@ class GameShelfApplication(Adw.Application):
# Add "removed=True" to the game properties so it can be deleted on next init # Add "removed=True" to the game properties so it can be deleted on next init
game_id = self.props.active_window.active_game_id game_id = self.props.active_window.active_game_id
open_file = open(os.path.join(os.path.join(os.environ.get("XDG_DATA_HOME"), "games", game_id + ".json")), "r") open_file = open(os.path.join(os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games", game_id + ".json")), "r")
data = json.loads(open_file.read()) data = json.loads(open_file.read())
open_file.close() open_file.close()
data["removed"] = True data["removed"] = True
@@ -153,6 +153,6 @@ class GameShelfApplication(Adw.Application):
self.set_accels_for_action(f"win.{name}", shortcuts) self.set_accels_for_action(f"win.{name}", shortcuts)
def main(version): def main(version):
app = GameShelfApplication() app = CartridgesApplication()
return app.run(sys.argv) return app.run(sys.argv)

View File

@@ -1,5 +1,5 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'gameshelf') moduledir = join_paths(pkgdatadir, 'cartridges')
gnome = import('gnome') gnome = import('gnome')
blueprints = custom_target('blueprints', blueprints = custom_target('blueprints',
@@ -13,8 +13,8 @@ blueprints = custom_target('blueprints',
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
) )
gnome.compile_resources('gameshelf', gnome.compile_resources('cartridges',
'gameshelf.gresource.xml', 'cartridges.gresource.xml',
gresource_bundle: true, gresource_bundle: true,
install: true, install: true,
install_dir: pkgdatadir, install_dir: pkgdatadir,
@@ -30,14 +30,14 @@ conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir) conf.set('pkgdatadir', pkgdatadir)
configure_file( configure_file(
input: 'gameshelf.in', input: 'cartridges.in',
output: 'gameshelf', output: 'cartridges',
configuration: conf, configuration: conf,
install: true, install: true,
install_dir: get_option('bindir') install_dir: get_option('bindir')
) )
gameshelf_sources = [ cartridges_sources = [
'__init__.py', '__init__.py',
'main.py', 'main.py',
'window.py', 'window.py',
@@ -55,4 +55,4 @@ gameshelf_sources = [
'utils/create_details_window.py' 'utils/create_details_window.py'
] ]
install_data(gameshelf_sources, install_dir: moduledir) install_data(cartridges_sources, install_dir: moduledir)

View File

@@ -19,7 +19,7 @@
from gi.repository import Adw, Gtk, Gio, GLib from gi.repository import Adw, Gtk, Gio, GLib
@Gtk.Template(resource_path='/hu/kramo/GameShelf/gtk/preferences.ui') @Gtk.Template(resource_path='/hu/kramo/Cartridges/gtk/preferences.ui')
class PreferencesWindow(Adw.PreferencesWindow): class PreferencesWindow(Adw.PreferencesWindow):
__gtype_name__ = 'PreferencesWindow' __gtype_name__ = 'PreferencesWindow'

View File

@@ -131,7 +131,6 @@ def create_details_window(parent_widget, game_id = None):
values = {} values = {}
games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "games")
final_name = name.get_buffer().get_text() final_name = name.get_buffer().get_text()
final_executable = executable.get_buffer().get_text() final_executable = executable.get_buffer().get_text()

View File

@@ -21,7 +21,7 @@ def get_cover(game, parent_widget):
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
import os import os
cover_path = os.path.join(os.environ.get("XDG_DATA_HOME"), "covers", game["game_id"] + ".dat") cover_path = os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "covers", game["game_id"] + ".dat")
if os.path.isfile(cover_path) == False: if os.path.isfile(cover_path) == False:
return parent_widget.placeholder_pixbuf return parent_widget.placeholder_pixbuf

View File

@@ -20,7 +20,7 @@
def get_games(): def get_games():
import os, json import os, json
games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "games") games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games")
games = {} games = {}
if os.path.exists(games_dir) == False: if os.path.exists(games_dir) == False:

View File

@@ -24,5 +24,5 @@ def run_command(parent_widget, executable):
subprocess.Popen(["flatpak-spawn --host " + executable], shell=True, start_new_session=True) subprocess.Popen(["flatpak-spawn --host " + executable], shell=True, start_new_session=True)
if Gio.Settings.new("hu.kramo.GameShelf").get_boolean("exit-after-launch") == True: if Gio.Settings.new("hu.kramo.Cartridges").get_boolean("exit-after-launch") == True:
sys.exit() sys.exit()

View File

@@ -21,7 +21,7 @@ def save_cover(game, parent_widget, file_path, pixbuf = None, game_id = None):
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
import os import os
covers_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "covers") covers_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "covers")
if os.path.exists(covers_dir) == False: if os.path.exists(covers_dir) == False:
os.makedirs(covers_dir) os.makedirs(covers_dir)

View File

@@ -19,7 +19,7 @@
def save_games(games): def save_games(games):
import os, json import os, json
games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "games") games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games")
existing = [] existing = []
if os.path.exists(games_dir) == False: if os.path.exists(games_dir) == False:

View File

@@ -19,7 +19,7 @@
def toggle_hidden(game): def toggle_hidden(game):
import os, json import os, json
games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "games") games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games")
if os.path.exists(games_dir) == False: if os.path.exists(games_dir) == False:
return return

View File

@@ -25,8 +25,8 @@ Adw.StatusPage hidden_notice_empty {
valign: center; valign: center;
} }
template GameShelfWindow : Adw.ApplicationWindow { template CartridgesWindow : Adw.ApplicationWindow {
title: _("Game Shelf"); title: _("Cartridges");
default-width: 1110; default-width: 1110;
default-height: 820; default-height: 820;
@@ -348,7 +348,7 @@ menu primary_menu {
} }
item { item {
label: _("About Game Shelf"); label: _("About Cartridges");
action: "app.about"; action: "app.about";
} }
} }

View File

@@ -26,9 +26,9 @@ from .get_cover import get_cover
from .get_games import get_games from .get_games import get_games
from .save_games import save_games from .save_games import save_games
@Gtk.Template(resource_path="/hu/kramo/GameShelf/window.ui") @Gtk.Template(resource_path="/hu/kramo/Cartridges/window.ui")
class GameShelfWindow(Adw.ApplicationWindow): class CartridgesWindow(Adw.ApplicationWindow):
__gtype_name__ = "GameShelfWindow" __gtype_name__ = "CartridgesWindow"
toast_overlay = Gtk.Template.Child() toast_overlay = Gtk.Template.Child()
stack = Gtk.Template.Child() stack = Gtk.Template.Child()
@@ -77,14 +77,14 @@ class GameShelfWindow(Adw.ApplicationWindow):
self.overview.set_measure_overlay(self.overview_box, True) self.overview.set_measure_overlay(self.overview_box, True)
self.overview.set_clip_overlay(self.overview_box, False) self.overview.set_clip_overlay(self.overview_box, False)
self.schema = Gio.Settings.new("hu.kramo.GameShelf") self.schema = Gio.Settings.new("hu.kramo.Cartridges")
self.placeholder_pixbuf = GdkPixbuf.Pixbuf.new_from_resource_at_scale("/hu/kramo/GameShelf/assets/library_placeholder.svg", 200, 300, False) self.placeholder_pixbuf = GdkPixbuf.Pixbuf.new_from_resource_at_scale("/hu/kramo/Cartridges/assets/library_placeholder.svg", 200, 300, False)
games = get_games() games = get_games()
for game in games: for game in games:
if "removed" in games[game].keys(): if "removed" in games[game].keys():
os.remove(os.path.join(os.environ.get("XDG_DATA_HOME"), "games", game + ".json")) os.remove(os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games", game + ".json"))
try: try:
os.remove(os.path.join(os.environ.get("XDG_DATA_HOME"), "covers", game + ".dat")) os.remove(os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "covers", game + ".dat"))
except FileNotFoundError: except FileNotFoundError:
pass pass
@@ -374,7 +374,7 @@ class GameShelfWindow(Adw.ApplicationWindow):
game_id = list(self.toasts)[-1] game_id = list(self.toasts)[-1]
except IndexError: except IndexError:
return return
open_file = open(os.path.join(os.path.join(os.environ.get("XDG_DATA_HOME"), "games", game_id + ".json")), "r") open_file = open(os.path.join(os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games", game_id + ".json")), "r")
data = json.loads(open_file.read()) data = json.loads(open_file.read())
open_file.close() open_file.close()
data.pop("removed") data.pop("removed")