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

gEDA-cvs: geda_manager.git: branch: master updated (b6d8830cf24c4d24f8216a167febea51d055d63c)



The branch, master has been updated
       via  b6d8830cf24c4d24f8216a167febea51d055d63c (commit)
      from  169d6296eb29864f63e53f02aa2362df972550a1 (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
=========

 src/gedamanager.py            |   16 +++---
 src/gsch2pcb.py               |  109 ++-------------------------------------
 src/processdependencyevent.py |    4 +-
 src/utils.py                  |  115 +++++++++++++++++++++-------------------
 4 files changed, 74 insertions(+), 170 deletions(-)


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

commit b6d8830cf24c4d24f8216a167febea51d055d63c
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date:   Sun Aug 31 12:09:49 2008 -0700

    Routine Checkin.

:100644 100644 1ba4392... 143e7bb... M	src/gedamanager.py
:100644 100644 c6bf288... d3378e4... M	src/gsch2pcb.py
:100644 100644 0d83377... c2ec4b7... M	src/processdependencyevent.py
:100644 100644 98b5603... fd84de8... M	src/utils.py

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

commit b6d8830cf24c4d24f8216a167febea51d055d63c
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date:   Sun Aug 31 12:09:49 2008 -0700

    Routine Checkin.

diff --git a/src/gedamanager.py b/src/gedamanager.py
index 1ba4392..143e7bb 100644
--- a/src/gedamanager.py
+++ b/src/gedamanager.py
@@ -546,7 +546,7 @@ class gEDAManager:
                     file_path = parent_path + '/' + f
                 else:
                     file_path = self.project.directory + '/' + f
-                image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(f)], 22, 0)
+                image = icon.load_icon(self.utils.icon_lut[self.utils.get_filename_ext(f)], 22, 0)
                 n_parent = self.sources.append(parent, [image, f, file_path])
 
 
@@ -1081,9 +1081,9 @@ class gEDAManager:
 ##             filepath = embed_fc.get_filename()
 ##             if filepath != None:
 ##                 # Find out what file it is so we can pick an icon for it
-##                 filename = self.utils.get_node_name(filepath)
+##                 filename = self.utils.get_filename_from_filepath(filepath)
 ##                 icon = gtk.IconTheme()
-##                 image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(filename)], 22, 0)
+##                 image = icon.load_icon(self.utils.icon_lut[self.utils.get_filename_ext(filename)], 22, 0)
 ##                 # We can't call update file list because the currently selected
 ##                 # node (a file) is not the one that we want to put it
 ##                 # under ( whic is some folder). Thus, we need to find the iter
@@ -1116,7 +1116,7 @@ class gEDAManager:
 ##                     self.utils.add_to_dependency_dict(self, filename)
 ##                     # Add the new file as a dependency for the selected file
 ##                     # and make sure that it is in the dependency_dict
-##                     parent_file = self.utils.get_node_name(selected_node)
+##                     parent_file = self.utils.get_filename_from_filepath(selected_node)
 ##                     self.utils.add_to_dependency_dict(self, parent_file)                
 ##                     self.project.dependency_dict[parent_file].append([True, filename])
 ##                     self.utils.update_file_list(self)
@@ -1187,10 +1187,10 @@ class gEDAManager:
                 i = i + 1
         os.mkdir(filepath)
         
-        filename = self.utils.get_node_name(filepath)
+        filename = self.utils.get_filename_from_filepath(filepath)
         # Find out what file it is so we can pick an icon for it
         icon = gtk.IconTheme()
-        image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(filename)], 22, 0)
+        image = icon.load_icon(self.utils.icon_lut[self.utils.get_filename_ext(filename)], 22, 0)
         self.sources.append(selection_iter, [image, filename, filepath])
         # Add the new folder to project file list
         self.utils.update_file_list(self)
@@ -1270,7 +1270,7 @@ class gEDAManager:
 ##             model[path][1] = new_text
 ##             model[path][2] = new_path
 ##             icon = gtk.IconTheme()
-##             model[path][0] = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(new_text)], 22, 0)
+##             model[path][0] = icon.load_icon(self.utils.icon_lut[self.utils.get_filename_ext(new_text)], 22, 0)
 ##             self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\n' + old_path + ' changed to ' + new_path + '.\n')
 ##         elif '.' in new_text and '.' not in old_path: # Folder being changed
 ##             pass # don't allow it to change names
@@ -1327,7 +1327,7 @@ class gEDAManager:
         model, selection_iter = selection.get_selected()
         if selection_iter != None:
             selected_node = self.sources.get_value(selection_iter, 2)
-            filename = self.utils.get_node_name(selected_node)
+            filename = self.utils.get_filename_from_filepath(selected_node)
             if '.' in filename and not filename.endswith(('.gm','.log')):
                 # Logic to call function to find what type of file it is
                 # and then to populate the according tree view
diff --git a/src/gsch2pcb.py b/src/gsch2pcb.py
index c6bf288..d3378e4 100644
--- a/src/gsch2pcb.py
+++ b/src/gsch2pcb.py
@@ -99,25 +99,6 @@ class Gsch2pcb:
         label.show()
         hbox.pack_end(label)
         self.dialog.vbox.pack_end(hbox, True, True, 0)
-
-##         # Project file
-##         hbox = gtk.HBox()
-##         hbox.show()
-##         self.project_entry = gtk.Entry()
-##         self.project_entry.show()
-##         self.project_entry.connect('activate', response_to_dialog_project, self.dialog, gtk.RESPONSE_OK)
-##         self.projectfile = gtk.FileChooserButton('PCB Name')
-##         self.projectfile.show()
-##         self.projectfile.connect('selection-changed',
-##                              cb_project_selection_changed, self.project_entry)
-##         self.projectfile.set_local_only(True)
-##         self.projectfile.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
-##         hbox.pack_end(self.projectfile)
-##         hbox.pack_end(self.project_entry)
-##         label = gtk.Label('Project file (use full paths for schematics):')
-##         label.show()
-##         hbox.pack_end(label)
-##         self.dialog.vbox.pack_end(hbox, True, True, 0)
         
         # Schematic selections
         scrolled_window = gtk.ScrolledWindow()
@@ -139,19 +120,8 @@ class Gsch2pcb:
         self.schematics_tree.append_column(column)        
         scrolled_window.add(self.schematics_tree)
         self.dialog.vbox.pack_end(scrolled_window, True, True, 0)
-
-##         # Radio buttons
-##         self.project_radio_button = gtk.RadioButton(None, 'Use project file')
-##         self.project_radio_button.connect('toggled', self.cb_rdobutton_toggled, 'Use project file')
-##         self.dialog.vbox.pack_end(self.project_radio_button, True, True, 0)
-##         self.project_radio_button.show()
-##         self.schematics_radio_button = gtk.RadioButton(self.project_radio_button, 'Select schematics from project')
-##         self.schematics_radio_button.set_active(True)
-##         self.schematics_radio_button.connect('toggled', self.cb_rdobutton_toggled, 'Select schematics from project')
-##         self.dialog.vbox.pack_end(self.schematics_radio_button, True, True, 0)
-##         self.schematics_radio_button.show()
-        
         self.dialog.show()
+
         response = self.dialog.run()
         if response == gtk.RESPONSE_OK:
             message = ''
@@ -159,8 +129,6 @@ class Gsch2pcb:
             schematics = ''
             self.in_project = False
 
-##         # Schematics or Project
-##         if self.schematics_radio_button.get_active():
             # Iterate over the gtk.TreeModel
             for row in self.schematics:
                 if row[2]:
@@ -169,19 +137,9 @@ class Gsch2pcb:
                     schematics += row[1] + ' '
             if not schematics_list:
                 message = 'At least one schematic must be chosen.\n'
-##         else:
-##             if self.projectpath == '' or self.projectpath == None:
-##                 message += 'Full path to project file must be specified.\n'
-
-##         if self.project_radio_button.get_active():
-##             # Check to see if there is projectpath
-##             if self.projectpath == None or self.projectpath == '':
-##                 message += 'You must specify a project path if using a project file.\n'
-##        else:
             name = self.name_entry.get_text()
             if name == '' or name == None:
                 message += 'A name for the PCB must be specified.\n'
-                    
             self.directory = directory_entry.get_text()
             if self.directory == '' or self.directory == None:
                 message += 'A target directory must be chosen.\n'
@@ -202,14 +160,6 @@ class Gsch2pcb:
                 dm.run()
                 dm.destroy()
             else:
-                # Steps
-                # 1) Get list of files in the target directory and put them in
-                # a list
-                # 2) Run the process
-                # 3) Get the list of files in target now
-                # 4) Subtract old from new to get added files
-                # 5) Add files to tree view (only ones I want)
-                # 6) Add these files to the dependency dict
                 files_before = os.listdir(self.directory)
                 subproc = Popen(['gsch2pcb', '-v','-v','-o',name,schematics]).wait()
                 files_after = os.listdir(self.directory)
@@ -218,13 +168,6 @@ class Gsch2pcb:
                     if f not in files_before:
                         files.append(f)
 
-##                 # Call the code to run the gsch2pcb workflow
-##                 if self.schematics_radio_button.get_active():
-##                     subproc = Popen(['gsch2pcb', '-v','-v','-o',name,schematics])
-##                 else:
-
-##                     subproc = Popen(['gsch2pcb', '-v','-v',self.projectpath])
-
                 if self.in_project:
                     # Add it to the sources tree view
                     icon = gtk.IconTheme()
@@ -254,34 +197,10 @@ class Gsch2pcb:
                             self.g.project.dependency_dict[sch[0]][0] = True
                             for f in new_files:
                                 self.g.project.dependency_dict[sch[0]].append(f)
-##                             new_list = []                            
-##                             for sch in self.schematics:
-##                                 lst = []
-##                                 lst.append(True)
-##                                 lst.append(sch[0])
-##                                 new_list.append(lst)
-##                             if f not in self.g.project.dependency_dict:
-##                                 self.g.project.dependency_dict[f] = new_list
-##                             else:
-##                                 # Add to the value that is already there
-##                                 for lst in new_list:
-##                                     print 'lst in new_list:',lst
-##                                     self.g.project.dependency_dict[f].append(lst)
-                    # Update project by saving it
+                    # Update the project and its file list
                     self.g.utils.update_file_list(self.g)
-
-##         for lst in gedamanager.project.dependency_dict[filename]:
-##             print lst, ' for updating lst'
-##             lst[0] = False
-##             new_list.append(lst)
-##                 if filename not in g.project.dependency_dict:
-##                     g.project.dependency_dict[filename] = []
-##         print 'new_list:', new_list
-##         gedamanager.project.dependency_dict[filename] = new_list
-                            
-
-                    
-
+                else: 
+                    pass
         self.dialog.destroy()
 
 
@@ -307,26 +226,6 @@ class Gsch2pcb:
         model[path][2] = not model[path][2]
 
 
-##     def cb_rdobutton_toggled(self, widget, data=None):
-##         """!
-##         Event handler for the radio buttons.
-##         @param widget the gtk.RadioButton that threw the event
-##         @param data option user paramater
-##         """
-##         print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
-##         if data == 'Use project file' and widget.get_active():
-##             # Make the self.schematics_tree insensitive
-##             self.schematics_tree.set_sensitive(False)
-##             self.name_entry.set_sensitive(False)
-##             self.project_entry.set_sensitive(True)
-##             self.projectfile.set_sensitive(True)            
-##         else:
-##             self.schematics_tree.set_sensitive(True)
-##             self.name_entry.set_sensitive(True)
-##             self.project_entry.set_sensitive(False)
-##             self.projectfile.set_sensitive(False)            
-            
-
     def get_schematics(self):
         """!
         Method to get to populate the gtk.TreeStore object self.schematics
diff --git a/src/processdependencyevent.py b/src/processdependencyevent.py
index 0d83377..c2ec4b7 100644
--- a/src/processdependencyevent.py
+++ b/src/processdependencyevent.py
@@ -49,9 +49,9 @@ class ProcessDependencyEvent(ProcessEvent):
         project's filesystem.
         """
         # Call method to set the status of the dependent files recursively
-        filename = self.g.utils.get_node_name(event.pathname)
+        filename = self.g.utils.get_filename_from_filepath(event.pathname)
         if filename != None and self.g.project.dependency_dict != None:
-            print 'filename in process catcher:',filename
             if filename in self.g.project.dependency_dict:
                 self.g.utils.update_dependency_dict(self.g, filename, True)
+                self.g.utils.update_file_list(self.g)
 
diff --git a/src/utils.py b/src/utils.py
index 98b5603..fd84de8 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -151,7 +151,7 @@ class Utils:
         return time.asctime(time.localtime(time.time()))
 
 
-    def get_node_name(self, path):
+    def get_filename_from_filepath(self, path):
         """!
         Method to return the node name from the path.
         @param path to the node
@@ -163,7 +163,7 @@ class Utils:
             return ''
 
 
-    def get_node_ext(self, filepath):
+    def get_filename_ext(self, filepath):
         """!
         Method to return the extension for the path.
         @param filepath for the node file
@@ -185,7 +185,7 @@ class Utils:
         @return icon the icon from the self.icon_lut structure
         """
         g = gedamanager
-        filename = self.get_node_name(selected_node)
+        filename = self.get_filename_from_filepath(selected_node)
         icon = gtk.IconTheme()        
         if filename in g.project.dependency_dict:
             # Check its status
@@ -285,11 +285,11 @@ class Utils:
             selection_iter = g.sources.get_iter_first()
         selected_node = g.sources.get_value(selection_iter, 2)
         if filepath != None:
-            filename = self.get_node_name(filepath) # Files
+            filename = self.get_filename_from_filepath(filepath) # Files
         else:
-            filename = self.get_node_name(selected_node) # Folders
+            filename = self.get_filename_from_filepath(selected_node) # Folders
         icon = gtk.IconTheme()
-        image = icon.load_icon(self.icon_lut[self.get_node_ext(filename)], 22, 0)
+        image = icon.load_icon(self.icon_lut[self.get_filename_ext(filename)], 22, 0)
         path = selected_node + '/' + filename
 
 
@@ -323,7 +323,7 @@ class Utils:
                 os.system('rm ' + selected_node)
                 g.sources.remove(selection_iter)
                 g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nDeleted ' + selected_node + '.\n')
-                node = self.get_node_name(selected_node)
+                node = self.get_filename_from_filepath(selected_node)
                 if node in g.project.dependency_dict and list(self.flatten(g.project.file_list)).count(node) == 1:
                     del g.project.dependency_dict[node]
         elif index == 2:
@@ -433,7 +433,7 @@ class Utils:
             extensions = []
             for f in files:
                 if not f.endswith(('~','-')):
-                    ext = self.get_node_ext(f)
+                    ext = self.get_filename_ext(f)
                     if ext not in extensions:
                         extensions.append(ext)
             for ext in extensions:
@@ -447,8 +447,8 @@ class Utils:
         if ext == 'sch':
             # Parent folders
             simulation = g.processes.append(None, ['Simulate Schematic(s)', None, None])
-            create_pcb = g.processes.append(None, ['Create or Update PCB for Schematic(s)', None, None])
-            create_netlist = g.processes.append(None, ['Create or Update Netlist for Schematic(s)', None, None])
+            create_pcb = g.processes.append(None, ['Create PCB for Schematic(s)', None, None])
+            create_netlist = g.processes.append(None, ['Create Netlist for Schematic(s)', None, None])
             modify_attributes = g.processes.append(None, ['Modify Attributes for Schematic(s)', None, None])
 
             # Simulate
@@ -457,15 +457,13 @@ class Utils:
 
             # PCB
             image = icon.load_icon(self.icon_lut['g2p'], 22, 0)
-            #status_image = self.get_status_image(g, selected_node, 'pcb')
-            g.processes.append(create_pcb, ['gsch2pcb workflow', image, None])#status_image])
+            g.processes.append(create_pcb, ['gsch2pcb workflow', image, None])
 
             # Netlists
             image = icon.load_icon(self.icon_lut['net'], 22, 0)
             gnetlist = g.processes.append(create_netlist, ['gnetlist', image, None])
             for netlist in sorted(self.netlists):
-                status_image = self.get_status_image(g, selected_node)
-                g.processes.append(gnetlist, [netlist, None, status_image])
+                g.processes.append(gnetlist, [netlist, None, None])
 
             # Modify attributes
             image = icon.load_icon(self.icon_lut['other'], 22, 0) #refdes -- TODO
@@ -478,22 +476,16 @@ class Utils:
         elif ext == 'pcb':
             # gsch2pcb
             status_image = self.get_status_image(g, selected_node)
-            export = g.processes.append(None, ['gsch2pcb', None, status_image])
+            export = g.processes.append(None, ['Update PCB (gsch2pcb)', None, status_image])
             # Export
             export = g.processes.append(None, ['Export', None, None])
-            status_image = self.get_status_image(g, selected_node)
-            gerber = g.processes.append(export, ['RS-274X (Gerber) file(s)', None, status_image])
+            gerber = g.processes.append(export, ['RS-274X (Gerber) file(s)', None, None])
             # May need to add for bom1 and bom2
-            status_image = self.get_status_image(g, selected_node)       
-            bom = g.processes.append(export, ['Bill of Materials (BOM) file(s)', None, status_image])
-            status_image = self.get_status_image(g, selected_node)
-            nelma = g.processes.append(export, ['Numerical analysis (Nelma) file(s)', None, status_image])
-            status_image = self.get_status_image(g, selected_node)
-            png = g.processes.append(export, ['GIF/JPEG/PNG file(s)', None, status_image])
-            status_image = self.get_status_image(g, selected_node)
-            ps = g.processes.append(export, ['Postscript file(s)', None, status_image])
-            status_image = self.get_status_image(g, selected_node)
-            eps = g.processes.append(export, ['Encapsulated Postscript file(s)', None, status_image])
+            bom = g.processes.append(export, ['Bill of Materials (BOM) file(s)', None, None])
+            nelma = g.processes.append(export, ['Numerical analysis (Nelma) file(s)', None, None])
+            png = g.processes.append(export, ['GIF/JPEG/PNG file(s)', None, None])
+            ps = g.processes.append(export, ['Postscript file(s)', None, None])
+            eps = g.processes.append(export, ['Encapsulated Postscript file(s)', None, None])
             # Print
             _print = g.processes.append(None, ['Print (lpr)', None, None])
             
@@ -573,7 +565,7 @@ class Utils:
         selection = g.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
         highlighted_source = g.sources.get_value(selection_iter, 2)
-        filename = self.get_node_name(highlighted_source)
+        filename = self.get_filename_from_filepath(highlighted_source)
         if filename not in g.project.dependency_dict:
             g.project.dependency_dict[filename] = [True]
         self.run_command(g, selected_node, highlighted_source)
@@ -593,19 +585,11 @@ class Utils:
         files = ['net','log','bom','bom1','bom2','v','vhd','gm','txt']
         # Sources
         if ext != None:
-            os.chdir(filepath.rpartition('/')[0])            
+            os.chdir(filepath.rpartition('/')[0])
             if ext == 'sch' or ext == 'sym':
                 if g.tools['sch'] == None or g.tools['sch'].poll() == 0:
                     g.tools['sch'] = Popen(['gschem', filepath], stdin=PIPE, stdout=PIPE)
-#                    Popen(['gschem', filepath], stdin=PIPE, stdout=PIPE)
-##                     stdout = g.tools['sch'].communicate()[0]
-##                     print 'stdout:',stdout
-##                     child_stdout = g.tools['sch'].stdout
-##                     print 'child_stdout:', child_stdout
-##                     for f in child_stdout.readline():
-##                         print 'child_stdout line:',f
                 elif g.tools['sch'].poll() == None: # Process is still running
-                    # Let's try to open a file
                     try:
                         st = os.stat(filepath)
                     except IOError:
@@ -640,17 +624,10 @@ class Utils:
                     g.tools['editor'] = Popen([g.settings.editor, filepath])
                 elif g.tools['editor'].poll() == None: # Process is still running
                     print 'editor in use'
-                    pass
 
         else: # Processes
             os.chdir(highlighted_source.rpartition('/')[0])
-            # The filepath in this case is actually the program to run
-            # so we will make the substitution to make it clearer
             program = filepath            
-            # Call the function for the row that was double clicked
-            # Need to figure out if the program to run will produce files
-            # and whether or not it is currently running (GUI only)
-
             # Netlists
             if program in self.netlists: # use gnetlist
                 subproc = Popen(['gnetlist', '-v','-g',program,highlighted_source])
@@ -675,18 +652,45 @@ class Utils:
                 # Call new class logic to go through the workflow
                 self.gsch2pcb = Gsch2pcb(g, highlighted_source)
                 pass
-            elif progarm == 'gsch2pcb':
-                pass
-##                 schematics = []
-                
-##                 subproc = Popen(['gsch2pcb', '-v','-v','-o',name,schematics]).wait()
-##                 files_after = os.listdir(self.directory)
-##                 files = []
-##                 for f in files_after:
-##                     if f not in files_before:
-##                         files.append(f)
-                
+            elif program == 'Update PCB (gsch2pcb)':
+                # Only run if the highlighted_souce is outdated
+                filename = self.get_filename_from_filepath(highlighted_source)
+                if not g.project.dependency_dict[filename][0]:
+                    print 'We are in'
+                    files_before = os.listdir(highlighted_source.rpartition('/')[0])
+                    schematics_list = [x for x in g.project.dependency_dict[filename][1:] if x.endswith('.sch')]
+                    schematics = ''
+                    for sch in schematics_list:
+                            schematics += row[1] + ' '
+                    
+                    name = filename.split('.')[0]
+                    subproc = Popen(['gsch2pcb', '-v','-v','-o',name,schematics]).wait()
+                    files_after = os.listdir(highlighted_source.rpartition('/')[0])
+                    files = [x for x in files_after if x not in files_before]
+                    print 'files:',files
+                    print 'files_before:',files_before
+                    print 'files_after:',files_after
+                    # Add any new files to the sources tree view
+                    icon = gtk.IconTheme()
+                    selection = g.sources_tree.get_selection()
+                    model, selection_iter = selection.get_selected()
+                    parent_iter = g.sources.iter_parent(selection_iter)
+                    wanted = ['pcb','new.pcb','net']
+                    new_files = []
+                    new_files.append(True)
+                    for f in files:
+                        if f.endswith('new.pcb'):
+                            ext = 'new.pcb'
+                        else:
+                            ext = f.split('.')[-1]
+                        if ext in wanted:
+                            image = icon.load_icon(g.utils.icon_lut[ext], 22, 0)
+                            g.sources.append(parent_iter, [image, f, directory + '/' + f])
+                            # Need to see if there are any new files
+                            new_files.append(f)
+                    print 'new_files:',new_files
             else:
+                print 'program: (process no name)',program
                 subproc = Popen([program, highlighted_source])                
                 
 
@@ -702,6 +706,7 @@ class Utils:
             # recure over files and make out of date
             self.update_dependency_dict(gedamanager, x, False)
         
+
     def add_to_dependency_dict(self, gedamanager, filename):
         """!
         Method to add a file to the project's dependency_dict.




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