This commit is contained in:
kramo
2023-03-29 23:02:10 +02:00
parent e6ba083736
commit dad4905753
4 changed files with 44 additions and 40 deletions

View File

@@ -17,7 +17,6 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
import os
import sys
import time

View File

@@ -27,13 +27,13 @@ from .create_dialog import create_dialog
class ImportPreferences:
def __init__(
self,
window,
source_id,
name,
key,
install_key,
paths,
expander_row,
file_chooser_button,
window,
config=False,
):
def set_dir(_source, result, _unused):
@@ -60,7 +60,7 @@ class ImportPreferences:
).connect("response", response)
else:
window.schema.set_string(
key,
install_key,
path,
)
except GLib.GError:
@@ -109,8 +109,9 @@ class PreferencesWindow(Adw.PreferencesWindow):
self.schema = parent_widget.schema
self.parent_widget = parent_widget
self.file_chooser = Gtk.FileDialog()
self.set_transient_for(parent_widget)
# General
self.schema.bind(
"exit-after-launch",
self.exit_after_launch_switch,
@@ -129,23 +130,20 @@ class PreferencesWindow(Adw.PreferencesWindow):
"active",
Gio.SettingsBindFlags.DEFAULT,
)
self.schema.bind(
"heroic-import-epic",
self.heroic_epic_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
)
self.schema.bind(
"heroic-import-gog",
self.heroic_gog_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
)
self.schema.bind(
"heroic-import-sideload",
self.heroic_sideloaded_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
# Steam
ImportPreferences(
self,
"steam",
"Steam",
"steam-location",
[
"steamapps",
os.path.join("steam", "steamapps"),
os.path.join("Steam", "steamapps"),
],
self.steam_expander_row,
self.steam_file_chooser_button,
)
def update_revealer():
@@ -174,39 +172,46 @@ class PreferencesWindow(Adw.PreferencesWindow):
)
self.steam_clear_button.connect("clicked", clear_steam_dirs)
# Heroic
ImportPreferences(
"steam",
"Steam",
"steam-location",
[
"steamapps",
os.path.join("steam", "steamapps"),
os.path.join("Steam", "steamapps"),
],
self.steam_expander_row,
self.steam_file_chooser_button,
self,
)
ImportPreferences(
"heroic",
"Heroic",
"heroic-location",
["config.json"],
self.heroic_expander_row,
self.heroic_file_chooser_button,
self,
True,
)
self.schema.bind(
"heroic-import-epic",
self.heroic_epic_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
)
self.schema.bind(
"heroic-import-gog",
self.heroic_gog_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
)
self.schema.bind(
"heroic-import-sideload",
self.heroic_sideloaded_switch,
"active",
Gio.SettingsBindFlags.DEFAULT,
)
# Bottles
ImportPreferences(
self,
"bottles",
"Bottles",
"bottles-location",
["library.yml"],
self.bottles_expander_row,
self.bottles_file_chooser_button,
self,
)
if os.name == "nt":

View File

@@ -34,7 +34,7 @@ def save_cover(parent_widget, game_id, cover_path, pixbuf=None):
os.makedirs(covers_dir)
if pixbuf is None:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(cover_path, 600, 900, False)
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(cover_path, 400, 600, False)
def cover_callback(*_unused):
pass

View File

@@ -83,7 +83,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
self.schema = Gio.Settings.new("hu.kramo.Cartridges")
self.placeholder_pixbuf = GdkPixbuf.Pixbuf.new_from_resource_at_scale(
"/hu/kramo/Cartridges/library_placeholder.svg", 200, 300, False
"/hu/kramo/Cartridges/library_placeholder.svg", 400, 600, False
)
current_games = get_games()
for current_game in current_games:
@@ -104,7 +104,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
or os.path.expanduser(os.path.join("~", ".local", "share")),
"cartridges",
"covers",
f"{current_game}.dat",
f"{current_game}.tiff",
)
)
except FileNotFoundError: