Remove redundant get_cover function
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 .get_cover import get_cover
|
||||
from .save_cover import save_cover
|
||||
from .save_games import save_games
|
||||
|
||||
@@ -47,7 +46,7 @@ def create_details_window(parent_widget, game_id=None):
|
||||
apply_button = Gtk.Button.new_with_label(_("Confirm"))
|
||||
else:
|
||||
window.set_title(_("Edit Game Details"))
|
||||
cover = Gtk.Picture.new_for_pixbuf(get_cover(game_id, parent_widget))
|
||||
cover = Gtk.Picture.new_for_pixbuf(parent_widget.games[game_id].pixbuf)
|
||||
developer = Gtk.Entry.new_with_buffer(
|
||||
Gtk.EntryBuffer.new(games[game_id].developer, -1)
|
||||
)
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# get_cover.py
|
||||
#
|
||||
# Copyright 2022-2023 kramo
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import os
|
||||
|
||||
from gi.repository import GdkPixbuf
|
||||
|
||||
|
||||
def get_cover(game_id, parent_widget):
|
||||
if game_id in parent_widget.pixbufs.keys():
|
||||
return parent_widget.pixbufs[game_id]
|
||||
|
||||
cover_path = os.path.join(
|
||||
os.getenv("XDG_DATA_HOME")
|
||||
or os.path.expanduser(os.path.join("~", ".local", "share")),
|
||||
"cartridges",
|
||||
"covers",
|
||||
f"{game_id}.tiff",
|
||||
)
|
||||
|
||||
if os.path.isfile(cover_path):
|
||||
return GdkPixbuf.Pixbuf.new_from_file(cover_path)
|
||||
return parent_widget.placeholder_pixbuf
|
||||
Reference in New Issue
Block a user