summaryrefslogtreecommitdiffstats
path: root/g-ed-it
diff options
context:
space:
mode:
authorMatthieu Gautier <mgautier@fedoraproject.org>2009-05-03 21:53:10 +0200
committerMatthieu Gautier <mgautier@fedoraproject.org>2009-05-03 21:55:54 +0200
commitbcbc657178824d2f88a1080d77a0d54eb8fc0534 (patch)
treea9457094f797ead6ac9496691fcaf93b38a18db9 /g-ed-it
parentd74a31da487bcff192cbc99e238bc2c989dcc4d3 (diff)
downloadg-ed-it-bcbc657178824d2f88a1080d77a0d54eb8fc0534.zip
g-ed-it-bcbc657178824d2f88a1080d77a0d54eb8fc0534.tar.gz
g-ed-it-bcbc657178824d2f88a1080d77a0d54eb8fc0534.tar.xz
Add a commit text to the docBar.
- If the commit text is empty, its content is used as commit message. - If not, the commit dialog box is shown.
Diffstat (limited to 'g-ed-it')
-rw-r--r--g-ed-it/docBar.py15
-rw-r--r--g-ed-it/gitAction.py12
2 files changed, 22 insertions, 5 deletions
diff --git a/g-ed-it/docBar.py b/g-ed-it/docBar.py
index e87a5c5..990c850 100644
--- a/g-ed-it/docBar.py
+++ b/g-ed-it/docBar.py
@@ -46,11 +46,13 @@ class DocBar (object):
self.lbl_status = gtk.Label("√Čtat du fichier")
+ self.commit_text = gtk.Entry()
+
self.btn_add = gtk.Button("add")
self.btn_add.connect("clicked", self.gitAction.add, self.tab.get_document().get_uri_for_display)
self.btn_commit = gtk.Button("commit")
- self.btn_commit.connect("clicked", self.gitAction.commit, window, self.tab.get_document().get_uri_for_display)
+ self.btn_commit.connect("clicked", self.gitAction.commit, window, self.tab.get_document().get_uri_for_display,self.get_and_clear_commitText)
self.btn_diff_head_index = gtk.Button("diff HEAD/INDEX")
self.btn_diff_head_index.connect("clicked", self.gitAction.diff_head_index, self.tab.get_document().get_uri_for_display)
@@ -60,9 +62,10 @@ class DocBar (object):
self.docBar.pack_start(self.btn_diff_head_index, False, False)
self.docBar.pack_start(self.btn_diff_index_wt, False, False)
- self.docBar.pack_start(self.lbl_status, True, False)
- self.docBar.pack_start(self.btn_add, False, False)
+ self.docBar.pack_start(self.lbl_status, True, True)
+ self.docBar.pack_start(self.commit_text, True, True)
self.docBar.pack_start(self.btn_commit, False, False)
+ self.docBar.pack_start(self.btn_add, False, False)
self.tab.pack_start(self.docBar, False, False)
@@ -70,6 +73,11 @@ class DocBar (object):
self.update_ui()
+ def get_and_clear_commitText(self):
+ text = self.commit_text.get_text()
+ self.commit_text.set_text("")
+ return text
+
def deactivate(self):
self.tab.remove(self.docBar)
@@ -83,6 +91,7 @@ class DocBar (object):
self.docBar.show()
self.btn_add.set_sensitive(self.docHelper.index2WT!=None or not self.docHelper.isCached)
self.btn_commit.set_sensitive(self.docHelper.HEAD2index!=None)
+ self.commit_text.set_sensitive(self.docHelper.HEAD2index!=None)
self.btn_diff_head_index.set_sensitive(self.docHelper.HEAD2index!=None)
self.btn_diff_index_wt.set_sensitive(self.docHelper.index2WT!=None)
text = "HEAD <-"
diff --git a/g-ed-it/gitAction.py b/g-ed-it/gitAction.py
index 47bd68e..28460f8 100644
--- a/g-ed-it/gitAction.py
+++ b/g-ed-it/gitAction.py
@@ -33,14 +33,22 @@ class GitAction (object):
self.plugin = plugin
pass
- def commit(self,launcher,window,fileUriMethod = None):
+ def commit(self,launcher,window,fileUriMethod = None, commitTextMethod = None):
if fileUriMethod :
fileUri = fileUriMethod()
allFile = False
else:
fileUri = window.get_active_document().get_uri_for_display()
allFile = True
- self.commitDialog.run(window,fileUri,allFile)
+ if commitTextMethod:
+ text = commitTextMethod()
+ if text != "":
+ subprocess.call('git-commit -m "'+text+'" '+os.path.basename(fileUri),stdout=subprocess.PIPE,cwd=os.path.dirname(fileUri), shell=True)
+ self.plugin.fast_update_ui()
+ else:
+ self.commitDialog.run(window,fileUri,allFile)
+ else:
+ self.commitDialog.run(window,fileUri,allFile)
pass
def add(self,launcher,fileUriMethod = None):