summaryrefslogtreecommitdiffstats
path: root/g-ed-it/commitDialog.py
diff options
context:
space:
mode:
authorMatthieu Gautier <mgautier@fedoraproject.org>2009-04-05 23:03:35 +0200
committerMatthieu Gautier <mgautier@fedoraproject.org>2009-04-05 23:03:35 +0200
commit958e374655d4920b648b43ee0f6f03921b678495 (patch)
tree5778b98830c3bf01457e9f0becac6ecd1af7971e /g-ed-it/commitDialog.py
parentbec3ba59a76c90e3364e6dd2abe794ebb8441d97 (diff)
downloadg-ed-it-958e374655d4920b648b43ee0f6f03921b678495.tar.gz
g-ed-it-958e374655d4920b648b43ee0f6f03921b678495.tar.xz
g-ed-it-958e374655d4920b648b43ee0f6f03921b678495.zip
Refactoring code.
* Create windowHelper * Create gitAction.py to handle all (almost) git actions * Split docBar into docHelper and docBar * Fix a bug when gedit is launch with the '&' * Change g-ed-it.glade in git_windows.glade Signed-off-by: Matthieu Gautier <mgautier@fedoraproject.org>
Diffstat (limited to 'g-ed-it/commitDialog.py')
-rw-r--r--g-ed-it/commitDialog.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/g-ed-it/commitDialog.py b/g-ed-it/commitDialog.py
index bd1906a..0bc2007 100644
--- a/g-ed-it/commitDialog.py
+++ b/g-ed-it/commitDialog.py
@@ -2,21 +2,21 @@
#-*- coding:utf-8 -*-
import os
+import time
import subprocess
class CommitDialog (object):
- def __init__(self,window,glade_xml):
- self.window = window
+ def __init__(self,glade_xml,plugin):
self.glade_xml = glade_xml
self.load_dialog()
+ self.plugin = plugin
pass
def load_dialog(self):
self.commit_dialog = self.glade_xml.get_widget("commit_dialog")
self.commit_dialog.hide()
- self.commit_dialog.set_transient_for(self.window)
- self.commit_dialog.connect("delete_event", self.commit_dialog.hide_on_delete)
+ self.commit_dialog.connect("delete_event", self.on_cancel_button_clicked)
self.commit_button = self.glade_xml.get_widget("commit_button")
self.commit_button.connect("clicked", self.on_commit_button_clicked)
@@ -27,33 +27,33 @@ class CommitDialog (object):
self.commit_text_box = self.glade_xml.get_widget("commit_text")
self.commit_text_box.connect("insert-at-cursor", self.on_commit_text_changed)
+ def run(self,window,fileURI, allFile):
+ self.commit_dialog.set_transient_for(window)
+ self.cwd = os.path.dirname(fileURI)
+ if allFile:
+ self.fileName = None
+ templateMsg = subprocess.Popen(["git-status","-s"],stdout=subprocess.PIPE,cwd=self.cwd).communicate()[0]
+ else:
+ self.fileName = os.path.basename(fileURI)
+ templateMsg = subprocess.Popen(["git-status","-s",self.fileName],stdout=subprocess.PIPE,cwd=self.cwd).communicate()[0]
+ self.commit_text_box.get_buffer().set_text(templateMsg)
+ self.commit_dialog.show()
+
def on_cancel_button_clicked(self, close_button):
self.commit_dialog.hide()
def on_commit_button_clicked(self, close_button):
commit_text_buffer = self.commit_text_box.get_buffer()
- subprocess.call(["git-commit","-m'"+commit_text_buffer.get_text(commit_text_buffer.get_start_iter(),commit_text_buffer.get_end_iter())+"'"],cwd=self.cwd)
- if self.call_obj :
- self.call_obj.getDocState()
- print "callback"
+ commit_text = commit_text_buffer.get_text(commit_text_buffer.get_start_iter(),commit_text_buffer.get_end_iter())
+ if self.fileName :
+ subprocess.call(["git-commit","-m'"+commit_text+"'", self.fileName],stdout=subprocess.PIPE,cwd=self.cwd)
+ else:
+ subprocess.call(["git-commit","-m'"+commit_text+"'"],stdout=subprocess.PIPE,cwd=self.cwd)
commit_text_buffer.set_text("")
self.commit_dialog.hide()
+ self.plugin.fast_update_ui()
pass
def on_commit_text_changed(self, commit_text_entry):
pass
-
- def show(self,fileName=None, call_obj=None):
- self.fileName = fileName
- self.call_obj = call_obj
- if self.fileName:
- self.cwd = os.path.dirname(fileName)
- templateMsg = subprocess.Popen(["git-status","-s",os.path.basename(fileName)],stdout=subprocess.PIPE,cwd=self.cwd).communicate()[0]
- else:
- self.cwd = os.path.dirname(self.window.get_active_document().get_uri_for_display())
- templateMsg = subprocess.Popen(["git-status","-s"],stdout=subprocess.PIPE,cwd=self.cwd).communicate()[0]
- self.commit_text_box.get_buffer().set_text(templateMsg)
- self.commit_dialog.show()
- print "dialog shown"
-