Add warnings for non-existent launcher directories
This commit is contained in:
@@ -21,6 +21,8 @@ import os
|
|||||||
|
|
||||||
from gi.repository import Adw, Gio, GLib, Gtk
|
from gi.repository import Adw, Gio, GLib, Gtk
|
||||||
|
|
||||||
|
from .create_dialog import create_dialog
|
||||||
|
|
||||||
|
|
||||||
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/preferences.ui")
|
@Gtk.Template(resource_path="/hu/kramo/Cartridges/gtk/preferences.ui")
|
||||||
class PreferencesWindow(Adw.PreferencesWindow):
|
class PreferencesWindow(Adw.PreferencesWindow):
|
||||||
@@ -120,10 +122,29 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
|
|
||||||
def set_steam_dir(_source, result, _unused):
|
def set_steam_dir(_source, result, _unused):
|
||||||
try:
|
try:
|
||||||
schema.set_string(
|
path = filechooser.select_folder_finish(result).get_path()
|
||||||
"steam-location",
|
|
||||||
filechooser.select_folder_finish(result).get_path(),
|
def response(widget, response):
|
||||||
)
|
if response == "choose_folder":
|
||||||
|
choose_folder(widget, set_steam_dir)
|
||||||
|
|
||||||
|
if (
|
||||||
|
not os.path.exists(os.path.join(path, "steamapps"))
|
||||||
|
and not os.path.exists(os.path.join(path, "steam", "steamapps"))
|
||||||
|
and not os.path.exists(os.path.join(path, "Steam", "steamapps"))
|
||||||
|
):
|
||||||
|
create_dialog(
|
||||||
|
parent_widget,
|
||||||
|
_("Installation Not Found"),
|
||||||
|
_("Select a valid Steam data directory."),
|
||||||
|
"choose_folder",
|
||||||
|
_("Set Steam Location"),
|
||||||
|
).connect("response", response)
|
||||||
|
else:
|
||||||
|
schema.set_string(
|
||||||
|
"steam-location",
|
||||||
|
path,
|
||||||
|
)
|
||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -142,19 +163,49 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
|
|
||||||
def set_heroic_dir(_source, result, _unused):
|
def set_heroic_dir(_source, result, _unused):
|
||||||
try:
|
try:
|
||||||
schema.set_string(
|
path = filechooser.select_folder_finish(result).get_path()
|
||||||
"heroic-location",
|
|
||||||
filechooser.select_folder_finish(result).get_path(),
|
def response(widget, response):
|
||||||
)
|
if response == "choose_folder":
|
||||||
|
choose_folder(widget, set_heroic_dir)
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(path, "config.json")):
|
||||||
|
create_dialog(
|
||||||
|
parent_widget,
|
||||||
|
_("Installation Not Found"),
|
||||||
|
_("Select a valid Heroic configuration directory."),
|
||||||
|
"choose_folder",
|
||||||
|
_("Set Heroic Location"),
|
||||||
|
).connect("response", response)
|
||||||
|
else:
|
||||||
|
schema.set_string(
|
||||||
|
"heroic-location",
|
||||||
|
path,
|
||||||
|
)
|
||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_bottles_dir(_source, result, _unused):
|
def set_bottles_dir(_source, result, _unused):
|
||||||
try:
|
try:
|
||||||
schema.set_string(
|
path = filechooser.select_folder_finish(result).get_path()
|
||||||
"bottles-location",
|
|
||||||
filechooser.select_folder_finish(result).get_path(),
|
def response(widget, response):
|
||||||
)
|
if response == "choose_folder":
|
||||||
|
choose_folder(widget, set_bottles_dir)
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(path, "library.yml")):
|
||||||
|
create_dialog(
|
||||||
|
parent_widget,
|
||||||
|
_("Installation Not Found"),
|
||||||
|
_("Select a valid Bottles data directory."),
|
||||||
|
"choose_folder",
|
||||||
|
_("Set Bottles Location"),
|
||||||
|
).connect("response", response)
|
||||||
|
else:
|
||||||
|
schema.set_string(
|
||||||
|
"bottles-location",
|
||||||
|
path,
|
||||||
|
)
|
||||||
except GLib.GError:
|
except GLib.GError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -166,8 +166,6 @@ def steam_parser(parent_widget):
|
|||||||
schema.set_string(
|
schema.set_string(
|
||||||
"steam-location", os.path.join(os.getenv("programfiles(x86)"), "Steam")
|
"steam-location", os.path.join(os.getenv("programfiles(x86)"), "Steam")
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
if os.path.exists(os.path.join(steam_dir, "steamapps")):
|
if os.path.exists(os.path.join(steam_dir, "steamapps")):
|
||||||
pass
|
pass
|
||||||
@@ -177,6 +175,7 @@ def steam_parser(parent_widget):
|
|||||||
schema.set_string("steam-location", os.path.join(steam_dir, "Steam"))
|
schema.set_string("steam-location", os.path.join(steam_dir, "Steam"))
|
||||||
else:
|
else:
|
||||||
steam_not_found()
|
steam_not_found()
|
||||||
|
steam_parser(parent_widget)
|
||||||
return
|
return
|
||||||
|
|
||||||
steam_dir = os.path.expanduser(schema.get_string("steam-location"))
|
steam_dir = os.path.expanduser(schema.get_string("steam-location"))
|
||||||
|
|||||||
Reference in New Issue
Block a user