From 314aaaf8774350be1041fcef3c268900cc2f71ca Mon Sep 17 00:00:00 2001 From: Christian Moser Date: Sat, 1 Mar 2025 19:44:34 +0100 Subject: [PATCH] Bugfix in SettingsDialog + added AboutDialog --- sgbackup/gui/_app.py | 27 +++++++++++++++++---------- sgbackup/gui/_dialogs.py | 33 +++++++++++++++++++++++++++++++++ sgbackup/gui/_settingsdialog.py | 2 +- 3 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 sgbackup/gui/_dialogs.py diff --git a/sgbackup/gui/_app.py b/sgbackup/gui/_app.py index 732cb9a..d01236f 100644 --- a/sgbackup/gui/_app.py +++ b/sgbackup/gui/_app.py @@ -34,7 +34,7 @@ from ._steam import SteamLibrariesDialog,NewSteamAppsDialog,NoNewSteamAppsDialog from ..steam import Steam from ._backupdialog import BackupSingleDialog,BackupManyDialog from ..archiver import ArchiverManager - +from ._dialogs import AboutDialog __gtype_name__ = __name__ @@ -335,7 +335,9 @@ class GameView(Gtk.Box): self._liststore.remove_all() self.__search_entry.set_text("") - for game in GameManager.get_global().games.values(): + gamemanager = GameManager.get_global() + gamemanager.load() + for game in gamemanager.games.values(): self._liststore.append(GameViewData(game)) def _on_game_dialog_response(self,dialog,response): @@ -429,15 +431,19 @@ class GameView(Gtk.Box): item.set_child(image) def _on_icon_column_bind(self,factory,item): - def transform_to_icon_name(_bidning,sgtype): - icon_name = SAVEGAME_TYPE_ICONS[sgtype] if sgtype in SAVEGAME_TYPE_ICONS else None - if icon_name: - return icon_name - return "" + def transform_to_icon_name(_binding,sgtype): + icon_name = SAVEGAME_TYPE_ICONS[sgtype] if sgtype in SAVEGAME_TYPE_ICONS else "" + if not icon_name: + logger.warning("No icon-name for sgtype {}".format(sgtype.value)) + return icon_name + icon = item.get_child() game = item.get_item().game + + icon.props.icon_name = transform_to_icon_name(None,game.savegame_type) + if not hasattr(game,'_savegame_type_to_icon_name_binding'): - game._savegame_type_to_icon_name_binding = game.bind_property('savegame_type',icon,'icon_name',BindingFlags.SYNC_CREATE,transform_to_icon_name) + game._savegame_type_to_icon_name_binding = game.bind_property('savegame_type',icon,'icon_name',BindingFlags.DEFAULT,transform_to_icon_name) def _on_key_column_setup(self,factory,item): label = Gtk.Label() @@ -957,7 +963,6 @@ class BackupView(Gtk.Box): def _on_action_convert_to_gog_linux(self,action,param): pass - def _on_columnview_selection_changed(self,selection,position,n_items): data = selection.get_selected_item() @@ -1369,7 +1374,9 @@ class Application(Gtk.Application): self.appwindow.present() def _on_action_about(self,action,param): - pass + dialog = AboutDialog() + dialog.present() + #dialog.connect('response',lambda dlg,response: dlg.destroy()) def _on_action_settings(self,action,param): dialog = self.new_settings_dialog() diff --git a/sgbackup/gui/_dialogs.py b/sgbackup/gui/_dialogs.py new file mode 100644 index 0000000..81069d0 --- /dev/null +++ b/sgbackup/gui/_dialogs.py @@ -0,0 +1,33 @@ +############################################################################### +# sgbackup - The SaveGame Backup tool # +# Copyright (C) 2024,2025 Christian Moser # +# # +# 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 . # +############################################################################### + +from gi.repository import Gtk,GLib,Gio +from ..version import VERSION + +class AboutDialog(Gtk.AboutDialog): + def __init__(self): + Gtk.AboutDialog.__init__(self) + self.set_program_name("SGBackup") + self.set_version(VERSION) + self.set_logo_icon_name("sgbackup-symbolic") + self.set_website("https://github.com/c9moser/sgbackup") + self.set_copyright("(C) 2024,2025 Christian Moser") + self.set_license_type(Gtk.License.GPL_3_0) + self.set_authors([ + "Christian Moser " + ]) diff --git a/sgbackup/gui/_settingsdialog.py b/sgbackup/gui/_settingsdialog.py index 15f7dfe..9683066 100644 --- a/sgbackup/gui/_settingsdialog.py +++ b/sgbackup/gui/_settingsdialog.py @@ -408,7 +408,7 @@ class SettingsDialog(Gtk.Dialog): data = item.get_item() label.set_text(data.value) if not hasattr(label,'_property_text_to_value_binding'): - label._property_text_to_value_binding = label.bind_property('text',data,'name',BindingFlags.DEFAULT) + label._property_text_to_value_binding = label.bind_property('text',data,'value',BindingFlags.DEFAULT) def _on_archiver_factory_setup(self,factory,item): label = Gtk.Label()