Update code style
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
from gi.repository import Adw, Gio, GLib, Gtk
|
||||
|
||||
|
||||
@Gtk.Template(resource_path='/hu/kramo/Cartridges/gtk/preferences.ui')
|
||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/preferences.ui")
|
||||
class PreferencesWindow(Adw.PreferencesWindow):
|
||||
__gtype_name__ = 'PreferencesWindow'
|
||||
__gtype_name__ = "PreferencesWindow"
|
||||
|
||||
exit_after_launch_switch = Gtk.Template.Child()
|
||||
import_epic_games_switch = Gtk.Template.Child()
|
||||
@@ -38,28 +38,57 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
||||
|
||||
self.set_transient_for(parent_widget)
|
||||
schema = parent_widget.schema
|
||||
schema.bind("exit-after-launch", self.exit_after_launch_switch, "active", Gio.SettingsBindFlags.DEFAULT)
|
||||
schema.bind("heroic-import-epic", self.import_epic_games_switch, "active", Gio.SettingsBindFlags.DEFAULT)
|
||||
schema.bind("heroic-import-gog", self.import_gog_games_switch, "active", Gio.SettingsBindFlags.DEFAULT)
|
||||
schema.bind("heroic-import-sideload", self.import_sideload_games_switch, "active", Gio.SettingsBindFlags.DEFAULT)
|
||||
schema.bind(
|
||||
"exit-after-launch",
|
||||
self.exit_after_launch_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
schema.bind(
|
||||
"heroic-import-epic",
|
||||
self.import_epic_games_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
schema.bind(
|
||||
"heroic-import-gog",
|
||||
self.import_gog_games_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
schema.bind(
|
||||
"heroic-import-sideload",
|
||||
self.import_sideload_games_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
filechooser = Gtk.FileDialog()
|
||||
|
||||
def set_steam_dir(source, result, user_data):
|
||||
try:
|
||||
schema.set_string("steam-location", filechooser.select_folder_finish(result).get_path())
|
||||
schema.set_string(
|
||||
"steam-location",
|
||||
filechooser.select_folder_finish(result).get_path(),
|
||||
)
|
||||
except GLib.GError:
|
||||
pass
|
||||
|
||||
def set_heroic_dir(source, result, user_data):
|
||||
try:
|
||||
schema.set_string("heroic-location", filechooser.select_folder_finish(result).get_path())
|
||||
schema.set_string(
|
||||
"heroic-location",
|
||||
filechooser.select_folder_finish(result).get_path(),
|
||||
)
|
||||
except GLib.GError:
|
||||
pass
|
||||
|
||||
def set_bottles_dir(source, result, user_data):
|
||||
try:
|
||||
schema.set_string("bottles-location", filechooser.select_folder_finish(result).get_path())
|
||||
schema.set_string(
|
||||
"bottles-location",
|
||||
filechooser.select_folder_finish(result).get_path(),
|
||||
)
|
||||
except GLib.GError:
|
||||
pass
|
||||
|
||||
@@ -67,5 +96,9 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
||||
filechooser.select_folder(parent_widget, None, function, None)
|
||||
|
||||
self.steam_file_chooser_button.connect("clicked", choose_folder, set_steam_dir)
|
||||
self.heroic_file_chooser_button.connect("clicked", choose_folder, set_heroic_dir)
|
||||
self.bottles_file_chooser_button.connect("clicked", choose_folder, set_bottles_dir)
|
||||
self.heroic_file_chooser_button.connect(
|
||||
"clicked", choose_folder, set_heroic_dir
|
||||
)
|
||||
self.bottles_file_chooser_button.connect(
|
||||
"clicked", choose_folder, set_bottles_dir
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user