Cleanups
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
def create_details_window(parent_widget, game_id = None):
|
||||
import os, json, time
|
||||
import time
|
||||
from gi.repository import Adw, Gtk, Gio, GLib, GdkPixbuf
|
||||
from .create_dialog import create_dialog
|
||||
from .save_games import save_games
|
||||
|
||||
@@ -49,7 +49,7 @@ def heroic_parser(parent_widget, action):
|
||||
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")):
|
||||
pass
|
||||
else:
|
||||
heroic_not_found()
|
||||
@@ -141,9 +141,9 @@ def heroic_parser(parent_widget, action):
|
||||
heroic_games[values["game_id"]] = values
|
||||
|
||||
# Import sideloaded games
|
||||
if schema.get_boolean("heroic-import-sideload") == False:
|
||||
if not schema.get_boolean("heroic-import-sideload"):
|
||||
pass
|
||||
elif os.path.exists(os.path.join(heroic_dir, "sideload_apps", "library.json")) == True:
|
||||
elif os.path.exists(os.path.join(heroic_dir, "sideload_apps", "library.json")):
|
||||
open_file = open(os.path.join(heroic_dir, "sideload_apps", "library.json"), "r")
|
||||
data = open_file.read()
|
||||
open_file.close()
|
||||
|
||||
@@ -24,5 +24,5 @@ def run_command(parent_widget, executable):
|
||||
|
||||
subprocess.Popen(["flatpak-spawn --host " + executable], shell=True, start_new_session=True)
|
||||
|
||||
if Gio.Settings.new("hu.kramo.Cartridges").get_boolean("exit-after-launch") == True:
|
||||
if Gio.Settings.new("hu.kramo.Cartridges").get_boolean("exit-after-launch"):
|
||||
sys.exit()
|
||||
|
||||
@@ -48,11 +48,11 @@ def steam_parser(parent_widget, action):
|
||||
|
||||
create_dialog(parent_widget, _("Couldn't Import Games"), _("Steam directory cannot be found."), "choose_folder", _("Set Steam Location")).connect("response", response)
|
||||
|
||||
if os.path.exists(os.path.join(steam_dir, "steamapps")) == True:
|
||||
if os.path.exists(os.path.join(steam_dir, "steamapps")):
|
||||
pass
|
||||
elif os.path.exists(os.path.join(steam_dir, "steam", "steamapps")) == True:
|
||||
elif os.path.exists(os.path.join(steam_dir, "steam", "steamapps")):
|
||||
schema.set_string("steam-location", os.path.join(steam_dir, "steam"))
|
||||
elif os.path.exists(os.path.join(steam_dir, "Steam", "steamapps")) == True:
|
||||
elif os.path.exists(os.path.join(steam_dir, "Steam", "steamapps")):
|
||||
schema.set_string("steam-location", os.path.join(steam_dir, "Steam"))
|
||||
else:
|
||||
steam_not_found()
|
||||
@@ -90,7 +90,7 @@ def steam_parser(parent_widget, action):
|
||||
values["added"] = current_time
|
||||
values["last_played"] = 0
|
||||
|
||||
if os.path.isfile(os.path.join(steam_dir, "appcache", "librarycache", values["appid"] + "_library_600x900.jpg")) == True:
|
||||
if os.path.isfile(os.path.join(steam_dir, "appcache", "librarycache", values["appid"] + "_library_600x900.jpg")):
|
||||
values["pixbuf_options"] = save_cover(values, parent_widget, os.path.join(steam_dir, "appcache", "librarycache", values["appid"] + "_library_600x900.jpg"))
|
||||
steam_games[values["game_id"]] = values
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ def toggle_hidden(game):
|
||||
import os, json
|
||||
games_dir = os.path.join(os.environ.get("XDG_DATA_HOME"), "cartridges", "games")
|
||||
|
||||
if os.path.exists(games_dir) == False:
|
||||
if not os.path.exists(games_dir):
|
||||
return
|
||||
|
||||
file = open(os.path.join(games_dir, game + ".json"), "r")
|
||||
|
||||
Reference in New Issue
Block a user