Skip to content
Browse files

sdfv zones

  • Loading branch information...
1 parent e997d83 commit 060361c214efe8a732af4e1b27107b54fb8bdb3b @baverman committed Jan 30, 2011
Showing with 33 additions and 14 deletions.
  1. +2 −1 setup.py
  2. +1 −0 typetrainer/__init__.py
  3. +10 −4 typetrainer/run.py
  4. +20 −9 typetrainer/ui/kbd.py
View
3 setup.py
@@ -1,8 +1,9 @@
from setuptools import setup, find_packages
+import typetrainer
setup(
name = 'typetrainer',
- version = '0.3.1',
+ version = typetrainer.VERSION,
author = 'Anton Bobrov',
author_email = 'bobrov@vl.ru',
description = 'Typing tutor trainer',
View
1 typetrainer/__init__.py
@@ -0,0 +1 @@
+VERSION = '0.3-git'
View
14 typetrainer/run.py
@@ -1,11 +1,16 @@
def run():
import sys
from optparse import OptionParser
+ from typetrainer import VERSION
- parser = OptionParser(usage="usage: %prog [options] file_with_words")
+ parser = OptionParser(usage="usage: %prog [options] file_with_words",
+ version="%prog " + VERSION)
parser.add_option("-t", "--tutor", dest="tutor", default='en.basic',
- help="Tutor maker to use (en.basic, en.advanced, ru.basic). Default is 'en.basic'",
+ help="Tutor maker to use (en.basic, en.advanced, ru.basic). Default is '%default'",
metavar="tutor")
+ parser.add_option("-k", "--keyboard", dest="keyboard", default="n130", type='choice',
+ choices=['n130', 'n130_sdfv'], metavar="keyboard",
+ help="Onscreen keyboard type (n130, n130_sdfv). Default is %default")
options, args = parser.parse_args()
@@ -32,9 +37,10 @@ def get_filler(tutor, filename):
from typetrainer.ui import idle
from typetrainer.ui.main import Main
- from typetrainer.ui.kbd import n130_keyboard, KeyboardDrawer
+ from typetrainer.ui import kbd
- app = Main(filler, KeyboardDrawer(n130_keyboard))
+ kbd_layout = getattr(kbd, options.keyboard + '_keyboard')
+ app = Main(filler, kbd.KeyboardDrawer(kbd_layout))
app.window.show()
idle(app.fill)
View
29 typetrainer/ui/kbd.py
@@ -51,15 +51,27 @@
]
}
+n130_sdfv_keyboard = n130_keyboard.copy()
+n130_sdfv_keyboard['zones'] = [
+ ([3, 4, 7, 9, 10, 13], [3, 1, 4, 5, 1, 3, 0]),
+ ([1, 3, 4, 6, 8, 9], [0, 3, 1, 4, 5, 1, 3]),
+ ([1, 3, 4, 6, 8, 9, 12], [0, 3, 1, 4, 5, 1, 3, 0]),
+ ([1, 2, 3, 4, 7, 8, 9, 11 ], [0, 3, 1, 4, 2, 5, 1, 3, 0]),
+ ([4, 5], [0, 6, 0]),
+]
+n130_sdfv_keyboard['main_keys'] = [
+ (2,2), (2,3), (2,4), (3,4), (3,6), (2,7), (2,8), (2,9)
+]
+
lc, hc = 0.68627, 0.88627
button_colors = [
- (hc, hc, hc), # grey
- (hc, lc, lc), # red
- (hc, hc, lc), # yellow
- (lc, hc, lc), # green
- (lc, hc, hc), # blue
- (hc, lc, hc), # magenta
- (lc, lc, hc), # deep blue
+ (hc, hc, hc), # 0 grey
+ (hc, lc, lc), # 1 red
+ (hc, hc, lc), # 2 yellow
+ (lc, hc, lc), # 3 green
+ (lc, hc, hc), # 4 blue
+ (hc, lc, hc), # 5 magenta
+ (lc, lc, hc), # 6 deep blue
]
class KeyboardDrawer(gtk.DrawingArea):
@@ -81,8 +93,7 @@ def __init__(self, kbd):
def do_expose_event(self, event):
cr = self.window.cairo_create()
- cr.rectangle(event.area.x, event.area.y,
- event.area.width, event.area.height)
+ cr.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)
cr.clip()
wh = self.window.get_size()

0 comments on commit 060361c

Please sign in to comment.
Something went wrong with that request. Please try again.