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

gEDA-cvs: branch: master updated (rel_0.1.1-3-g5911561)



The branch, master has been updated
       via  5911561361be6e21d586d4f2dcbe901d6278d702 (commit)
      from  90d72dc57a8817d86409473dc2b3db6bc3704c85 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 lib/xgsch2pcb/gui.py        |   30 +++++++++++++++++++++++-
 lib/xgsch2pcb/pcbmanager.py |   52 ++++++++++++++++++++++++++++++------------
 2 files changed, 65 insertions(+), 17 deletions(-)


=================
 Commit Messages
=================

commit 5911561361be6e21d586d4f2dcbe901d6278d702
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Oct 8 23:29:49 2007 +0100

    Parse gsch2pcb ouput for missing elements its backup filename.
    
    Popup a dialog warning the user of any missing elements from the layout.
    In addition, gsch2pcb only makes a backup file if it changes the board
    layout. Don't make PCB "revert" to the new layout in that case, as it
    looses the user's undo history un-necessarily.

:100644 100644 445f4a4... 95be683... M	lib/xgsch2pcb/gui.py
:100644 100644 1314659... 0303b49... M	lib/xgsch2pcb/pcbmanager.py

=========
 Changes
=========

commit 5911561361be6e21d586d4f2dcbe901d6278d702
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Mon Oct 8 23:29:49 2007 +0100

    Parse gsch2pcb ouput for missing elements its backup filename.
    
    Popup a dialog warning the user of any missing elements from the layout.
    In addition, gsch2pcb only makes a backup file if it changes the board
    layout. Don't make PCB "revert" to the new layout in that case, as it
    looses the user's undo history un-necessarily.

diff --git a/lib/xgsch2pcb/gui.py b/lib/xgsch2pcb/gui.py
index 445f4a4..95be683 100644
--- a/lib/xgsch2pcb/gui.py
+++ b/lib/xgsch2pcb/gui.py
@@ -751,8 +751,34 @@ class MonitorWindow(gtk.Window):
 
     def update_layout( self ):
         # TODO: Catch any exceptions which might prevent this working
-        self.pcbmanager.update_layout( self.project.pages )
-        
+        unfound = self.pcbmanager.update_layout( self.project.pages )
+        if len(unfound) > 0:
+            results_string = '<span weight="bold" size="larger">' + \
+                             _('Elements missing from layout') + '</span>\n\n' + \
+                             _('The footprints for the following elements were not found.\nPlease check the \'footprint\' attribute for these elements:\n')
+
+            for [ refdes, footprint ] in unfound:
+                results_string = results_string + '\n  ' + refdes + ' (footprint=' + footprint + ')'
+
+            md = gtk.MessageDialog(self,
+                                   (gtk.DIALOG_MODAL |
+                                    gtk.DIALOG_DESTROY_WITH_PARENT),
+                                   gtk.MESSAGE_WARNING,
+                                   gtk.BUTTONS_OK)
+
+            md.set_markup( results_string )
+
+            # Set GUI spacings
+            md.set_border_width( 6 )
+            md.vbox.set_spacing( 12 )
+            #md.hbox.border_width( 6 )
+            #md.hbox.set_spacing( 12 )
+
+            md.show_all()
+            md.run()
+            md.hide_all()
+
+
 gobject.type_register( MonitorWindow )
 
 class AddPageDialog(gtk.Dialog):
diff --git a/lib/xgsch2pcb/pcbmanager.py b/lib/xgsch2pcb/pcbmanager.py
index 1314659..0303b49 100644
--- a/lib/xgsch2pcb/pcbmanager.py
+++ b/lib/xgsch2pcb/pcbmanager.py
@@ -221,7 +221,7 @@ class PCBManager( gobject.GObject ):
             error_restore_backup()
             # TODO: TELL PCB TO ALLOW USER ACTIONS
             # TODO: ERROR MESSAGE TO USER
-            return
+            return []
 
         # Copy saved layout to backup
         shutil.copy(self.output_name + ".pcb", self.output_name + ".savedbackup.pcb")
@@ -234,40 +234,62 @@ class PCBManager( gobject.GObject ):
         gsch2pcb_cmd = self.gsch2pcbpath + ' -q "' + self.output_name + '.tmp.gsch2pcb"'
         gsch2pcb_output = commands.getstatusoutput(gsch2pcb_cmd)
         lines = gsch2pcb_output[1].splitlines()
+        unfound = []
+        gsch2pcb_backup = None
         for line in lines:
             print "<gsch2pcb>:", line
 
-        # TODO: HANDLE ERROR OUTPUT FROM gsch2pcb!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-        
-        # Load layout
-        if self.pcb_actions_iface.ExecAction("LoadFrom", [ "Revert", self.output_name + ".pcb" ]):
-            error_restore_backup()
-            # TODO: TELL PCB TO ALLOW USER ACTIONS
-            # TODO: ERROR MESSAGE TO USER
-            return
-        
+            search = ' is backed up as '
+            found_idx = line.find( search )
+            if found_idx >= 0:
+                # The last character is a ".", so don't return that.
+                gsch2pcb_backup = line[ found_idx + len(search) : len(line) -1 ]
+
+            search = ': can\'t find PCB element for footprint '
+            found_idx = line.find( search )
+            if found_idx >= 0:
+                refdes = line[ 0 : found_idx ]
+                end_fp_idx = line.find( " (value=", found_idx )
+                footprint = line[ found_idx + len( search ) : end_fp_idx ]
+                unfound.append( [ refdes, footprint ] )
+
+        # TODO: Report to the user the backup filename made by xgsch2pcb (or us?)
+        #       if they don't like the changes.
+
+        # TODO: HANDLE ERROR OUTPUT FROM gsch2pcb!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+        # Load new layout (if gsch2pcb modified it)
+        # otherwise, don't force the revert as it destroys the users UNDO history
+        if gsch2pcb_backup:
+            if self.pcb_actions_iface.ExecAction("LoadFrom", [ "Revert", self.output_name + ".pcb" ]):
+                error_restore_backup()
+                # TODO: TELL PCB TO ALLOW USER ACTIONS
+                # TODO: ERROR MESSAGE TO USER
+                return []
+
         # Delete rats
         if self.pcb_actions_iface.ExecAction("DeleteRats", ["AllRats"]):
             # TODO: WARNING TO USER?
             pass
-        
+
         # Load netlist
         if self.pcb_actions_iface.ExecAction("LoadFrom", ["Netlist", self.output_name + ".net"]):
             # TODO: WARNING TO THE USER?
             pass
-        
+
         # If new elements exist, put them in the paste-buffer
+        # FIXME: This overwrites the pastebuffer... hopefully the user didn't have anything useful in there!
         newparts = self.output_name + ".new.pcb"
         if os.path.exists (newparts):
             if self.pcb_actions_iface.ExecAction("LoadFrom", ["LayoutToBuffer", newparts]):
                 # TODO: WARN USER?
                 pass
-       
+
             # Paste the new components near the origin
             if self.pcb_actions_iface.ExecAction("PasteBuffer", ["ToLayout","10","10","mil"]):
                 # TODO: WARN USER?
                 pass
-            
+
             # Change back to the "none" (select) tool
             if self.pcb_actions_iface.ExecAction("Mode", ["None"]):
                 # TODO: WARN USER?
@@ -287,7 +309,7 @@ class PCBManager( gobject.GObject ):
         cleanup_files()
 
         print _("********DONE UPDATING********")
-            
+        return unfound
 
 gobject.type_register( PCBManager )
 




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