Revert animation support due to performance issues
This commit is contained in:
@@ -25,7 +25,6 @@ import time
|
||||
from gi.repository import Adw, GdkPixbuf, Gio, GLib, GObject, Gtk
|
||||
|
||||
from .create_dialog import create_dialog
|
||||
from .display_animation import display_animation
|
||||
from .save_cover import save_cover
|
||||
from .save_game import save_game
|
||||
from .steamgriddb import SGDBSave
|
||||
@@ -38,7 +37,6 @@ def create_details_window(parent_widget, game_id=None):
|
||||
|
||||
games = parent_widget.games
|
||||
pixbuf = None
|
||||
animation_path = None
|
||||
cover_deleted = False
|
||||
|
||||
cover_button_edit = Gtk.Button(
|
||||
@@ -59,24 +57,8 @@ def create_details_window(parent_widget, game_id=None):
|
||||
margin_end=6,
|
||||
)
|
||||
|
||||
def update_animation(game_id, animation=None):
|
||||
new_id = (
|
||||
game_id if parent_widget.current_anim_edit != game_id else f"{game_id}_new"
|
||||
)
|
||||
parent_widget.current_anim_edit = new_id
|
||||
|
||||
display_animation(
|
||||
cover.set_pixbuf,
|
||||
animation_path if not animation else None,
|
||||
animation=animation,
|
||||
parent_widget=parent_widget,
|
||||
game_id=new_id,
|
||||
place="edit",
|
||||
)
|
||||
|
||||
def delete_pixbuf(_widget):
|
||||
nonlocal pixbuf
|
||||
nonlocal animation_path
|
||||
nonlocal cover_deleted
|
||||
|
||||
cover.set_pixbuf(parent_widget.placeholder_pixbuf)
|
||||
@@ -84,9 +66,6 @@ def create_details_window(parent_widget, game_id=None):
|
||||
pixbuf = None
|
||||
cover_deleted = True
|
||||
|
||||
animation_path = None
|
||||
parent_widget.current_anim_edit = None
|
||||
|
||||
cover_button_delete.connect("clicked", delete_pixbuf)
|
||||
|
||||
cover_button_delete_revealer = Gtk.Revealer(
|
||||
@@ -105,12 +84,6 @@ def create_details_window(parent_widget, game_id=None):
|
||||
else:
|
||||
window.set_title(_("Edit Game Details"))
|
||||
cover = Gtk.Picture.new_for_pixbuf(parent_widget.games[game_id].pixbuf)
|
||||
animation_path = (
|
||||
parent_widget.data_dir / "cartridges" / "animated_covers" / game_id
|
||||
)
|
||||
if animation_path.is_file():
|
||||
update_animation(game_id)
|
||||
|
||||
developer = Gtk.Entry.new_with_buffer(
|
||||
Gtk.EntryBuffer.new(games[game_id].developer, -1)
|
||||
)
|
||||
@@ -245,8 +218,6 @@ def create_details_window(parent_widget, game_id=None):
|
||||
|
||||
def set_cover(_source, result, _unused):
|
||||
nonlocal pixbuf
|
||||
nonlocal animation_path
|
||||
|
||||
try:
|
||||
path = filechooser.open_finish(result).get_path()
|
||||
except GLib.GError:
|
||||
@@ -254,25 +225,20 @@ def create_details_window(parent_widget, game_id=None):
|
||||
|
||||
try:
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, 200, 300, False)
|
||||
cover.set_pixbuf(pixbuf)
|
||||
parent_widget.current_anim_edit = None
|
||||
except GLib.GError:
|
||||
animation_path = path
|
||||
animated_pixbuf = GdkPixbuf.PixbufAnimation.new_from_file(path)
|
||||
pixbuf = animated_pixbuf.get_static_image().scale_simple(
|
||||
200, 300, GdkPixbuf.InterpType.BILINEAR
|
||||
)
|
||||
|
||||
update_animation(game_id, animated_pixbuf)
|
||||
|
||||
cover_button_delete_revealer.set_reveal_child(True)
|
||||
cover.set_pixbuf(pixbuf)
|
||||
|
||||
def close_window(_widget, _callback=None):
|
||||
window.close()
|
||||
|
||||
def apply_preferences(_widget, _callback=None):
|
||||
nonlocal pixbuf
|
||||
nonlocal animation_path
|
||||
nonlocal cover_deleted
|
||||
nonlocal game_id
|
||||
|
||||
@@ -351,18 +317,13 @@ def create_details_window(parent_widget, game_id=None):
|
||||
(
|
||||
parent_widget.data_dir / "cartridges" / "covers" / f"{game_id}.tiff"
|
||||
).unlink(missing_ok=True)
|
||||
(
|
||||
parent_widget.data_dir / "cartridges" / "animated_covers" / game_id
|
||||
).unlink(missing_ok=True)
|
||||
if game_id in parent_widget.pixbufs:
|
||||
parent_widget.pixbufs.pop(game_id)
|
||||
parent_widget.pixbufs.pop(game_id)
|
||||
|
||||
if pixbuf:
|
||||
if game_id in parent_widget.pixbufs:
|
||||
parent_widget.pixbufs.pop(game_id)
|
||||
|
||||
save_cover(parent_widget, game_id, None, pixbuf, animation_path)
|
||||
|
||||
save_cover(parent_widget, game_id, None, pixbuf)
|
||||
elif not (
|
||||
parent_widget.data_dir / "cartridges" / "covers" / f"{game_id}.tiff"
|
||||
).is_file():
|
||||
@@ -379,11 +340,7 @@ def create_details_window(parent_widget, game_id=None):
|
||||
|
||||
parent_widget.update_games([game_id])
|
||||
window.close()
|
||||
if parent_widget.stack.get_visible_child() != parent_widget.overview:
|
||||
parent_widget.show_overview(None, game_id)
|
||||
|
||||
if not animation_path:
|
||||
parent_widget.current_anim_overview = None
|
||||
parent_widget.show_overview(None, game_id)
|
||||
|
||||
def focus_executable(_widget):
|
||||
window.set_focus(executable)
|
||||
|
||||
Reference in New Issue
Block a user