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

Re: gEDA-dev: Some gschem misfeatures noted this morning (10.5.2006)



On Thursday 05 October 2006 15:41, Stuart Brorson wrote:
> Just a quick note on the second issue:
>
> I re-opened my multi-page schematic from the command line using gschem
> like this:
>
> gschem foo_*.sch
>
> (I have foo_1.sch, foo_2.sch, etc.)
>
> This time gschem gave me only one status window.  Therefore the
> problem is *not* in gschem.
>
> I suspect that the new project manager, xgsch2pcb, opens multiple
> files like this:
>
> for file in filelist:
>    sys.command("gschem "+file)
>
> Whereas it should do something like:
>
> filestring = ""
> for file in filelist:
>    filestring = filestring +" "
> # Now open all at once....
> sys.command("gschem "+filestring)
>
> I can look at xgsch2pcb and maybe submit a patch . . . .
>

Try this one.  Haven't had time to test it properly, but it should work 
more-or-less.  Please make sure gattrib works as expected when it's passed 
paths to more than one schematic.

Peter

-- 
Fisher Society committee                    http://tinyurl.com/o39w2
CUSBC novices, match and league secretary   http://tinyurl.com/mwrc9

v3sw6YChw7$ln3pr6$ck3ma8u7+Lw3+2m0l7Ci6e4+8t4Gb8en6g6Pa2Xs5Mr4p4
  hackerkey.com                                  peter-b.co.uk
diff --git a/geda/xgsch2pcb/lib/xgsch2pcb/gui.py b/geda/xgsch2pcb/lib/xgsch2pcb/gui.py
index c76551f..fa3e1cd 100644
--- a/geda/xgsch2pcb/lib/xgsch2pcb/gui.py
+++ b/geda/xgsch2pcb/lib/xgsch2pcb/gui.py
@@ -355,28 +355,30 @@ class MonitorWindow(gtk.Window):
 
     def event_schematic_button_clicked(self, button, tool):
         
-        def runtool_func(model, path, iter):
-            page = model.get_value(iter, 0)
-
-            toolpath = find_tool_path(tool)
-            if toolpath == None:
-                md = gtk.MessageDialog(self,
-                                       (gtk.DIALOG_MODAL |
-                                        gtk.DIALOG_DESTROY_WITH_PARENT),
-                                       gtk.MESSAGE_ERROR,
-                                       gtk.BUTTONS_OK,
-                                       _('Could not locate tool: %s') % tool)
-                md.show_all()
-                md.run()
-                md.hide_all()
-                return
-
-            Popen([toolpath, page])
-
-        # Call the private helper function defined above for each
-        # selected schematic page.
-        self.pagelist.get_selection().selected_foreach(runtool_func)
-
+        # Call a private helper function defined above for each
+        # selected schematic page in order to build a list of pages.
+        pages = []
+        def buildpagelist_func(model, path, iter):
+            pages.append(model.get_value(iter, 0))
+        self.pagelist.get_selection().selected_foreach(buildpagelist_func)
+
+        # Launch the requested tool
+        # FIXME does this work for gattrib?
+        toolpath = find_tool_path(tool)
+        if toolpath == None:
+            md = gtk.MessageDialog(self,
+                                   (gtk.DIALOG_MODAL |
+                                    gtk.DIALOG_DESTROY_WITH_PARENT),
+                                   gtk.MESSAGE_ERROR,
+                                   gtk.BUTTONS_OK,
+                                   _('Could not locate tool: %s') % tool)
+            md.show_all()
+            md.run()
+            md.hide_all()
+            return
+        
+        Popen([toolpath] + pages)
+            
     def event_editpcb_button_clicked(self, button):
         
         # Check if the layout might need updating

PGP signature



_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev