[pybliographer/wip/gtk3] document: Migrate gnome_app_error to Gtk.MessageDialog



commit 7c92483998dcfc00d7af243934e6f357f475fd38
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Tue Oct 10 09:07:55 2017 -0300

    document: Migrate gnome_app_error to Gtk.MessageDialog

 Pyblio/GnomeUI/Document.py |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 0ba6729..98c4b2b 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -396,7 +396,7 @@ class Document (Connector.Publisher):
         try:
             file = open (output, 'w')
         except IOError, err:
-            self.w.error (_("can't open file `%s' for writing:\n%s")
+            Utils.error_dialog_s(self.w, _("can't open file `%s' for writing:\n%s")
                           % (output, str (err)))
             return
         
@@ -417,7 +417,7 @@ class Document (Connector.Publisher):
             Pyblio.Style.Utils.generate (url, format, self.data, entries, file)
         except RuntimeError, err:
             print err
-            self.w.error (_("Error while parsing `%s':\n%s") % (style, err))
+            Utils.error_dialog_s(self.w, _("Error while parsing `%s':\n%s") % (style, err))
         return
 
 
@@ -521,11 +521,11 @@ class Document (Connector.Publisher):
 
         if url is None:
             # no result.
-            self.w.error (_("Your query returned no result"))
+            Utils.error_dialog_s(self.w, _("Your query returned no result"))
             return
         elif url is -1:
             # error
-            self.w.error (_("An error occurred during Medline Query"))
+            Utils.error_dialog_s(self.w, _("An error occurred during Medline Query"))
             return
 
         self.open_in_new(url, 'medline', no_name=True)
@@ -656,7 +656,7 @@ class Document (Connector.Publisher):
                         os.remove (old_auto_save)
                     except (OSError, IOError), error:
                         Utils.set_cursor (self.w, 'normal')
-                        self.w.error (_("Unable to remove autosave file `%s':\n%s") % (str (old_auto_save), 
str (error)))
+                        Utils.error_dialog_s(self.w, _("Unable to remove autosave file `%s':\n%s") % (str 
(old_auto_save), str (error)))
                         return
 
 
@@ -707,7 +707,7 @@ class Document (Connector.Publisher):
             try:
                 savefile = open (save, 'w')
             except (IOError, OSError), error:
-                self.w.error (_("Error during autosaving:\n%s") % error [1])
+                Utils.error_dialog_s(self.w, _("Error during autosaving:\n%s") % error [1])
                 return False
 
             iterator = Selection.Selection (sort = Sort.Sort([Sort.KeySort()]))
@@ -735,7 +735,7 @@ class Document (Connector.Publisher):
                 self.data.update (Sort.Sort([Sort.KeySort()]))
             except (OSError, IOError), error:
                 Utils.set_cursor (self.w, 'normal')
-                self.w.error (_("Unable to save `%s':\n%s") % (str (self.data.key),
+                Utils.error_dialog_s(self.w, _("Unable to save `%s':\n%s") % (str (self.data.key),
                                                                str (error)))
                 return
         except:
@@ -743,7 +743,7 @@ class Document (Connector.Publisher):
             traceback.print_exception (etype, value, tb)
             
             Utils.set_cursor (self.w, 'normal')
-            self.w.error (_("An internal error occurred during saving\nTry to Save As..."))
+            Utils.error_dialog_s(self.w, _("An internal error occurred during saving\nTry to Save As..."))
             return
 
         Utils.set_cursor (self.w, 'normal')
@@ -771,7 +771,7 @@ class Document (Connector.Publisher):
         try:
             file = open (url, 'w')
         except IOError, error:
-            self.w.error (_("During opening:\n%s") % error [1])
+            Utils.error_dialog_s(self.w, _("During opening:\n%s") % error [1])
             return
 
         Utils.set_cursor (self.w, 'clock')
@@ -797,7 +797,7 @@ class Document (Connector.Publisher):
                         os.remove (old_auto_save)
                     except (OSError, IOError), error:
                         Utils.set_cursor (self.w, 'normal')
-                        self.w.error (_("Unable to remove autosave file `%s':\n%s") % (str (old_auto_save), 
str (error)))
+                        Utils.error_dialog_s(self.w, _("Unable to remove autosave file `%s':\n%s") % (str 
(old_auto_save), str (error)))
                         return
 
         
@@ -857,7 +857,7 @@ class Document (Connector.Publisher):
                         os.remove (old_auto_save)
                     except (OSError, IOError), error:
                         Utils.set_cursor (self.w, 'normal')
-                        self.w.error (_("Unable to remove autosave file `%s':\n%s") % (str (old_auto_save), 
str (error)))
+                        Utils.error_dialog_s(self.w, _("Unable to remove autosave file `%s':\n%s") % (str 
(old_auto_save), str (error)))
                         return
 
         return answer
@@ -1023,7 +1023,7 @@ class Document (Connector.Publisher):
             try:
                 test = SearchCls.AnyTester(q.encode('latin-1'))
             except UnicodeEncodeError:
-                self.w.error (_("your search text must contain\nlatin-1 characters only"))
+                Utils.error_dialog_s(self.w, _("your search text must contain\nlatin-1 characters only"))
                 return
         else:
             test = None
@@ -1102,7 +1102,7 @@ class Document (Connector.Publisher):
             try:
                 self.lyx = LyX.LyXClient ()
             except IOError, msg:
-                self.w.error (_("Can't connect to LyX:\n%s") % msg)
+                Utils.error_dialog_s(self.w, _("Can't connect to LyX:\n%s") % msg)
                 return
 
         keys = string.join (map (lambda x: x.key.key, entries), ', ')
@@ -1110,7 +1110,7 @@ class Document (Connector.Publisher):
             self.lyx ('citation-insert', keys)
         except IOError, msg:
             msg = msg [1].decode (enc)
-            self.w.error (_("Can't connect to LyX:\n%s") % msg)
+            Utils.error_dialog_s(self.w, _("Can't connect to LyX:\n%s") % msg)
         return
     
 
@@ -1225,7 +1225,7 @@ class Document (Connector.Publisher):
         try:
             Gtk.show_uri (None, "help:pybliographer", timestamp)            
         except GObject.GError, msg:
-            self.w.error (_("Can't display documentation:\n%s") % msg)
+            Utils.error_dialog_s(self.w, _("Can't display documentation:\n%s") % msg)
             
         return
 
@@ -1260,4 +1260,3 @@ class Document (Connector.Publisher):
 
         about.connect('response', lambda w, b: w.destroy())
         about.show()
-


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]