Cleanups
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import json
|
||||
import os
|
||||
import shlex
|
||||
import time
|
||||
@@ -90,7 +89,7 @@ def create_details_window(win, game_id=None):
|
||||
apply_button = Gtk.Button.new_with_label(_("Apply"))
|
||||
|
||||
game_cover.new_cover(win.games[game_id].get_cover_path())
|
||||
if game_cover.get_pixbuf():
|
||||
if game_cover.pixbuf:
|
||||
cover_button_delete_revealer.set_reveal_child(True)
|
||||
else:
|
||||
window.set_title(_("Add New Game"))
|
||||
@@ -328,7 +327,7 @@ def create_details_window(win, game_id=None):
|
||||
else:
|
||||
Game(win, values).save()
|
||||
|
||||
if not game_cover.get_pixbuf():
|
||||
if not game_cover.pixbuf:
|
||||
SGDBSave(win, {(game_id, values["name"])})
|
||||
|
||||
win.game_covers[game_id].pictures.remove(cover)
|
||||
|
||||
@@ -23,9 +23,11 @@ import json
|
||||
def get_games(win):
|
||||
games = {}
|
||||
|
||||
if not win.games_dir.exists():
|
||||
return games
|
||||
|
||||
for open_file in win.games_dir.iterdir():
|
||||
if open_file.exists():
|
||||
data = json.load(open_file.open())
|
||||
games[data["game_id"]] = data
|
||||
data = json.load(open_file.open())
|
||||
games[data["game_id"]] = data
|
||||
|
||||
return games
|
||||
|
||||
@@ -56,7 +56,7 @@ class Importer:
|
||||
|
||||
def save_game(self, values=None, cover_path=None):
|
||||
if values:
|
||||
Game(self.win, values).save()
|
||||
Game(self.win, values)
|
||||
|
||||
if cover_path:
|
||||
save_cover(
|
||||
|
||||
@@ -111,10 +111,14 @@ class SGDBSave:
|
||||
_("Preferences"),
|
||||
).connect("response", self.response)
|
||||
|
||||
if not self.importer:
|
||||
game = self.win.games[result.propagate_value()[1]]
|
||||
game.set_loading(-1)
|
||||
game.update()
|
||||
game = self.win.games.get(result.propagate_value()[1])
|
||||
game.set_loading(-1)
|
||||
|
||||
if game:
|
||||
if self.importer:
|
||||
game.save()
|
||||
else:
|
||||
game.update()
|
||||
|
||||
def response(self, _widget, response):
|
||||
if response == "open_preferences":
|
||||
|
||||
Reference in New Issue
Block a user