aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-06-03 11:23:53 -0400
committerChristopher Harvey <chris@basementcode.com>2010-06-03 11:23:53 -0400
commitb08a2a60f5beddccfe7d3013fa7f725ef0bb46d5 (patch)
tree0a72c0e260ecbeda0e5ca35af4a52ec6f825e8fb
parentStarted modprobe module (diff)
downloadventoo-b08a2a60f5beddccfe7d3013fa7f725ef0bb46d5.tar.gz
ventoo-b08a2a60f5beddccfe7d3013fa7f725ef0bb46d5.tar.bz2
ventoo-b08a2a60f5beddccfe7d3013fa7f725ef0bb46d5.zip
Added graphical apply button. Used to apply diffs once the user is happy with the changes. Diffs are not appled, just the button is there.
-rw-r--r--src/frontend/main.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/frontend/main.py b/src/frontend/main.py
index d12d8db..3131ec2 100644
--- a/src/frontend/main.py
+++ b/src/frontend/main.py
@@ -67,6 +67,10 @@ class MainWindow(gtk.Window):
self.rootBox.pack_start(self.mainToolbar, False, False)
self.mainPaned = gtk.HPaned()
self.rootBox.pack_start(self.docBox)
+ self.applyDiffButton = gtk.Button("Apply diff")
+ self.applyDiffButton.connect("clicked", self.applyDiffPressed, None)
+ self.rootBox.pack_start(self.applyDiffButton, False, False)
+ self.hideApplyDiffButton()
self.files_tv = AugFileTree.AugFileTree()
self.edit_tv = AugEditTree.AugEditTree()
self.edit_tv.connect("cursor-changed", self.nodeChanged, None)
@@ -185,8 +189,12 @@ class MainWindow(gtk.Window):
outFile.write("</html>\n")
outFile.close()
self.docWindow.load_url("file:///tmp/ventooDiff.html")
+ #TODO: check to make sure diff is correctly displayed (html file found)
+ self.showApplyDiffButton()
-
+ def applyDiffPressed(self, button, data=None):
+ pass
+
def showRCUpdate(self, button, data=None):
win = RcUpdateWindow.RcUpdateWindow()
win.show_all()
@@ -333,7 +341,8 @@ class MainWindow(gtk.Window):
Called when the user picks a new file to view.
"""
def fileSelectionChanged(self, tv, data=None):
- #uer picked a new file to edit.
+ #user picked a new file to edit.
+ self.hideApplyDiffButton()
self.currentConfigFilePath = self.files_tv.getSelectedConfigFilePath()
#update the display...and get new module info.
#thse path manipulations are sketchy, should make this code clearer.
@@ -343,6 +352,12 @@ class MainWindow(gtk.Window):
self.currentModule = VentooModule.VentooModule(augeas_utils.getVentooModuleNameFromSysPath(a, tmp))
self.refreshAugeasEditTree()
+ def hideApplyDiffButton(self):
+ self.applyDiffButton.hide()
+
+ def showApplyDiffButton(self):
+ self.applyDiffButton.show()
+
if __name__ == '__main__':
if len(sys.argv) > 1:
sandboxDir = sys.argv[1]
@@ -361,6 +376,7 @@ if __name__ == '__main__':
#instances to edit multiple "roots" at the same time.
window = MainWindow(a)
window.show_all()
+ window.hideApplyDiffButton() #TODO: overload show_all to preserve apply button state.
#clear the diff storage place...
shutil.rmtree(augeas_utils.getDiffRoot(), True)