[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: geda_manager.git: branch: master updated (a5231e95a421d68cf83a36782e963d598a323bfb)
The branch, master has been updated
via a5231e95a421d68cf83a36782e963d598a323bfb (commit)
from 512afc310b1314c0b13c10e2a830c6bcba4c79ed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/gedamanager.py | 81 ++++++++++++++++++++-------------
src/utils.py | 128 ++++++++++++++++++++++++++-------------------------
2 files changed, 115 insertions(+), 94 deletions(-)
=================
Commit Messages
=================
commit a5231e95a421d68cf83a36782e963d598a323bfb
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date: Wed Jul 30 01:23:26 2008 -0700
Routine checkin. DOES NOT BUILD. Just checking in changes as backup.
:100644 100644 7ceb890... e139efb... M src/gedamanager.py
:100644 100644 3cce376... 5dac5f1... M src/utils.py
=========
Changes
=========
commit a5231e95a421d68cf83a36782e963d598a323bfb
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date: Wed Jul 30 01:23:26 2008 -0700
Routine checkin. DOES NOT BUILD. Just checking in changes as backup.
diff --git a/src/gedamanager.py b/src/gedamanager.py
index 7ceb890..e139efb 100644
--- a/src/gedamanager.py
+++ b/src/gedamanager.py
@@ -165,7 +165,7 @@ class gEDAManager:
sources_notebook.set_tab_label(sources_notebook.get_nth_page(0), sources_label)
processes_notebook.set_tab_label(processes_notebook.get_nth_page(0), processes_label)
self.sources = gtk.TreeStore(gtk.gdk.Pixbuf, str, str)
- self.processes = gtk.TreeStore(gtk.gdk.Pixbuf, str)
+ self.processes = gtk.TreeStore(str, gtk.gdk.Pixbuf)
# Tree views
self.sources_tree = gtk.TreeView(self.sources)
@@ -183,15 +183,18 @@ class gEDAManager:
sources_cell = gtk.CellRendererText()
column = gtk.TreeViewColumn(None, sources_cell, text=1)
self.sources_tree.append_column(column)
- column = gtk.TreeViewColumn('Processes for: ', gtk.CellRendererPixbuf(), pixbuf=0)
+ column = gtk.TreeViewColumn('Processes for: ', gtk.CellRendererText(), text=0)
self.processes_tree.append_column(column)
- column = gtk.TreeViewColumn(None, gtk.CellRendererText(), text=1)
+ processes_pixbuf = gtk.CellRendererPixbuf()
+ processes_pixbuf.set_property('xalign', 0)
+ column = gtk.TreeViewColumn(None, processes_pixbuf, pixbuf=1)
self.processes_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)
+
# make it searchable
self.sources_tree.set_search_column(0)
self.processes_tree.set_search_column(0)
@@ -396,29 +399,37 @@ class gEDAManager:
manipulate the project's file list. The rest is done in the Utils
class. The reason we do it here is because it is a brand new project
and it is not a bid deal to push out a utility just for this. """
- self.project.file_list = [self.project.directory, [self.project.directory +'/' + self.project.name + '.gm']]
+ self.project.file_list = [self.project.name, [self.project.name + '.gm']]
- def load_tree(self, list, parent=None):
+ def load_tree(self, file_list, parent=None):
"""!
Method to the load the tree -- recursively.
@param list of paths in the project's file_list.
@param parent node to help setup the gtk.TreeView object.
"""
-
- for file_path in list:
- if file_path[0] == '/': # means this file is a parent
- name = self.utils.get_node_name(file_path)
- if file_path == self.project.directory:
- icon = gtk.IconTheme()
- image = icon.load_icon(self.utils.icon_lut['project'], 22, 0)
- else:
- icon = gtk.IconTheme()
- image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(name)], 22, gtk.ICON_LOOKUP_NO_SVG)
- n_parent = self.sources.append(parent, [image, name, file_path])
- else:
- # recursion
- self.load_tree(file_path, n_parent)
+ # 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(parent, [image, file_list[0], self.project.directory])
+ file_list = file_list[1]
+ parent = n_parent
+
+ # In the file_list we have folders, nodes, and 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):
+ 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_tree(f, n_parent)
+ else: # We have a node
+ file_path = self.project.directory + '/' + f
+ image = icon.load_icon(self.utils.icon_lut[self.utils.get_node_ext(f)], 22, 0)
+ n_parent = self.sources.append(parent, [image, f, file_path])
def save_settings(self):
@@ -505,21 +516,21 @@ class gEDAManager:
@exceptions
def write_logs(self):
- """!
+ """
Method to write out the error and output logs with what is in
the textbuffers.
"""
startiter, enditer = self.output_textbuffer.get_bounds()
output = self.output_textbuffer.get_text(startiter, enditer)
os.chdir(self.project.directory)
- f = file('output.txt', 'w')
+ f = file('output.log', 'w')
f.writelines(output)
f.close()
startiter, enditer = self.errors_textbuffer.get_bounds()
errors = self.errors_textbuffer.get_text(startiter, enditer)
os.chdir(self.project.directory)
- f = file('errors.txt', 'w')
+ f = file('errors.log', 'w')
f.writelines(errors)
f.close()
@@ -811,7 +822,8 @@ class gEDAManager:
dialog.destroy()
new_path = old_path.rpartition('/')[0] + '/' + new_text
- if old_path == self.project.directory: # Project 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
@@ -819,24 +831,31 @@ class gEDAManager:
os.remove(project_file)
self.project.directory = new_path
self.project.name = new_text
- self.project.file_list[0] = new_path
- self.project.file_list[1][0] = new_path + '/' + new_text + '.gm'
+## self.project.file_list[0] = new_path
+## self.project.file_list[1][0] = new_path + '/' + new_text + '.gm'
self.project.save()
+
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')
- elif '.' in new_text and '.' in old_path: # File
+
+ 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, old_path + ' changed to ' + new_path + '.\n')
+ 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
- else: # Folder -- so image does not need to be changed
+
+ 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
@@ -947,18 +966,18 @@ class gEDAManager:
# Choose Popup Menu
if selected_node == self.project.directory:
# Project Folder
- merge_id = self.popup_uimanager.add_ui_from_file(self.utils.get_file(self, 'project_popup.xml'))
+ merge_id = self.popup_uimanager.add_ui_from_file(self.utils.directory + '/project_popup.xml')
popup_menu = self.popup_uimanager.get_widget('/popup')
elif '.' not in selected_node:
# Folder
- merge_id = self.popup_uimanager.add_ui_from_file(self.utils.get_file(self, 'folder_popup.xml'))
+ merge_id = self.popup_uimanager.add_ui_from_file(self.utils.directory + '/folder_popup.xml')
popup_menu = self.popup_uimanager.get_widget('/popup')
else:
# File
if selected_node.endswith('.gm'):
return
- merge_id = self.popup_uimanager.add_ui_from_file(self.utils.get_file(self, 'file_popup.xml'))
+ merge_id = self.popup_uimanager.add_ui_from_file(self.utils.directory + '/file_popup.xml')
popup_menu = self.popup_uimanager.get_widget('/popup')
popup_menu.connect('deactivate', self.cb_popup_deactivate, merge_id)
diff --git a/src/utils.py b/src/utils.py
index 3cce376..5dac5f1 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -72,11 +72,11 @@ class Utils:
def __init__(self):
""" Constructor. """
self.directory = os.getcwd()
- self.__lut__()
+ self.__icons__()
- def __lut__(self):
- """ Method to load the look up tables. """
+ def __icons__(self):
+ """ Method to load the icon look up table. """
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/icons/terminal.jpg')
@@ -102,7 +102,9 @@ class Utils:
- self.icon_lut = {'spice': 'spice',
+ self.icon_lut = {'gattrib': 'geda-gattrib',
+ 'gschem': 'geda-gschem',
+ 'spice': 'spice',
'other': 'other',
'vhd': 'vhd',
'vhdl': 'vhdl',
@@ -115,36 +117,18 @@ class Utils:
'gEDAManager': 'gEDAManager',
'sch': 'application-x-geda-schematic',
'sym': 'application-x-geda-symbol',
- 'net': 'application-x-geda-netlist',
'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',
- 'cnc': 'application-x-excellon'}
+ 'gerber': 'application-x-gerber',
+ 'cnc': 'application-x-excellon',
+ 'net': 'application-x-geda-netlist',
+ 'exc': 'application-x-excellon',
+ 'fp': 'application-x-pcb-footprint'}
- self.file_lut = {'project_popup': 'project_popup.xml',
- 'folder_popup': 'folder_popup.xml',
- 'file_popup': 'file_popup.xml'}
-
-
- @exceptions
- def get_file(self, gedamanager, filename):
- """!
- Method to get the file from the file look up table.
- @param gedamanager is the current gEDAManager instance.
- @param filename is the file to find.
- @returns path to the file.
- """
- current_directory = os.getcwd()
- os.chdir(self.directory)
- if '.' in filename:
- key = filename.split('.')[0]
- f = self.directory + '/' + self.file_lut[key]
- os.chdir(current_directory)
- return f
-
def get_node_name(self, path):
"""!
@@ -155,7 +139,7 @@ class Utils:
if '/' in path:
return path.split('/')[-1]
else:
- return None
+ return ''
def get_node_ext(self, path):
@@ -191,7 +175,7 @@ class Utils:
while True:
try:
child_row = row_iter.next()
- child_list.append(child_row[2])
+ child_list.append(child_row[1])
child_row_iter = child_row.iterchildren()
if child_row_iter != None:
child_list.append(child_recurse(child_row_iter))
@@ -216,6 +200,7 @@ class Utils:
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
+ print 'selected_node:',selected_node
files = os.listdir(selected_node)
if name not in files:
os.system('cp ' + filename + ' ' + selected_node)
@@ -242,7 +227,7 @@ class Utils:
for row in g.sources:
# Get the name of the node
if row[2] == g.project.directory: # Project Folder
- g.project.file_list.append(row[2])
+ 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 = child_recurse(row_iter)
@@ -262,39 +247,56 @@ class Utils:
@param ext is the filename extension for the currently selected node
in the 'Sources' tree view.
"""
-## g = gedamanager
-## current_directory = os.getcwd()
-## os.chdir(self.directory)
-## g.processes.clear()
-## if ext == 'sch':
-## icon_type = self.icon_lut['g2p']
-## g.processes.append(None, [image, 'gsch2pcb'])
-## icon_type = self.icon_lut['other']#icon_type = self.icon_lut['net']
-## image = gtk.gdk.pixbuf_new_from_file(icon_type)
-## parent = g.processes.append(None, [image, 'gnetlist'])
-## 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']
-## for netlist in sorted(netlists):
-## g.processes.append(parent, [None, netlist])
-## icon_type = self.icon_lut['other']
-## image = gtk.gdk.pixbuf_new_from_file(icon_type)
-## g.processes.append(None, [image, 'refdes_renum'])
-## icon_type = self.icon_lut['other']
-## image = gtk.gdk.pixbuf_new_from_file(icon_type)
-## g.processes.append(None, [image, 'grenum'])
-## icon_type = self.icon_lut['spice']
-## image = gtk.gdk.pixbuf_new_from_file(icon_type)
-## g.processes.append(None, [image, 'gspiceui'])
-## icon_type = self.icon_lut['gattribrc']
-## image = gtk.gdk.pixbuf_new_from_file(icon_type)
-## g.processes.append(None, [image, 'gattrib'])
-## elif ext == 'v':
-## pass
-## elif ext == 'pcb':
-## pass
-## # add more
-## if ext == None: # We have a folder, so we will need to look through
-## pass
+ g = gedamanager
+ current_directory = os.getcwd()
+ os.chdir(self.directory)
+ g.processes.clear()
+ icon = gtk.IconTheme()
+ if ext == 'sch':
+ # Parent folders
+ simulation = g.processes.append(None, ['Simulation', None])
+ create_pcb = g.processes.append(None, ['Create pcb', None])
+ create_netlist = g.processes.append(None, ['Create netlist', None])
+ modify_attributes = g.processes.append(None, ['Modify attributes', None])
+
+ # Simulate
+ image = icon.load_icon(self.icon_lut['spice'], 22, 0)
+ g.processes.append(simulation, ['gspiceui', image])
+
+ # PCB
+ image = icon.load_icon(self.icon_lut['g2p'], 22, 0)
+ g.processes.append(create_pcb, ['gsch2pcb', image])
+
+ # Netlists
+ 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']
+ image = icon.load_icon(self.icon_lut['other'], 22, 0)
+ gnetlist = g.processes.append(create_netlist, ['gnetlist', image])
+ for netlist in sorted(netlists):
+ g.processes.append(gnetlist, [netlist, None])
+
+ # Modify attributes
+ image = icon.load_icon(self.icon_lut['other'], 22, 0) #refdes
+ g.processes.append(modify_attributes, ['refdes_renum', image])
+ image = icon.load_icon(self.icon_lut['other'], 22, 0) #grenum
+ g.processes.append(modify_attributes, ['grenum', image])
+ image = icon.load_icon(self.icon_lut['gattrib'], 22, 0)
+ g.processes.append(modify_attributes, ['gattrib', image])
+
+ elif ext == 'pcb':
+ # Parent folders
+ create_gerber = g.processes.append(None, ['Create Gerber files', None])
+ image = icon.load_icon(self.icon_lut['pcb'], 22, 0)
+ g.processes.append(create_gerber, ['PCB', image])
+
+ elif ext == 'gbr':
+ # Parent folders
+ analyize_gerber = g.processes.append(None, ['View Gerber file', None])
+ image = icon.load_icon(self.icon_lut['gbr'], 22, 0)
+ g.processes.append(modify_attributes, ['Gerbv', image])
+
+ if ext == None: # We have a folder, so we will need to look through
+ pass
-## os.chdir(current_directory)
+ os.chdir(current_directory)
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs