[pybliographer/wip/gtk3] utils: Fix error_dialog to work on gtk3
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pybliographer/wip/gtk3] utils: Fix error_dialog to work on gtk3
- Date: Thu, 12 Oct 2017 16:55:58 +0000 (UTC)
commit ce214606310053b64a961bdc5e3fce8c615bdf26
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Wed Oct 11 22:03:41 2017 -0300
utils: Fix error_dialog to work on gtk3
Pyblio/GnomeUI/Utils.py | 57 +++++++++++++++++++---------------------------
1 files changed, 24 insertions(+), 33 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Utils.py b/Pyblio/GnomeUI/Utils.py
index 8cdae7b..1165db6 100644
--- a/Pyblio/GnomeUI/Utils.py
+++ b/Pyblio/GnomeUI/Utils.py
@@ -163,46 +163,37 @@ def popup_add (menu, item, action = None, argument = None):
return tmp
-def error_dialog (title, err, parent = None):
-
- dialog = \
- Gtk.MessageDialog (parent,
- Gtk.DialogFlags.MODAL |
- Gtk.DialogFlags.DESTROY_WITH_PARENT,
- Gtk.MessageType.ERROR,
- message_format = title)
-
- b = dialog.add_button (Gtk.STOCK_OK, Gtk.ResponseType.OK)
- b.set_property ('has_default', True)
-
- buff = Gtk.TextBuffer ()
- title = buff.create_tag ('title', weight = Pango.Weight.BOLD)
-
- text = Gtk.TextView ()
- text.set_editable (False)
- text.set_cursor_visible (False)
- text.set_buffer (buff)
- text.set_size_request (400, 200)
-
- iter = buff.get_start_iter ()
-
- buff.insert_with_tags (iter, _("The following errors occurred:\n"),
- title)
+def error_dialog(title, err, parent=None):
+ dialog = Gtk.MessageDialog(parent,
+ Gtk.DialogFlags.MODAL |
+ Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.ERROR,
+ Gtk.ButtonsType.CLOSE,
+ title)
+ dialog.format_secondary_text(_("The following errors occurred:"))
- buff.insert (iter, str (err))
+ buff = Gtk.TextBuffer()
+ iter = buff.get_start_iter()
+ buff.insert (iter, str(err))
+
+ text = Gtk.TextView()
+ text.set_editable(False)
+ text.set_cursor_visible(False)
+ text.set_size_request(400, 200)
+ text.set_buffer(buff)
holder = Gtk.ScrolledWindow ()
holder.set_policy (Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
- holder.add (text)
-
- dialog.vbox.pack_start (holder)
- holder.show_all ()
-
+ holder.set_property('expand', True)
+ holder.add(text)
+
+ dialog.vbox.pack_start(holder, False, False, 0)
+ dialog.vbox.set_property('spacing', 0)
+ dialog.show_all ()
+
dialog.run ()
dialog.destroy ()
-
- return
def error_dialog_s(parent, primary, secondary=None):
dialog = Gtk.MessageDialog(parent,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]