aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-08-02 01:44:29 -0400
committerChristopher Harvey <chris@basementcode.com>2010-08-02 01:44:29 -0400
commitdd0f51c887a86b7e90561876691aa4c7dc307fdd (patch)
tree46f8ea763a44051bacd59f8f8fdb2f39d8fbbf33
parentAdded getValidationScript to VentooModule (diff)
downloadventoo-dd0f51c887a86b7e90561876691aa4c7dc307fdd.tar.gz
ventoo-dd0f51c887a86b7e90561876691aa4c7dc307fdd.tar.bz2
ventoo-dd0f51c887a86b7e90561876691aa4c7dc307fdd.zip
Changed __rowEdited in main.py to mark a cell as invalid if the script for that cell says it is.
-rw-r--r--src/ventoo/main.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ventoo/main.py b/src/ventoo/main.py
index 28c35fa..d6435f1 100644
--- a/src/ventoo/main.py
+++ b/src/ventoo/main.py
@@ -166,6 +166,9 @@ class MainWindow(gtk.Window):
No need to refresh here.
"""
def __rowEdited(self, editWidget, path, text, connectData):
+ p = self.edit_tv.getSelectedEntryPath()
+ p = augeas_utils.removeNumbers(p)
+ xmlPath = osp.join("/VentooModule/root", p)
model = editWidget.get_model()
thisIter = model.get_iter_from_string(path)
enabled = model.get_value(thisIter, 0)
@@ -176,6 +179,16 @@ class MainWindow(gtk.Window):
else:
augPath = osp.join('files', augeas_utils.stripBothSlashes(self.currentConfigFilePath), self.edit_tv.get_label_path(thisIter))
enteredValue = model.get_value(thisIter, 2) #get what the user entered.
+ valScript = self.currentModule.getValidationScript(xmlPath)
+ if valScript != None:
+ #There is a script that can validate this input. import and run it.
+ shutil.copyfile(valScript, '/tmp/thisCheck.py')
+ import thisCheck as validate
+ valid = validate.validate(text)
+ if valid:
+ self.edit_tv.setValid(thisIter)
+ else:
+ self.edit_tv.setInvalid(thisIter)
self.a.set(augPath, enteredValue)
print("set " + augPath + " '" + enteredValue + "'")
@@ -417,6 +430,8 @@ if __name__ == '__main__':
print(sandboxDir + " is not a directory.")
sys.exit(0)
+ sys.path.append('/tmp')
+
print('Starting augeas...')
#None could be a 'loadpath'
a = augeas.Augeas(sandboxDir, None, augeas.Augeas.SAVE_NEWFILE)