Compare commits

..

7 Commits

Author SHA1 Message Date
kramo
1b654de6c9 v0.1.2 2023-02-01 16:45:48 +01:00
kramo
9242801395 Update screenshot 2023-02-01 16:39:50 +01:00
kramo
a9a5a1d3c2 Rename to Cartridges 2023-02-01 16:34:26 +01:00
kramo
de4fd79144 Update icons 2023-01-31 18:39:43 +01:00
kramo
077bfd5c10 Merge pull request #1 from imLinguin/heroic_improvements
Improve images import from Heroic
2023-01-30 18:32:29 +01:00
Paweł Lidwin
7351d26469 Fix flatpak manifest 2023-01-30 18:19:29 +01:00
Paweł Lidwin
08729a1dba Improve images import from Heroic 2023-01-30 18:18:38 +01:00
32 changed files with 150 additions and 132 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

@@ -0,0 +1,33 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" fill="none">
<path fill="url(#a)" d="M111 29H17a8 8 0 0 0-8 8v70a8 8 0 0 0 8 8h94a8 8 0 0 0 8-8V37a8 8 0 0 0-8-8Z"/>
<path fill="#C061CB" d="M111 29H17c-4.418 0-8 3.681-8 8.222v57.556c0 4.54 3.582 8.222 8 8.222h94c4.418 0 8-3.681 8-8.222V37.222c0-4.54-3.582-8.222-8-8.222Z"/>
<path fill="#000" d="M84 42H44a4 4 0 0 0-4 4v40a4 4 0 0 0 4 4h40a4 4 0 0 0 4-4V46a4 4 0 0 0-4-4Z"/>
<path fill="url(#b)" d="M81 50H47a2 2 0 0 0-2 2v28a2 2 0 0 0 2 2h34a2 2 0 0 0 2-2V52a2 2 0 0 0-2-2Z"/>
<path fill="#000" d="M102 61v-1a5 5 0 0 0-10 0v1a5 5 0 0 0 10 0ZM114 55v-1a5 5 0 0 0-10 0v1a5 5 0 0 0 10 0Z"/>
<path fill="#3D3846" d="M97 64c2.761 0 5-2.015 5-4.5S99.761 55 97 55s-5 2.015-5 4.5 2.239 4.5 5 4.5ZM109 58c2.761 0 5-2.015 5-4.5s-2.239-4.5-5-4.5-5 2.015-5 4.5 2.239 4.5 5 4.5Z"/>
<path fill="#000" d="M29 56.5a3.5 3.5 0 1 0-7 0v13a3.5 3.5 0 1 0 7 0v-13Z"/>
<path fill="#000" d="M33 58H18a3 3 0 0 0-3 3v2a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3v-2a3 3 0 0 0-3-3Z"/>
<path fill="#3D3846" d="M29 54.5a3.5 3.5 0 1 0-7 0v13a3.5 3.5 0 1 0 7 0v-13Z"/>
<path fill="#3D3846" d="M33 58H18a3 3 0 1 0 0 6h15a3 3 0 1 0 0-6Z"/>
<path fill="#000" d="M71 109a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z"/>
<path fill="#9141AC" d="M71.063 108.5a2 2 0 0 0 3.874 0 1.999 1.999 0 0 1-2.817 2.294 1.996 1.996 0 0 1-1.057-2.294Z"/>
<path fill="#000" d="M66 107H56a2 2 0 1 0 0 4h10a2 2 0 1 0 0-4Z"/>
<path fill="#9141AC" d="M54.063 108.5A2 2 0 0 0 56 111h10a2.005 2.005 0 0 0 1.582-.775 1.996 1.996 0 0 0 .355-1.725A1.999 1.999 0 0 1 66 110H56a1.998 1.998 0 0 1-1.937-1.5Z"/>
<path fill="#613583" d="M110 74H96a1 1 0 1 0 0 2h14a1 1 0 0 0 0-2ZM110 79H96a1 1 0 1 0 0 2h14a1 1 0 0 0 0-2ZM110 84H96a1 1 0 1 0 0 2h14a1 1 0 0 0 0-2Z"/>
<path fill="#000" d="M21.5 79h-3a2.5 2.5 0 0 0 0 5h3a2.5 2.5 0 0 0 0-5ZM32.5 79h-3a2.5 2.5 0 0 0 0 5h3a2.5 2.5 0 0 0 0-5Z"/>
<path fill="#3D3846" d="M22 79h-4a2 2 0 1 0 0 4h4a2 2 0 1 0 0-4ZM33 79h-4a2 2 0 1 0 0 4h4a2 2 0 1 0 0-4Z"/>
<defs>
<linearGradient id="a" x1="9" x2="119" y1="115" y2="115" gradientUnits="userSpaceOnUse">
<stop stop-color="#613583"/>
<stop offset=".05" stop-color="#9141AC"/>
<stop offset=".22" stop-color="#613583"/>
<stop offset=".78" stop-color="#613583"/>
<stop offset=".95" stop-color="#9141AC"/>
<stop offset="1" stop-color="#613583"/>
</linearGradient>
<linearGradient id="b" x1="45" x2="45" y1="50" y2="82" gradientUnits="userSpaceOnUse">
<stop stop-color="#BDD0D5"/>
<stop offset="1" stop-color="#305749"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -1,36 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" fill="none">
<rect width="88" height="112" x="20" y="8" fill="url(#a)" rx="9" style="fill:url(#a)"/>
<rect width="88" height="95" x="20" y="8" fill="url(#b)" rx="9" style="fill:url(#b)"/>
<rect width="74" height="46" x="27" y="15" fill="#000" rx="5"/>
<rect width="50" height="34" x="39" y="21" fill="url(#c)" rx="4" style="fill:url(#c)"/>
<rect width="9" height="9" x="55" y="107" fill="#241f31" rx="4.5"/>
<rect width="5" height="5" x="57" y="109" fill="#000" rx="2.5"/>
<rect width="5" height="5" x="71" y="109" fill="#241f31" rx="2.5"/>
<rect width="7" height="21" x="40" y="72" fill="#000" rx="3.5"/>
<rect width="7" height="21" x="79" y="-54" fill="#000" rx="3.5" transform="rotate(90)"/>
<rect width="7" height="21" x="40" y="71" fill="#241f31" rx="3.5"/>
<rect width="7" height="21" x="78" y="-54" fill="#241f31" rx="3.5" transform="rotate(90)"/>
<rect width="11" height="11" x="80" y="-80" fill="#000" rx="5.5" transform="rotate(90)"/>
<rect width="11" height="11" x="73" y="-94" fill="#000" rx="5.5" transform="rotate(90)"/>
<rect width="11" height="11" x="79" y="-80" fill="#241f31" rx="5.5" transform="rotate(90)"/>
<rect width="11" height="11" x="72" y="-94" fill="#241f31" rx="5.5" transform="rotate(90)"/>
<defs>
<linearGradient id="a" x1="20" x2="108" y1="120" y2="120" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF7800"/>
<stop offset=".06" stop-color="#FFA348"/>
<stop offset=".21" stop-color="#FFA348" style="stop-color:#ff7800;stop-opacity:1"/>
<stop offset=".8" stop-color="#FFA348" style="stop-color:#ff7800;stop-opacity:1"/>
<stop offset=".94" stop-color="#FFA348"/>
<stop offset="1" stop-color="#FF7800"/>
</linearGradient>
<linearGradient id="b" x1="64" x2="64" y1="8" y2="103" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#FFA348" style="stop-color:#f6d32d;stop-opacity:1"/>
<stop offset=".9" stop-color="#F6D32D"/>
<stop offset="1" stop-color="#F9F06B"/>
</linearGradient>
<linearGradient id="c" x1="39" x2="39" y1="21" y2="55" gradientUnits="userSpaceOnUse">
<stop stop-color="#53784D"/>
<stop offset="1" stop-color="#B2D18B"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 3C1.89543 3 1 3.89543 1 5V11C1 12.1046 1.89543 13 3 13H13C14.1046 13 15 12.1046 15 11V5C15 3.89543 14.1046 3 13 3H3ZM6 5C5.44772 5 5 5.44772 5 6V10C5 10.5523 5.44772 11 6 11H10C10.5523 11 11 10.5523 11 10V6C11 5.44772 10.5523 5 10 5H6ZM12 8C12 7.44772 12.4477 7 13 7C13.5523 7 14 7.44772 14 8C14 8.55228 13.5523 9 13 9C12.4477 9 12 8.55228 12 8ZM3 7C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9C3.55228 9 4 8.55228 4 8C4 7.44772 3.55228 7 3 7Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 618 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 1C2.44772 1 2 1.44772 2 2V14C2 14.5523 2.44772 15 3 15H13C13.5523 15 14 14.5523 14 14V2C14 1.44772 13.5523 1 13 1H3ZM5 2C4.44772 2 4 2.44772 4 3V6C4 6.55228 4.44772 7 5 7H11C11.5523 7 12 6.55228 12 6V3C12 2.44772 11.5523 2 11 2H5ZM4 10.5C4 9.67157 4.67157 9 5.5 9C6.32843 9 7 9.67157 7 10.5C7 11.3284 6.32843 12 5.5 12C4.67157 12 4 11.3284 4 10.5ZM10 9C9.44772 9 9 9.44771 9 10C9 10.5523 9.44771 11 10 11H11C11.5523 11 12 10.5523 12 10C12 9.44771 11.5523 9 11 9H10Z" fill="black"/>
</svg>

Before

Width:  |  Height:  |  Size: 637 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')
) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 KiB

After

Width:  |  Height:  |  Size: 876 KiB

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,13 +27,13 @@
], ],
"modules" : [ "modules" : [
{ {
"name" : "gameshelf", "name" : "cartridges",
"builddir" : true, "builddir" : true,
"buildsystem" : "meson", "buildsystem" : "meson",
"sources" : [ "sources" : [
{ {
"type" : "git", "type" : "dir",
"url" : "file:///home/kramo/Projects" "path" : "."
} }
] ]
} }

View File

@@ -1,5 +1,5 @@
project('gameshelf', project('cartridges',
version: '0.1.1', version: '0.1.2',
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,10 +70,10 @@ 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.2",
developers=["kramo"], developers=["kramo"],
copyright="© 2022 kramo", copyright="© 2022 kramo",
license_type=Gtk.License.GPL_3_0) license_type=Gtk.License.GPL_3_0)
@@ -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

@@ -18,7 +18,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
def heroic_parser(parent_widget, action): def heroic_parser(parent_widget, action):
import os, json, time import os, json, time, hashlib
from gi.repository import Gtk, GLib from gi.repository import Gtk, GLib
@@ -46,7 +46,8 @@ def heroic_parser(parent_widget, action):
if response == "choose_folder": if response == "choose_folder":
choose_folder(widget) choose_folder(widget)
create_dialog(parent_widget, _("Couldn't Import Games"), _("Heroic directory cannot be found."), "choose_folder", _("Set Heroic Location")).connect("response", response) create_dialog(parent_widget, _("Couldn't Import Games"), _("Heroic directory cannot be found."),
"choose_folder", _("Set Heroic Location")).connect("response", response)
if os.path.exists(os.path.join(heroic_dir, "config.json")) == True: if os.path.exists(os.path.join(heroic_dir, "config.json")) == True:
pass pass
@@ -58,21 +59,28 @@ def heroic_parser(parent_widget, action):
current_time = int(time.time()) current_time = int(time.time())
# Import Epic games # Import Epic games
if schema.get_boolean("heroic-import-epic") == False: if not schema.get_boolean("heroic-import-epic"):
pass pass
elif os.path.exists(os.path.join(heroic_dir, "lib-cache", "installInfo.json")) == True: elif os.path.exists(os.path.join(heroic_dir, "lib-cache", "installInfo.json")) and os.path.exists(
os.path.join(heroic_dir, "lib-cache", "library.json")):
open_file = open(os.path.join(heroic_dir, "lib-cache", "installInfo.json"), "r") open_file = open(os.path.join(heroic_dir, "lib-cache", "installInfo.json"), "r")
data = open_file.read() data = open_file.read()
open_file.close() open_file.close()
installInfo = json.loads(data) installInfo = json.loads(data)
open_file = open(os.path.join(heroic_dir, "lib-cache", "library.json"), "r")
data = open_file.read()
library = json.loads(data)
open_file.close()
for item in installInfo: for item in installInfo:
if installInfo[item]["install"] != None: if installInfo[item].get("install") is not None:
values = {} values = {}
app_name = installInfo[item]["game"]["app_name"] app_name = installInfo[item]["game"]["app_name"]
values["game_id"] = "heroic_epic_" + app_name values["game_id"] = "heroic_epic_" + app_name
if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[values["game_id"]].keys(): if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[
values["game_id"]].keys():
continue continue
values["name"] = installInfo[item]["game"]["title"] values["name"] = installInfo[item]["game"]["title"]
@@ -81,15 +89,22 @@ def heroic_parser(parent_widget, action):
values["source"] = "heroic_epic" values["source"] = "heroic_epic"
values["added"] = current_time values["added"] = current_time
values["last_played"] = 0 values["last_played"] = 0
if os.path.isfile(os.path.join(heroic_dir, "icons", app_name + ".jpg")) == True:
values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(os.path.join(heroic_dir, "icons", app_name + ".jpg")))
for game in library["library"]:
if game["app_name"] == app_name:
image_path = os.path.join(heroic_dir, "images-cache",
hashlib.sha256((game[
"art_square"] + "?h=400&resize=1&w=300").encode()).hexdigest())
if os.path.exists(image_path):
values["pixbuf_options"] = save_cover(values, parent_widget, image_path)
break
heroic_games[values["game_id"]] = values heroic_games[values["game_id"]] = values
# Import GOG games # Import GOG games
if schema.get_boolean("heroic-import-gog") == False: if not schema.get_boolean("heroic-import-gog"):
pass pass
elif os.path.exists(os.path.join(heroic_dir, "gog_store", "installed.json")) == True: elif os.path.exists(os.path.join(heroic_dir, "gog_store", "installed.json")):
open_file = open(os.path.join(heroic_dir, "gog_store", "installed.json"), "r") open_file = open(os.path.join(heroic_dir, "gog_store", "installed.json"), "r")
data = open_file.read() data = open_file.read()
open_file.close() open_file.close()
@@ -100,8 +115,9 @@ def heroic_parser(parent_widget, action):
values["game_id"] = "heroic_gog_" + app_name values["game_id"] = "heroic_gog_" + app_name
if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[values["game_id"]].keys(): if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[
continue values["game_id"]].keys():
continue
# Get game title from library.json as it's not present in installed.json # Get game title from library.json as it's not present in installed.json
open_file = open(os.path.join(heroic_dir, "gog_store", "library.json"), "r") open_file = open(os.path.join(heroic_dir, "gog_store", "library.json"), "r")
@@ -111,6 +127,10 @@ def heroic_parser(parent_widget, action):
for game in library["games"]: for game in library["games"]:
if game["app_name"] == app_name: if game["app_name"] == app_name:
values["name"] = game["title"] values["name"] = game["title"]
image_path = os.path.join(heroic_dir, "images-cache",
hashlib.sha256(game["art_square"].encode()).hexdigest())
if os.path.exists(image_path):
values["pixbuf_options"] = save_cover(values, parent_widget, image_path)
break break
values["executable"] = "xdg-open heroic://launch/" + app_name values["executable"] = "xdg-open heroic://launch/" + app_name
@@ -118,8 +138,6 @@ def heroic_parser(parent_widget, action):
values["source"] = "heroic_gog" values["source"] = "heroic_gog"
values["added"] = current_time values["added"] = current_time
values["last_played"] = 0 values["last_played"] = 0
if os.path.isfile(os.path.join(heroic_dir, "icons", app_name + ".jpg")) == True:
values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(os.path.join(heroic_dir, "icons", app_name + ".jpg")))
heroic_games[values["game_id"]] = values heroic_games[values["game_id"]] = values
# Import sideloaded games # Import sideloaded games
@@ -136,7 +154,8 @@ def heroic_parser(parent_widget, action):
values["game_id"] = "heroic_sideload_" + app_name values["game_id"] = "heroic_sideload_" + app_name
if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[values["game_id"]].keys(): if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[
values["game_id"]].keys():
continue continue
values["name"] = item["title"] values["name"] = item["title"]
@@ -145,8 +164,10 @@ def heroic_parser(parent_widget, action):
values["source"] = "heroic_sideload" values["source"] = "heroic_sideload"
values["added"] = current_time values["added"] = current_time
values["last_played"] = 0 values["last_played"] = 0
if os.path.isfile(os.path.join(heroic_dir, "icons", app_name + ".jpg")) == True: image_path = os.path.join(heroic_dir, "images-cache",
values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(os.path.join(heroic_dir, "icons", app_name + ".jpg"))) hashlib.sha256(item["art_square"].encode()).hexdigest())
if os.path.exists(image_path):
values["pixbuf_options"] = save_cover(values, parent_widget, image_path)
heroic_games[values["game_id"]] = values heroic_games[values["game_id"]] = values
if len(heroic_games) == 0: if len(heroic_games) == 0:
@@ -154,5 +175,6 @@ def heroic_parser(parent_widget, action):
elif len(heroic_games) == 1: elif len(heroic_games) == 1:
create_dialog(parent_widget, _("Heroic Games Imported"), _("Successfully imported 1 game.")) create_dialog(parent_widget, _("Heroic Games Imported"), _("Successfully imported 1 game."))
elif len(heroic_games) > 1: elif len(heroic_games) > 1:
create_dialog(parent_widget, _("Heroic Games Imported"), _("Successfully imported") + " " + str(len(heroic_games)) + " " + _("games.")) create_dialog(parent_widget, _("Heroic Games Imported"),
_("Successfully imported") + " " + str(len(heroic_games)) + " " + _("games."))
return heroic_games return heroic_games

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")