[gnome-initial-setup/shell/4765: 286/362] Test script for keyboard detection



commit b599eefad70b8ba55775d42187409b3df39dc97b
Author: Roddy Shuler <roddy endlessm com>
Date:   Tue Nov 25 15:48:28 2014 -0800

    Test script for keyboard detection
    
    Runs the keyboard query and prints the results to standard output.
    
    [endlessm/eos-shell#3425]

 keyboard-detector/keyboard_test.py |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/keyboard-detector/keyboard_test.py b/keyboard-detector/keyboard_test.py
new file mode 100755
index 0000000..b7ba32d
--- /dev/null
+++ b/keyboard-detector/keyboard_test.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+from gi.repository import Gtk
+import os
+
+import keyboard_query
+
+class KeyboardTest():
+
+    def __init__(self):
+        self.query = keyboard_query.KeyboardQuery(self)
+        self.query.connect('layout_result', self.calculate_result)
+        self.query.connect('delete-event', self.calculate_closed)
+        self.query.connect('destroy', self.destroy)
+
+    def run(self):
+        self.query.run()
+
+    def calculate_result(self, w, keymap):
+        print keymap
+        self.calculate_closed()
+
+    def calculate_closed(self, *args):
+        if self.query:
+            self.query.destroy()
+        self.query = None
+
+    def destroy(self, w):
+        Gtk.main_quit()
+
+if __name__ == '__main__':
+
+    test = KeyboardTest()
+    test.run()
+    Gtk.main()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]