aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-08-04 13:24:06 -0400
committerChristopher Harvey <chris@basementcode.com>2010-08-04 13:24:06 -0400
commita43dd9beabd3c7d28cd6d8ea787647e78ddb16cd (patch)
tree5074bb4f51f75c2e8344a532ba5eaa8d6d31b2f7
parentAdded a check to see if a module exists and sets the foregound colour for tha... (diff)
downloadventoo-a43dd9beabd3c7d28cd6d8ea787647e78ddb16cd.tar.gz
ventoo-a43dd9beabd3c7d28cd6d8ea787647e78ddb16cd.tar.bz2
ventoo-a43dd9beabd3c7d28cd6d8ea787647e78ddb16cd.zip
Added clear to AugEditTree. Changed the file change event to clear the editing tree if the module for the newly selected file doesn't exist.
-rw-r--r--src/ventoo/AugEditTree.py3
-rw-r--r--src/ventoo/main.py9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/ventoo/AugEditTree.py b/src/ventoo/AugEditTree.py
index 52bf9ac..11695ba 100644
--- a/src/ventoo/AugEditTree.py
+++ b/src/ventoo/AugEditTree.py
@@ -78,6 +78,9 @@ class AugEditTree(gtk.TreeView):
(gobject.TYPE_STRING,))
+ def clear(self):
+ self.tv_store.clear()
+
def entry_edited(self, cell, path, text):
#column = int(path)
self.tv_store[path][2] = text
diff --git a/src/ventoo/main.py b/src/ventoo/main.py
index 2900c9b..c4ee4d5 100644
--- a/src/ventoo/main.py
+++ b/src/ventoo/main.py
@@ -415,8 +415,13 @@ class MainWindow(gtk.Window):
#update the display...and get new module info.
#thse path manipulations are sketchy, should make this code clearer.
tmp = self.currentConfigFilePath
- self.currentModule = VentooModule.VentooModule(augeas_utils.getVentooModuleNameFromSysPath(self.a, osp.join('/', tmp)))
- self.refreshAugeasEditTree()
+ try:
+ self.currentModule = VentooModule.VentooModule(augeas_utils.getVentooModuleNameFromSysPath(self.a, osp.join('/', tmp)))
+ self.refreshAugeasEditTree()
+ except RuntimeError:
+ #module doesn't exist. ignore request.
+ self.edit_tv.clear()
+
def hideApplyDiffButton(self):
self.applyDiffButton.hide()