From 40082bd2b1e60443bd1c5a64fa312f5d2368708c Mon Sep 17 00:00:00 2001 From: Ben Konrath Date: Wed, 2 Dec 2009 15:21:01 -0500 Subject: Move qwerty keyboard to python package --- src/keyboard.py | 2 +- src/keyboards/__init__.py | 0 src/keyboards/qwerty.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++ src/qwerty.py | 90 ----------------------------------------------- 4 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 src/keyboards/__init__.py create mode 100644 src/keyboards/qwerty.py delete mode 100644 src/qwerty.py diff --git a/src/keyboard.py b/src/keyboard.py index 47c8ccd..0524671 100644 --- a/src/keyboard.py +++ b/src/keyboard.py @@ -23,7 +23,7 @@ import gobject import gtk.gdk as gdk import pango import virtkey -import qwerty +from keyboards import qwerty import rsvg import cairo diff --git a/src/keyboards/__init__.py b/src/keyboards/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/keyboards/qwerty.py b/src/keyboards/qwerty.py new file mode 100644 index 0000000..8dc32c3 --- /dev/null +++ b/src/keyboards/qwerty.py @@ -0,0 +1,90 @@ +# -*- coding: UTF-8 -*- +# +# Carbou - text entry and UI navigation application +# +# Copyright (C) 2009 Adaptive Technology Resource Centre +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by the +# Free Software Foundation; either version 2.1 of the License, or (at your +# option) any later version. +# +# This program 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 Lesser General Public License +# for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import keysyms + +# TODO add horizontal keysize - will be able to specify a mulitplier +# TODO add key colour +# TODO add noop keysym +# TODO add ability switch back to previous layer after x keystrokes +# TODO ensure keyboard doesn't change size when changing layers +# TODO finish numbers and punctuation layout + +############################################################################### +# keys with keysyms - use known keysyms from keysyms.py or used hex code +# format: ("label", keysym) +############################################################################### + +# backspace +bs = ("⌫", keysyms.backspace) +# enter +en = ("↲", keysyms.enter) +# space +sp = ("␣", keysyms.space) +# up +up = ("↑", keysyms.up) +# down +dn = ("↓", keysyms.down) +# left +le = ("←", keysyms.left) +# right +ri = ("→", keysyms.right) + + +############################################################################### +# keys to switch layers +# format: ("label", "name of layer to switch to") +############################################################################### + +# shift up +su = ("⇧", "uppercase") +# shift down +sd = ("⇩", "lowercase") +# number and punctuation +np = (".?12", "num_punct") +# letters +lt = ("abc", "lowercase") + +############################################################################### +# keyboard layouts +# rules: +# * key can be a single utf-8 character or a tuple defined above +# * at least one layout must contain the reserved label "cf" for configuration +# * layouts must be the same dimensions +############################################################################### + +lowercase = ( ("cf", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p"), + ( np, "a", "s", "d", "f", "g", "h", "j", "k", "l", bs), + ( su, "z", "x", "c", "v", "b", "n", "m", sp, ".", en) ) + +uppercase = ( ("cf", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"), + ( np, "A", "S", "D", "F", "G", "H", "J", "K", "L", bs), + ( sd, "Z", "X", "C", "V", "B", "N", "M", sp, ".", en) ) + +num_punct = ( ("!", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"), + ( lt, "@", "$", "/", "+", "-", up, "\"", ",", "?", bs), + ("'", "(", ")", ";", ":", le, dn, ri, sp, ".", en) ) + +############################################################################### +# list of keyboard layouts - the layout in position 0 will be active when the +# keyboard is first created +############################################################################### + +layouts = ( "lowercase", "uppercase", "num_punct" ) diff --git a/src/qwerty.py b/src/qwerty.py deleted file mode 100644 index 8dc32c3..0000000 --- a/src/qwerty.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: UTF-8 -*- -# -# Carbou - text entry and UI navigation application -# -# Copyright (C) 2009 Adaptive Technology Resource Centre -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by the -# Free Software Foundation; either version 2.1 of the License, or (at your -# option) any later version. -# -# This program 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 Lesser General Public License -# for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -import keysyms - -# TODO add horizontal keysize - will be able to specify a mulitplier -# TODO add key colour -# TODO add noop keysym -# TODO add ability switch back to previous layer after x keystrokes -# TODO ensure keyboard doesn't change size when changing layers -# TODO finish numbers and punctuation layout - -############################################################################### -# keys with keysyms - use known keysyms from keysyms.py or used hex code -# format: ("label", keysym) -############################################################################### - -# backspace -bs = ("⌫", keysyms.backspace) -# enter -en = ("↲", keysyms.enter) -# space -sp = ("␣", keysyms.space) -# up -up = ("↑", keysyms.up) -# down -dn = ("↓", keysyms.down) -# left -le = ("←", keysyms.left) -# right -ri = ("→", keysyms.right) - - -############################################################################### -# keys to switch layers -# format: ("label", "name of layer to switch to") -############################################################################### - -# shift up -su = ("⇧", "uppercase") -# shift down -sd = ("⇩", "lowercase") -# number and punctuation -np = (".?12", "num_punct") -# letters -lt = ("abc", "lowercase") - -############################################################################### -# keyboard layouts -# rules: -# * key can be a single utf-8 character or a tuple defined above -# * at least one layout must contain the reserved label "cf" for configuration -# * layouts must be the same dimensions -############################################################################### - -lowercase = ( ("cf", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p"), - ( np, "a", "s", "d", "f", "g", "h", "j", "k", "l", bs), - ( su, "z", "x", "c", "v", "b", "n", "m", sp, ".", en) ) - -uppercase = ( ("cf", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"), - ( np, "A", "S", "D", "F", "G", "H", "J", "K", "L", bs), - ( sd, "Z", "X", "C", "V", "B", "N", "M", sp, ".", en) ) - -num_punct = ( ("!", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"), - ( lt, "@", "$", "/", "+", "-", up, "\"", ",", "?", bs), - ("'", "(", ")", ";", ":", le, dn, ri, sp, ".", en) ) - -############################################################################### -# list of keyboard layouts - the layout in position 0 will be active when the -# keyboard is first created -############################################################################### - -layouts = ( "lowercase", "uppercase", "num_punct" ) -- cgit v1.2.1