Re: sqdfcqs



On Fri, Apr 17, 2009 at 4:42 PM, Vincent Legoll
<vincent legoll gmail com> wrote:
> Oops,
>
> this was not intended to the ML, but now that it is...
>
> This patch asks the user if he wants the inexistent file
> he has entered the path into a filediff's fileentry to be
> created instead of blindly trying to open and display an
> error message "cannot read from file"
>
> Exchanging an error dialog for a useful (hope so) one...

Here's a very rough sketch of how we can remove the dialog popups.
Also we have more space to suggest possible solutions.

Stephen.
Index: filediff.py
===================================================================
--- filediff.py	(revision 1351)
+++ filediff.py	(working copy)
@@ -515,13 +515,23 @@
                                        pane = i)
                     tasks.append(task)
                 except (IOError, LookupError), e:
-                    buf.set_text("\n")
-                    misc.run_dialog(
+                    box = gtk.VBox()
+                    lbl = gtk.Label(
                         "%s\n\n%s\n%s" % (
                             _("Could not read from '%s'") % f,
                             _("The error was:"),
-                            str(e)),
-                        parent = self)
+                            str(e)))
+
+                    fra = gtk.Frame()
+                    fra.add(lbl)
+                    box.pack_start( fra )
+                    box.pack_start( gtk.Button("Create it") )
+                    eb = gtk.EventBox()
+                    eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("light yellow"))
+                    eb.add(box)
+                    eb.show_all()
+                    self.textview[i].add_child_in_window( eb, gtk.TEXT_WINDOW_TEXT, 10, 10)
+                    self.textview[i].set_editable(False)
             else:
                 panetext[i] = buf.get_text(*buf.get_bounds())
         yield _("[%s] Reading files") % self.label_text


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