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

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



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

 docs/config.dox               |    2 +-
 src/gedamanager.py            |   57 ++++++++++++++++++++++------
 src/gsch2pcb.py               |   84 +++++++++++++++++++++--------------------
 src/processdependencyevent.py |    2 +-
 src/project.py                |    2 -
 src/settings.py               |   56 +++++++++++++--------------
 src/utils.py                  |   52 +++++++++++++-------------
 7 files changed, 143 insertions(+), 112 deletions(-)


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

commit f0b5f1a92a70a526f6c791305f5a55412c05dfdb
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxxx>
Date:   Mon Dec 1 13:35:06 2008 -0800

    Routine checkin.  Fixed several bugs and cleaning up code.

:100644 100644 e5c2e0d... 581e9e0... M	docs/config.dox
:100644 100644 3e28361... 912c02a... M	src/gedamanager.py
:100644 100644 d4bffb4... 371ec5e... M	src/gsch2pcb.py
:100644 100644 8b2914a... c52c120... M	src/processdependencyevent.py
:100644 100644 28a3275... 78c32a6... M	src/project.py
:100644 100644 8184e01... 7812bea... M	src/settings.py
:100644 100644 f37c4ec... 11c33f4... M	src/utils.py

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

commit f0b5f1a92a70a526f6c791305f5a55412c05dfdb
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxxx>
Date:   Mon Dec 1 13:35:06 2008 -0800

    Routine checkin.  Fixed several bugs and cleaning up code.

diff --git a/docs/config.dox b/docs/config.dox
index e5c2e0d..581e9e0 100644
--- a/docs/config.dox
+++ b/docs/config.dox
@@ -31,7 +31,7 @@ PROJECT_NAME           = "gEDA Manager"
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = "1.0"
+PROJECT_NUMBER         = "0.1"
 
 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
 # base path where the generated documentation will be put. 
diff --git a/src/gedamanager.py b/src/gedamanager.py
index 3e28361..912c02a 100644
--- a/src/gedamanager.py
+++ b/src/gedamanager.py
@@ -94,6 +94,9 @@ class gEDAManager:
         # More to be added
         self.tools = {'sch': None, 'pcb': None, 'gerbv': None, 'gattrib': None,
                       'editor': None}
+        # Check if .gmrc has an editor attribute
+        if self.settings.editor != None:
+            self.tools['editor'] = self.settings.editor
         
 
     def __init_menus__(self):
@@ -292,7 +295,7 @@ class gEDAManager:
         except:
             pass
         self.terminal = vte.Terminal()
-        self.terminal.connect('child-exited', lambda term: gtk.main_quit())
+        self.terminal.connect('child-exited', lambda term: self.cb_vte())#lambda term: gtk.main_quit())
         self.terminal.fork_command()
         self.terminal.show()
         os.chdir(current_directory)
@@ -446,7 +449,7 @@ class gEDAManager:
 
     def set_sources_tree_to_project(self):
         """ Method to set the tree to current project object. """
-
+        print 'set_sources_tree_to_project'
         self.sources.clear()
         if self.project.name != None:
             self.load_sources_tree()
@@ -488,7 +491,9 @@ class gEDAManager:
         """
         if self.sources != None:
             # Clear out the sources first
+            print 'load_sources_tree'
             self.sources.clear()
+            print 'sources cleared'
             # Start adding data to the Model
             if os.path.exists(self.project.directory):
                 os.chdir(self.project.directory)
@@ -503,18 +508,26 @@ class gEDAManager:
 
                     folder = root.split('/')[-1]
                     try:
+                        print "root node"
                         node = self.sources.append(dictionary[root], [image, folder, root])
+                        print "root node out"
                     except KeyError:
+                        print "folder node"
                         node = self.sources.append(None, [image, folder, root])
+                        print "folder node out"
                     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)
+                            print "node"
                             self.sources.append(node, [image, f, os.path.join(root, f)])
+                            print "node out"
                     for d in dirs:
                         dictionary[os.path.join(root, d)] = node
 
                 self.sources_tree.expand_all()
 
+            print 'leaving load_sources_tree'
+
         
 ##     def load_sources_tree(self, file_list, parent=None, parent_path=None):
 ##         """!
@@ -695,7 +708,7 @@ class gEDAManager:
         # "You have open processes.  If you exit you may lose unsaved
         # changes.  Would you like to proceed? Okay or Cancel.
         for tool, value in self.tools.iteritems():
-            if value != None: # kill the process
+            if value != None and not isinstance(value, str): # kill the process
                 os.kill(value.pid, signal.SIGKILL)
     
 
@@ -794,8 +807,8 @@ class gEDAManager:
         """
         self.write_logs()
         self.project.save()
-        self.project.close();
-        
+        self.project.close()
+
 
     def cb_exit(self, menuitem, data=None):
         """!
@@ -809,6 +822,18 @@ class gEDAManager:
         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):
@@ -937,7 +962,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)
         
         def response_to_dialog(entry, dialog, response):
             dialog.response(response)
@@ -1113,8 +1139,10 @@ class gEDAManager:
         model, selection_iter = selection.get_selected()
         selected_node = self.sources.get_value(selection_iter, 2)
 
+        print 'cb_delete'
         os.system('rm ' + selected_node)
-        self.sources.remove(selection_iter)
+        # 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)
         if node in self.project.dependency_dict and list(self.utils.flatten(self.project.file_list)).count(node) == 1:
@@ -1135,11 +1163,16 @@ class gEDAManager:
 
         exists = os.path.exists(selected_node)
         if exists: # delete directory recursively
-            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]
+            # 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.sources.remove(selection_iter)
+            # 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')
 
 
diff --git a/src/gsch2pcb.py b/src/gsch2pcb.py
index d4bffb4..371ec5e 100644
--- a/src/gsch2pcb.py
+++ b/src/gsch2pcb.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-
 # gEDA Manager
 # Copyright (C) 2008 Newell Jensen
 # Copyright (C) 2008 gEDA Contributors (see ChangeLog for details)
@@ -34,7 +32,7 @@ class Gsch2pcb:
     This class allows the user to select multiple schematics
     to be used in the gsch2pcb workflow to produce a PCB file.
     """
-    @exceptions
+    #@exceptions
     def __init__(self, gedamanager, filepath):
         """!
         Gsch2pcb Constructor.
@@ -171,44 +169,48 @@ class Gsch2pcb:
                     if f not in files_before:
                         files.append(f)
 
-                if self.in_project:
-                    # Add it to the sources tree view
-                    icon = gtk.IconTheme()
-                    selection = self.g.sources_tree.get_selection()
-                    model, selection_iter = selection.get_selected()
-                    parent_iter = self.g.sources.iter_parent(selection_iter)
-                    wanted = ['pcb','new.pcb','net']
-                    new_files = []
-                    new_files.append(True)
-                    print 'files:',files
-                    print 'parent_iter:',parent_iter
-                    for f in files:
-                        if f.endswith('new.pcb'):
-                            ext = 'new.pcb'
-                        else:
-                            ext = f.split('.')[-1]
-                        if ext in wanted:
-                            filepath = self.directory + '/' + f
-                            print 'filepath:',filepath
-                            image = icon.load_icon(self.g.utils.icon_lut[ext], 22, 0)
-                            self.g.sources.append(parent_iter, [image, f, filepath])
-                            self.g.dependencies.append(None, [f, filepath])
-                            # add new file to the dependency_dict
-                            if f not in self.g.project.dependency_dict:
-                                self.g.project.dependency_dict[f] = [True]
-                            
-                            new_files.append(f)
-                    for sch in self.schematics:
-                        if sch[0] not in self.g.project.dependency_dict[sch[0]]:
-                            self.g.project.dependency_dict[sch[0]] = new_files
-                        else:
-                            self.g.project.dependency_dict[sch[0]][0] = True
-                            for f in new_files:
-                                self.g.project.dependency_dict[sch[0]].append(f)
-                    # Update the project and its file list
-                    self.g.utils.update_file_list(self.g)
-                else:
-                    pass
+                ## if self.in_project:
+                ##     # Add it to the sources tree view
+                ##     icon = gtk.IconTheme()
+                ##     selection = self.g.sources_tree.get_selection()
+                ##     model, selection_iter = selection.get_selected()
+                    
+                ##     if isinstance(selection_iter, gtk.TreeIter):
+                ##         parent_iter = self.g.sources.iter_parent(selection_iter)
+                ##     else:
+                ##         print model
+                ##         print selection_iter
+                ##     ## wanted = ['pcb','new.pcb','net']
+                ##     ## new_files = []
+                ##     ## new_files.append(True)
+                ##     ## print 'files:',files
+                ##     ## print 'parent_iter:',parent_iter
+                ##     ## for f in files:
+                ##     ##     if f.endswith('new.pcb'):
+                ##     ##         ext = 'new.pcb'
+                ##     ##     else:
+                ##     ##         ext = f.split('.')[-1]
+                ##     ##     if ext in wanted:
+                ##     ##         filepath = self.directory + '/' + f
+                ##     ##         print 'filepath:',filepath
+                ##     ##         image = icon.load_icon(self.g.utils.icon_lut[ext], 22, 0)
+                ##     ##         self.g.sources.append(parent_iter, [image, f, filepath])
+                ##     ##         self.g.dependencies.append(None, [f, filepath])
+                ##     ##         # add new file to the dependency_dict
+                ##     ##         if f not in self.g.project.dependency_dict:
+                ##     ##             self.g.project.dependency_dict[f] = [True]
+                ##     ##         new_files.append(f)
+                ##     ## for sch in self.schematics:
+                ##     ##     if sch[0] not in self.g.project.dependency_dict[sch[0]]:
+                ##     ##         self.g.project.dependency_dict[sch[0]] = new_files
+                ##     ##     else:
+                ##     ##         self.g.project.dependency_dict[sch[0]][0] = True
+                ##     ##         for f in new_files:
+                ##     ##             self.g.project.dependency_dict[sch[0]].append(f)
+                ##     ## # Update the project and its file list
+                ##     ## self.g.utils.update_file_list(self.g)
+                ## else:
+                ##     pass
         self.dialog.destroy()
 
 
diff --git a/src/processdependencyevent.py b/src/processdependencyevent.py
index 8b2914a..c52c120 100644
--- a/src/processdependencyevent.py
+++ b/src/processdependencyevent.py
@@ -89,7 +89,7 @@ class ProcessDependencyEvent(ProcessEvent):
         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.g.dependencyloop.switch_projects()
 
         
 
diff --git a/src/project.py b/src/project.py
index 28a3275..78c32a6 100644
--- a/src/project.py
+++ b/src/project.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-
 # gEDA Manager
 # Copyright (C) 2008 Newell Jensen
 # Copyright (C) 2008 gEDA Contributors (see ChangeLog for details)
diff --git a/src/settings.py b/src/settings.py
index 8184e01..7812bea 100644
--- a/src/settings.py
+++ b/src/settings.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-
 # gEDA Manager
 # Copyright (C) 2008 Newell Jensen
 # Copyright (C) 2008 gEDA Contributors (see ChangeLog for details)
@@ -37,13 +35,13 @@ class Settings:
     def __init__(self):
         """ Settings Default Constructor. """
         self.version = 1.0
-        self.installed_apps = []
+        ## self.installed_apps = []
         self.project = None
         self.editor = None
         self.path = os.path.expanduser('~') + '/.gmrc'
-        self.geda_apps = ['gschem','pcb','gsch2pcb','gnucap','ngspice',
-                          'iverilog','gattrib','gtkwave','gwave','gnetlist',
-                          'tragesym','grenum','gerbv','wcalc','mcalc','olib']
+        ## self.geda_apps = ['gschem','pcb','gsch2pcb','gnucap','ngspice',
+        ##                   'iverilog','gattrib','gtkwave','gwave','gnetlist',
+        ##                   'tragesym','grenum','gerbv','wcalc','mcalc','olib']
         try:
             config = yaml.load(open(self.path))
         except IOError:
@@ -60,7 +58,7 @@ class Settings:
             stream = file(self.path, 'r')
 
             for data in yaml.load_all(stream):
-                self.installed_apps = data['programs']
+                ## self.installed_apps = data['programs']
                 self.project = data['project']
                 self.editor = data['editor']
                 # Check to see if this file is still available
@@ -85,30 +83,30 @@ class Settings:
             stream.close()
         elif not config:
             # find installed apps and create the config file
-            self.installed_apps = self.find_installed_apps()
+            ## self.installed_apps = self.find_installed_apps()
             self.create_config_file()
             
 
-    def find_installed_apps(self):
-        """!
-        Find all of the gEDA suite applications that are
-        installed on this machine and return list of these programs.
-        @return list of installed geda apps
-        """
-        apps = []
-        for app in self.geda_apps:
-            # Check to see if program is installed
-            args = 'which ' + app
-            path = Popen(['which', app], stdout=PIPE).communicate()[0]
-            #get name from path
-            path = path.strip('\n')
-            geda_app = path.rsplit('/',1)
-            try:
-                apps.append(geda_app[1])
-            except IndexError:
-                print 'IndexError:', sys.exc_info()[0]
-                print 'The application ' + app + ' is not installed.'
-        return apps
+    ## def find_installed_apps(self):
+    ##     """!
+    ##     Find all of the gEDA suite applications that are
+    ##     installed on this machine and return list of these programs.
+    ##     @return list of installed geda apps
+    ##     """
+    ##     apps = []
+    ##     for app in self.geda_apps:
+    ##         # Check to see if program is installed
+    ##         args = 'which ' + app
+    ##         path = Popen(['which', app], stdout=PIPE).communicate()[0]
+    ##         #get name from path
+    ##         path = path.strip('\n')
+    ##         geda_app = path.rsplit('/',1)
+    ##         try:
+    ##             apps.append(geda_app[1])
+    ##         except IndexError:
+    ##             print 'IndexError:', sys.exc_info()[0]
+    ##             print 'The application ' + app + ' is not installed.'
+    ##     return apps
 
     
     def create_config_file(self):
@@ -134,7 +132,7 @@ class Settings:
           
         """
         yaml.dump(yaml.load(document), stream, default_flow_style=False)
-        yaml.dump({'programs': self.installed_apps, 'version': self.version,
+        yaml.dump({'version': self.version,
                    'project': self.project,
                    'editor': self.editor}, stream, default_flow_style=False)
         stream.close()
diff --git a/src/utils.py b/src/utils.py
index f37c4ec..11c33f4 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -40,12 +40,12 @@ class Utils:
         """ Constructor. """
         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')
+        ## # 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):
@@ -307,7 +307,8 @@ class Utils:
             files = os.listdir(selected_node)
             if filename not in files:
                 os.system('cp ' + filepath + ' ' + selected_node)
-                g.sources.append(selection_iter, [image, filename, path])
+                # 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')
                 # Add to the dependency tree
                 if not self.is_filename_in_dependencies(g, filename):
@@ -316,7 +317,8 @@ class Utils:
                 if filename not in g.project.dependency_dict:
                     g.project.dependency_dict[filename] = [True, [], []]
             elif filepath == selected_node + '/' + filename:
-                g.sources.append(selection_iter, [image, filename, path])
+                # 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, [], []]
@@ -348,8 +350,9 @@ class Utils:
             # Logic here to add a new source
             files = os.listdir(selected_node)
             if filename not in files:
-                os.system('touch ' + filepath)                
-                g.sources.append(selection_iter, [image, filename, filepath])
+                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')
                 # Add to the dependency tree
                 if not self.is_filename_in_dependencies(g, filename):
@@ -362,7 +365,8 @@ class Utils:
         elif index == 4:
             # Logic here to remove a source
             # Remove from tree view
-            g.sources.remove(selection_iter)
+            # 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')                
@@ -552,6 +556,7 @@ class Utils:
         self.run_command(g, selected_node, None, ext)
         
 
+    #@exceptions
     def cb_processes_row_activated(self, widget, path, view_column, gedamanager):
         """!
         Event occurs when 'row-activated' signal is emitted or a user double
@@ -567,14 +572,15 @@ class Utils:
         selected_node = g.processes[path][0]
         selection = g.sources_tree.get_selection()
         model, selection_iter = selection.get_selected()
-        highlighted_source = g.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 isinstance(selection_iter, gtk.TreeIter):
+            highlighted_source = g.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)
 
         
-    @exceptions
+    #@exceptions
     def run_command(self, gedamanager, filepath, highlighted_source=None, ext=None):
         """!
         Method to run commands for 'Processes' and 'Sources'.
@@ -623,13 +629,8 @@ class Utils:
                     dialog.destroy()
                 
                 # Need to put some logic here to make sure it is a valid program
-                elif g.tools['editor'] == None or g.tools['editor'].poll() == 0:
+                elif g.tools['editor'] != None: 
                     g.tools['editor'] = Popen([g.settings.editor, filepath])
-                elif g.tools['editor'].poll() == None: # Process is still running
-                    print 'editor in use'
-                    # TODO -- Need to try and change this so they can have as many
-                    # instances of the editor open as they want.
-                    # Make a system() call instead of doing a subprocess
 
         else: # Processes
             os.chdir(highlighted_source.rpartition('/')[0])
@@ -655,9 +656,7 @@ class Utils:
                 arg = '-v ' + highlighted_source
                 subproc = Popen([program, arg])
             elif program == 'gsch2pcb workflow':
-                # Call new class logic to go through the workflow
                 self.gsch2pcb = Gsch2pcb(g, highlighted_source)
-                pass
             elif program == 'Update PCB (gsch2pcb)':
                 filename = self.get_filename_from_filepath(highlighted_source)
                 print 'filename:',filename
@@ -705,7 +704,8 @@ class Utils:
                                 if ext in wanted:
                                     filepath = directory + '/' + f
                                     image = icon.load_icon(g.utils.icon_lut[ext], 22, 0)
-                                    g.sources.append(parent_iter, [image, f, filepath])
+                                    # Don't think I need the below
+                                    #g.sources.append(parent_iter, [image, f, filepath])
                                     g.dependencies.append(None, [f, filepath])
                                     # Need to see if there are any new files
                                     new_files.append(f)




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