[caribou: 4/6] Unpress modifier when Caribou quites (bug #621596). Thanks Daniel Baeyens!
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [caribou: 4/6] Unpress modifier when Caribou quites (bug #621596). Thanks Daniel Baeyens!
- Date: Wed, 16 Jun 2010 16:18:03 +0000 (UTC)
commit 6e45a8d17495f3ade0c57cb74d3ff9b942ec1c60
Author: Eitan Isaacson <eitan monotonous org>
Date: Wed Jun 16 09:06:30 2010 -0700
Unpress modifier when Caribou quites (bug #621596). Thanks Daniel Baeyens!
caribou/ui/main.py | 64 ++++++++++++++++++++++++++++++----------------------
1 files changed, 37 insertions(+), 27 deletions(-)
---
diff --git a/caribou/ui/main.py b/caribou/ui/main.py
index 0cf8fe3..81d41f2 100644
--- a/caribou/ui/main.py
+++ b/caribou/ui/main.py
@@ -2,6 +2,8 @@ import gtk.gdk as gdk
import pyatspi
import gconf
import gtk
+import signal
+
from window import CaribouWindowEntry
from keyboard import CaribouKeyboard
from caribou.ui.i18n import _
@@ -23,6 +25,7 @@ class Caribou:
self.on_text_caret_moved, "object:text-caret-moved")
pyatspi.Registry.registerKeystrokeListener(
self.on_key_down, mask=None, kind=(pyatspi.KEY_PRESSED_EVENT,))
+ signal.signal(signal.SIGINT, self.signal_handler)
def _get_a11y_enabled(self):
try:
@@ -116,30 +119,37 @@ class Caribou:
# TODO: implement keyboard scanning
pass
elif event.event_string == "Control_R":
- if debug == True:
- print "quitting ..."
- result = pyatspi.Registry.deregisterEventListener(self.on_text_caret_moved, "object:text-caret-moved")
- if debug == True:
- print "deregisterEventListener - object:text-caret-moved ...",
- if result == False:
- print "OK"
- else:
- print "FAIL"
- result = pyatspi.Registry.deregisterEventListener(self.on_focus, "object:state-changed:focused")
- if debug == True:
- print "deregisterEventListener - object:state-changed:focused ...",
- if result == False:
- print "OK"
- else:
- print "FAIL"
- result = pyatspi.Registry.deregisterEventListener(self.on_focus, "focus")
- if debug == True:
- print "deregisterEventListener - focus ...",
- if result == False:
- print "OK"
- else:
- print "FAIL"
- result = pyatspi.Registry.deregisterKeystrokeListener(self.on_key_down, mask=None, kind=(pyatspi.KEY_PRESSED_EVENT,))
- if debug == True:
- print "deregisterKeystrokeListener"
- gtk.main_quit()
+ self.clean_exit()
+
+ def signal_handler(self,signal,frame):
+ # Clean exit pressing Control + C
+ self.clean_exit()
+
+ def clean_exit(self):
+ if debug == True:
+ print "quitting ..."
+ result = pyatspi.Registry.deregisterEventListener(self.on_text_caret_moved, "object:text-caret-moved")
+ if debug == True:
+ print "deregisterEventListener - object:text-caret-moved ...",
+ if result == False:
+ print "OK"
+ else:
+ print "FAIL"
+ result = pyatspi.Registry.deregisterEventListener(self.on_focus, "object:state-changed:focused")
+ if debug == True:
+ print "deregisterEventListener - object:state-changed:focused ...",
+ if result == False:
+ print "OK"
+ else:
+ print "FAIL"
+ result = pyatspi.Registry.deregisterEventListener(self.on_focus, "focus")
+ if debug == True:
+ print "deregisterEventListener - focus ...",
+ if result == False:
+ print "OK"
+ else:
+ print "FAIL"
+ result = pyatspi.Registry.deregisterKeystrokeListener(self.on_key_down, mask=None, kind=(pyatspi.KEY_PRESSED_EVENT,))
+ if debug == True:
+ print "deregisterKeystrokeListener"
+ gtk.main_quit()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]