diff --git a/examples/eekboard-inscript.in b/examples/eekboard-inscript.in index 2998be9f..5211ec4d 100644 --- a/examples/eekboard-inscript.in +++ b/examples/eekboard-inscript.in @@ -55,6 +55,7 @@ class InscriptKeyboard(object): self.__keyboard.connect('key-pressed', self.__key_pressed_cb) self.__keyboard.connect('key-released', self.__key_released_cb) self.__virtkey = virtkey.virtkey() + self.__english = False def enable(self): self.__eekboard.push_context(self.__context) @@ -66,15 +67,26 @@ class InscriptKeyboard(object): self.__context.show_keyboard() def set_group(self, group): - self.__context.set_group(group) + self.__group = group + self.__context.set_group(self.__group) def __key_pressed_cb(self, keyboard, key): + if key.get_keycode() == 37: + return symbol = key.get_symbol() if isinstance(symbol, eekboard.Keysym): xkeysym = symbol.get_xkeysym() self.__virtkey.press_keysym(xkeysym) def __key_released_cb(self, keyboard, key): + if key.get_keycode() == 37: + if self.__english: + self.__context.set_group(self.__group) + self.__english = False + else: + self.__context.set_group(0) + self.__english = True + return symbol = key.get_symbol() if isinstance(symbol, eekboard.Keysym): xkeysym = symbol.get_xkeysym() @@ -90,12 +102,13 @@ if __name__ == "__main__": help="Specify language code to LANGCODE", metavar="LANGCODE") (options, args) = parser.parse_args() - group = 0 + group = 1 if options.langcode: group = None for index, langcode in enumerate(GROUPS): if langcode.startswith(options.langcode): - group = index + group = index + 1 + break if group is None: print >> sys.stderr, "Unknown langcode %s" % options.langcode exit(1) diff --git a/examples/gen-inscript-keyboard.py b/examples/gen-inscript-keyboard.py index 6b24ebb0..ec5bbec2 100644 --- a/examples/gen-inscript-keyboard.py +++ b/examples/gen-inscript-keyboard.py @@ -134,7 +134,10 @@ keyboard = eekboard.XmlKeyboard(os.path.abspath(sys.argv[1])) def each_key(element, data): keycode = element.get_keycode() - matrix = Eek.SymbolMatrix.new(len(files), 4) + matrix = Eek.SymbolMatrix.new(len(files) + 1, 4) + for l in xrange(4): + keysym = element.get_symbol_at_index(0, l, 0, 0) + matrix.set_symbol(0, l, keysym) for g, f in enumerate(files): entry = f.get_entry_for_keycode(keycode) for l in xrange(4): @@ -146,8 +149,8 @@ def each_key(element, data): except: pass if not keysym: - keysym = element.get_symbol_at_index(g, l, 0, 0) - matrix.set_symbol(g, l, keysym) + keysym = element.get_symbol_at_index(g + 1, l, 0, 0) + matrix.set_symbol(g + 1, l, keysym) element.set_symbol_matrix(matrix) def each_section(element, data): diff --git a/examples/inscript2.xml b/examples/inscript2.xml index 0eee3f17..faa4ff6b 100644 --- a/examples/inscript2.xml +++ b/examples/inscript2.xml @@ -1,7 +1,7 @@ 0.000000,0.000000,640.000000,296.585366 -
+
15.609756,15.609756,640.000000,39.024390 0 @@ -11,7 +11,11 @@ 3.121951,1.560976,37.463415,37.463415 outline4 - + + Escape + Escape + Escape + Escape Escape Escape Escape @@ -105,7 +109,11 @@ 84.292683,1.560976,37.463415,37.463415 outline4 - + + F1 + (null) + F1 + F1 F1 (null) F1 @@ -199,7 +207,11 @@ 124.878049,1.560976,37.463415,37.463415 outline4 - + + F2 + (null) + F2 + F2 F2 (null) F2 @@ -293,7 +305,11 @@ 165.463415,1.560976,37.463415,37.463415 outline4 - + + F3 + (null) + F3 + F3 F3 (null) F3 @@ -387,7 +403,11 @@ 206.048780,1.560976,37.463415,37.463415 outline4 - + + F4 + (null) + F4 + F4 F4 (null) F4 @@ -481,7 +501,11 @@ 266.926829,1.560976,37.463415,37.463415 outline4 - + + F5 + (null) + F5 + F5 F5 (null) F5 @@ -575,7 +599,11 @@ 307.512195,1.560976,37.463415,37.463415 outline4 - + + F6 + (null) + F6 + F6 F6 (null) F6 @@ -669,7 +697,11 @@ 348.097561,1.560976,37.463415,37.463415 outline4 - + + F7 + (null) + F7 + F7 F7 (null) F7 @@ -763,7 +795,11 @@ 388.682927,1.560976,37.463415,37.463415 outline4 - + + F8 + (null) + F8 + F8 F8 (null) F8 @@ -857,7 +893,11 @@ 449.560976,1.560976,37.463415,37.463415 outline4 - + + F9 + (null) + F9 + F9 F9 (null) F9 @@ -951,7 +991,11 @@ 490.146341,1.560976,37.463415,37.463415 outline4 - + + F10 + (null) + F10 + F10 F10 (null) F10 @@ -1045,7 +1089,11 @@ 530.731707,1.560976,37.463415,37.463415 outline4 - + + F11 + (null) + F11 + F11 F11 (null) F11 @@ -1139,7 +1187,11 @@ 571.317073,1.560976,37.463415,37.463415 outline4 - + + F12 + (null) + F12 + F12 F12 (null) F12 @@ -1231,7 +1283,7 @@
-
+
15.609756,78.048780,608.780488,201.365854 0 @@ -1257,7 +1309,11 @@ 3.121951,1.560976,37.463415,37.463415 outline4 - + + quoteleft + asciitilde + quoteleft + quoteleft quoteleft asciitilde quoteleft @@ -1351,7 +1407,11 @@ 43.707317,1.560976,37.463415,37.463415 outline4 - + + 1 + exclam + 1 + 1 exclam 1 @@ -1445,7 +1505,11 @@ 84.292683,1.560976,37.463415,37.463415 outline4 - + + 2 + at + 2 + 2 at 2 @@ -1539,7 +1603,11 @@ 124.878049,1.560976,37.463415,37.463415 outline4 - + + 3 + numbersign + 3 + 3 numbersign 3 @@ -1633,7 +1701,11 @@ 165.463415,1.560976,37.463415,37.463415 outline4 - + + 4 + dollar + 4 + 4 dollar (null) @@ -1727,7 +1799,11 @@ 206.048780,1.560976,37.463415,37.463415 outline4 - + + 5 + percent + 5 + 5 percent 5 @@ -1821,7 +1897,11 @@ 245.073171,1.560976,37.463415,37.463415 outline4 - + + 6 + asciicircum + 6 + 6 asciicircum 6 @@ -1915,7 +1995,11 @@ 285.658537,1.560976,37.463415,37.463415 outline4 - + + 7 + ampersand + 7 + 7 ampersand 7 @@ -2009,7 +2093,11 @@ 326.243902,1.560976,37.463415,37.463415 outline4 - + + 8 + asterisk + 8 + 8 asterisk 8 @@ -2103,7 +2191,11 @@ 366.829268,1.560976,37.463415,37.463415 outline4 - + + 9 + parenleft + 9 + 9 (null) 9 @@ -2197,7 +2289,11 @@ 407.414634,1.560976,37.463415,37.463415 outline4 - + + 0 + parenright + 0 + 0 (null) 0 @@ -2291,7 +2387,11 @@ 448.000000,1.560976,37.463415,37.463415 outline4 - + + minus + underscore + minus + minus minus minus @@ -2385,7 +2485,11 @@ 488.585366,1.560976,37.463415,37.463415 outline4 - + + equal + plus + equal + equal @@ -2479,7 +2583,11 @@ 529.170732,1.560976,79.609756,37.463415 outline1 - + + BackSpace + BackSpace + BackSpace + BackSpace BackSpace BackSpace BackSpace @@ -2573,7 +2681,11 @@ 3.121951,42.146341,59.317073,37.463415 outline6 - + + Tab + ISO_Left_Tab + Tab + Tab Tab ISO_Left_Tab Tab @@ -2667,7 +2779,11 @@ 65.560976,42.146341,37.463415,37.463415 outline4 - + + q + Q + q + q q @@ -2761,7 +2877,11 @@ 106.146341,42.146341,37.463415,37.463415 outline4 - + + w + W + w + w w @@ -2855,7 +2975,11 @@ 145.170732,42.146341,37.463415,37.463415 outline4 - + + e + E + e + e e @@ -2949,7 +3073,11 @@ 185.756098,42.146341,37.463415,37.463415 outline4 - + + r + R + r + r @@ -3043,7 +3171,11 @@ 226.341463,42.146341,37.463415,37.463415 outline4 - + + t + T + t + t t @@ -3137,7 +3269,11 @@ 266.926829,42.146341,37.463415,37.463415 outline4 - + + y + Y + y + y y @@ -3231,7 +3367,11 @@ 307.512195,42.146341,37.463415,37.463415 outline4 - + + u + U + u + u u @@ -3325,7 +3465,11 @@ 348.097561,42.146341,37.463415,37.463415 outline4 - + + i + I + i + i i @@ -3419,7 +3563,11 @@ 388.682927,42.146341,37.463415,37.463415 outline4 - + + o + O + o + o o @@ -3513,7 +3661,11 @@ 429.268293,42.146341,37.463415,37.463415 outline4 - + + p + P + p + p p @@ -3607,7 +3759,11 @@ 468.292683,42.146341,37.463415,37.463415 outline4 - + + bracketleft + braceleft + bracketleft + bracketleft @@ -3701,7 +3857,11 @@ 508.878049,42.146341,37.463415,37.463415 outline4 - + + bracketright + braceright + bracketright + bracketright bracketright @@ -3795,7 +3955,11 @@ 549.463415,42.146341,59.317073,37.463415 outline7 - + + backslash + bar + backslash + backslash backslash bar backslash @@ -3889,7 +4053,11 @@ 3.121951,82.731707,68.682927,37.463415 outline8 - + + Control_L + Control_L + Control_L + Control_L Control_L Control_L Control_L @@ -3983,7 +4151,11 @@ 76.487805,82.731707,37.463415,37.463415 outline4 - + + a + A + a + a a @@ -4077,7 +4249,11 @@ 115.512195,82.731707,37.463415,37.463415 outline4 - + + s + S + s + s s @@ -4171,7 +4347,11 @@ 156.097561,82.731707,37.463415,37.463415 outline4 - + + d + D + d + d d @@ -4265,7 +4445,11 @@ 196.682927,82.731707,37.463415,37.463415 outline4 - + + f + F + f + f ি @@ -4359,7 +4543,11 @@ 237.268293,82.731707,37.463415,37.463415 outline4 - + + g + G + g + g g @@ -4453,7 +4641,11 @@ 277.853659,82.731707,37.463415,37.463415 outline4 - + + h + H + h + h h @@ -4547,7 +4739,11 @@ 318.439024,82.731707,37.463415,37.463415 outline4 - + + j + J + j + j J j @@ -4641,7 +4837,11 @@ 359.024390,82.731707,37.463415,37.463415 outline4 - + + k + K + k + k k @@ -4735,7 +4935,11 @@ 399.609756,82.731707,37.463415,37.463415 outline4 - + + l + L + l + l @@ -4829,7 +5033,11 @@ 438.634146,82.731707,37.463415,37.463415 outline4 - + + semicolon + colon + semicolon + semicolon semicolon @@ -4923,7 +5131,11 @@ 479.219512,82.731707,37.463415,37.463415 outline4 - + + quoteright + quotedbl + quoteright + quoteright quotedbl quoteright @@ -5017,7 +5229,11 @@ 519.804878,82.731707,88.975610,37.463415 outline9 - + + Return + Return + Return + Return Return Return Return @@ -5111,7 +5327,11 @@ 3.121951,121.756098,88.975610,37.463415 outline10 - + + Shift_L + Shift_L + Shift_L + Shift_L Shift_L Shift_L Shift_L @@ -5205,7 +5425,11 @@ 95.219512,121.756098,37.463415,37.463415 outline4 - + + z + Z + z + z ʼ Z z @@ -5299,7 +5523,11 @@ 135.804878,121.756098,37.463415,37.463415 outline4 - + + x + X + x + x @@ -5393,7 +5621,11 @@ 176.390244,121.756098,37.463415,37.463415 outline4 - + + c + C + c + c c @@ -5487,7 +5719,11 @@ 215.414634,121.756098,37.463415,37.463415 outline4 - + + v + V + v + v V v @@ -5581,7 +5817,11 @@ 256.000000,121.756098,37.463415,37.463415 outline4 - + + b + B + b + b b B b @@ -5675,7 +5915,11 @@ 296.585366,121.756098,37.463415,37.463415 outline4 - + + n + N + n + n N n @@ -5769,7 +6013,11 @@ 337.170732,121.756098,37.463415,37.463415 outline4 - + + m + M + m + m m @@ -5863,7 +6111,11 @@ 377.756098,121.756098,37.463415,37.463415 outline4 - + + comma + less + comma + comma comma @@ -5957,7 +6209,11 @@ 418.341463,121.756098,37.463415,37.463415 outline4 - + + period + greater + period + period period @@ -6051,7 +6307,11 @@ 458.926829,121.756098,37.463415,37.463415 outline4 - + + slash + question + slash + slash slash @@ -6145,7 +6405,11 @@ 499.512195,121.756098,109.268293,37.463415 outline11 - + + Shift_R + Shift_R + Shift_R + Shift_R Shift_R Shift_R Shift_R @@ -6239,101 +6503,19 @@ 3.121951,162.341463,56.195122,37.463415 outline12 - - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L - Control_L + + Control_L + Control_L 62.439024,162.341463,48.390244,37.463415 outline2 - + + Super_L + Super_L + Super_L + Super_L Super_L Super_L Super_L @@ -6427,7 +6609,11 @@ 113.951220,162.341463,48.390244,37.463415 outline2 - + + Alt_L + Meta_L + Alt_L + Alt_L Alt_L Meta_L Alt_L @@ -6521,7 +6707,11 @@ 165.463415,162.341463,238.829268,37.463415 outline3 - + + space + space + space + space space space space @@ -6615,7 +6805,11 @@ 407.414634,162.341463,48.390244,37.463415 outline2 - + + ISO_Level3_Shift + ISO_Level3_Shift + ISO_Level3_Shift + ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift @@ -6709,7 +6903,11 @@ 458.926829,162.341463,48.390244,37.463415 outline2 - + + Super_R + Super_R + Super_R + Super_R Super_R Super_R Super_R @@ -6803,7 +7001,11 @@ 508.878049,162.341463,48.390244,37.463415 outline2 - + + Menu + Menu + Menu + Menu Menu Menu Menu @@ -6897,7 +7099,11 @@ 560.390244,162.341463,48.390244,37.463415 outline2 - + + Control_R + Control_R + Control_R + Control_R Control_R Control_R Control_R