Cleanups
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
"--device=dri",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.freedesktop.Flatpak",
|
||||
"--filesystem=xdg-run/gvfsd",
|
||||
"--filesystem=~/.steam/steam/",
|
||||
"--filesystem=~/.var/app/com.heroicgameslauncher.hgl/config/heroic/"
|
||||
],
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -118,7 +118,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
|
||||
entry = game(current_game["name"], get_cover(current_game, self), game_id)
|
||||
|
||||
if self.games[game_id]["hidden"] == False:
|
||||
if not self.games[game_id]["hidden"]:
|
||||
self.visible_widgets[game_id] = entry
|
||||
self.library.append(entry)
|
||||
else:
|
||||
@@ -144,7 +144,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
|
||||
def search_changed(self, widget, hidden):
|
||||
# Refresh search filter on keystroke in search box
|
||||
if hidden == False:
|
||||
if not hidden:
|
||||
self.library.invalidate_filter()
|
||||
else:
|
||||
self.hidden_library.invalidate_filter()
|
||||
@@ -203,7 +203,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
def show_overview(self, widget, game_id):
|
||||
game = self.games[game_id]
|
||||
|
||||
if game["hidden"] == False:
|
||||
if not game["hidden"]:
|
||||
self.overview_menu_button.set_menu_model(self.game_options)
|
||||
else:
|
||||
self.overview_menu_button.set_menu_model(self.hidden_game_options)
|
||||
@@ -341,7 +341,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
||||
search_bar.set_search_mode(not search_mode)
|
||||
search_button.set_active(not search_button.get_active())
|
||||
|
||||
if search_mode == False:
|
||||
if not search_mode:
|
||||
self.set_focus(search_entry)
|
||||
else:
|
||||
search_entry.set_text("")
|
||||
|
||||
Reference in New Issue
Block a user