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

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



The branch, master has been updated
       via  3e8c1cb93be292c2a886762289e67fc2c152ff51 (commit)
      from  0f67788ff1ac8594de7dd3d44a79ade85ec39a39 (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/dependencyloop.py         |    7 +-
 src/gedamanager.py            |  522 +++++++++++++++++++----------------------
 src/gsch2pcb.py               |   13 +-
 src/processdependencyevent.py |   54 ++---
 src/utils.py                  |  359 ++++++++++++----------------
 5 files changed, 426 insertions(+), 529 deletions(-)


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

commit 3e8c1cb93be292c2a886762289e67fc2c152ff51
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxxx>
Date:   Wed Dec 3 14:51:17 2008 -0800

    Fixed segmentation fault problems.  Cleaned up code.  Created a "not
    implemented yet" message for the user for parts of the program under
    construction.

:100644 100644 d41641b... f087d0f... M	src/dependencyloop.py
:100644 100644 cc6a8ca... 429c6e0... M	src/gedamanager.py
:100644 100644 371ec5e... efc253a... M	src/gsch2pcb.py
:100644 100644 c52c120... 75eae43... M	src/processdependencyevent.py
:100644 100644 43e482e... d8f5e72... M	src/utils.py

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

commit 3e8c1cb93be292c2a886762289e67fc2c152ff51
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxxx>
Date:   Wed Dec 3 14:51:17 2008 -0800

    Fixed segmentation fault problems.  Cleaned up code.  Created a "not
    implemented yet" message for the user for parts of the program under
    construction.

diff --git a/src/dependencyloop.py b/src/dependencyloop.py
index d41641b..f087d0f 100644
--- a/src/dependencyloop.py
+++ b/src/dependencyloop.py
@@ -38,7 +38,7 @@ class DependencyLoop:
         """!
         Constructor for the DependencyLoop class.
         This class is component of the gEDAManager class ('has-a' relationship).
-        @param gedamanager current gEDAManager instance.
+        @param gedamanager current gEDAManager instance
         """
         # Things to do: (we can get all the info from the gedamanager object
         # Start the thread with the project's directory
@@ -50,17 +50,16 @@ class DependencyLoop:
         self.threaded_notifier.start()
         # start watching the project's directory recursively
         self.wdd = None
-        mask = IN_CREATE | IN_DELETE | IN_MOVED_FROM#IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVED_FROM
+        mask = IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVED_FROM
         if self.g.project.directory != None:
             self.wdd = self.watch_manager.add_watch(self.g.project.directory, mask, rec=True)
 
-        
+
     def switch_projects(self):
         """
         Method to switch which directory is being watched for events.
         This method will be called when projects are changed, etc.
         """
-        print 'SWITCHING PROJECTS'
         # Takes care of subdirectories
         if self.wdd != None:
             self.watch_manager.rm_watch(self.wdd.values()) 
diff --git a/src/gedamanager.py b/src/gedamanager.py
index cc6a8ca..429c6e0 100644
--- a/src/gedamanager.py
+++ b/src/gedamanager.py
@@ -23,7 +23,7 @@
 #Top-level window for the gEDA Manager
 #@author Newell Jensen
 
-import os, sys, gtk, pygtk, yaml, gnomevfs
+import os, sys, gtk, pygtk, yaml, gnomevfs, time
 import gobject, shutil, vte, logging, subprocess
 pygtk.require('2.0')
 from lib.decorators import exceptions
@@ -32,7 +32,9 @@ from settings import *
 from utils import *
 from newproject import *
 from dependencyloop import *
+from threading import Thread
 
+gtk.gdk.threads_init()
 
 class gEDAManager:
     """
@@ -56,10 +58,7 @@ class gEDAManager:
         self.project.connect('saved', self.cb_project_saved)
         self.project.connect('opened', self.cb_project_opened)
         self.project.connect('created', self.cb_project_created)
-        gtk.gdk.threads_init()
-        gtk.gdk.threads_enter()
         self.dependencyloop = DependencyLoop(self)
-        gtk.gdk.threads_leave()
         # Create top-level window
         self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
         self.window.connect('destroy', self.cb_destroy)
@@ -489,7 +488,6 @@ class gEDAManager:
         if self.sources != None:
             # Clear out the sources first
             self.sources.clear()
-            print 'sources cleared'
             # Start adding data to the Model
             if os.path.exists(self.project.directory):
                 os.chdir(self.project.directory)
@@ -505,10 +503,11 @@ class gEDAManager:
                     folder = root.split('/')[-1]
                     try:
                         node = self.sources.append(dictionary[root], [image, folder, root])
+#                        node = self.sources.append(None, [image, folder, root])
                     except KeyError:
                         node = self.sources.append(None, [image, folder, root])
                     for f in [name for dec,name in sorted((os.path.splitext(f)[1][1:],f) for f in files)]: # List expression sorts by file extension
-                        if not f.endswith(('~','-')):
+                        if not f.endswith(('~','-','#')):
                             image = icon.load_icon(self.utils.load_image(f), 22, 0)
                             self.sources.append(node, [image, f, os.path.join(root, f)])
                     for d in dirs:
@@ -516,44 +515,6 @@ class gEDAManager:
 
                 self.sources_tree.expand_all()
 
-        
-##     def load_sources_tree(self, file_list, parent=None, parent_path=None):
-##         """!
-##         Method to the load the tree -- recursively.
-##         @param file_list list of paths in the project's file_list
-##         @param parent node to help setup the gtk.TreeView object
-##         @param parent_path parameter to help in writing the paths
-##         to the self.sources gtk.TreeStore object
-##         """
-##         # parent == None is for the 'Project' node
-##         icon = gtk.IconTheme() # The icon used throughout the function
-##         if parent == None:
-##             image = icon.load_icon(self.utils.icon_lut['project'], 22, 0)
-##             n_parent = self.sources.append(None, [image, file_list[0], self.project.directory])
-##             parent = n_parent # parent used below
-##             file_list = file_list[1] # Now pointing to the nested list
-
-##         # In the file_list we have folders, nodes --> lists to recurse over
-##         for index, f in enumerate(file_list):
-##             if (index + 1) < len(file_list): # Check for folder
-##                 if isinstance(file_list[index+1], list):
-##                     if parent_path != None:
-##                         file_path = parent_path + '/' + f
-##                     else:
-##                         file_path = self.project.directory + '/' + f
-##                     image = icon.load_icon(self.utils.icon_lut['folder'], 22, 0)
-##                     n_parent = self.sources.append(parent, [image, f, file_path])
-##                     continue # jump to next iterator
-##             if isinstance(f, list): # Check for lists and use recursion
-##                 self.load_sources_tree(f, n_parent, file_path)
-##             else: # We have a node
-##                 if parent_path != None:
-##                     file_path = parent_path + '/' + f
-##                 else:
-##                     file_path = self.project.directory + '/' + f
-##                 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])
-
 
     def load_dependencies_tree(self, dep_dict, parent=None, parent_path=None, number=None):
         """!
@@ -589,7 +550,7 @@ class gEDAManager:
         else:
             self.settings.project = None
         self.settings.create_config_file()
-        gtk.main_quit()
+
 
 
     def get_processes_selected_node(self):
@@ -599,7 +560,7 @@ class gEDAManager:
         """
         selection = self.processes_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        if (selection_iter):
+        if isinstance(selection_iter, gtk.TreeIter):                
             return self.processes.get_value(selection_iter, 2)
         else:
             return None
@@ -612,6 +573,8 @@ class gEDAManager:
         @param dialog gtk.FileChooserDialog object
         """
         # These are subject to change depending on users input
+        # TODO -- see if we need these at all
+        # also see if we can add multiple filters per name e.g. .vhd and .vhdl
         file_filter = gtk.FileFilter()
         file_filter.set_name("All files")
         file_filter.add_pattern('*')
@@ -798,32 +761,6 @@ class gEDAManager:
         self.project.close()
 
 
-    def cb_exit(self, menuitem, data=None):
-        """!
-        Event handler for 'Exit'.
-        @param menuitem menuitem that threw the event
-        @param data optional user data to pass in
-        """
-        self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nExiting gEDA Manager.\n')
-        self.write_logs()        
-        self.project.save()
-        self.save_settings()
-        self.kill_processes()
-        self.dependencyloop.kill_thread()        
-
-
-    def cb_vte(self):
-        """
-        Event handler for when the embedded terminal is exited.
-        """
-        self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nExiting gEDA Manager.\n')
-        self.write_logs()
-        self.project.save()
-        self.save_settings()
-        self.kill_processes()
-        self.dependencyloop.kill_thread()
-        
-
     def cb_project_closed(self, widget, event):
         """!
         Event occurs when a Project object is closed
@@ -882,8 +819,8 @@ class gEDAManager:
         def new_source_cursor_changed(newsources_tree):
             selection = newsources_tree.get_selection()
             model, selection_iter = selection.get_selected()
-            self.newsource = model.get_value(selection_iter, 1)
-
+            if isinstance(selection_iter, gtk.TreeIter):                
+                self.newsource = model.get_value(selection_iter, 1)
 
         if self.settings.editor != None:
             old_editor = self.settings.editor
@@ -1016,17 +953,18 @@ class gEDAManager:
             # Get the selected_node for the folder to add to            
             selection = self.sources_tree.get_selection()
             model, selection_iter = selection.get_selected()
-            selected_node = self.sources.get_value(selection_iter, 2)
-            # Get the type of extension for the program to call
-            if '.' in new_text: # user may have overriden extension
-                return
-            else: # Need to find out what extension from the highlighted node
-                ext = self.newsource[self.newsource.find('.')+1:self.newsource.find(')')]
-            # Make sure a file with the same name doesn't already exist
-            filepath = selected_node + '/' + new_text + '.' + ext
-            filename = new_text + '.' + ext
-            self.utils.update_file_list(self, 3, filepath)
-            self.utils.run_command(self, filepath, None, ext)
+            if isinstance(selection_iter, gtk.TreeIter):
+                selected_node = self.sources.get_value(selection_iter, 2)
+                # Get the type of extension for the program to call
+                if '.' in new_text: # user may have overriden extension
+                    return
+                else: # Need to find out what extension from the highlighted node
+                    ext = self.newsource[self.newsource.find('.')+1:self.newsource.find(')')]
+                # Make sure a file with the same name doesn't already exist
+                filepath = selected_node + '/' + new_text + '.' + ext
+                filename = new_text + '.' + ext
+                self.utils.update_file_list(self, 3, filepath)
+                self.utils.run_command(self, filepath, None, ext)
         else:
             dialog = gtk.MessageDialog(self.window,
                                        (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
@@ -1072,60 +1010,63 @@ class gEDAManager:
 
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        selected_node = self.sources.get_value(selection_iter, 2)
-        if '.' in selected_node:
-            # This is not a folder
-            # YES, this is a hack and was put in place because
-            # we get some problems if the use right clicks on a node before
-            # it becomes highlighted.
-            return
-        os.chdir(selected_node)
-        dialog = gtk.MessageDialog(self.window,
-                                   (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
-                                   gtk.MESSAGE_QUESTION,
-                                   gtk.BUTTONS_OK_CANCEL,
-                                   gtk.STOCK_DIRECTORY)
-        dialog.set_markup('<b>Please enter new folder name:</b>\nIf the folder name you choose exists\non disk in this directory it will deleted.')
-        entry = gtk.Entry()
-        entry.show()
-        entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
-        hbox = gtk.HBox()
-        hbox.show()
-        hbox.pack_end(entry)
-        dialog.vbox.pack_end(hbox, True, True, 0)
-        dialog.show()
-        response = dialog.run()
-        text = entry.get_text()        
-        if response == gtk.RESPONSE_OK and text.strip() != '':
-            filepath = selected_node + '/' + text
-
-            def delete_dependency_dict_entry(arg, dirname, filenames):
-                """ function to delete the filenames from the dependency_dict """
-                for f in filenames:
-                    if f in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(f) == 1:
-                        del self.project.dependency_dict[f]
-
-            # See if this directory already exists
-            if os.path.exists(filepath): # delete directory recursively
-                os.path.walk(filepath, delete_dependency_dict_entry, None)
-                shutil.rmtree(filepath)
-                flag = True
-                i = 0
-                while flag:
-                    child_iter = self.sources.iter_nth_child(selection_iter, i)
-                    if child_iter != None:
-                        child_node = self.sources.get_value(child_iter, 2)
-                        if child_node == filepath:
-                                flag = self.sources.remove(child_iter)
-                                if flag: # break out if flag is true
-                                    flag = False
-                    else:
-                        break
-                    i = i + 1
-            os.mkdir(filepath)
-        dialog.destroy()
+        if isinstance(selection_iter, gtk.TreeIter):
+            selected_node = self.sources.get_value(selection_iter, 2)
+            if '.' in selected_node:
+                # This is not a folder
+                # YES, this is a hack and was put in place because
+                # we get some problems if the use right clicks on a node before
+                # it becomes highlighted.
+                return
+            os.chdir(selected_node)
+            dialog = gtk.MessageDialog(self.window,
+                                       (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
+                                       gtk.MESSAGE_QUESTION,
+                                       gtk.BUTTONS_OK_CANCEL,
+                                       gtk.STOCK_DIRECTORY)
+            dialog.set_markup('<b>Please enter new folder name:</b>\nIf the folder name you choose exists\non disk in this directory it will deleted.')
+            entry = gtk.Entry()
+            entry.show()
+            entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
+            hbox = gtk.HBox()
+            hbox.show()
+            hbox.pack_end(entry)
+            dialog.vbox.pack_end(hbox, True, True, 0)
+            dialog.show()
+            response = dialog.run()
+            text = entry.get_text()        
+            if response == gtk.RESPONSE_OK and text.strip() != '':
+                filepath = selected_node + '/' + text
+
+                def delete_dependency_dict_entry(arg, dirname, filenames):
+                    """ function to delete the filenames from the dependency_dict """
+                    for f in filenames:
+                        if f in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(f) == 1:
+                            del self.project.dependency_dict[f]
+
+                # See if this directory already exists
+                if os.path.exists(filepath): # delete directory recursively
+                    os.path.walk(filepath, delete_dependency_dict_entry, None)
+                    shutil.rmtree(filepath)
+                    flag = True
+                    i = 0
+                    while flag:
+                        child_iter = self.sources.iter_nth_child(selection_iter, i)
+                        if child_iter != None:
+                            child_node = self.sources.get_value(child_iter, 2)
+                            if child_node == filepath:
+                                    flag = self.sources.remove(child_iter)
+                                    if flag: # break out if flag is true
+                                        flag = False
+                        else:
+                            break
+                        i = i + 1
+                os.mkdir(filepath)
+#                self.load_sources_tree()
+            dialog.destroy()
 
 
+    @exceptions
     def cb_delete(self, menuitem, data=None):
         """!
         Event handler for 'Delete'.
@@ -1137,19 +1078,19 @@ class gEDAManager:
         # Just delete the file from the directory structure
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        selected_node = self.sources.get_value(selection_iter, 2)
-
-        print 'cb_delete'
-        os.system('rm ' + selected_node)
-        # Don't know if I need to have this
-        #self.sources.remove(selection_iter)
-        self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nDeleted ' + selected_node + '.\n')
-        node = self.utils.get_filename_from_filepath(selected_node)
-        # Commented out till I know what I am doing with the dependencies
-        ## if node in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(node) == 1:
-        ##     del self.project.dependency_dict[node]
+        print 'selection_iter:',selection_iter        
+        if isinstance(selection_iter, gtk.TreeIter):
+            selected_node = self.sources.get_value(selection_iter, 2)
+            os.system('rm ' + selected_node)
+            self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nDeleted ' + selected_node + '.\n')
+            # TODO
+            # Commented out till I know what I am doing with the dependencies
+            ## node = self.utils.get_filename_from_filepath(selected_node)
+            ## if node in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(node) == 1:
+            ##     del self.project.dependency_dict[node]
         
 
+    @exceptions
     def cb_delete_folder(self, widget):
         """!
         Event occurs when the user chooses to delete a folder from the project.
@@ -1160,21 +1101,21 @@ class gEDAManager:
         # this or not.
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        selected_node = self.sources.get_value(selection_iter, 2)
-
-        exists = os.path.exists(selected_node)
-        if exists: # delete directory recursively
-            # TODO
-            # The commented out section here is for the dependency tree
-            # Until I get other things working better I will have this commented
-            # out
-            ## for f in os.listdir(selected_node):
-            ##     if f in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(f) == 1:
-            ##         del self.project.dependency_dict[f]
-            os.system('rm -rf ' + selected_node)
-            # Don't think I need the below since pyinotify
-            #self.sources.remove(selection_iter)
-            self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nDeleted ' + selected_node + '.\n')
+        print 'selection_iter:',selection_iter
+        if isinstance(selection_iter, gtk.TreeIter):        
+            selected_node = self.sources.get_value(selection_iter, 2)
+            exists = os.path.exists(selected_node)
+            if exists: # delete directory recursively
+                # TODO
+                # The commented out section here is for the dependency tree
+                # Until I get other things working better I will have this commented
+                # out
+                ## for f in os.listdir(selected_node):
+                ##     if f in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(f) == 1:
+                ##         del self.project.dependency_dict[f]
+                os.system('rm -rf ' + selected_node)
+                self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nDeleted ' + selected_node + '.\n')
+#                self.load_sources_tree()
 
 
     @exceptions
@@ -1185,9 +1126,11 @@ class gEDAManager:
         """
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        selected_node = self.sources.get_value(selection_iter, 2)
-        # Run the command as if the file is a text file
-        self.utils.run_command(self, selected_node, None, 'txt')
+        print 'selection_iter:',selection_iter        
+        if isinstance(selection_iter, gtk.TreeIter):                
+            selected_node = self.sources.get_value(selection_iter, 2)
+            # Run the command as if the file is a text file
+            self.utils.run_command(self, selected_node, None, 'txt')
 
 
     @exceptions
@@ -1201,54 +1144,56 @@ class gEDAManager:
 
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        old_path = self.sources.get_value(selection_iter, 2)
-        path = self.sources.get_path(selection_iter)
-
-        dialog = gtk.MessageDialog(self.window,
-                                   (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
-                                   gtk.MESSAGE_QUESTION,
-                                   gtk.BUTTONS_OK_CANCEL,
-                                   gtk.STOCK_DIRECTORY)
-        dialog.set_markup('<b>Please enter the new folder name:\n</b>')
-        entry = gtk.Entry()
-        entry.show()
-        entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
-        hbox = gtk.HBox()
-        hbox.show()
-        hbox.pack_end(entry)
-        dialog.vbox.pack_end(hbox, True, True, 0)
-        dialog.show()
-        dialog.run()
-        new_text = entry.get_text()
-        dialog.destroy()
-        new_path = old_path.rpartition('/')[0] + '/' + new_text
+        print 'selection_iter:',selection_iter        
+        if isinstance(selection_iter, gtk.TreeIter):                
+            old_path = self.sources.get_value(selection_iter, 2)
+            path = self.sources.get_path(selection_iter)
 
-        if '.' not in new_text:
-            ## We are going to handle the project folder in cb_rename_folder
-            if old_path == self.project.directory:
-                # Project Folder
-                os.rename(old_path, new_path)
-                model[path][1] = new_text
-                model[path][2] = new_path
-                project_file = new_path + '/' + self.project.name + '.gm'
-                os.remove(project_file)
-                self.project.directory = new_path
-                self.project.name = new_text
-                self.project.file_list[0] = new_text
-                self.project.file_list[1][0] = new_text + '.gm'
-                self.project.save()
-
-                model[(0)][1] = new_text
-                model[(0)][2] = new_path + '/' + new_text
-                model[(0,0)][1] = new_text + '.gm'
-                model[(0,0)][2] = new_path + '/' + new_text + '.gm'
-                self.output_textbuffer.insert(self.output_textiter, 'Project changed from ' + old_path + ' to ' + new_path + '.\n')
-            else:
-                # Regular folder
-                if os.path.exists(new_path):
-                    self.output_textbuffer.insert(self.output_textiter, 'Folder already exists with this name.  Cannot rename.\n')
-                    return
-                os.rename(old_path, new_path)
+            dialog = gtk.MessageDialog(self.window,
+                                       (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
+                                       gtk.MESSAGE_QUESTION,
+                                       gtk.BUTTONS_OK_CANCEL,
+                                       gtk.STOCK_DIRECTORY)
+            dialog.set_markup('<b>Please enter the new folder name:\n</b>')
+            entry = gtk.Entry()
+            entry.show()
+            entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
+            hbox = gtk.HBox()
+            hbox.show()
+            hbox.pack_end(entry)
+            dialog.vbox.pack_end(hbox, True, True, 0)
+            dialog.show()
+            dialog.run()
+            new_text = entry.get_text()
+            dialog.destroy()
+            new_path = old_path.rpartition('/')[0] + '/' + new_text
+
+            if '.' not in new_text:
+                ## We are going to handle the project folder in cb_rename_folder
+                if old_path == self.project.directory:
+                    # Project Folder
+                    os.rename(old_path, new_path)
+                    model[path][1] = new_text
+                    model[path][2] = new_path
+                    project_file = new_path + '/' + self.project.name + '.gm'
+                    os.remove(project_file)
+                    self.project.directory = new_path
+                    self.project.name = new_text
+                    self.project.file_list[0] = new_text
+                    self.project.file_list[1][0] = new_text + '.gm'
+                    self.project.save()
+
+                    model[(0)][1] = new_text
+                    model[(0)][2] = new_path + '/' + new_text
+                    model[(0,0)][1] = new_text + '.gm'
+                    model[(0,0)][2] = new_path + '/' + new_text + '.gm'
+                    self.output_textbuffer.insert(self.output_textiter, 'Project changed from ' + old_path + ' to ' + new_path + '.\n')
+                else:
+                    # Regular folder
+                    if os.path.exists(new_path):
+                        self.output_textbuffer.insert(self.output_textiter, 'Folder already exists with this name.  Cannot rename.\n')
+                        return
+                    os.rename(old_path, new_path)
 
 
     @exceptions
@@ -1262,76 +1207,53 @@ class gEDAManager:
 
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        old_path = self.sources.get_value(selection_iter, 2)
-        path = self.sources.get_path(selection_iter)
-
-        dialog = gtk.MessageDialog(self.window,
-                                   (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
-                                   gtk.MESSAGE_QUESTION,
-                                   gtk.BUTTONS_OK_CANCEL,
-                                   gtk.STOCK_DIRECTORY)
-        dialog.set_markup('<b>Please enter the new name\n(including extension if changing):</b>')
-        entry = gtk.Entry()
-        entry.show()
-        entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
-        hbox = gtk.HBox()
-        hbox.show()
-        hbox.pack_end(entry)
-        dialog.vbox.pack_end(hbox, True, True, 0)
-        dialog.show()
-        dialog.run()
-        new_text = entry.get_text()
-        dialog.destroy()
-        new_path = old_path.rpartition('/')[0] + '/' + new_text
-
-        ## We are going to handle the project folder in cb_rename_folder
-##         if old_path == self.project.directory and '.' not in new_text: 
-##             # Project Folder
-##             os.rename(old_path, new_path)
-##             model[path][1] = new_text
-##             model[path][2] = new_path
-##             project_file = new_path + '/' + self.project.name + '.gm'
-##             os.remove(project_file)
-##             self.project.directory = new_path
-##             self.project.name = new_text
-##             self.project.file_list[0] = new_text
-##             self.project.file_list[1][0] = new_text + '.gm'
-##             self.project.save()
-
-##             model[(0)][1] = new_text
-##             model[(0)][2] = new_path + '/' + new_text
-##             model[(0,0)][1] = new_text + '.gm'
-##             model[(0,0)][2] = new_path + '/' + new_text + '.gm'
-##             self.output_textbuffer.insert(self.output_textiter, 'Project changed from ' + old_path + ' to ' + new_path + '.\n')                        
-
-        if '.' in new_text and '.' in old_path:
-            # File
-            os.rename(old_path, new_path)
-            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)
-            self.output_textbuffer.insert(self.output_textiter, 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
-
-##         elif '.' not in new_text and '.' in old_path: # File being changed
-##             pass # don't allow it to change names
+        print 'selection_iter:',selection_iter        
+        if isinstance(selection_iter, gtk.TreeIter):                
+            old_path = self.sources.get_value(selection_iter, 2)
+            path = self.sources.get_path(selection_iter)
 
-        else:
-            # Folder -- so image does not need to be changed
-            if os.path.exists(new_path):
-                self.output_textbuffer.insert(self.output_textiter, 'Folder already exists with this name.  Cannot rename.\n')
-                return
-            os.rename(old_path, new_path)
-            model[path][1] = new_text
-            model[path][2] = new_path
-            self.output_textbuffer.insert(self.output_textiter, old_path + ' changed to ' + new_path + '.\n')            
+            dialog = gtk.MessageDialog(self.window,
+                                       (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
+                                       gtk.MESSAGE_QUESTION,
+                                       gtk.BUTTONS_OK_CANCEL,
+                                       gtk.STOCK_DIRECTORY)
+            dialog.set_markup('<b>Please enter the new name\n(including extension if applicable):</b>')
+            entry = gtk.Entry()
+            entry.show()
+            entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
+            hbox = gtk.HBox()
+            hbox.show()
+            hbox.pack_end(entry)
+            dialog.vbox.pack_end(hbox, True, True, 0)
+            dialog.show()
+            dialog.run()
+            new_text = entry.get_text()
+            dialog.destroy()
+            new_path = old_path.rpartition('/')[0] + '/' + new_text
 
-        #self.utils.update_file_list(self) # update file list
+            print 'new_text:',new_text
+            print 'old_path:',old_path
+            if '.' in new_text and '.' in old_path:
+                # File
+                os.rename(old_path, new_path)
+                ## 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)
+                self.output_textbuffer.insert(self.output_textiter, old_path + ' changed to ' + new_path + '.\n')
+            elif not '.' in new_text and not '.' in old_path:
+                # Folder -- so image does not need to be changed
+                print 'folder rename'
+                if os.path.exists(new_path):
+                    self.output_textbuffer.insert(self.output_textiter, 'Folder already exists with this name.  Cannot rename.\n')
+                    return
+                os.rename(old_path, new_path)
+                ## model[path][1] = new_text
+                ## model[path][2] = new_path
+                self.output_textbuffer.insert(self.output_textiter, old_path + ' changed to ' + new_path + '.\n')            
 
 
+    @exceptions
     def cb_cursor_changed(self, widget):
         """!
         Event occurs when the cursor changes in the treeview.
@@ -1339,7 +1261,7 @@ class gEDAManager:
         """
         selection = self.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        if selection_iter != None:
+        if isinstance(selection_iter, gtk.TreeIter):                
             selected_node = self.sources.get_value(selection_iter, 2)
             filename = self.utils.get_filename_from_filepath(selected_node)
             if '.' in filename and not filename.endswith(('.gm','.log')):
@@ -1362,6 +1284,7 @@ class gEDAManager:
                 self.processes.clear()
 
 
+    @exceptions
     def cb_row_changed(self, model, path, _iter):
         """!
         Event occurs when the columns change in the dependencies treeview.
@@ -1381,6 +1304,7 @@ class gEDAManager:
         # Need to update the dependency_dict -- put here
 
 
+    @exceptions
     def cb_switch_page(self, notebook, page, page_num):
         if page_num == 1: # Dependencies notebook tab
             selection = self.sources_tree.get_selection()
@@ -1388,6 +1312,7 @@ class gEDAManager:
             self.processes.clear()
             
 
+    @exceptions
     def cb_popup_deactivate(self, popup_menu, merge_id):
         """!
         Event occurs when the 'deactivate' signal is thrown from
@@ -1410,7 +1335,7 @@ class gEDAManager:
         if event.button == 3:
             selection = self.sources_tree.get_selection()
             model, selection_iter = selection.get_selected()
-            if selection_iter != None:
+            if isinstance(selection_iter, gtk.TreeIter):                
                 selected_node = self.sources.get_value(selection_iter, 2)
             else:
                 return
@@ -1440,7 +1365,7 @@ class gEDAManager:
                 popup_menu = self.popup_uimanager.get_widget('/popup')
             else:
                 # File
-                if selected_node.endswith(('.gm','.log')):
+                if selected_node.endswith('.gm'):
                     return
                 merge_id = self.popup_uimanager.add_ui_from_file(self.utils.directory + '/file_popup.xml')
                 popup_menu = self.popup_uimanager.get_widget('/popup')
@@ -1450,18 +1375,47 @@ class gEDAManager:
             popup_menu.popup(None, None, None, event.button, event.time)
 
 
+    ## TODO -- combine the next three callbacks in some fashion
+    def cb_exit(self, menuitem, data=None):
+        """!
+        Event handler for 'Exit'.
+        @param menuitem menuitem that threw the event
+        @param data optional user data to pass in
+        """
+        self.dependencyloop.kill_thread()                
+        self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nExiting gEDA Manager.\n')
+        self.write_logs()        
+        self.project.save()
+        self.save_settings()
+        self.kill_processes()
+        gtk.main_quit()
+
+
+    def cb_vte(self):
+        """
+        Event handler for when the embedded terminal is exited.
+        """
+        self.dependencyloop.kill_thread()
+        self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nExiting gEDA Manager.\n')
+        self.write_logs()
+        self.project.save()
+        self.save_settings()
+        self.kill_processes()
+        gtk.main_quit()        
+
+
     def cb_destroy(self, event):
         """!
         Event handlder when the form is closed in any fashion.
         @param event event that was thrown
         """
+        self.dependencyloop.kill_thread()        
         self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nExiting gEDA Manager.\n')
         self.write_logs()        
         self.project.save()
         self.save_settings()
         self.kill_processes()
-        self.dependencyloop.kill_thread()
-
+        gtk.main_quit()
 
     ########################################################
 
diff --git a/src/gsch2pcb.py b/src/gsch2pcb.py
index 371ec5e..efc253a 100644
--- a/src/gsch2pcb.py
+++ b/src/gsch2pcb.py
@@ -24,7 +24,8 @@
 import os, pygtk, gtk
 pygtk.require('2.0')
 from lib.decorators import exceptions
-from subprocess import Popen
+from subprocess import Popen, PIPE
+
 
 class Gsch2pcb:
     """
@@ -32,12 +33,12 @@ class Gsch2pcb:
     This class allows the user to select multiple schematics
     to be used in the gsch2pcb workflow to produce a PCB file.
     """
-    #@exceptions
     def __init__(self, gedamanager, filepath):
         """!
         Gsch2pcb Constructor.
+        @param gedamanagercurrent gEDAManager instance
         @param filepath filepath of file to be automatically included
-        in the checklist of schematics.
+        in the checklist of schematics
         """
         self.g = gedamanager            
         def response_to_dialog_directory(entry, dialog, response):
@@ -160,7 +161,11 @@ class Gsch2pcb:
             else:
                 os.chdir(self.directory)
                 files_before = os.listdir(self.directory)
-                subproc = Popen(['gsch2pcb', '-v','-v','-o',name,schematics]).wait()
+                subproc = Popen(['gsch2pcb', '-v','-v','-o',name,schematics], stdout=PIPE).wait()
+                ## print 'subproc:',subproc                
+                ## print 'subproc.communicate()[0]:',subproc.communicate()[0]
+                ## self.g.output_textbuffer.insert(self.g.output_textiter, self.g.utils.get_time() + ' and output from gsch2pcb:\n' + subproc.communicate()[0] + '.\n')
+                
                 print 'self.directory:',self.directory
                 print 'pwd:',os.getcwd()
                 files_after = os.listdir(self.directory)
diff --git a/src/processdependencyevent.py b/src/processdependencyevent.py
index c52c120..75eae43 100644
--- a/src/processdependencyevent.py
+++ b/src/processdependencyevent.py
@@ -31,7 +31,6 @@ class ProcessDependencyEvent(ProcessEvent):
     """
     Class to process the events from the thread executed by DependencyLoop.
     """
-    # I need to be able to pass the gedamanager into this class somehow
     def __init__(self, gedamanager):
         """!
         Constructor for the ProcessDependencyEvent class.
@@ -39,59 +38,58 @@ class ProcessDependencyEvent(ProcessEvent):
         """
         self.g = gedamanager
 
+    def cb_main_thread(self, event):
+        """!
+        Method to call the 'gtk' modifying code in the main thread.
+        @param event current event that was caught for the section of
+        filesystem under watch
+        """
+        filename = self.g.utils.get_filename_from_filepath(event.pathname)
+        gtk.gdk.threads_enter()
+        self.g.load_sources_tree()
+        self.g.dependencyloop.switch_projects()
+        gtk.gdk.threads_leave()
+
 
-    ## def process_IN_MODIFY(self, event):
-    ##     """!
-    ##     Method to process the IN_MODIFY event from the pyinotify module
-    ##     @param event current IN_MODIFY event that was caught for the section of
-    ##     filesystem under watch
-    ##     """
-    ##     print 'processing in modify'
-    ##     filename = self.g.utils.get_filename_from_filepath(event.pathname)
-    ##     self.g.load_sources_tree()
-    ##     if filename != None and self.g.project.dependency_dict != None:
-    ##         if filename in self.g.project.dependency_dict:
-    ##             print 'filename in process catcher:',filename
-    ##             self.g.utils.update_dependency_dict(self.g, filename, True)
-    ##             self.g.utils.update_file_list(self.g)
+    def process_IN_MODIFY(self, event):
+        """!
+        Method to process the IN_MODIFY event from the pyinotify module.
+        @param event current IN_MODIFY event that was caught for the section of
+        filesystem under watch
+        """
+        print 'processing in modify'
+        self.cb_main_thread(event)
 
 
     def process_IN_DELETE(self, event):
         """!
-        Method to process the IN_DELETE event from the pyinotify module
+        Method to process the IN_DELETE event from the pyinotify module.
         @param event current IN_DELETE event that was caught for the section of
         filesystem under watch
         """
         print 'processing delete'
-        filename = self.g.utils.get_filename_from_filepath(event.pathname)
-        self.g.load_sources_tree()
-        #self.g.dependencyloop.switch_projects()
+        self.cb_main_thread(event)        
 
 
     def process_IN_CREATE(self, event):
         """!
-        Method to process the IN_CREATE event from the pyinotify module
+        Method to process the IN_CREATE event from the pyinotify module.
         @param event current IN_CREATE event that was caught for the section of
         filesystem under watch
         """
         print 'processing create'
-        filename = self.g.utils.get_filename_from_filepath(event.pathname)
-        self.g.load_sources_tree()
-        #self.g.dependencyloop.switch_projects()
+        self.cb_main_thread(event)        
 
 
     def process_IN_MOVED_FROM(self, event):
         """!
-        Method to process the IN_MOVED_FROM event from the pyinotify module
+        Method to process the IN_MOVED_FROM event from the pyinotify module.
         @param event current IN_MOVED_FROM event that was caught for the
         section of filesystem under watch
         """
         print 'processing move from'
-        filename = self.g.utils.get_filename_from_filepath(event.pathname)
-        self.g.load_sources_tree()
-        #self.g.dependencyloop.switch_projects()
+        self.cb_main_thread(event)        
 
-        
 
 
 
diff --git a/src/utils.py b/src/utils.py
index 43e482e..d8f5e72 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -37,15 +37,13 @@ class Utils:
     Utility class for the gEDA Manager.
     """
     def __init__(self):
-        """ Constructor. """
+        """!
+        Constructor of the Utils class.  Utils is a utility class for the
+        gEDAManager class.
+        @param gedamanager current gEDAManager instance
+        """
         self.directory = os.getcwd()
         self.__setup__()
-        ## # Set up the DBUS session bus
-        ## dbus_loop = DBusGMainLoop()
-        ## self.session_bus = dbus.SessionBus(mainloop=dbus_loop)
-        ## self.dbus_obj = self.session_bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
-        ## self.dbus_iface = dbus.Interface(self.dbus_obj, 'org.freedesktop.DBus')
-        ## self.empty_char_array = dbus.Array('', signature='s')
 
 
     def __setup__(self):
@@ -150,6 +148,22 @@ class Utils:
                          'fp': 'application-x-pcb-footprint'}
 
 
+    def cb_not_implemented(self, gedamanager):
+        """
+        Method to let the user know that the selected feature is not
+        implemented yet.
+        """
+        dialog = gtk.MessageDialog(gedamanager.window,
+                                   (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
+                                   gtk.MESSAGE_INFO,
+                                   gtk.BUTTONS_OK,
+                                   gtk.STOCK_DIRECTORY)
+        dialog.set_markup('<b>The selected feature is currently not implemented.\nUnder construction.</b>')
+        dialog.show()
+        response = dialog.run()
+        dialog.destroy()
+
+
     def get_time(self):
         """ Method returns a string of the current time. """
         return time.asctime(time.localtime(time.time()))
@@ -187,17 +201,16 @@ class Utils:
     def get_status_image(self, gedamanager, selected_node):
         """!
         Method to get the status image for the process.
-        @param gedamanager current gEDAManager instance
+        @param gedamanager current gEDAManager instance                
         @param selected_node currently selected node in the 'Sources' tree view.
         @return icon from the self.icon_lut structure
         """
-        g = gedamanager
         filename = self.get_filename_from_filepath(selected_node)
         icon = gtk.IconTheme()        
-        if filename in g.project.dependency_dict:
+        if filename in gedamanager.project.dependency_dict:
             # Check its status
-            if g.project.dependency_dict[filename] != None:
-                if g.project.dependency_dict[filename][0]:
+            if gedamanager.project.dependency_dict[filename] != None:
+                if gedamanager.project.dependency_dict[filename][0]:
                     return icon.load_icon(self.icon_lut['updated'], 22, 0)
                 else:
                     # If nothing found in the loop, then it is outdated
@@ -222,7 +235,7 @@ class Utils:
         """!
         Method to determine if the given filename is in the project's
         dependencies.
-        @param gedamanager current gEDAManager instance
+        @param gedamanager current gEDAManager instance                
         @param filename name of the file under investigation
         @return True or False
         """
@@ -279,18 +292,21 @@ class Utils:
         """!
         Method to update the gEDA Manager's project file list any time
         the 'Sources' tree view is changed.
-        @param gedamanager current gEDAManager instance
+        @param gedamanager current gEDAManager instance                
         @param index index -- (0 = add copy source, 1 = delete source,
         2 = delete folder, 3 = add a new source, 4 = remove source,
         5 = remove folder)
         @param filepath filepath of the source to copy
         """
-        g = gedamanager
-        selection = g.sources_tree.get_selection()
+        ## TODO -- rip this functionality out and put into the gedamanager class
+        ## or put that functionality in here.  Currently I have cb_delete_folder
+        ## etc in the gedamanager class
+        selection = gedamanager.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        if selection_iter == None:
-            selection_iter = g.sources.get_iter_first()
-        selected_node = g.sources.get_value(selection_iter, 2)
+        if isinstance(selection_iter, gtk.TreeIter):
+            selected_node = gedamanager.sources.get_value(selection_iter, 2)
+        else:
+            return
         if filepath != None:
             filename = self.get_filename_from_filepath(filepath) # Files
         else:
@@ -299,121 +315,59 @@ class Utils:
         image = icon.load_icon(self.load_image(filename), 22, 0)
         path = selected_node + '/' + filename
 
-
-#        print 'g.projec.file_list before:',g.project.file_list        
         if index == 0:
             # Logic here for copying the file to the selected_node's folder
             # First check that a file with the same name does not exist
             files = os.listdir(selected_node)
             if filename not in files:
                 os.system('cp ' + filepath + ' ' + selected_node)
-                # Don't think I need the below
-                #g.sources.append(selection_iter, [image, filename, path])
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\n' + 'Added copy of source:' + filepath + ' to ' + selected_node + '.\n')
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\n' + 'Added copy of source:' + filepath + ' to ' + selected_node + '.\n')
                 # Add to the dependency tree
-                if not self.is_filename_in_dependencies(g, filename):
-                    g.dependencies.append(None, [filename, path])
+                if not self.is_filename_in_dependencies(gedamanager, filename):
+                    self.dependencies.append(None, [filename, path])
                 # Add to the dependency_dict if not in there
-                if filename not in g.project.dependency_dict:
-                    g.project.dependency_dict[filename] = [True, [], []]
+                if filename not in self.project.dependency_dict:
+                    self.project.dependency_dict[filename] = [True, [], []]
             elif filepath == selected_node + '/' + filename:
-                # Don't think I need the below                
-                #g.sources.append(selection_iter, [image, filename, path])
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\n' + 'Added copy of source:' + filepath + ' to project.\n')
-                if filename not in g.project.dependency_dict:
-                    g.project.dependency_dict[filename] = [True, [], []]
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\n' + 'Added copy of source:' + filepath + ' to project.\n')
+                if filename not in self.project.dependency_dict:
+                    self.project.dependency_dict[filename] = [True, [], []]
             else:
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\n' + filename + ' is already present in the directory: ' + selected_node + '.\n')
-##         elif index == 1:
-##             # This is currently not implemented -- TODO delete this            
-##             # Logic here to delete the selected file
-##             f = os.path.exists(selected_node)
-##             if f:
-##                 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_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:
-##             # This is currently not implemented -- TODO delete this
-##             # Logic here to delete the folder
-##             exists = os.path.exists(selected_node)
-##             if exists: # delete directory recursively
-##                 for f in os.listdir(selected_node):
-##                     if f in g.project.dependency_dict and list(self.flatten(g.project.file_list)).count(f) == 1:
-##                         del g.project.dependency_dict[f]
-##                 os.system('rm -rf ' + selected_node)
-##                 g.sources.remove(selection_iter)
-##                 g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nDeleted ' + selected_node + '.\n')
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\n' + filename + ' is already present in the directory: ' + selected_node + '.\n')
         elif index == 3:
             # Logic here to add a new source
             files = os.listdir(selected_node)
             if filename not in files:
                 os.system('touch ' + filepath)
-                # Don't think I need the below                
-                #g.sources.append(selection_iter, [image, filename, filepath])
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\n' + 'Added new source:' + filepath + ' to ' + selected_node + '.\n')
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\n' + 'Added new source:' + filepath + ' to ' + selected_node + '.\n')
                 # Add to the dependency tree
-                if not self.is_filename_in_dependencies(g, filename):
-                    g.dependencies.append(None, [filename, path])
+                if not self.is_filename_in_dependencies(gedamanager, filename):
+                    gedamanager.dependencies.append(None, [filename, path])
                 # Add to the dependency_dict if not in there
-                if filename not in g.project.dependency_dict:
-                    g.project.dependency_dict[filename] = [True, [], []]
+                if filename not in gedamanager.project.dependency_dict:
+                    gedamanager.project.dependency_dict[filename] = [True, [], []]
             else:
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\n' + filename + ' is already present in the directory: ' + selected_node + '.\n')
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\n' + filename + ' is already present in the directory: ' + selected_node + '.\n')
         elif index == 4:
             # Logic here to remove a source
-            # Remove from tree view
-            # Don't think I need the below
-            #g.sources.remove(selection_iter)
-            # Remove from dependency tree
-            if self.is_filename_in_dependencies(g, filename, True):
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nRemoved ' + selected_node + ' from dependencies tree.\n')                
+            if self.is_filename_in_dependencies(gedamanager, filename, True):
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\nRemoved ' + selected_node + ' from dependencies tree.\n')                
             # Remove from dependency_dict
-            if filename in g.project.dependency_dict:
-                del g.project.dependency_dict[filename]
-            g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nRemoved ' + selected_node + ' from project.\n')
-##         elif index == 5:
-##             # Logic here to remove a folder
-##             for f in os.listdir(selected_node):
-##                 # Remove from dependency tree
-##                 if self.is_filename_in_dependencies(g, filename, True):
-##                     g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nRemoved ' + selected_node + ' from dependencies tree.\n')
-##                 # Remove from dependency_dict
-## #                if f in g.project.dependency_dict and list(self.flatten(g.project.file_list)).count(f) == 1:
-##                     del g.project.dependency_dict[f]
-##             g.sources.remove(selection_iter)
-##             g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nRemoved ' + selected_node + ' from project.\n')
-
-        # Create Project's File List
-##         g.project.file_list = [] 
-##         for row in g.sources:
-##             # Get the filename of the node
-##             if row[2] == g.project.directory: # Project Folder
-##                 g.project.file_list.append(row[1])
-##             row_iter = row.iterchildren() # This will be True for the root
-##             if row_iter != None: # We have children in this row
-##                 child_list = self.child_recurse(row_iter, 1)
-##                 if child_list != None:
-##                     for x in child_list:
-##                         if x == None:
-##                             child_list.remove(None)
-##                     g.project.file_list.append(child_list)
+            if filename in gedamanager.project.dependency_dict:
+                del gedamanager.project.dependency_dict[filename]
+            gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ':\nRemoved ' + selected_node + ' from project.\n')
 
         # Expand the 'Sources' tree view
-        g.sources_tree.expand_all()
-        # Create a new dependency loop
-#        g.dependencyloop.switch_projects()
+        gedamanager.sources_tree.expand_all()
         # Now save the project since the new update file_list is made        
-        g.project.save()
+        gedamanager.project.save()
 
 
     @exceptions
     def get_processes_tree(self, gedamanager, selected_node=None, ext=None, folder=None, clear=None):
         """!
         Method to populate the 'Processes' tree view in the gEDA Manager.
-        @param gedamanager current gEDAManager instance
+        @param gedamanager current gEDAManager instance                
         @param selected_node selected node in the 'Sources' tree view
         @param ext filename extension for the currently selected node
         in the 'Sources' tree view
@@ -422,17 +376,17 @@ class Utils:
         @param clear paramater that is used to force a clearing of the
         processes model
         """
-        g = gedamanager
         current_directory = os.getcwd()
         os.chdir(self.directory)
         if clear:
-            g.processes.clear()
+            gedamanager.processes.clear()
         icon = gtk.IconTheme()
         
         if ext == None and folder != None:
-            selection = g.sources_tree.get_selection()
+            selection = gedamanager.sources_tree.get_selection()
             model, selection_iter = selection.get_selected()
-            selected_node = g.sources.get_value(selection_iter, 2)
+            if isinstance(selection_iter, gtk.TreeIter):                
+                selected_node = gedamanager.sources.get_value(selection_iter, 2)
 
             # Iterate over the folder to see what types of files they have
             # and build the tree this way.
@@ -446,89 +400,89 @@ class Utils:
             for ext in extensions:
                 # recursively structure the tree
                 if ext in self.icon_lut:
-                    self.get_processes_tree(g, selected_node, ext, True)
+                    self.get_processes_tree(gedamanager, selected_node, ext, True)
                 else:
                     print 'self.icon_lut does not contain:', ext
             return
             
         if ext == 'sch':
             # Parent folders
-            simulation = g.processes.append(None, ['Simulate', None, None])
-            create_pcb = g.processes.append(None, ['Create PCB', None, None])
-            create_netlist = g.processes.append(None, ['Create Netlist', None, None])
-            modify_attributes = g.processes.append(None, ['Modify Attributes', None, None])
+            simulation = gedamanager.processes.append(None, ['Simulate', None, None])
+            create_pcb = gedamanager.processes.append(None, ['Create PCB', None, None])
+            create_netlist = gedamanager.processes.append(None, ['Create Netlist', None, None])
+            modify_attributes = gedamanager.processes.append(None, ['Modify Attributes', None, None])
 
             # Simulate
             image = icon.load_icon(self.icon_lut['spice'], 22, 0) 
-            g.processes.append(simulation, ['gspiceui', image, None])
+            gedamanager.processes.append(simulation, ['gspiceui', image, None])
 
             # PCB
             image = icon.load_icon(self.icon_lut['g2p'], 22, 0)
-            g.processes.append(create_pcb, ['gsch2pcb workflow', image, None])
+            gedamanager.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])
+            gnetlist = gedamanager.processes.append(create_netlist, ['gnetlist', image, None])
             for netlist in sorted(self.netlists):
-                g.processes.append(gnetlist, [netlist, None, None])
+                gedamanager.processes.append(gnetlist, [netlist, None, None])
 
             # Modify attributes
             image = icon.load_icon(self.icon_lut['other'], 22, 0) #refdes -- TODO
-            g.processes.append(modify_attributes, ['refdes_renum', None, None])
+            gedamanager.processes.append(modify_attributes, ['refdes_renum', None, None])
             image = icon.load_icon(self.icon_lut['other'], 22, 0) #grenum -- TODO
-            g.processes.append(modify_attributes, ['grenum', None, None])
+            gedamanager.processes.append(modify_attributes, ['grenum', None, None])
             image = icon.load_icon(self.icon_lut['gattrib'], 22, 0) 
-            g.processes.append(modify_attributes, ['gattrib', image, None])
+            gedamanager.processes.append(modify_attributes, ['gattrib', image, None])
 
         elif ext == 'pcb':
             # gsch2pcb
-            status_image = self.get_status_image(g, selected_node)
-            export = g.processes.append(None, ['Update PCB (gsch2pcb)', None, status_image])
+            status_image = self.get_status_image(gedamanager, selected_node)
+            export = gedamanager.processes.append(None, ['Update PCB (gsch2pcb)', None, status_image])
             # Export
-            export = g.processes.append(None, ['Export', None, None])
-            gerber = g.processes.append(export, ['RS-274X (Gerber) file(s)', None, None])
+            export = gedamanager.processes.append(None, ['Export', None, None])
+            gerber = gedamanager.processes.append(export, ['RS-274X (Gerber) file(s)', None, None])
             # May need to add for bom1 and bom2
-            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])
+            bom = gedamanager.processes.append(export, ['Bill of Materials (BOM) file(s)', None, None])
+            nelma = gedamanager.processes.append(export, ['Numerical analysis (Nelma) file(s)', None, None])
+            png = gedamanager.processes.append(export, ['GIF/JPEG/PNG file(s)', None, None])
+            ps = gedamanager.processes.append(export, ['Postscript file(s)', None, None])
+            eps = gedamanager.processes.append(export, ['Encapsulated Postscript file(s)', None, None])
             # Print
-            _print = g.processes.append(None, ['Print (lpr)', None, None])
+            _print = gedamanager.processes.append(None, ['Print (lpr)', None, None])
             
         elif ext == 'gbr':
             pass # Decide if any processes later
         elif ext == 'sym':
             # Parent folders
-            check_symbols = g.processes.append(None, ['Check Symbols', None, None])
+            check_symbols = gedamanager.processes.append(None, ['Check Symbols', None, None])
             image = icon.load_icon(self.icon_lut['sym'], 22, 0) 
-            g.processes.append(check_symbols, ['gsymcheck', image, None])
+            gedamanager.processes.append(check_symbols, ['gsymcheck', image, None])
 
         elif ext == 'v':
             # Parent folders
-            compile_source = g.processes.append(None, ['Compile Verilog', None, None])
+            compile_source = gedamanager.processes.append(None, ['Compile Verilog', None, None])
             
-            comsim_source = g.processes.append(None, ['Compile and Simulate Verilog', None, None])
+            comsim_source = gedamanager.processes.append(None, ['Compile and Simulate Verilog', None, None])
             image = icon.load_icon(self.icon_lut['icarus'], 22, 0)
-            g.processes.append(compile_source, ['icarus-compile', image, None])
-            g.processes.append(comsim_source, ['icarus-compile->gtkwave-simulate', image, None])
+            gedamanager.processes.append(compile_source, ['icarus-compile', image, None])
+            gedamanager.processes.append(comsim_source, ['icarus-compile->gtkwave-simulate', image, None])
 
         elif ext == 'vcd':
             # Parent folders
             # TODO -- need to find out if this is a from a .vhd file
             # or a .v file.  Then either put a ghdl icon or icarus icon
-            simulate = g.processes.append(None, ['Simulate', None, None])
+            simulate = gedamanager.processes.append(None, ['Simulate', None, None])
             image = icon.load_icon(self.icon_lut['icarus'], 22, 0) 
-            g.processes.append(simulate, ['iverilog', image, None])
+            gedamanager.processes.append(simulate, ['iverilog', image, None])
 
         elif ext == 'vhd' or ext == 'vhdl':
             # Parent folders
-            compile_source = g.processes.append(None, ['Compile VHDL', None, None])
+            compile_source = gedamanager.processes.append(None, ['Compile VHDL', None, None])
             
-            comsim_source = g.processes.append(None, ['Compile and Simulate VHDL', None, None])
+            comsim_source = gedamanager.processes.append(None, ['Compile and Simulate VHDL', None, None])
             image = icon.load_icon(self.icon_lut['ghdl'], 22, 0) 
-            g.processes.append(compile_source, ['ghdl-compile', image, None])
-            g.processes.append(comsim_source, ['ghdl-compile->gtkwave-simulate', image, None])
+            gedamanager.processes.append(compile_source, ['ghdl-compile', image, None])
+            gedamanager.processes.append(comsim_source, ['ghdl-compile->gtkwave-simulate', image, None])
             
         os.chdir(current_directory)            
 
@@ -541,19 +495,18 @@ class Utils:
         @param path path of the row of the cell to be activated in the gtk.TreeView
         object
         @param view_column gtk.TreeViewColumn of the cell to be
+        @param gedamanager current gEDAManager instance                
         activated
-        @param gedamanager current gEDAManager instance
         """
-        g = gedamanager
-        selected_node = g.sources[path][2]
-        filename = g.sources[path][1]        
+        selected_node = gedamanager.sources[path][2]
+        filename = gedamanager.sources[path][1]        
         if '.' in filename: # We have a file
             ext = filename.split('.')[-1]
         elif filename in self.configfiles:
             ext = 'config'
         else: # We have a folder
             ext = 'folder'
-        self.run_command(g, selected_node, None, ext)
+        self.run_command(gedamanager, selected_node, None, ext)
         
 
     @exceptions
@@ -568,60 +521,49 @@ class Utils:
         activated
         @param gedamanager current gEDAManager instance
         """
-        g = gedamanager
-        selected_node = g.processes[path][0]
-        selection = g.sources_tree.get_selection()
+        selected_node = gedamanager.processes[path][0]
+        selection = gedamanager.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
         if isinstance(selection_iter, gtk.TreeIter):
-            highlighted_source = g.sources.get_value(selection_iter, 2)
+            highlighted_source = gedamanager.sources.get_value(selection_iter, 2)
             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)
+            if filename not in gedamanager.project.dependency_dict:
+                gedamanager.project.dependency_dict[filename] = [True, [], []]
+            self.run_command(gedamanager, selected_node, highlighted_source)
 
         
     @exceptions
     def run_command(self, gedamanager, filepath, highlighted_source=None, ext=None):
         """!
         Method to run commands for 'Processes' and 'Sources'.
-        @param gedamanager current gEDAManager instance
+        @param gedamanager current gEDAManager instance                
         @param filepath selected 'Sources' or 'Processes' node
         @param highlighted_source highlighted 'Sources' node that
         is being used for the current process
         @param ext extension of the selected file
         """
-        g = gedamanager
         files = ['net','log','bom','bom1','bom2','v','vhd','gm','txt','cmd']
         # Sources
         if ext != None:
             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])
-                elif g.tools['sch'].poll() == None: # Process is still running
-                    # The code below is just some code to check when the file
-                    # was modified etc
-                    ## try:
-                    ##     st = os.stat(filepath)
-                    ## except IOError:
-                    ##     print 'IOError'
-                    ## else:
-                    ##     print 'file size:', st[ST_SIZE]
-                    ##     print 'file modified:', st[ST_MTIME]
+                if gedamanager.tools['sch'] == None or gedamanager.tools['sch'].poll() == 0:
+                    gedamanager.tools['sch'] = Popen(['gschem', filepath])
+                elif gedamanager.tools['sch'].poll() == None: # Process is still running
                     pass
             elif ext == 'pcb':
-                if g.tools['pcb'] == None or g.tools['pcb'].poll() == 0:
-                    g.tools['pcb'] = Popen(['pcb', filepath])
-                elif g.tools['pcb'].poll() == None: # Process is still running
+                if gedamanager.tools['pcb'] == None or gedamanager.tools['pcb'].poll() == 0:
+                    gedamanager.tools['pcb'] = Popen(['pcb', filepath])
+                elif gedamanager.tools['pcb'].poll() == None: # Process is still running
                     pass
             elif ext == 'gbr':
-                if g.tools['gerbv'] == None or g.tools['gerbv'].poll() == 0:
-                    g.tools['gerbv'] = Popen(['gerbv', filepath])
-                elif g.tools['gerbv'].poll() == None: # Process is still running
+                if gedamanager.tools['gerbv'] == None or gedamanager.tools['gerbv'].poll() == 0:
+                    gedamanager.tools['gerbv'] = Popen(['gerbv', filepath])
+                elif gedamanager.tools['gerbv'].poll() == None: # Process is still running
                     print 'gerbv is open'
             elif (ext in files or ext in self.configfiles):
-                if g.settings.editor == None:
-                    dialog = gtk.MessageDialog(g.window,
+                if gedamanager.settings.editor == None:
+                    dialog = gtk.MessageDialog(gedamanager.window,
                                                (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
                                                gtk.MESSAGE_INFO,
                                                gtk.BUTTONS_OK,
@@ -632,8 +574,8 @@ class Utils:
                     dialog.destroy()
                 
                 # Need to put some logic here to make sure it is a valid program
-                elif g.tools['editor'] != None: 
-                    Popen([g.settings.editor, filepath])
+                elif gedamanager.tools['editor'] != None: 
+                    Popen([gedamanager.settings.editor, filepath])
                     
         else: # Processes
             os.chdir(highlighted_source.rpartition('/')[0])
@@ -641,50 +583,50 @@ class Utils:
             # Netlists
             if program in self.netlists: # use gnetlist
                 subproc = Popen(['gnetlist', '-v','-g',program,highlighted_source], stdout=PIPE)
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ' and output from ' + program + ':\n' + subproc.communicate()[0] + '\n')
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ' and output from ' + program + ':\n' + subproc.communicate()[0] + '\n')
             elif program == 'ghdl-compile':
                 # TODO
-                pass
+                self.cb_not_implemented(gedamanager)
             elif program == 'ghdl-compile->gtkwave-simulate':
                 # TODO
+                self.cb_not_implemented(gedamanager)                
                 pass
             elif program == 'icarus-compile':
                 # TODO
+                self.cb_not_implemented(gedamanager)                
                 pass
             elif program == 'icarus-compile->gtkwave-simulate':
                 # TODO
-                #subproc = Popen([program, highlighted_source])
+                self.cb_not_implemented(gedamanager)                
                 pass
             elif program == 'gattrib':
-                if g.tools['gattrib'] == None or g.tools['gattrib'].poll() == 0:
-                    g.tools['gattrib'] = Popen([program, highlighted_source], stdout=PIPE)
-                    g.output_textbuffer.insert(g.output_textiter, self.get_time() + ' and output from ' + program + ':\n' + g.tools['gattrib'].communicate()[0] + '.\n')
-                elif g.tools['gattrib'].poll() == None: # Process is still running
+                if gedamanager.tools['gattrib'] == None or gedamanager.tools['gattrib'].poll() == 0:
+                    gedamanager.tools['gattrib'] = Popen([program, highlighted_source], stdout=PIPE)
+                    gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ' and output from ' + program + ':\n' + gedamanager.tools['gattrib'].communicate()[0] + '.\n')
+                elif gedamanager.tools['gattrib'].poll() == None: # Process is still running
                     pass
             elif program == 'gsymcheck':
                 arg = '-v ' + highlighted_source
                 subproc = Popen([program, arg], stdout=PIPE)
-                g.output_textbuffer.insert(g.output_textiter, self.get_time() + ' and output from ' + program + ':\n' + subproc.communicate()[0] + '.\n')
+                gedamanager.output_textbuffer.insert(gedamanager.output_textiter, self.get_time() + ' and output from ' + program + ':\n' + subproc.communicate()[0] + '.\n')
             elif program == 'gsch2pcb workflow':
-                self.gsch2pcb = Gsch2pcb(g, highlighted_source)
+                self.gsch2pcb = Gsch2pcb(gedamanager, highlighted_source)
             elif program == 'Update PCB (gsch2pcb)':
                 filename = self.get_filename_from_filepath(highlighted_source)
-                print 'filename:',filename
                 # Only run if the highlighted_souce is outdated                
-                if not g.project.dependency_dict[filename][0]:
-                    print 'We are in'
+                if not gedamanager.project.dependency_dict[filename][0]:
                     files_before = os.listdir(highlighted_source.rpartition('/')[0])
                     schematics_list = []
-#                    schematics_list = [x for x in g.project.dependency_dict[filename][1:] if x.endswith('.sch')]
-                    for x in g.project.dependency_dict:
+#                    schematics_list = [x for x in gedamanager.project.dependency_dict[filename][1:] if x.endswith('.sch')]
+                    for x in gedamanager.project.dependency_dict:
                         if x.endswith('.sch'):
-                            for y in g.project.dependency_dict[x]:
+                            for y in gedamanager.project.dependency_dict[x]:
                                 if y == filename:
                                     # Add to list
                                     schematics_list.append(x)
                                     
-                    print 'g.project.dependency_dict[filename][1:]:',g.project.dependency_dict[filename][1:]
-                    print 'g.project.dependency_dict:',g.project.dependency_dict
+                    print 'gedamanager.project.dependency_dict[filename][1:]:',gedamanager.project.dependency_dict[filename][1:]
+                    print 'gedamanager.project.dependency_dict:',gedamanager.project.dependency_dict
                     print 'schematics_list:',schematics_list
                     if schematics_list:
                         schematics = ''
@@ -700,9 +642,10 @@ class Utils:
                         # Add any new files to the sources tree view if any
                         if files:
                             icon = gtk.IconTheme()
-                            selection = g.sources_tree.get_selection()
+                            selection = gedamanager.sources_tree.get_selection()
                             model, selection_iter = selection.get_selected()
-                            parent_iter = g.sources.iter_parent(selection_iter)
+                            if isinstance(selection_iter, gtk.TreeIter):                
+                                parent_iter = gedamanager.sources.iter_parent(selection_iter)
                             wanted = ['pcb','new.pcb','net']
                             new_files = []
                             new_files.append(True)
@@ -713,27 +656,27 @@ class Utils:
                                     ext = f.split('.')[-1]
                                 if ext in wanted:
                                     filepath = directory + '/' + f
-                                    image = icon.load_icon(g.utils.icon_lut[ext], 22, 0)
+                                    image = icon.load_icon(self.icon_lut[ext], 22, 0)
                                     # Don't think I need the below
-                                    #g.sources.append(parent_iter, [image, f, filepath])
-                                    g.dependencies.append(None, [f, filepath])
+                                    #gedamanager.sources.append(parent_iter, [image, f, filepath])
+                                    gedamanager.dependencies.append(None, [f, filepath])
                                     # Need to see if there are any new files
                                     new_files.append(f)
                             print 'new_files:',new_files
                         else:
                             print 'no new files'
                         # Update the status of the PCB file
-                        g.project.dependency_dict[filename][0] = True
+                        gedamanager.project.dependency_dict[filename][0] = True
                         
             else:
-                print 'program: (process no name)',program
-                subproc = Popen([program, highlighted_source])                
-                
+                self.cb_not_implemented(gedamanager)
+                ## TODO I will need to change the below since 'program' may
+                ## not be an actual program
+                ## subproc = Popen([program, highlighted_source])                                
 
     def update_dependency_dict(self, gedamanager, filename, flag=False):
         """!
         Method to update the dependencies for filename.
-        @param gedamanager current gEDAManager instance
         @param filename file that will have its dependencies updated
         or list of filenames that will have its dependencies updated
         @param flag sets status of filename
@@ -754,11 +697,9 @@ class Utils:
     def add_to_dependency_dict(self, gedamanager, filename):
         """!
         Method to add a file to the project's dependency_dict.
-        @param gedamanager current gEDAManager instance
         @param filename file to add to project.dependency_dict
         """
-        g = gedamanager
         # add file to the dependency_dict
-        if filename not in g.project.dependency_dict:
-            g.project.dependency_dict[filename] = [True, [], []]
+        if filename not in gedamanager.project.dependency_dict:
+            gedamanager.project.dependency_dict[filename] = [True, [], []]
 




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