[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: geda_manager.git: branch: master updated (0c106db157317346503da41f3c915d2f310923be)
The branch, master has been updated
via 0c106db157317346503da41f3c915d2f310923be (commit)
from 5f84798d93c9d617f91bf0de6486d033e984490c (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
=========
images/bitmaps/LaTeX.png | Bin 0 -> 559 bytes
images/bitmaps/application_home.png | Bin 0 -> 685 bytes
images/bitmaps/chart_curve.png | Bin 0 -> 710 bytes
images/bitmaps/gerbv-22.png | Bin 0 -> 1112 bytes
images/bitmaps/page.png | Bin 0 -> 635 bytes
images/bitmaps/page_gear.png | Bin 0 -> 833 bytes
src/file_popup.xml | 4 +-
src/folder_popup.xml | 5 +-
src/gedamanager.py | 642 +++++++++++++++++++++--------------
src/newproject.py | 28 +-
src/processdependencyevent.py | 9 +-
src/utils.py | 259 ++++++++-------
12 files changed, 551 insertions(+), 396 deletions(-)
create mode 100644 images/bitmaps/LaTeX.png
create mode 100644 images/bitmaps/application_home.png
create mode 100644 images/bitmaps/chart_curve.png
create mode 100644 images/bitmaps/gerbv-22.png
create mode 100644 images/bitmaps/page.png
create mode 100644 images/bitmaps/page_gear.png
=================
Commit Messages
=================
commit 0c106db157317346503da41f3c915d2f310923be
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date: Sat Aug 23 17:39:41 2008 -0700
Added some new icons and currently in the middle of dependencies modification.
:000000 100644 0000000... 4816c7c... A images/bitmaps/LaTeX.png
:000000 100644 0000000... b60d0c8... A images/bitmaps/application_home.png
:000000 100644 0000000... 01e933a... A images/bitmaps/chart_curve.png
:000000 100644 0000000... e9f23c3... A images/bitmaps/gerbv-22.png
:000000 100644 0000000... 03ddd79... A images/bitmaps/page.png
:000000 100644 0000000... 8e83281... A images/bitmaps/page_gear.png
:100644 100644 e336cf8... 98b3137... M src/file_popup.xml
:100644 100644 883f1c8... 5d23af0... M src/folder_popup.xml
:100644 100644 23d9721... dfb1f2b... M src/gedamanager.py
:100644 100644 96fd769... 591a9e8... M src/newproject.py
:100644 100644 95ddb90... 8b12455... M src/processdependencyevent.py
:100644 100644 1e846b3... d96a2b3... M src/utils.py
=========
Changes
=========
commit 0c106db157317346503da41f3c915d2f310923be
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date: Sat Aug 23 17:39:41 2008 -0700
Added some new icons and currently in the middle of dependencies modification.
diff --git a/images/bitmaps/LaTeX.png b/images/bitmaps/LaTeX.png
new file mode 100644
index 0000000..4816c7c
Binary files /dev/null and b/images/bitmaps/LaTeX.png differ
diff --git a/images/bitmaps/application_home.png b/images/bitmaps/application_home.png
new file mode 100644
index 0000000..b60d0c8
Binary files /dev/null and b/images/bitmaps/application_home.png differ
diff --git a/images/bitmaps/chart_curve.png b/images/bitmaps/chart_curve.png
new file mode 100644
index 0000000..01e933a
Binary files /dev/null and b/images/bitmaps/chart_curve.png differ
diff --git a/images/bitmaps/gerbv-22.png b/images/bitmaps/gerbv-22.png
new file mode 100644
index 0000000..e9f23c3
Binary files /dev/null and b/images/bitmaps/gerbv-22.png differ
diff --git a/images/bitmaps/page.png b/images/bitmaps/page.png
new file mode 100644
index 0000000..03ddd79
Binary files /dev/null and b/images/bitmaps/page.png differ
diff --git a/images/bitmaps/page_gear.png b/images/bitmaps/page_gear.png
new file mode 100644
index 0000000..8e83281
Binary files /dev/null and b/images/bitmaps/page_gear.png differ
diff --git a/src/file_popup.xml b/src/file_popup.xml
index e336cf8..98b3137 100644
--- a/src/file_popup.xml
+++ b/src/file_popup.xml
@@ -1,8 +1,8 @@
<ui>
<popup>
<separator/>
- <menuitem action="Delete"/>
- <menuitem action="Rename"/>
+ <menuitem action="Open in Editor"/>
+ <menuitem action="Remove File from Project"/>
<menuitem action="Copy Existing Dependency for Selected File to the Project..."/>
<separator/>
</popup>
diff --git a/src/folder_popup.xml b/src/folder_popup.xml
index 883f1c8..5d23af0 100644
--- a/src/folder_popup.xml
+++ b/src/folder_popup.xml
@@ -1,11 +1,10 @@
<ui>
<popup>
<separator/>
- <menuitem action="New Folder"/>
- <menuitem action="Delete Folder"/>
<menuitem action="New Source..."/>
+ <menuitem action="New Folder"/>
+ <menuitem action="Remove Folder from Project"/>
<menuitem action="Copy Existing Source To Project..."/>
- <menuitem action="Rename"/>
<separator/>
</popup>
</ui>
diff --git a/src/gedamanager.py b/src/gedamanager.py
index 23d9721..dfb1f2b 100644
--- a/src/gedamanager.py
+++ b/src/gedamanager.py
@@ -54,10 +54,6 @@ 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)
- # Set up the project's dependency dictionary
- if self.project.dependency_dict == None:
- print 'project dependency_dict is null'
- self.project.dependency_dict = {}
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
self.dependencyloop = DependencyLoop(self)
@@ -163,67 +159,74 @@ class gEDAManager:
def __init_gui_sections__(self):
""" Method to create the main gui sections of the top-level window. """
# Partitioning the window
- hpaned1 = gtk.HPaned()
- self.vbox1.pack_start(hpaned1, True, True, 0)
- hpaned1.show()
-
- # Main Window
- # TODO -- once I know what we are going to put there
+ hpaned = gtk.HPaned()
+ hpaned.set_position(400)
+ self.vbox1.pack_start(hpaned, True, True, 0)
+ hpaned.show()
# Notebook
- vpaned2 = gtk.VPaned() # This is the vpaned for sources and process
- hpaned1.pack1(vpaned2, True, True)
- vpaned2.show()
+ vpaned = gtk.VPaned() # This is the vpaned for sources and process
+ hpaned.pack1(vpaned, True, True)
+ vpaned.show()
sources_notebook = gtk.Notebook()
sources_notebook.show()
processes_notebook = gtk.Notebook()
processes_notebook.show()
- vpaned2.pack1(sources_notebook, True, True)
- vpaned2.pack2(processes_notebook, True, True)
+ vpaned.pack1(sources_notebook, True, True)
+ vpaned.pack2(processes_notebook, True, True)
sources_notebook.set_tab_pos(gtk.POS_BOTTOM)
processes_notebook.set_tab_pos(gtk.POS_BOTTOM)
- scrolled_window1 = gtk.ScrolledWindow()
-
- scrolled_window1.show()
- scrolled_window2 = gtk.ScrolledWindow()
- scrolled_window2.show()
- scrolled_window1.set_shadow_type(gtk.SHADOW_IN)
- scrolled_window1.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scrolled_window2.set_shadow_type(gtk.SHADOW_IN)
- scrolled_window2.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- sources_notebook.add(scrolled_window1)
- processes_notebook.add(scrolled_window2)
+
+ scrolled_window_sources = gtk.ScrolledWindow()
+ scrolled_window_sources.show()
+ scrolled_window_processes = gtk.ScrolledWindow()
+ scrolled_window_processes.show()
+ scrolled_window_dependencies = gtk.ScrolledWindow()
+ scrolled_window_dependencies.show()
+ scrolled_window_sources.set_shadow_type(gtk.SHADOW_IN)
+ scrolled_window_sources.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ scrolled_window_processes.set_shadow_type(gtk.SHADOW_IN)
+ scrolled_window_processes.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ scrolled_window_dependencies.set_shadow_type(gtk.SHADOW_IN)
+ scrolled_window_dependencies.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+
+ sources_notebook.add(scrolled_window_sources)
+ processes_notebook.add(scrolled_window_processes)
+ sources_notebook.append_page(scrolled_window_dependencies)
# Labels
sources_label = gtk.Label('Sources')
sources_label.show()
+ dependencies_label = gtk.Label('Dependencies')
+ dependencies_label.show()
processes_label = gtk.Label('Processes')
processes_label.show()
sources_notebook.set_tab_label(sources_notebook.get_nth_page(0), sources_label)
+ sources_notebook.set_tab_label(sources_notebook.get_nth_page(1), dependencies_label)
processes_notebook.set_tab_label(processes_notebook.get_nth_page(0), processes_label)
# Models for the Tree Views
self.sources = gtk.TreeStore(gtk.gdk.Pixbuf, str, str)
self.processes = gtk.TreeStore(str, gtk.gdk.Pixbuf, gtk.gdk.Pixbuf)
+ self.dependencies = gtk.TreeStore(str, str)
- # Tree Views
+ # Source Tree View
self.sources_tree = gtk.TreeView(self.sources)
self.sources_tree.show()
self.sources_tree.connect('button_press_event', self.cb_button_press)
self.sources_tree.connect('row-activated', self.utils.cb_sources_row_activated, self)
self.sources_tree.connect('cursor-changed', self.cb_cursor_changed)
-
- self.processes_tree = gtk.TreeView(self.processes)
- self.processes_tree.show()
- self.processes_tree.connect('row-activated', self.utils.cb_processes_row_activated, self)
-
- # column headings
column = gtk.TreeViewColumn(None, gtk.CellRendererPixbuf(), pixbuf=0)
self.sources_tree.append_column(column)
sources_cell = gtk.CellRendererText()
column = gtk.TreeViewColumn(None, sources_cell, text=1)
column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
self.sources_tree.append_column(column)
+
+ # Processes Tree View
+ self.processes_tree = gtk.TreeView(self.processes)
+ self.processes_tree.show()
+ self.processes_tree.connect('row-activated', self.utils.cb_processes_row_activated, self)
column = gtk.TreeViewColumn('Processes for: ', gtk.CellRendererText(), text=0)
column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
self.processes_tree.append_column(column)
@@ -234,20 +237,46 @@ class gEDAManager:
column = gtk.TreeViewColumn(None, processes_pixbuf, pixbuf=2)
column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
self.processes_tree.append_column(column)
-
-
+
+ # Dependencies Tree View
+ self.dependencies_tree = gtk.TreeView(self.dependencies)
+ self.dependencies_tree.show()
+ self.dependencies_tree.connect('columns-changed', self.cb_columns_changed)
+## # we'll add some data now - 4 rows with 3 child rows each
+## for parent in range(4):
+## piter = self.dependencies.append(None, ['parent %i' % parent])
+## for child in range(3):
+## self.dependencies.append(piter, ['child %i of parent %i' %
+## (child, parent)])
+
+ # create the TreeViewColumn to display the data
+ column = gtk.TreeViewColumn('Files')
+ column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
+ dependencies_cell = gtk.CellRendererText()
+ column.pack_start(dependencies_cell, True)
+ column.add_attribute(dependencies_cell, 'text', 0)
+
+ # Allow sorting on the column
+ column.set_sort_column_id(0)
+ self.dependencies_tree.append_column(column)
+
# set some properties
self.sources_tree.set_property('enable-tree-lines', True)
self.processes_tree.set_property('enable-tree-lines', True)
+ self.dependencies_tree.set_property('enable-tree-lines', True)
# make it searchable
self.sources_tree.set_search_column(0)
self.processes_tree.set_search_column(0)
+ self.dependencies_tree.set_search_column(0)
- # add to the scrolling window
- scrolled_window1.add(self.sources_tree)
- scrolled_window2.add(self.processes_tree)
+ # Allow drag and drop reordering of rows
+ self.dependencies_tree.set_reorderable(True)
+ # add the scrolling windows
+ scrolled_window_sources.add(self.sources_tree)
+ scrolled_window_processes.add(self.processes_tree)
+ scrolled_window_dependencies.add(self.dependencies_tree)
######################################
# Lower Notebook Window
@@ -255,7 +284,7 @@ class gEDAManager:
notebook = gtk.Notebook()
notebook.show()
- hpaned1.pack2(notebook, True, True)
+ hpaned.pack2(notebook, True, True)
notebook.set_tab_pos(gtk.POS_BOTTOM)
terminal_scrolled_window = gtk.ScrolledWindow()
terminal_scrolled_window.show()
@@ -323,8 +352,9 @@ class gEDAManager:
self.output_textbuffer.insert(self.output_textiter, 'Output log--\n')
self.errors_textbuffer.insert(self.errors_textiter, 'Error log--\n')
- # Finally add data to the store
+ # Finally add data to the sources_tree and the dependencies_tree
self.set_sources_tree_to_project()
+ self.set_dependencies_tree_to_project()
def __init_about_dialog__(self):
@@ -416,15 +446,25 @@ class gEDAManager:
self.project.open(path)
self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\n' + 'Project set to ' + self.project.name + '\n')
+
def set_sources_tree_to_project(self):
""" Method to set the tree to current project object. """
self.sources.clear()
if self.project.file_list != None:
- self.load_tree(self.project.file_list)
+ self.load_sources_tree(self.project.file_list)
self.sources_tree.expand_all()
+ def set_dependencies_tree_to_project(self):
+ """ Method to set the tree to current project object. """
+
+ self.dependencies.clear()
+ if self.project.dependency_dict != None:
+ self.load_dependencies_tree(self.project.dependency_dict)
+ self.dependencies_tree.expand_all()
+
+
def set_sources_tree_to_new_project(self):
""" Method to set the tree to newly created project object. """
@@ -436,14 +476,33 @@ class gEDAManager:
parent = self.sources.append(None, [image, self.project.name, self.project.directory])
# Child Node
- icon = gtk.IconTheme()
image = icon.load_icon(self.utils.icon_lut['gm'], 22, 0)
- path = self.project.directory + '/' + self.project.name + '.gm'
- self.sources.append(parent, [image, self.project.name + '.gm', path])
+ project_file_path = self.project.directory + '/' + self.project.name + '.gm'
+ self.sources.append(parent, [image, self.project.name + '.gm', project_file_path])
+ image = icon.load_icon(self.utils.icon_lut['log'], 22, 0)
+ output_log_path = self.project.directory + '/output.log'
+ self.sources.append(parent, [image, 'output.log', output_log_path])
+ errors_log_path = self.project.directory + '/error.log'
+ self.sources.append(parent, [image, 'error.log', errors_log_path])
self.sources_tree.expand_all()
- def load_tree(self, file_list, parent=None, parent_path=None):
+ def set_dependencies_tree_to_new_project(self):
+ """ Method to set the tree to newly created project object. """
+
+ self.dependencies.clear()
+ # Parent Folder
+ project_path = self.project.directory + '/' + self.project.name
+ project_file_path = project_path + '.gm'
+ output_file_path = self.project.directory + '/output.log'
+ error_file_path = self.project.directory + '/error.log'
+ self.dependencies.append(None, [self.project.name + '.gm', project_file_path])
+ self.dependencies.append(None, ['output.log', output_file_path])
+ self.dependencies.append(None, ['error.log', error_file_path])
+ self.dependencies_tree.expand_all()
+
+
+ def load_sources_tree(self, file_list, parent=None, parent_path=None):
"""!
Method to the load the tree -- recursively.
@param list of paths in the project's file_list.
@@ -471,7 +530,7 @@ class gEDAManager:
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_tree(f, n_parent, file_path)
+ self.load_sources_tree(f, n_parent, file_path)
else: # We have a node
if parent_path != None:
file_path = parent_path + '/' + f
@@ -481,6 +540,31 @@ class gEDAManager:
n_parent = self.sources.append(parent, [image, f, file_path])
+ def load_dependencies_tree(self, dep_dict, parent=None, parent_path=None):
+ """!
+ Method to the load the dependencies tree
+ @param dependency_dict of the project's dependencies
+ @param parent node to help setup the gtk.TreeView object
+ @param parent_path is a parameter to help in writing the paths
+ to the self.sources gtk.TreeStore object
+ """
+ print 'Loading Dependencies'
+ for key, value in dep_dict.iteritems():
+ # filepath
+ if parent_path != None:
+ filepath = parent_path + '/' + key
+ else:
+ filepath = self.project.directory + '/' + key
+ # parent
+ if parent != None:
+ n_parent = self.dependencies.append(parent, [key, filepath])
+ else:
+ n_parent = self.dependencies.append(None, [key, filepath])
+ # recurse
+ if isinstance(value, dict):
+ self.load_dependencies_tree(value, n_parent, filepath)
+
+
def save_settings(self):
""" Method to save current settings to .gmrc file. """
@@ -572,16 +656,18 @@ class gEDAManager:
startiter, enditer = self.output_textbuffer.get_bounds()
output = self.output_textbuffer.get_text(startiter, enditer)
os.chdir(self.project.directory)
- f = file('output.log', 'w')
+ f = file('output.log', 'a')
f.writelines(output)
f.close()
+ #self.output_textbuffer.delete(self.output_textbuffer.get_start_iter(), self.output_textbuffer.get_end_iter())
startiter, enditer = self.errors_textbuffer.get_bounds()
errors = self.errors_textbuffer.get_text(startiter, enditer)
os.chdir(self.project.directory)
- f = file('errors.log', 'w')
+ f = file('error.log', 'a')
f.writelines(errors)
f.close()
+ #self.errors_textbuffer.delete(self.errors_textbuffer.get_start_iter(), self.errors_textbuffer.get_end_iter())
@exceptions
@@ -684,6 +770,7 @@ class gEDAManager:
@param menuitem that threw the event.
@param data optional to pass in.
"""
+ self.write_logs()
self.project.save()
self.project.close();
@@ -694,21 +781,21 @@ class gEDAManager:
@param menuitem that threw the event.
@param data optional to pass in.
"""
- self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\n' + 'Exiting gEDA Manager.\n')
+ 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.write_logs()
self.kill_processes()
self.dependencyloop.kill_thread()
- def cb_delete(self, menuitem, data=None):
- """!
- Event handler for 'Delete'.
- @param menuitem that threw the event.
- @param data optional to pass in.
- """
- self.utils.update_file_list(self, 1)
+## def cb_delete(self, menuitem, data=None):
+## """!
+## Event handler for file 'Delete'.
+## @param menuitem that threw the event.
+## @param data optional to pass in.
+## """
+## self.utils.update_file_list(self, 1)
def cb_project_closed(self, widget, event):
@@ -720,7 +807,7 @@ class gEDAManager:
self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\n' + 'Project closed.\n')
self.set_menu_defaults()
self.set_sources_tree_to_project()
-
+ self.set_dependencies_tree_to_project()
def cb_project_saved(self, widget, event):
"""!
@@ -744,6 +831,7 @@ class gEDAManager:
self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\n' + 'Project ' + self.project.name + ' opened.\n')
self.set_menu_defaults()
self.set_sources_tree_to_project()
+ self.set_dependencies_tree_to_project()
def cb_project_created(self, widget, event):
@@ -755,7 +843,7 @@ class gEDAManager:
self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nProject ' + self.project.name + ' created.\n')
self.set_menu_defaults()
self.set_sources_tree_to_new_project()
-
+ self.set_dependencies_tree_to_new_project()
@exceptions
def cb_preferences(self, menuitem, data=None):
@@ -846,7 +934,7 @@ class gEDAManager:
gtk.MESSAGE_QUESTION,
gtk.BUTTONS_OK_CANCEL,
gtk.STOCK_DIRECTORY)
- dialog.set_markup('<b>Please enter the new file name\n(add extension to override defaults):</b>')
+ dialog.set_markup('<b>Please enter the new file name (extension will be added):</b>')#\n(add extension to override defaults):</b>')
entry = gtk.Entry()
entry.show()
entry.connect('activate', response_to_dialog, dialog, gtk.RESPONSE_OK)
@@ -901,7 +989,7 @@ class gEDAManager:
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
- ext = self.utils.get_node_ext(new_text)
+ 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
@@ -933,94 +1021,94 @@ class gEDAManager:
dialog.destroy()
- #@exceptions
- def cb_add_copy_dependency(self, menuitem, data=None):
- """!
- Event occurs when the user wants to add a source to the project
- @param menuitem that threw the event.
- @param data optional to pass in.
- """
- selection = self.sources_tree.get_selection()
- model, selection_iter = selection.get_selected()
- selected_node = self.sources.get_value(selection_iter, 2)
- dialog = gtk.MessageDialog(self.window,
- (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
- gtk.MESSAGE_OTHER,
- gtk.BUTTONS_OK_CANCEL,
- gtk.STOCK_DIRECTORY)
- dialog.set_markup('<b>Choose file that is dependent on selected file.\nChoose target directory (within project) for this file.</b>')
- dialog.set_title('Copy Existing Dependency for Selected File to the Project...')
- hbox = gtk.HBox()
- hbox.show()
- filebutton = gtk.FileChooserButton('Target Location')
- filebutton.show()
- filebutton.set_local_only(True)
- filebutton.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
- hbox.pack_end(filebutton)
- label = gtk.Label('Target Location:')
- label.show()
- hbox.pack_end(label)
- dialog.vbox.pack_end(hbox, True, True, 0)
-
- hbox = gtk.HBox()
- hbox.show()
- embed_fc = gtk.FileChooserButton('Dependency File')
- embed_fc.show()
- embed_fc.set_local_only(True)
- embed_fc.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
- hbox.pack_end(embed_fc)
- label = gtk.Label('Dependency File')
- label.show()
- hbox.pack_end(label)
- dialog.vbox.pack_end(hbox, True, True, 0)
- dialog.show()
- response = dialog.run()
- if response == gtk.RESPONSE_OK:
- directory = filebutton.get_filename()
- filepath = embed_fc.get_filename()
- if filepath != None:
- # Find out what file it is so we can pick an icon for it
- filename = self.utils.get_node_name(filepath)
- icon = gtk.IconTheme()
- image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(filename)], 22, 0)
- # We can't call update file list because the currently selected
- # node (a file) is not the one that we want to put it
- # under ( whic is some folder). Thus, we need to find the iter
- # for the directory chosen.
-# quit = True
- for row in self.sources:
- # Get the gtk.TreeIter for the directory
- if row[2] == directory:
- row_iter = row.iter
- # Add the new folder to project file list
- self.utils.update_file_list(self)
- break
- if row_iter == None:
- self.errors_textbuffer.insert(self.errors_textiter, self.utils.get_time() + ':\n' + directory + " is not present in the project's directory structure.\nWhen adding a dependency the target directory must be in the project.\n")
- dialog.destroy()
- return
- else:
- # Copy the filepath to the chosen directory
- # Also update the sources with the proper node
- files = os.listdir(directory)
- if filename not in files:
- os.system('cp ' + filepath + ' ' + directory)
- self.sources.append(row_iter, [image, filename, filepath])
- self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() +
- ':\n' + 'Added copy of source - ' + filepath + ' - to ' + directory + '.\n')
- else:
- self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() +
- ':\n' + filename + ' is already present in the directory - ' + directory + '.\n')
- # add new file to the dependency_dict
- self.utils.add_to_dependency_dict(self, filename)
- # Add the new file as a dependency for the selected file
- # and make sure that it is in the dependency_dict
- parent_file = self.utils.get_node_name(selected_node)
- self.utils.add_to_dependency_dict(self, parent_file)
- self.project.dependency_dict[parent_file].append((True, filename))
- self.utils.update_file_list(self)
-
- dialog.destroy()
+## @exceptions
+## def cb_add_copy_dependency(self, menuitem, data=None):
+## """!
+## Event occurs when the user wants to add a source to the project
+## @param menuitem that threw the event.
+## @param data optional to pass in.
+## """
+## selection = self.sources_tree.get_selection()
+## model, selection_iter = selection.get_selected()
+## selected_node = self.sources.get_value(selection_iter, 2)
+## dialog = gtk.MessageDialog(self.window,
+## (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
+## gtk.MESSAGE_OTHER,
+## gtk.BUTTONS_OK_CANCEL,
+## gtk.STOCK_DIRECTORY)
+## dialog.set_markup('<b>Choose file that is dependent on selected file.\nChoose target directory (within project) for this file.</b>')
+## dialog.set_title('Copy Existing Dependency for Selected File to the Project...')
+## hbox = gtk.HBox()
+## hbox.show()
+## filebutton = gtk.FileChooserButton('Target Location')
+## filebutton.show()
+## filebutton.set_local_only(True)
+## filebutton.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
+## hbox.pack_end(filebutton)
+## label = gtk.Label('Target Location:')
+## label.show()
+## hbox.pack_end(label)
+## dialog.vbox.pack_end(hbox, True, True, 0)
+
+## hbox = gtk.HBox()
+## hbox.show()
+## embed_fc = gtk.FileChooserButton('Dependency File')
+## embed_fc.show()
+## embed_fc.set_local_only(True)
+## embed_fc.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
+## hbox.pack_end(embed_fc)
+## label = gtk.Label('Dependency File')
+## label.show()
+## hbox.pack_end(label)
+## dialog.vbox.pack_end(hbox, True, True, 0)
+## dialog.show()
+## response = dialog.run()
+## if response == gtk.RESPONSE_OK:
+## directory = filebutton.get_filename()
+## filepath = embed_fc.get_filename()
+## if filepath != None:
+## # Find out what file it is so we can pick an icon for it
+## filename = self.utils.get_node_name(filepath)
+## icon = gtk.IconTheme()
+## image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(filename)], 22, 0)
+## # We can't call update file list because the currently selected
+## # node (a file) is not the one that we want to put it
+## # under ( whic is some folder). Thus, we need to find the iter
+## # for the directory chosen.
+## # quit = True
+## for row in self.sources:
+## # Get the gtk.TreeIter for the directory
+## if row[2] == directory:
+## row_iter = row.iter
+## # Add the new folder to project file list
+## self.utils.update_file_list(self)
+## break
+## if row_iter == None:
+## self.errors_textbuffer.insert(self.errors_textiter, self.utils.get_time() + ':\n' + directory + " is not present in the project's directory structure.\nWhen adding a dependency the target directory must be in the project.\n")
+## dialog.destroy()
+## return
+## else:
+## # Copy the filepath to the chosen directory
+## # Also update the sources with the proper node
+## files = os.listdir(directory)
+## if filename not in files:
+## os.system('cp ' + filepath + ' ' + directory)
+## self.sources.append(row_iter, [image, filename, filepath])
+## self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() +
+## ':\n' + 'Added copy of source - ' + filepath + ' - to ' + directory + '.\n')
+## else:
+## self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() +
+## ':\n' + filename + ' is already present in the directory - ' + directory + '.\n')
+## # add new file to the dependency_dict
+## self.utils.add_to_dependency_dict(self, filename)
+## # Add the new file as a dependency for the selected file
+## # and make sure that it is in the dependency_dict
+## parent_file = self.utils.get_node_name(selected_node)
+## self.utils.add_to_dependency_dict(self, parent_file)
+## self.project.dependency_dict[parent_file].append([True, filename])
+## self.utils.update_file_list(self)
+
+## dialog.destroy()
@exceptions
@@ -1047,7 +1135,7 @@ class gEDAManager:
gtk.MESSAGE_QUESTION,
gtk.BUTTONS_OK_CANCEL,
gtk.STOCK_DIRECTORY)
- dialog.set_markup('<b>Please enter new folder name:</b>\nIf the node you selected already contains\na folder with this name it will be deleted.')
+ 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)
@@ -1072,20 +1160,20 @@ class gEDAManager:
# See if this directory already exists
if os.path.exists(filepath): # delete directory recursively
- print 'before'
os.path.walk(filepath, delete_dependency_dict_entry, None)
- print 'after'
shutil.rmtree(filepath)
flag = True
i = 0
while flag:
child_iter = self.sources.iter_nth_child(selection_iter, i)
- child_node = self.sources.get_value(child_iter, 2)
- if child_node == filepath:
- if child_iter != None:
- flag = self.sources.remove(child_iter)
- if flag: # break out if flag is true
- flag = False
+ 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)
@@ -1098,99 +1186,126 @@ class gEDAManager:
self.utils.update_file_list(self)
- @exceptions
- def cb_delete_folder(self, widget):
+## @exceptions
+## def cb_delete_folder(self, action):
+## """!
+## Event occurs when the user chooses to delete a folder from the project.
+## @param action is the gtk.Action object involved with this event
+## """
+## self.utils.update_file_list(self, 2)
+
+
+## @exceptions
+## def cb_rename(self, action):
+## """!
+## Event handler for renaming a file, folder, or project.
+## @param action is the gtk.Action object involved with this event
+## """
+## # TODO -- note...this is currently broken
+## # I need to add the functionality that when the project
+## # name is changed, that it iterates recursively over all
+## # the subdirectories and changes the names in the model.
+## # Currently I am getting errors because I change the project
+## # but not the subdirectory names in the nodes.
+## # The error for this is actually seen in the utils.get_processes_tree
+## # method in the Utils class.
+## def response_to_dialog(entry, dialog, response):
+## dialog.response(response)
+
+## 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 proper 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
+
+## 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'
+
+## model[(0)][1] = new_text
+## model[(0)][2] = new_path
+## model[(0,0)][1] = new_text + '.gm'
+## model[(0,0)][2] = new_path + '/' + new_text + '.gm'
+## self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nProject changed from ' + old_path + ' to ' + new_path + '\n.')
+## self.project.save()
+## elif '.' 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, self.utils.get_time() + ':\n' + old_path + ' changed to ' + new_path + '.\n')
+## elif '.' in new_text and '.' not in old_path: # Folder being changed
+## pass # don't allow it to change names
+
+## elif '.' not in new_text and '.' in old_path: # File being changed
+## pass # don't allow it to change names
+
+## else:
+## # Folder -- so image does not need to be changed
+## if os.path.exists(new_path):
+## self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nFolder 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, self.utils.get_time() + ':\n' + old_path + ' changed to ' + new_path + '.\n')
+
+## self.utils.update_file_list(self) # update file list
+
+
+ def open_in_editor(self, action):
"""!
- Event occurs when the user chooses to delete a folder from the project.
- @param widget that threw the event.
+ Event occurs when the user wants to open a source file in the editor.
+ @param action is the gtk.Action object involved with this event
"""
- self.utils.update_file_list(self, 2)
-
-
- @exceptions
- def cb_rename(self, action):
- """!
- Event handler for renaming a file, folder, or project.
- @param action is the gtk.Action object involved with this event.
- """
- # TODO -- note...this is currently broken
- # I need to add the functionality that when the project
- # name is changed, that it iterates recursively over all
- # the subdirectories and changes the names in the model.
- # Currently I am getting errors because I change the project
- # but not the subdirectory names in the nodes.
- # The error for this is actually seen in the utils.get_processes_tree
- # method in the Utils class.
- def response_to_dialog(entry, dialog, response):
- dialog.response(response)
-
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)
+ 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')
- 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 proper 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
-
- 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'
-
- model[(0)][1] = new_text
- model[(0)][2] = new_path
- model[(0,0)][1] = new_text + '.gm'
- model[(0,0)][2] = new_path + '/' + new_text + '.gm'
- self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nProject changed from ' + old_path + ' to ' + new_path + '\n.')
- self.project.save()
- elif '.' 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, self.utils.get_time() + ':\n' + old_path + ' changed to ' + new_path + '.\n')
- elif '.' in new_text and '.' not in old_path: # Folder being changed
- pass # don't allow it to change names
-
- elif '.' not in new_text and '.' in old_path: # File being changed
- pass # don't allow it to change names
- else:
- # Folder -- so image does not need to be changed
- if os.path.exists(new_path):
- self.output_textbuffer.insert(self.output_textiter, self.utils.get_time() + ':\nFolder 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, self.utils.get_time() + ':\n' + old_path + ' changed to ' + new_path + '.\n')
+ def cb_remove_file_from_project(self, action):
+ """!
+ Event occurs when the user chooses to remove a file from the project.
+ @param action is the gtk.Action object involved with this event
+ """
+ self.utils.update_file_list(self, 4)
- self.utils.update_file_list(self) # update file list
+ def cb_remove_folder_from_project(self, action):
+ """!
+ Event occurs when the user chooses to remove a folder from the project.
+ @param action is the gtk.Action object involved with this event
+ """
+ self.utils.update_file_list(self, 5)
def cb_cursor_changed(self, widget):
@@ -1203,7 +1318,7 @@ class gEDAManager:
if selection_iter != None:
selected_node = self.sources.get_value(selection_iter, 2)
filename = self.utils.get_node_name(selected_node)
- if '.' in filename and not filename.endswith('.gm'):
+ if '.' in filename and not filename.endswith(('.gm','.log')):
# Logic to call function to find what type of file it is
# and then to populate the according tree view
ext = filename.split('.')[-1]
@@ -1231,6 +1346,26 @@ class gEDAManager:
self.processes.clear()
+ def cb_columns_changed(self, widget):
+ """!
+ Event occurs when the columns change in the dependencies treeview.
+ @param widget that threw the event
+ """
+# self.update_dependency_dict(self,
+ # Start a new dictionary
+ self.project.dependency_dict = {}
+ # Iterate over the whole tree and create the project.depedency_dict
+ for row in self.dependencies:
+ print 'row:',row
+ row_iter = row.iterchildren()
+ if row_iter != None:
+ # We have children for this row so we need to nest
+ print 'row_iter:',row_iter
+ else:
+ # Add key, value pair to the dictionary
+ self.project.dependency_dict[row[0]] = None
+
+
def cb_popup_deactivate(self, popup_menu, merge_id):
"""!
Event occurs when the 'deactivate' signal is thrown from
@@ -1259,13 +1394,16 @@ class gEDAManager:
return
popup_menu = gtk.Menu()
actiongroup = gtk.ActionGroup('Popup')
- actiongroup_list = [('Rename', None, '_Rename', None, None, self.cb_rename),
- ('Delete', gtk.STOCK_DELETE, '_Delete', '<Control>d', None, self.cb_delete),
- ('Copy Existing Dependency for Selected File to the Project...', None, 'Copy Existing _Dependency for Selected File to the Project...', None, None, self.cb_add_copy_dependency),
+ actiongroup_list = [('Open in Editor', None, '_Open in Editor', None, None, self.open_in_editor),
+ #('Rename', None, '_Rename', None, None, self.cb_rename),
+ ('Remove File from Project', gtk.STOCK_REMOVE, 'R_emove File from Project', None, None, self.cb_remove_file_from_project),
+# ('Delete', gtk.STOCK_DELETE, '_Delete', '<Control>d', None, self.cb_delete),
+ ('Copy Existing Dependency for Selected File to the Project...', gtk.STOCK_COPY, 'Copy Existing _Dependency for Selected File to the Project...', None, None, self.cb_add_copy_dependency),
('New Source...', gtk.STOCK_FILE, '_New Source...', None, None, self.cb_new_source),
- ('Copy Existing Source To Project...', gtk.STOCK_DND_MULTIPLE, '_Copy Existing Source To Project...', None, None, self.cb_add_copy_source),
+ ('Copy Existing Source To Project...', gtk.STOCK_COPY, '_Copy Existing Source To Project...', None, None, self.cb_add_copy_source),
('New Folder', gtk.STOCK_DIRECTORY, 'New _Folder', None, None, self.cb_new_folder),
- ('Delete Folder', gtk.STOCK_DELETE, '_Delete Folder', None, None, self.cb_delete_folder),]
+# ('Delete Folder', gtk.STOCK_DELETE, '_Delete Folder', None, None, self.cb_delete_folder),
+ ('Remove Folder from Project', gtk.STOCK_REMOVE, 'R_emove Folder from Project', None, None, self.cb_remove_folder_from_project),]
actiongroup.add_actions(actiongroup_list)
self.popup_uimanager.insert_action_group(actiongroup, 0)
@@ -1281,7 +1419,7 @@ class gEDAManager:
popup_menu = self.popup_uimanager.get_widget('/popup')
else:
# File
- if selected_node.endswith('.gm'):
+ if selected_node.endswith(('.gm','.log')):
return
merge_id = self.popup_uimanager.add_ui_from_file(self.utils.directory + '/file_popup.xml')
popup_menu = self.popup_uimanager.get_widget('/popup')
@@ -1297,9 +1435,9 @@ class gEDAManager:
@param event that was thrown.
"""
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.write_logs()
self.kill_processes()
self.dependencyloop.kill_thread()
diff --git a/src/newproject.py b/src/newproject.py
index 96fd769..591a9e8 100644
--- a/src/newproject.py
+++ b/src/newproject.py
@@ -194,7 +194,7 @@ class NewProject:
Function is called when there is already a file with the same
name as the one that is trying to be created.
@param togglebutton is the widget that is either checked (activated)
- or not checked (not activated).
+ or not checked (not activated)
"""
confirmed = togglebutton.get_active()
self.assistant.set_page_complete(self.summary_page, confirmed)
@@ -212,7 +212,7 @@ class NewProject:
"""!
Function to check whether or not the directory to be created
already exists.
- @return returns a list
+ @return list
"""
filename = self.get_filename().split('.')[0]
f = os.path.exists(self.get_path() + '/' + filename)
@@ -229,8 +229,8 @@ class NewProject:
def cb_prepare(assistant, page):
"""!
Function to help setup the assistant summary page.
- @param assistant is the gtk.Assistant object.
- @param page is one of the pages of the gtk.Assistant object.
+ @param assistant is the gtk.Assistant object
+ @param page is one of the pages of the gtk.Assistant object
"""
if page is self.summary_page:
# Summary page before creating the new project on disk
@@ -264,14 +264,14 @@ class NewProject:
def cb_close(self, assistant):
"""!
Method is called when the NewProject object is closed.
- @param assistant is the gtk.Assistant object.
+ @param assistant is the gtk.Assistant object
"""
self.assistant.destroy()
def cb_cancel(self, assistant):
"""!
Method is called when the the user chooses 'cancel'.
- @param assistant is the gtk.Assistant object.
+ @param assistant is the gtk.Assistant object
"""
self.assistant.destroy()
@@ -279,14 +279,14 @@ class NewProject:
"""!
Method is called when the user chooses 'apply' to create
the new project.
- @param assistant is the gtk.Assistant object.
+ @param assistant is the gtk.Assistant object
"""
try:
# Set new project attributes
self.project.name = self.get_filename().split('.')[0]
self.project.directory = self.get_path() + '/' + self.project.name.split('.')[0]
- self.project.dependency_dict = {}
- self.project.file_list = [self.project.name, [self.project.name + '.gm']]
+ self.project.dependency_dict = {self.project.name + '.gm': [], 'ouput.log': [], 'error.log': []}
+ self.project.file_list = [self.project.name, [self.project.name + '.gm', 'output.log', 'error.log']]
# Remove directories with imported remove_tree
if self.confirm_overwrite.get_active():
shutil.rmtree(self.project.directory)
@@ -325,9 +325,8 @@ class NewProject:
def get_path(self):
"""!
- Method to get path of new project
- @return filepath: filepath from the filebutton
- @type filepath: string
+ Method to get path of new project.
+ @return filepath from the filebutton
"""
filepath = self.filebutton.get_filename()
return filepath
@@ -335,9 +334,8 @@ class NewProject:
def get_filename(self):
"""!
- Method to get file name of the new project
- @return filename: filename for the new project file
- @type filename: string
+ Method to get file name of the new project.
+ @return filename for the new project file
"""
filename = self.filename.get_text()
if not filename.endswith('.gm'):
diff --git a/src/processdependencyevent.py b/src/processdependencyevent.py
index 95ddb90..8b12455 100644
--- a/src/processdependencyevent.py
+++ b/src/processdependencyevent.py
@@ -50,9 +50,8 @@ class ProcessDependencyEvent(ProcessEvent):
"""
# Call method to set the status of the dependent files recursively
filename = self.g.utils.get_node_name(event.pathname)
- print 'filename in process catcher:',filename
- print 'dependency_dict in process catcher:',self.g.project.dependency_dict
- if filename in self.g.project.dependency_dict:
- self.g.utils.update_dependency_dict(self.g, filename)
- print 'catching event'
+ if filename != None and self.g.project.dependency_dict != None:
+ if filename in self.g.project.dependency_dict:
+ self.g.utils.update_dependency_dict(self.g, filename)
+ print 'catching event for file:',filename
diff --git a/src/utils.py b/src/utils.py
index 1e846b3..d96a2b3 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -51,16 +51,18 @@ class Utils:
def __setup__(self):
""" Method to load the icon look up table and netlists list. """
+ self.configfiles = ['gschemrc','.gschemrc','gafrc','.gafrc','gnetlistrc','.gnetlistrc','gattribrc','.gattribrc','attribs','.attribs']
self.netlists = ['bom2','calay','mathematica','vipec','geda','systemc','allegro','redac','drc2','cascade','pads','bae','pcbpins','vams','drc','gsch2pcb','partslist2','partslist3','partslist-common','gossip','maxascii','PCB','vhdl','tango','spice-sdb','partstlist1','PCBboard','switchcap','osmond','spice','verilog','bom','eagle','protelII','futurenet2','gnetlist']
-
+
+ # Images to import for later use
image = gtk.gdk.pixbuf_new_from_file('../images/icons/geda-xgsch2pcb-48.png')
gtk.icon_theme_add_builtin_icon('gEDAManager', 22, image)
image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/gq-folder.png')
gtk.icon_theme_add_builtin_icon('folder', 22, image)
- image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/pn-project.bmp')
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/application_home.png')
gtk.icon_theme_add_builtin_icon('project', 22, image)
- image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/document.bmp')
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/page.png')
gtk.icon_theme_add_builtin_icon('gm', 22, image)
image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/page_white.png')
gtk.icon_theme_add_builtin_icon('log', 22, image)
@@ -72,7 +74,7 @@ class Utils:
gtk.icon_theme_add_builtin_icon('vhdl', 22, image)
image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/page_white_error.png')
gtk.icon_theme_add_builtin_icon('other', 22, image)
- image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/plot_singleplot.png')
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/chart_curve.png')
gtk.icon_theme_add_builtin_icon('spice', 22, image)
image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/background-logo-icon.png')
gtk.icon_theme_add_builtin_icon('icarus', 22, image)
@@ -88,9 +90,28 @@ class Utils:
gtk.icon_theme_add_builtin_icon('output', 22, image)
image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/exclamation.png')
gtk.icon_theme_add_builtin_icon('errors', 22, image)
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/image.png')
+ gtk.icon_theme_add_builtin_icon('png', 22, image)
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/gerbv-22.png')
+ gtk.icon_theme_add_builtin_icon('gerbv', 22, image)
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/LaTeX.png')
+ gtk.icon_theme_add_builtin_icon('tex', 22, image)
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/money.png')
+ gtk.icon_theme_add_builtin_icon('bom', 22, image)
+ image = gtk.gdk.pixbuf_new_from_file('../images/bitmaps/page_gear.png')
+ gtk.icon_theme_add_builtin_icon('config', 22, image)
+
+ self.configfiles = ['gschemrc','.gschemrc','gafrc','.gafrc','gnetlistrc','.gnetlistrc','gattribrc','.gattribrc','attribs','.attribs']
- self.icon_lut = {'errors': 'errors',
+ self.icon_lut = {'config': 'config',
+ 'bom': 'bom',
+ 'bom1': 'bom',
+ 'bom2': 'bom',
+ 'tex': 'tex',
+ 'gerbv': 'gerbv',
+ 'png': 'png',
+ 'errors': 'errors',
'output': 'output',
'outdated': 'outdated',
'updated': 'updated',
@@ -114,7 +135,6 @@ class Utils:
'sym': 'application-x-geda-symbol',
'gsch2pcb': 'application-x-geda-gsch2pcb-project',
'g2p': 'application-x-geda-gsch2pcb-project',
- 'fp': 'application-x-pcb-footprint',
'pcb': 'application-x-pcb-layout',
'pcb.net': 'application-x-pcb-netlist',
'gbr': 'application-x-gerber',
@@ -132,11 +152,9 @@ class Utils:
def get_node_name(self, path):
"""!
- Method to return the node name from the path
- @param path: path to the node
- @type path: string
- @return filename: name of the node without an extension
- @type filename: string
+ Method to return the node name from the path.
+ @param path to the node
+ @return filename of the node without an extension
"""
if '/' in path:
return path.split('/')[-1]
@@ -144,16 +162,16 @@ class Utils:
return ''
- def get_node_ext(self, path):
+ def get_node_ext(self, filepath):
"""!
- Method to return the extension for the path
- @param path: filepath for the node file
- @type path: string
- @return ext: extension of the node
- @type ext: string
+ Method to return the extension for the path.
+ @param filepath for the node file
+ @return ext the extension of the node
"""
- if '.' in path:
- return path.split('.')[-1]
+ if '.' in filepath:
+ return filepath.split('.')[-1]
+ elif filepath in self.configfiles:
+ return 'config'
else:
return 'folder'
@@ -161,28 +179,28 @@ class Utils:
def get_status_image(self, gedamanager, selected_node, process_ext):
"""!
Method to get the status image for the process.
- @param gedamanager: current gEDAManager instance
- @type gedamanager: gEDAManager
- @param selected_node: currently selected node in the 'Sources' tree view.
- @type selected_node: string
- @param process_ext: type of file that is having its status set (updated/outdated)
- @type process_ext: string
- @return icon: icon from the self.icon_lut structure
- @type icon: gtk.IconTheme
+ @param gedamanager the current gEDAManager instance
+ @param selected_node the currently selected node in the 'Sources' tree view.
+ @param process_ext the type of file that is having its status set (updated/outdated)
+ @return icon the icon from the self.icon_lut structure
"""
g = gedamanager
filename = self.get_node_name(selected_node)
icon = gtk.IconTheme()
if filename in g.project.dependency_dict:
- for tup in g.project.dependency_dict[filename]:
- if tup[0] and tup[1].endswith(process_ext):
- print tup[1], ' is updated'
+ for lst in g.project.dependency_dict[filename]:
+ if lst[0] and lst[1].endswith(process_ext):
+ print lst[1], ' is updated'
return icon.load_icon(self.icon_lut['updated'], 22, 0)
# If nothing found in the loop, then it is outdated
return icon.load_icon(self.icon_lut['outdated'], 22, 0)
def flatten(self, lst):
+ """!
+ Method to flatten a nested list with tuple or list elements.
+ @param lst the nested list to flatten
+ """
for elem in lst:
if type(elem) in (tuple, list):
for i in self.flatten(elem):
@@ -196,13 +214,11 @@ class Utils:
"""!
Method to update the gEDA Manager's project file list any time
the 'Sources' tree view is changed.
- @param gedamanager: The current gEDAManager instance
- @type gedamanager: gEDAManager
- @param index: (0 = add copy source, 1 = delete source,
- 2 = delete folder)
- @type index: int
- @param filepath: filepath of the source to copy
- @type filepath: string
+ @param gedamanager is the current gEDAManager instance
+ @param index (0 = add copy source, 1 = delete source,
+ 2 = delete folder, 3 = add a new source, 4 = remove source,
+ 5 = remove folder)
+ @param filepath of the source to copy
"""
g = gedamanager
def child_recurse(row_iter):
@@ -239,9 +255,6 @@ class Utils:
icon = gtk.IconTheme()
image = icon.load_icon(self.icon_lut[self.get_node_ext(filename)], 22, 0)
path = selected_node + '/' + filename
-## print 'path:',path
-## print 'filepath:',filepath
-## print 'filename:',filename
if index == 0:
# Logic here for copying the file to the selected_node's folder
@@ -263,7 +276,6 @@ class Utils:
g.sources.remove(selection_iter)
g.output_textbuffer.insert(g.output_textiter, self.get_time() + ':\nDeleted ' + selected_node + '.\n')
node = self.get_node_name(selected_node)
- print 'count:',list(self.flatten(g.project.file_list)).count(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:
@@ -287,7 +299,22 @@ class Utils:
g.project.dependency_dict[filename] = []
else:
g.output_textbuffer.insert(g.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
+ g.sources.remove(selection_iter)
+ # Remove from dependency list
+ 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):
+ 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:
@@ -310,14 +337,14 @@ class Utils:
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 is the current gEDAManager instance.
- @param selected_node is the selected node in the 'Sources' tree view.
+ @param gedamanager is the current gEDAManager instance
+ @param selected_node is the selected node in the 'Sources' tree view
@param ext is the filename extension for the currently selected node
- in the 'Sources' tree view.
+ in the 'Sources' tree view
@param folder is a flag used to let the method know whether or not a
- folder has been selected.
+ folder has been selected
@param clear is a paramater that is used to force a clearing of the
- processes model.
+ processes model
"""
g = gedamanager
current_directory = os.getcwd()
@@ -365,33 +392,41 @@ class Utils:
g.processes.append(create_pcb, ['gsch2pcb', image, status_image])
# Netlists
- image = icon.load_icon(self.icon_lut['other'], 22, 0)
+ image = icon.load_icon(self.icon_lut['net'], 22, 0)
gnetlist = g.processes.append(create_netlist, ['gnetlist', image, None])
for netlist in sorted(self.netlists):
status_image = self.get_status_image(g, selected_node, netlist)
g.processes.append(gnetlist, [netlist, None, status_image])
# Modify attributes
- image = icon.load_icon(self.icon_lut['other'], 22, 0) #refdes
- g.processes.append(modify_attributes, ['refdes_renum', image, None])
- image = icon.load_icon(self.icon_lut['other'], 22, 0) #grenum
- g.processes.append(modify_attributes, ['grenum', image, None])
+ image = icon.load_icon(self.icon_lut['other'], 22, 0) #refdes -- TODO
+ g.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])
image = icon.load_icon(self.icon_lut['gattrib'], 22, 0)
g.processes.append(modify_attributes, ['gattrib', image, None])
elif ext == 'pcb':
- # Parent folders
- create_gerber = g.processes.append(None, ['Create or Update Gerber files', None, None])
- image = icon.load_icon(self.icon_lut['pcb'], 22, 0)
+ # Export
+ export = g.processes.append(None, ['Export', None, None])
status_image = self.get_status_image(g, selected_node, 'gbr')
- g.processes.append(create_gerber, ['pcb', image, status_image])
-
+ gerber = g.processes.append(export, ['RS-274X (Gerber) file(s)', None, status_image])
+ # May need to add for bom1 and bom2
+ status_image = self.get_status_image(g, selected_node, 'bom')
+ bom = g.processes.append(export, ['Bill of Materials (BOM) file(s)', None, status_image])
+ status_image = self.get_status_image(g, selected_node, 'em')
+ nelma = g.processes.append(export, ['Numerical analysis (Nelma) file(s)', None, status_image])
+ status_image = self.get_status_image(g, selected_node, 'png')
+ png = g.processes.append(export, ['GIF/JPEG/PNG file(s)', None, status_image])
+ status_image = self.get_status_image(g, selected_node, 'ps')
+ ps = g.processes.append(export, ['Postscript file(s)', None, status_image])
+ status_image = self.get_status_image(g, selected_node, 'eps')
+ eps = g.processes.append(export, ['Encapsulated Postscript file(s)', None, status_image])
+ # Print
+ _print = g.processes.append(None, ['Print (lpr)', None, None])
+
elif ext == 'gbr':
- # Parent folders
- analyze_gerber = g.processes.append(None, ['View Gerber file', None, None])
- image = icon.load_icon(self.icon_lut['gbr'], 22, 0)
- g.processes.append(analyze_gerber, ['gerbv', image, None])
-
+ pass # Decide if any processes later
elif ext == 'sym':
# Parent folders
check_symbols = g.processes.append(None, ['Check Symbols', None, None])
@@ -431,18 +466,20 @@ class Utils:
"""!
Event occurs when 'row-activated' signal is emitted or a user double
clicks on a treeview row.
- @param widget that threw the event.
+ @param widget that threw the event
@param path of the row of the cell to be activated in the gtk.TreeView
- object.
+ object
@param view_column is the gtk.TreeViewColumn of the cell to be
- activated.
- @param gedamanager is the current gEDAManager instance.
+ activated
+ @param gedamanager is the current gEDAManager instance
"""
g = gedamanager
selected_node = g.sources[path][2]
- if '.' in selected_node: # We have a file
- name = g.sources[path][1]
- ext = name.split('.')[-1]
+ filename = g.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)
@@ -452,12 +489,12 @@ class Utils:
"""!
Event occurs when 'row-activated' signal is emitted or a user double
clicks on a treeview row.
- @param widget that threw the event.
+ @param widget that threw the event
@param path of the row of the cell to be activated in the gtk.TreeView
- object.
+ object
@param view_column is the gtk.TreeViewColumn of the cell to be
- activated.
- @param gedamanager is the current gEDAManager instance.
+ activated
+ @param gedamanager is the current gEDAManager instance
"""
g = gedamanager
selected_node = g.processes[path][0]
@@ -474,27 +511,20 @@ class Utils:
def run_command(self, gedamanager, filepath, highlighted_source=None, ext=None):
"""!
Method to run commands for 'Processes' and 'Sources'.
- @param gedamanager is the current gEDAManager instance.
- @param filepath is the selected 'Sources' or 'Processes' node.
+ @param gedamanager is the current gEDAManager instance
+ @param filepath is the selected 'Sources' or 'Processes' node
@param highlighted_source is the highlighted 'Sources' node that
- is being used for the current process.
- @param ext is the extension of the selected file.
+ is being used for the current process
+ @param ext is the extension of the selected file
"""
g = gedamanager
- files = ['net','log','bom','bom1','bom2','v','vhd','gm','gafrc','txt']
+ files = ['net','log','bom','bom1','bom2','v','vhd','gm','txt']
# Sources
if ext != None:
if ext == 'sch' or ext == 'sym':
if g.tools['sch'] == None or g.tools['sch'].poll() == 0:
g.tools['sch'] = Popen(['gschem', filepath], stdin=PIPE)
elif g.tools['sch'].poll() == None: # Process is still running
-## pcb_instances = self.dbus_iface.ListQueuedOwners('org.seul.geda.gschem')
-## for pcb in pcb_instances:
-## # Let's end it
-## pcb_obj = self.session_bus.get_object(pcb, '/org/seul/geda/gschem')
-## self.pcb_actions_iface = dbus.Interface(pcb_obj, 'org.seul.geda.gschem.actions')
-## print 'HEY'
-## self.pcb_actions_iface.ExecAction('Quit', self.empty_char_array)
# Let's try to open a file
try:
st = os.stat(filepath)
@@ -507,44 +537,38 @@ class Utils:
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
- pcb_instances = self.dbus_iface.ListQueuedOwners('org.seul.geda.pcb')
- for pcb in pcb_instances:
- # Let's end it
- pcb_obj = self.session_bus.get_object(pcb, '/org/seul/geda/pcb')
- self.pcb_actions_iface = dbus.Interface(pcb_obj, 'org.seul.geda.pcb.actions')
- self.pcb_actions_iface.ExecAction('Quit', self.empty_char_array)
+ 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
- pass
- elif ext in files and g.settings.editor != None:
+ print 'gerbv is open'
+ if (ext in files or ext in self.configfiles) and g.settings.editor != None:
# Need to put some logic here to make sure it is a valid program
if g.tools['editor'] == None or g.tools['editor'].poll() == 0:
g.tools['editor'] = Popen([g.settings.editor, filepath])
elif g.tools['editor'].poll() == None: # Process is still running
pass
- elif g.settings.editor == None:
- dialog = gtk.MessageDialog(g.window,
- (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
- gtk.MESSAGE_INFO,
- gtk.BUTTONS_OK,
- gtk.STOCK_DIRECTORY)
- dialog.set_markup('<b>Please go to Edit->Preferences and choose a default text editor.</b>')
- dialog.show()
- response = dialog.run()
- dialog.destroy()
+ elif g.settings.editor == None:
+ dialog = gtk.MessageDialog(g.window,
+ (gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT),
+ gtk.MESSAGE_INFO,
+ gtk.BUTTONS_OK,
+ gtk.STOCK_DIRECTORY)
+ dialog.set_markup('<b>Please go to Edit->Preferences and choose a default text editor.</b>')
+ dialog.show()
+ response = dialog.run()
+ dialog.destroy()
else: # Processes
# The filepath in this case is actually the program to run
# so we will make the substitution to make it clearer
-
+ program = filepath
# Call the function for the row that was double clicked
# Need to figure out if the program to run will produce files
# and whether or not it is currently running (GUI only)
# Netlists
- program = filepath
if program in self.netlists: # use gnetlist
if program == 'gnetlist':
return
@@ -568,26 +592,25 @@ class Utils:
arg = '-v ' + highlighted_source
subproc = Popen([program, arg])
else:
- subproc = Popen([program, highlighted_source])
+ print 'program:',program
+ subproc = Popen([program, highlighted_source])
@exceptions
def update_dependency_dict(self, gedamanager, filename):
"""!
- Method to update the dependencies for filename
- @param gedamanager: current gEDAManager instance
- @type gedamanager: gEDAManager
- @param filename: file that will have its dependencies updated
- @type filename: string
+ Method to update the dependencies for filename.
+ @param gedamanager of the current gEDAManager instance
+ @param filename of the file that will have its dependencies updated
"""
# We just need to create a new list and set that as the value
print 'UPDATING'
new_list = []
- for tup in gedamanager.project.dependency_dict[filename]:
- print tup, ' for updating tup'
- tup[0] = False
- new_list.append(tup)
+ for lst in gedamanager.project.dependency_dict[filename]:
+ print lst, ' for updating lst'
+ lst[0] = False
+ new_list.append(lst)
# Now set the new_list as the value for filename
print 'new_list:', new_list
gedamanager.project.dependency_dict[filename] = new_list
@@ -598,10 +621,8 @@ class Utils:
def add_to_dependency_dict(self, gedamanager, filename):
"""!
Method to add a file to the project's dependency_dict.
- @param gedamanager: The current gEDAManager instance
- @type gedamanager: gEDAManager
- @param filename: filename is the name of the file to add to project.dependency_dict
- @type filename: string
+ @param gedamanager of the current gEDAManager instance
+ @param filename of the file to add to project.dependency_dict
"""
g = gedamanager
# add file to the dependency_dict
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs