From dca82f090cb238ff58f5a4a3b48b9440649ed633 Mon Sep 17 00:00:00 2001 From: deltragon Date: Tue, 2 Jan 2024 13:36:44 +0100 Subject: [PATCH] gtk4: about dialog --- safeeyes/glade/about_dialog.glade | 154 ++++++++++-------------------- safeeyes/ui/about_dialog.py | 7 +- safeeyes/utility.py | 2 +- 3 files changed, 56 insertions(+), 107 deletions(-) diff --git a/safeeyes/glade/about_dialog.glade b/safeeyes/glade/about_dialog.glade index 16780f7..791ad51 100644 --- a/safeeyes/glade/about_dialog.glade +++ b/safeeyes/glade/about_dialog.glade @@ -20,7 +20,7 @@ ~ along with this program. If not, see . --> - + 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 @@ -36,167 +36,113 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - False Safe Eyes - False - center-always - safeeyes - dialog - center - + 0 + safeeyes - True - False - 5 - 5 - 5 - 5 - True - True + 1 + 5 + 5 + 5 + 5 + 1 + 1 vertical - top + top - True - False + 1 start - True + 1 vertical - True - False + 1 center center - 10 - 10 + 10 + 10 Safe Eyes 2.1.5 center + 1 + 1 - - True - True - 0 - - True - False - 4 - Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer + 1 + 4 + Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer fill - True - 60 - 60 + 1 + 60 + 60 - - False - True - 1 - - True - False + 1 start center - 10 + 10 License: - - False - True - 2 - - True - True - True - True - False - word + 1 + 1 + 1 + 1 + 0 + word text_buffer_license - False + 0 - - True - True - 3 - https://slgobinath.github.io/SafeEyes - True - True - False - True + 1 + 1 + 0 + 1 center - none + 0 https://slgobinath.github.io/SafeEyes - - False - True - 4 - - - False - True - 0 - - True - False - 5 - 5 + 1 + 5 + 5 - - False - True - 1 - - - True - False + + 1 start - 5 - end + 5 + end Close - True - True - True - + 1 + 1 + 1 + 1 + 1 - - True - True - 1 - - - False - True - 2 - diff --git a/safeeyes/ui/about_dialog.py b/safeeyes/ui/about_dialog.py index 39362b0..8107f56 100644 --- a/safeeyes/ui/about_dialog.py +++ b/safeeyes/ui/about_dialog.py @@ -35,8 +35,11 @@ class AboutDialog: def __init__(self, version): builder = utility.create_gtk_builder(ABOUT_DIALOG_GLADE) - builder.connect_signals(self) self.window = builder.get_object('window_about') + + self.window.connect("close-request", self.on_window_delete) + builder.get_object('btn_close').connect('clicked', self.on_close_clicked) + builder.get_object('lbl_decription').set_label(_("Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer")) builder.get_object('lbl_license').set_label(_('License') + ':') @@ -47,7 +50,7 @@ class AboutDialog: """ Show the About dialog. """ - self.window.show_all() + self.window.present() def on_window_delete(self, *args): """ diff --git a/safeeyes/utility.py b/safeeyes/utility.py index a33c3d7..a51d59a 100644 --- a/safeeyes/utility.py +++ b/safeeyes/utility.py @@ -660,7 +660,7 @@ def create_gtk_builder(glade_file): builder.add_from_file(glade_file) # Tranlslate all sub components for obj in builder.get_objects(): - if (not isinstance(obj, Gtk.SeparatorMenuItem)) and hasattr(obj, "get_label"): + if hasattr(obj, "get_label"): label = obj.get_label() if label is not None: obj.set_label(_(label))