[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: branch: master updated (f9ebd2a7cbe872e8086fff2601ed1a1f6cb61fe3)
The branch, master has been updated
via f9ebd2a7cbe872e8086fff2601ed1a1f6cb61fe3 (commit)
from 9823a0908c711381bd09dbcf0fa2415009e8e9ca (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 | 303 +++++++++++++++++++++++++--------------------------
src/newproject.py | 26 ++---
src/project.py | 16 ++--
src/settings.py | 11 +--
src/utils.py | 31 +++---
5 files changed, 188 insertions(+), 199 deletions(-)
=================
Commit Messages
=================
commit f9ebd2a7cbe872e8086fff2601ed1a1f6cb61fe3
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date: Sat Jul 19 16:21:25 2008 -0700
Routine checking. Error notebook output and Output notebook output working.
:100644 100644 6161475... 9b02194... M src/gedamanager.py
:100644 100644 d12c1a5... d0fa8e8... M src/newproject.py
:100644 100644 07697c3... 8d0647e... M src/project.py
:100644 100644 d96c851... d0f9847... M src/settings.py
:100644 100644 bfa10da... 3a4fbb9... M src/utils.py
=========
Changes
=========
commit f9ebd2a7cbe872e8086fff2601ed1a1f6cb61fe3
Author: Newell Jensen <jensen@xxxxxxxxxxxxxxx>
Date: Sat Jul 19 16:21:25 2008 -0700
Routine checking. Error notebook output and Output notebook output working.
diff --git a/src/gedamanager.py b/src/gedamanager.py
index 6161475..9b02194 100644
--- a/src/gedamanager.py
+++ b/src/gedamanager.py
@@ -4,13 +4,13 @@
#Top-level window for the gEDA Manager
#@author Newell Jensen
-import os, sys, gtk, pygtk, yaml, gnomevfs, gobject, shutil, vte
+import os, sys, gtk, pygtk, yaml, gnomevfs
+import gobject, shutil, vte, logging
pygtk.require('2.0')
from project import *
from settings import *
from utils import *
from newproject import *
-from distutils.dir_util import remove_tree
# i18n TODO
import gettext
@@ -22,9 +22,7 @@ class gEDAManager:
and communication with lower level objects.
"""
def __init__(self):
- """
- gEDAManager Constructor
- """
+ """ gEDAManager Constructor. """
# Initialize gEDA Manager
self.no_project_name = 'No project loaded...\n\n Select:\n File->Open Project\n or File->New Project'
self.settings = Settings()
@@ -56,20 +54,21 @@ class gEDAManager:
self.__init_gui_sections__()
self.set_menu_defaults()
self.window.show()
-## splash_screen.destroy()
+
#####################################################
# Initializer Methods -- methods to create the window
#####################################################
def __init_about_dialog__(self):
- """
- Method to create the about dialog.
- """
+ """ Method to create the about dialog. """
+
def about_url_cb(dialog, link, user_data):
- """
+ """!
Call back function to test url for the about dialog
- @param
+ @param dialog is the about dialog object.
+ @param link is the the url link that was clicked.
+ @param user_data is user data that was passed in.
"""
try:
gnomevfs.url_show(link)
@@ -98,9 +97,7 @@ class gEDAManager:
def __init_menus__(self):
- """
- Method to create the menu bar.
- """
+ """ Method to create the menu bar. """
actiongroup0 = gtk.ActionGroup('gEDAManager')
actiongroup0_list = [('File', None, '_File'),
@@ -212,9 +209,7 @@ class gEDAManager:
def __init_gui_sections__(self):
- """
- Method to create the main gui sections of the top-level window.
- """
+ """ Method to create the main gui sections of the top-level window. """
# Partitioning the window
vpaned1 = gtk.VPaned()
self.vbox1.pack_start(vpaned1, True, True, 0)
@@ -313,59 +308,66 @@ class gEDAManager:
notebook.show()
vpaned1.pack2(notebook, True, True)
notebook.set_tab_pos(gtk.POS_BOTTOM)
- scrolled_window5 = gtk.ScrolledWindow()
- scrolled_window5.show()
+ terminal_scrolled_window = gtk.ScrolledWindow()
+ terminal_scrolled_window.show()
# Add a terminal to the terminal output notebook
- for f in sys.argv:
- print f
current_directory = os.getcwd()
try:
os.chdir(self.project.directory)
except:
- print 'Unable to switch to', self.project.directory
- term = vte.Terminal()
- term.connect("child-exited", lambda terminal: gtk.main_quit())
- term.fork_command()
- term.show()
+ print 'Unable to switch to directory:', self.project.directory
+ terminal = vte.Terminal()
+ terminal.connect('child-exited', lambda term: gtk.main_quit())
+ terminal.fork_command()
+ terminal.show()
try:
os.chdir(current_directory)
except:
- print 'Unable to switch to', current_directory
- scrolled_window5.set_shadow_type(gtk.SHADOW_IN)
- scrolled_window5.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scrolled_window5.add_with_viewport(term)
- notebook.add(scrolled_window5)
+ print 'Unable to switch to directory:', current_directory
+
+ terminal_scrolled_window.set_shadow_type(gtk.SHADOW_IN)
+ terminal_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ terminal_scrolled_window.add_with_viewport(terminal)
+ notebook.add(terminal_scrolled_window)
terminal_icon = gtk.Image()
terminal_icon.set_from_file('../images/icons/terminal.jpg')
terminal_icon.show()
notebook.set_tab_label(notebook.get_nth_page(0), terminal_icon)
- scrolled_window3 = gtk.ScrolledWindow()
- scrolled_window3.show()
- scrolled_window3.set_shadow_type(gtk.SHADOW_IN)
- scrolled_window3.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- notebook.add(scrolled_window3)
+ output_scolled_window = gtk.ScrolledWindow()
+ output_scolled_window.show()
+ output_scolled_window.set_shadow_type(gtk.SHADOW_IN)
+ output_scolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ notebook.add(output_scolled_window)
- textview2 = gtk.TextView()
- textview2.show()
- scrolled_window3.add(textview2)
+ output_textview = gtk.TextView()
+ output_textview.set_editable(False)
+ output_textview.set_cursor_visible(False)
+ self.output_textbuffer = output_textview.get_buffer()
+ self.output_textiter = self.output_textbuffer.get_start_iter()
+ output_textview.show()
+ output_scolled_window.add(output_textview)
output_icon = gtk.image_new_from_stock('gtk-justify-fill',
gtk.ICON_SIZE_BUTTON)
output_icon.show()
notebook.set_tab_label(notebook.get_nth_page(1), output_icon)
- scrolled_window4 = gtk.ScrolledWindow()
- scrolled_window4.show()
- scrolled_window4.set_shadow_type(gtk.SHADOW_IN)
- scrolled_window4.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- notebook.add(scrolled_window4)
+ errors_scrolled_window = gtk.ScrolledWindow()
+ errors_scrolled_window.show()
+ errors_scrolled_window.set_shadow_type(gtk.SHADOW_IN)
+ errors_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+ notebook.add(errors_scrolled_window)
- textview3 = gtk.TextView()
- textview3.show()
- scrolled_window4.add(textview3)
+ errors_textview = gtk.TextView()
+ errors_textview.set_editable(False)
+ errors_textview.set_cursor_visible(False)
+ self.errors_textbuffer = errors_textview.get_buffer()
+ self.errors_textiter = self.errors_textbuffer.get_start_iter()
+ errors_textview.show()
+ errors_scrolled_window.add(errors_textview)
errors_icon = gtk.image_new_from_stock('gtk-dialog-error',
gtk.ICON_SIZE_BUTTON)
@@ -379,8 +381,8 @@ class gEDAManager:
def set_menu_defaults(self):
"""
- Method to coordiante which methods should be called to handle the
- sensitivity of the menu items.
+ Method to coordiante which methods should be called to handle
+ the sensitivity of the menu items.
"""
# Project
if self.project.name == None or self.project.name == self.no_project_name:
@@ -550,7 +552,7 @@ class gEDAManager:
def set_project(self, path):
- """
+ """!
Method to set current project to the one on path.
@param path of project to open.
"""
@@ -559,12 +561,12 @@ class gEDAManager:
self.project.save()
self.project.open(path)
-
+ self.output_textbuffer.insert(self.output_textiter,
+ 'Project set to: ' + self.project.name + '\n')
def set_sources_tree_to_project(self):
- """
- Method to set the tree to current project object.
- """
+ """ 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)
@@ -572,9 +574,8 @@ class gEDAManager:
def set_sources_tree_to_new_project(self):
- """
- Method to set the tree to newly created project object.
- """
+ """ Method to set the tree to newly created project object. """
+
self.sources.clear()
# Parent Folder
@@ -588,17 +589,19 @@ class gEDAManager:
self.sources.append(parent, [image, self.project.name, path])
self.sources_tree.expand_all()
- # This is the only place in the gEDA Manager where we actually
- # manipulate the project's file list. The rest is done in the Utils
- # class.
+ """ This is the only place in the gEDA Manager where we actually
+ 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]]
def load_tree(self, 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)
@@ -613,9 +616,8 @@ class gEDAManager:
def save_settings(self):
- """
- Method to save current settings to .gmrc file.
- """
+ """ Method to save current settings to .gmrc file. """
+
if self.project.directory and self.project.name:
if not self.project.name.endswith('.gm'):
self.settings.project = self.project.directory + '/' + self.project.name + '.gm'
@@ -628,7 +630,7 @@ class gEDAManager:
def get_processes_selected_node(self):
- """
+ """!
Method to get the selected node in the 'Processes' treeview.
@return path of the selected node.
"""
@@ -641,7 +643,7 @@ class gEDAManager:
def file_filters(self, dialog):
- """
+ """!
Method to abstract some redundant code that is used in the message
dialog boxes.
@param dialog is gtk.FileChooserDialog object.
@@ -705,7 +707,7 @@ class gEDAManager:
# Help Menu #
def cb_show_about_dialog(self, menuitem, data=None):
- """
+ """!
Event handler for About menu button.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -716,7 +718,7 @@ class gEDAManager:
def cb_url_geda_wiki(self, menuitem, data=None):
- """
+ """!
Event handler for gEDA Wiki.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -724,12 +726,11 @@ class gEDAManager:
try:
gnomevfs.url_show('http://geda.seul.org/wiki/')
except:
- print 'Unexpected error:', sys.exc_info()[0]
- raise
+ self.errors_textbuffer.insert(self.errors_textiter, 'Unexpected error: ' + sys.exc_info()[0] + '.\n')
def cb_url_geda_documentation(self, menuitem, data=None):
- """
+ """!
Event handler for gEDA Documentation.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -737,12 +738,11 @@ class gEDAManager:
try:
gnomevfs.url_show('http://geda.seul.org/wiki/geda:documentation')
except:
- print 'Unexpected error:', sys.exc_info()[0]
- raise
+ self.errors_textbuffer.insert(self.errors_textiter, 'Unexpected error: ' + sys.exc_info()[0] + '.\n')
def cb_url_geda_manager(self, menuitem, data=None):
- """
+ """!
Event handler for gEDA Manager.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -750,13 +750,12 @@ class gEDAManager:
try:
gnomevfs.url_show('http://www.gempillar.com')
except:
- print 'Unexpected error:', sys.exc_info()[0]
- raise
+ self.errors_textbuffer.insert(self.errors_textiter, 'Unexpected error: ' + sys.exc_info()[0] + '.\n')
# File Menu #
def cb_new_project(self, menuitem, data=None):
- """
+ """!
Event handler for 'New Project'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -766,7 +765,7 @@ class gEDAManager:
def cb_open_project(self, menuitem, data=None):
- """
+ """!
Event handler for 'Open Project'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -792,7 +791,7 @@ class gEDAManager:
def cb_close_project(self, menuitem, data=None):
- """
+ """!
Event handler for 'Close Project'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -801,8 +800,8 @@ class gEDAManager:
self.project.close();
- def cb_save_project_as(self, menuitem, date=None):
- """
+ def cb_save_project_as(self, menuitem, data=None):
+ """!
Event handler for 'Save Project As...'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -841,23 +840,14 @@ class gEDAManager:
filename = dialog.get_filename()
if not filename.endswith('.gm'):
filename += '.gm'
-## old_name = self.project.name
-## old_directory = self.project.directory
self.project.name = self.utils.get_node_name(filename)
self.project.directory = filename.rpartition('/')[0]
-## print old_name
-## print old_directory
-## print self.project.name
-## print self.project.directory
-## try:
-## os.system('rename ' + old_name + ' ' + ...
-
self.project.save()
dialog.destroy()
def cb_new(self, menuitem, data=None):
- """
+ """!
Event handler for a 'New' file.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -868,7 +858,7 @@ class gEDAManager:
def cb_open(self, menuitem, data=None):
- """
+ """!
Event handler to 'Open' a file.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -885,10 +875,10 @@ class gEDAManager:
if response == gtk.RESPONSE_OK:
filename = dialog.get_filename()
dialog.destroy()
+ self.output_textbuffer.insert(self.output_textiter, 'File opened: ' + filename + '.\n')
-
- def cb_close(self, menuitem, date=None):
- """
+ def cb_close(self, menuitem, data=None):
+ """!
Event handler to 'Close' a file.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -900,16 +890,16 @@ class gEDAManager:
selected_node = self.get_sources_selected_node()
- def cb_save(self, menuitem, date=None):
- """
+ def cb_save(self, menuitem, data=None):
+ """!
Event handler to 'Save' a file.
@param menuitem that threw the event.
@param data optional to pass in.
"""
- def cb_save_as(self, menuitem, date=None):
- """
+ def cb_save_as(self, menuitem, data=None):
+ """!
Event handler for 'Save As...'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -927,10 +917,10 @@ class gEDAManager:
if response == gtk.RESPONSE_OK:
filename = dialog.get_filename()
dialog.destroy()
+ self.output_textbuffer.insert(self.output_textiter, 'File saved as: ' + filename + '.\n')
-
- def cb_save_all(self, menuitem, date=None):
- """
+ def cb_save_all(self, menuitem, data=None):
+ """!
Event handler for 'Save All'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -938,7 +928,7 @@ class gEDAManager:
def cb_print_preview(self, menuitem, data=None):
- """
+ """!
Event handler for 'Print Preview'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -946,50 +936,50 @@ class gEDAManager:
def cb_print(self, menuitem, data=None):
- """
+ """!
Event handler for 'Print'
@param menuitem that threw the event.
@param data optional to pass in.
"""
- def cb_exit(self, menuitem, date=None):
- """
+ def cb_exit(self, menuitem, data=None):
+ """!
Event handler for 'Exit'.
@param menuitem that threw the event.
@param data optional to pass in.
"""
- print 'exiting'
+ self.output_textbuffer.insert(self.output_textiter, 'Exiting gEDA Manager.\n')
self.project.save()
self.save_settings()
# Edit Menu #
- def cb_cut(self, menuitem, date=None):
- """
+ def cb_cut(self, menuitem, data=None):
+ """!
Event handler for 'Cut'.
@param menuitem that threw the event.
@param data optional to pass in.
"""
- def cb_copy(self, menuitem, date=None):
- """
+ def cb_copy(self, menuitem, data=None):
+ """!
Event handler for 'Copy'.
@param menuitem that threw the event.
@param data optional to pass in.
"""
- def cb_paste(self, menuitem, date=None):
- """
+ def cb_paste(self, menuitem, data=None):
+ """!
Event handler for 'Paste'.
@param menuitem that threw the event.
@param data optional to pass in.
"""
- def cb_delete(self, menuitem, date=None):
- """
+ def cb_delete(self, menuitem, data=None):
+ """!
Event handler for 'Delete'.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -998,21 +988,21 @@ class gEDAManager:
def cb_output_toggled(self, menuitem, data=None):
- """
+ """!
Event occurs when the 'Output' check box is toggled.
@param menuitem that threw the event.
@param data optional to pass in.
"""
def cb_errors_toggled(self, menuitem, data=None):
- """
+ """!
Event occurs when the 'Errors' check box is toggled.
@param menuitem that threw the event.
@param data optional to pass in.
"""
def cb_warnings_toggled(self, menuitem, data=None):
- """
+ """!
Event occurs when the 'Warnings' check box is toggled.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -1020,7 +1010,7 @@ class gEDAManager:
def cb_terminal_toggled(self, menuitem, data=None):
- """
+ """!
Event occurs when the 'Terminal' check box is toggled.
@param menuitem that threw the event.
@param data optional to pass in.
@@ -1028,59 +1018,65 @@ class gEDAManager:
def cb_expander_activate(self, expander, data=None):
- """
+ """!
Event occurs when an expander is activated
- @param menuitem that threw the event.
+ @param expander that threw the event.
@param data optional to pass in.
"""
# TODO -- decide if I want to combine the three functions below
def cb_project_closed(self, widget, event):
- """
+ """!
Event occurs when a Project object is closed
- @param menuitem that threw the event.
- @param data optional to pass in.
+ @param widget that threw the event.
+ @param event that was thrown.
"""
- print 'project closed'
+ if self.project.name != None:
+ self.output_textbuffer.insert(self.output_textiter, 'Project ' + self.project.name + ' closed')
+ else:
+ self.output_textbuffer.insert(self.output_textiter, 'Project closed\n')
self.set_menu_defaults()
self.set_sources_tree_to_project()
def cb_project_saved(self, widget, event):
- """
+ """!
Event occurs when a Project object is saved.
- @param menuitem that threw the event.
- @param data optional to pass in.
+ @param widget that threw the event.
+ @param event that was thrown.
"""
- print 'project saved'
+ if self.project.name != None:
+ self.output_textbuffer.insert(self.output_textiter, 'Project ' + self.project.name + ' saved.\n')
+ else:
+ self.output_textbuffer.insert(self.output_textiter, 'Project saved.\n')
self.set_menu_defaults()
self.set_sources_tree_to_project()
def cb_project_opened(self, widget, event):
- """
+ """!
Event occurs when a Project object is opened
- @param menuitem that threw the event.
- @param data optional to pass in.
+ @param widget that threw the event.
+ @param event that was thrown.
"""
- print 'project opened'
+ self.output_textbuffer.insert(self.output_textiter, 'Project ' + self.project.name + ' opened.\n')
self.set_menu_defaults()
self.set_sources_tree_to_project()
def cb_project_created(self, widget, event):
- """
+ """!
Event occurs when a Project object is created
- @param menuitem that threw the event.
- @param data optional to pass in.
+ @param widget that threw the event.
+ @param event that was thrown.
"""
- print 'project created'
+ self.output_textbuffer.insert(self.output_textiter, 'Project created: ' + self.project.name + '.\n')
self.set_menu_defaults()
self.set_sources_tree_to_new_project()
def cb_add_copy_source(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.
@@ -1098,12 +1094,13 @@ class gEDAManager:
filename = dialog.get_filename()
self.utils.update_file_list(self, 0, filename)
dialog.destroy()
+ self.output_textbuffer.insert(self.output_textiter, 'Copy of source added: ' + filename + '.\n')
def cb_new_folder(self, action):
- """
+ """!
Event occurs when the user chooses to add a new folder to the project.
- @param gtk.Action object.
+ @param action is a gtk.Action object.
"""
def response_to_dialog(entry, dialog, response):
dialog.response(response)
@@ -1154,10 +1151,11 @@ class gEDAManager:
flag = False
i = i + 1
os.mkdir(path)
+ self.output_textbuffer.insert(self.output_textiter, 'Created directory: ' + path + '.\n')
except IOError, detail:
- print 'IOError:', detail
+ self.errors_textbuffer.insert(self.errors_textiter, 'IOError: ' + detail + '.\n')
except:
- print 'Unexpected error:', sys.exc_info()[0]
+ self.errors_textbuffer.insert(self.errors_textiter, 'Unexpected error: ' + sys.exc_info()[0] + '.\n')
raise
name = self.utils.get_node_name(path)
@@ -1168,7 +1166,7 @@ class gEDAManager:
self.utils.update_file_list(self)
def cb_delete_folder(self, widget):
- """
+ """!
Event occurs when the user chooses to delete a folder from the project.
@param widget that threw the event.
"""
@@ -1176,7 +1174,7 @@ class gEDAManager:
def cb_row_activated(self, widget, path, view_column):
- """
+ """!
Event occurs when 'row-activated' signal is emitted or a user double
clicks on a treeview row.
@param widget that threw the event.
@@ -1191,7 +1189,7 @@ class gEDAManager:
def cb_cursor_changed(self, widget):
- """
+ """!
Event occurs when the cursor changes in the treeview.
@param widget that threw the event.
"""
@@ -1205,19 +1203,18 @@ class gEDAManager:
def cb_popup_deactivate(self, popup_menu, merge_id):
- """
+ """!
Event occurs when the 'deactivate' signal is thrown from
the popup menu.
@param popup_menu is the popup_menu.
@param merge_id is the merge id from the popup uimanager.
- This needs to be removed so that ui's don't combine.
"""
# Remove the ui from the uimanager
self.popup_uimanager.remove_ui(merge_id)
def cb_treeview_popup(self, widget, event):
- """
+ """!
This signal handler will be called when the treeview emits
a 'button_press_event' signal.
@param widget that threw the event.
@@ -1242,7 +1239,7 @@ class gEDAManager:
('New Source...', gtk.STOCK_FILE, '_New Source...'),
('Add Copy of Source...', gtk.STOCK_DND_MULTIPLE, 'Add _Copy of Source...', None, None, self.cb_add_copy_source),
('New Folder', gtk.STOCK_DIRECTORY, 'New _Folder', None, None, self.cb_new_folder),
- ('Delete Folder', gtk.STOCK_CANCEL, '_Delete Folder', None, None, self.cb_delete_folder),]
+ ('Delete Folder', gtk.STOCK_DELETE, '_Delete Folder', None, None, self.cb_delete_folder),]
actiongroup.add_actions(actiongroup_list)
self.popup_uimanager.insert_action_group(actiongroup, 0)
@@ -1268,11 +1265,11 @@ class gEDAManager:
def cb_destroy(self, event):
- """
+ """!
Event handlder when the form is closed in any fashion.
@param event that was thrown.
"""
- print 'leaving'
+ self.output_textbuffer.insert(self.output_textiter, 'Exiting gEDA Manager.\n')
self.project.save()
self.save_settings()
@@ -1280,9 +1277,7 @@ class gEDAManager:
########################################################
def main(self):
- """
- Method starts the main loop for gtk
- """
+ """ Method starts the main loop for gtk. """
gtk.main()
diff --git a/src/newproject.py b/src/newproject.py
index d12c1a5..d0fa8e8 100644
--- a/src/newproject.py
+++ b/src/newproject.py
@@ -15,7 +15,7 @@ class NewProject:
when the user wants to create a new project.
"""
def __init__(self, gedamanager):
- """
+ """!
NewProject Constructor.
@param gedamanager is gEDAManager object that the new project is
called from.
@@ -70,7 +70,7 @@ class NewProject:
table.attach(label, 0, 1, 1, 2, gtk.FILL, 0)
def cb_filebutton_selection_changed(filechooser):
- """
+ """!
Function to handle when the filebutton selection is changed.
@param filechooser is the gtk.FileChooserButton object.
"""
@@ -93,7 +93,7 @@ class NewProject:
self.filename_page = vbox
def cb_filename_changed(filename_entry):
- """
+ """!
Function to handle when the filename is changed.
@param filename_entry is the text entered for the file and
directory to be created.
@@ -170,7 +170,7 @@ class NewProject:
vbox1.pack_start(self.confirm_overwrite, False, False)
def cb_confirm_overwrite_toggled(togglebutton):
- """
+ """!
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)
@@ -189,7 +189,7 @@ class NewProject:
self.summary_page = vbox
def check_directory_overwrite():
- """
+ """!
Function to check whether or not the directory to be created
already exists.
@return returns a list
@@ -207,7 +207,7 @@ 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.
@@ -242,21 +242,21 @@ class NewProject:
######################################
def cb_close(self, assistant):
- """
+ """!
Method is called when the NewProject object is closed.
@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.
"""
self.assistant.destroy()
def cb_apply(self, assistant):
- """
+ """!
Method is called when the user chooses 'apply' to create
the new project.
@param assistant is the gtk.Assistant object.
@@ -304,7 +304,7 @@ class NewProject:
######################################
def get_path(self):
- """
+ """!
Method to get path of new project.
@return path for file.
"""
@@ -312,7 +312,7 @@ class NewProject:
return path
def get_filename(self):
- """
+ """!
Method to get file name of the new project.
@return file name.
"""
@@ -322,9 +322,7 @@ class NewProject:
return filename
def main(self):
- """
- Method starts the main loop for gtk.
- """
+ """ Method starts the main loop for gtk. """
gtk.main()
diff --git a/src/project.py b/src/project.py
index 07697c3..8d0647e 100644
--- a/src/project.py
+++ b/src/project.py
@@ -35,9 +35,7 @@ class Project(gobject.GObject):
def __init__(self, path=None):
- """
- Default Constructor
- """
+ """ Default Constructor. """
gobject.GObject.__init__(self)
if path != None:
@@ -71,7 +69,8 @@ class Project(gobject.GObject):
def close(self):
"""
- Method to emit the 'close' signal
+ Method to close the current project and then
+ emit the 'closed' signal.
"""
self.name = None
self.directory = None
@@ -88,8 +87,8 @@ class Project(gobject.GObject):
def save(self, silent=None):
"""
- Method to write out the project file
- This file will be a tree hierarchy file
+ Method to save the project file and then emit the
+ 'saved' signal if succesful.
"""
if self.name != None and self.directory != None:
if not self.name.endswith('.gm'):
@@ -110,8 +109,9 @@ class Project(gobject.GObject):
self.emit('saved', False)
def open(self, path):
- """
- Method to open up project from path and set as current project
+ """!
+ Method to open up project from path and set as current project.
+ @param path is the path of the project file to open.
"""
self.name = path.rsplit('/')[-1]
self.directory = path.rpartition('/')[0]
diff --git a/src/settings.py b/src/settings.py
index d96c851..d0f9847 100644
--- a/src/settings.py
+++ b/src/settings.py
@@ -15,9 +15,7 @@ class Settings:
the applicaton settings.
"""
def __init__(self):
- """
- Settings Default Constructor.
- """
+ """ Settings Default Constructor. """
self.version = 1.0
self.installed_apps = []
self.project = None
@@ -70,7 +68,7 @@ class Settings:
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
@@ -91,10 +89,7 @@ class Settings:
def create_config_file(self):
- """
- Create the configuration file for the
- gEDA Manager.
- """
+ """ Create the configuration file for the gEDA Manager. """
stream = file(self.path, 'w')
document = """
purpose: |
diff --git a/src/utils.py b/src/utils.py
index bfa10da..3a4fbb9 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -54,14 +54,12 @@ class Utils:
def __init__(self):
- """
- Constructor.
- """
+ """ Constructor. """
self.directory = os.getcwd()
def get_file(self, filename):
- """
+ """!
Method to get the file from the file look up table.
@param filename is the file to find.
@returns path to the file.
@@ -82,10 +80,9 @@ class Utils:
return f
def get_node_image(self, name):
- """
+ """!
Method to get the image for node with param name.
@param name of the file.
- @param project_node is the top-level node
@return a gtk.Pixbuf image is returned
"""
try:
@@ -109,15 +106,17 @@ class Utils:
icon_type = self.icon_lut[key]
else:
icon_type = self.icon_lut['other']
- image = gtk.gdk.pixbuf_new_from_file(icon_type)
+
+ image = gtk.gdk.pixbuf_new_from_file(icon_type)
os.chdir(current_directory)
return image
def get_node_name(self, path):
- """
+ """!
Method to return the node name from the path.
- @return name of the node without an extension
+ @param path to the node.
+ @return name of the node without an extension.
"""
if path.count('/'):
return path.split('/')[-1]
@@ -126,7 +125,7 @@ class Utils:
def update_file_list(self, gedamanager, index=None, filename=None):
- """
+ """!
Method to update the gEDA Manager's project file list any time
the 'Sources' tree view is changed.
@param gedamanager is the the gEDAManager instance.
@@ -179,27 +178,29 @@ class Utils:
if name not in files:
os.system('cp ' + filename + ' ' + selected_node)
g.sources.append(selection_iter, [image, name, path])
+ g.output_textbuffer.insert(g.output_textiter, 'Added copy of source:' + filename + ' to ' + selected_node + '.\n')
else:
- print 'This file is already present in the directory.'
+ g.output_textbuffer.insert(g.output_textiter, 'This file is already present in the directory.\n')
elif index == 1:
# Logic here to delete the selected file
- print selected_node
f = os.path.exists(selected_node)
if f:
os.system('rm ' + selected_node)
g.sources.remove(selection_iter)
+ g.output_textbuffer.insert(g.output_textiter, 'Deleted: ' + selected_node + '.\n')
elif index == 2:
# Logic here to delete the folder
f = os.path.exists(selected_node)
if f: # delete directory recursively
os.system('rm -rf ' + selected_node)
g.sources.remove(selection_iter)
+ g.output_textbuffer.insert(g.output_textiter, 'Folder deleted: ' + selected_node + '.\n')
except IOError:
- print 'IOError:', sys.exc_info()[0]
+ g.errors_textbuffer.insert(g.errors_textiter, 'IOError: ' + sys.exc_info()[0] + '.\n')
except OSError:
- print 'OSError:', sys.exc_info[0]
+ g.errors_textbuffer.insert(g.errors_textiter, 'OSError: ' + sys.exc_info()[0] + '.\n')
except:
- print 'Unexpected error:', sys.exc_info()[0]
+ g.errors_textbuffer.insert(g.errors_textiter, 'Unexpected error: ' + sys.exc_info()[0] + '.\n')
raise
# Project's File List
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs