🐛 Fixed UI not updating on some game actions

This commit is contained in:
GeoffreyCoulaud
2023-06-10 15:31:54 +02:00
parent 8eb2a270f6
commit 3a0911e742
4 changed files with 21 additions and 3 deletions

View File

@@ -17,20 +17,21 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
import logging
import os
import shlex
from time import time
from gi.repository import Adw, Gio, GLib, Gtk
from PIL import Image
from requests.exceptions import HTTPError, SSLError
# TODO use SGDBHelper
from src import shared
from src.game import Game
from src.game_cover import GameCover
from src.utils.create_dialog import create_dialog
from src.utils.save_cover import resize_cover, save_cover
from src.utils.steamgriddb import SGDBSave
from src.utils.steamgriddb import SGDBError, SGDBHelper
@Gtk.Template(resource_path=shared.PREFIX + "/gtk/details_window.ui")
@@ -202,9 +203,20 @@ class DetailsWindow(Adw.Window):
)
self.game.save()
self.game.update()
# Try to get a cover if none is present
# TODO inform the user
# TODO wrap in a task and mark loading
if not self.game_cover.get_pixbuf():
SGDBSave({self.game})
print("test 1212")
sgdb = SGDBHelper()
try:
sgdb.conditionaly_update_cover(self.game)
except SGDBError as error:
logging.error("Could not update cover", exc_info=error)
except (HTTPError, SSLError, ConnectionError):
logging.warning("Could not connect to SteamGridDB")
self.game_cover.pictures.remove(self.cover)