Bugfix in SettingsDialog + added AboutDialog

This commit is contained in:
Christian Moser 2025-03-01 19:44:34 +01:00
parent 70a6aa3c65
commit 314aaaf877
Failed to extract signature
3 changed files with 51 additions and 11 deletions

View File

@ -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:
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
return ""
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()

33
sgbackup/gui/_dialogs.py Normal file
View File

@ -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 <https://www.gnu.org/licenses/>. #
###############################################################################
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 <christian@mydevel.at>"
])

View File

@ -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()