[pybliographer] ui: Migrate warning dialog from gnome to gtk
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer] ui: Migrate warning dialog from gnome to gtk
- Date: Sun, 25 Mar 2018 22:56:03 +0000 (UTC)
commit 205e28c1e5e94350d68fe61da808b66fed4c8419
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Sat Mar 24 17:57:11 2018 -0300
ui: Migrate warning dialog from gnome to gtk
Pyblio/GnomeUI/Config.py | 9 ++++-----
Pyblio/GnomeUI/Fields.py | 6 ++----
Pyblio/GnomeUI/Utils.py | 11 +++++++++++
3 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Config.py b/Pyblio/GnomeUI/Config.py
index 2d8628c..24a87e9 100644
--- a/Pyblio/GnomeUI/Config.py
+++ b/Pyblio/GnomeUI/Config.py
@@ -56,7 +56,7 @@ class ConfigDialog (Utils.GladeWindow):
## tooltips = gtk.Tooltips ()
## tooltips.enable ()
- self.warning = 0
+ self.warning = False
self.parent = parent
domains = Config.domains ()
@@ -142,10 +142,9 @@ class ConfigDialog (Utils.GladeWindow):
def changed (self):
if not self.warning:
- self.warning = 1
- self.parent.warning (
- _("Some changes require to restart Pybliographic\n"
- "to be correctly taken into account"))
+ self.warning = True
+ Utils.warning_dialog_s(self.parent, _("Some changes require to restart Pybliographic\n"
+ "to be correctly taken into account"))
class BaseConfig:
diff --git a/Pyblio/GnomeUI/Fields.py b/Pyblio/GnomeUI/Fields.py
index b8c5ec3..524794a 100644
--- a/Pyblio/GnomeUI/Fields.py
+++ b/Pyblio/GnomeUI/Fields.py
@@ -63,7 +63,7 @@ class FieldsDialog (Utils.GladeWindow):
## tooltips = gtk.Tooltips ()
## tooltips.enable ()
- self.warning = 0
+ self.warning = False
self.parent = parent
self.init_page_1()
self.init_page_2()
@@ -414,10 +414,8 @@ class FieldsDialog (Utils.GladeWindow):
Config.set_and_save ('base/fields', result)
if self.parent:
- self.parent.warning (_("Some changes require to restart Pybliographic\n"
+ Utils.warning_dialog_s(self.parent, _("Some changes require to restart Pybliographic\n"
"to be correctly taken into account"))
- return
-
def add_cb (self, * arg):
name = string.strip (self.name.get_text ())
diff --git a/Pyblio/GnomeUI/Utils.py b/Pyblio/GnomeUI/Utils.py
index ff52231..ef83a66 100644
--- a/Pyblio/GnomeUI/Utils.py
+++ b/Pyblio/GnomeUI/Utils.py
@@ -228,3 +228,14 @@ def error_dialog_s(parent, primary, secondary=None):
dialog.format_secondary_text(secondary)
dialog.run()
dialog.destroy()
+
+
+def warning_dialog_s(parent, primary, secondary=None):
+ dialog = Gtk.MessageDialog(parent,
+ Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.WARNING,
+ Gtk.ButtonsType.CLOSE, primary)
+ if secondary:
+ dialog.format_secondary_text(secondary)
+ dialog.run()
+ dialog.destroy()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]