Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/keybuilder.py
diff options
context:
space:
mode:
authorWade Brainerd <wadetb@gmail.com>2009-03-09 03:30:12 (GMT)
committer Wade Brainerd <wadetb@gmail.com>2009-03-09 03:30:12 (GMT)
commitc2e093dbb337428d7701960e2ed007876aba1d21 (patch)
treeb07450df7933ad30674e8c9f60e9ad368813567f /keybuilder.py
parenta2b70d2c0baaf600d05b0c58d59942c7b5696cfd (diff)
Add support for custom key map files. Add key builder.
Diffstat (limited to 'keybuilder.py')
-rwxr-xr-xkeybuilder.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/keybuilder.py b/keybuilder.py
new file mode 100755
index 0000000..9d32161
--- /dev/null
+++ b/keybuilder.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# vi: sw=4 et
+# Copyright 2008 by Kate Scheppke and Wade Brainerd.
+# This file is part of Typing Turtle.
+#
+# Typing Turtle is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Typing Turtle is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Typing Turtle. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import keyboard
+
+import gtk
+
+window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+window.set_title("keyboard widget")
+window.connect("destroy", lambda w: gtk.main_quit())
+window.show_all()
+window.realize()
+
+image = keyboard.KeyboardImages(800,400)
+image.load_images()
+
+k = keyboard.KeyboardWidget(image, window, True, record_map=True)
+k.set_layout(keyboard.OLPC_LAYOUT)
+k.load_key_map(sys.argv[1])
+
+savebtn = gtk.Button()
+savebtn.add(gtk.Label('Save Keys'))
+savebtn.connect('clicked', lambda w: k.save_letter_map(sys.argv[1]))
+
+quitbtn = gtk.Button()
+quitbtn.add(gtk.Label('Quit'))
+quitbtn.connect('clicked', lambda w: gtk.main_quit())
+
+hbox = gtk.HBox()
+hbox.pack_start(savebtn)
+hbox.pack_start(quitbtn)
+
+vbox = gtk.VBox()
+vbox.pack_start(k)
+vbox.pack_start(hbox)
+
+window.add(vbox)
+window.show_all()
+
+gtk.main()
+