summaryrefslogtreecommitdiffstats
path: root/g-ed-it
diff options
context:
space:
mode:
authorMatthieu Gautier <starmad@pegase.localdomain>2009-03-25 20:50:51 +0100
committerMatthieu Gautier <starmad@pegase.localdomain>2009-03-25 20:50:51 +0100
commit1f857e7cf9fcd85811195365894d822efcf00c78 (patch)
tree77c9256ec122ecb6eed1b11639cafac20f96e506 /g-ed-it
parent20e5e77ebea384f7d4acfa270fd8b0a5bfb9886a (diff)
downloadg-ed-it-1f857e7cf9fcd85811195365894d822efcf00c78.zip
g-ed-it-1f857e7cf9fcd85811195365894d822efcf00c78.tar.gz
g-ed-it-1f857e7cf9fcd85811195365894d822efcf00c78.tar.xz
Add a commitDialog.py file
Signed-off-by: Matthieu Gautier <starmad@pegase.localdomain>
Diffstat (limited to 'g-ed-it')
-rw-r--r--g-ed-it/commitDialog.py39
-rw-r--r--g-ed-it/g_ed_it.py45
2 files changed, 45 insertions, 39 deletions
diff --git a/g-ed-it/commitDialog.py b/g-ed-it/commitDialog.py
new file mode 100644
index 0000000..a0bc052
--- /dev/null
+++ b/g-ed-it/commitDialog.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+class CommitDialog (object):
+
+ def __init__(self,window,glade_xml):
+ self.window = window
+ self.glade_xml = glade_xml
+ self.load_dialog()
+ 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_button = self.glade_xml.get_widget("commit_button")
+ self.commit_button.connect("clicked", self.on_commit_button_clicked)
+
+ self.close_button = self.glade_xml.get_widget("cancel_button")
+ self.close_button.connect("clicked", self.on_cancel_button_clicked)
+
+ self.commit_text_box = self.glade_xml.get_widget("commit_text")
+ self.commit_text_box.connect("changed", self.on_commit_text_changed)
+
+ def on_cancel_button_clicked(self, close_button):
+ self.commit_dialog.hide()
+
+ def on_commit_button_clicked(self, close_button):
+ pass
+
+ def on_commit_text_changed(self, commit_text_entry):
+ pass
+
+ def show(self):
+ self.commit_dialog.show()
+
+
diff --git a/g-ed-it/g_ed_it.py b/g-ed-it/g_ed_it.py
index 754e3b9..148743f 100644
--- a/g-ed-it/g_ed_it.py
+++ b/g-ed-it/g_ed_it.py
@@ -9,6 +9,7 @@ import os
import time
import menuManager
+import commitDialog
GLADE_FILE = os.path.join(os.path.dirname(__file__), "commit.glade")
@@ -18,10 +19,11 @@ class PluginHelper:
self.plugin = plugin
self.createActionManager()
+ self.glade_xml = gtk.glade.XML(GLADE_FILE)
- self.menuManager = menuManager.MenuManager(window)
- self.load_dialogs()
-
+ self.menuManager = menuManager.MenuManager(self.window)
+
+ self.commitDialog = commitDialog.CommitDialog(self.window,self.glade_xml)
# I hardly even know how this works, but it gets our encoding.
try: self.encoding = gedit.encoding_get_current()
@@ -38,7 +40,7 @@ class PluginHelper:
return
def action_commit(self, window):
- self._search_dialog.show()
+ self.commitDialog.show()
pass
def action_add(self, window):
@@ -73,40 +75,5 @@ class PluginHelper:
# Add the action group.
self.manager.insert_action_group(self.action_group, -1)
pass
-
- ###
- # Called when the "Close" button is clicked.
- def on_cancel_button_clicked(self, close_button):
- self._search_dialog.hide()
-
- def on_commit_button_clicked(self, close_button):
- pass
-
- ###
- # Called when the text to be replaced is changed.
- def on_commit_text_changed(self, commit_text_entry):
- pass
-
- ###
- # Load commit dialog.
- # - Load dialog from its Glade file
- # - Connect widget signals
- # - Put needed widgets in object variables.
- def load_dialogs(self):
- self.glade_xml = gtk.glade.XML(GLADE_FILE)
-
- self._search_dialog = self.glade_xml.get_widget("commit_dialog")
- self._search_dialog.hide()
- self._search_dialog.set_transient_for(self.window)
- self._search_dialog.connect("delete_event", self._search_dialog.hide_on_delete)
-
- self._find_button = self.glade_xml.get_widget("commit_button")
- self._find_button.connect("clicked", self.on_commit_button_clicked)
-
- close_button = self.glade_xml.get_widget("cancel_button")
- close_button.connect("clicked", self.on_cancel_button_clicked)
-
- self._search_text_box = self.glade_xml.get_widget("commit_text")
- self._search_text_box.connect("changed", self.on_commit_text_changed)