Permalink
Browse files

add package files

  • Loading branch information...
baverman committed Jan 21, 2011
1 parent ef79f1f commit 739fd3ba8e8818403086db205c5a770be7d9f5a5
Showing with 179 additions and 62 deletions.
  1. 0 CHANGES
  2. +21 −0 LICENSE
  3. +4 −0 MANIFEST.in
  4. +60 −0 README.rst
  5. +2 −62 run.py
  6. +28 −0 setup.py
  7. +64 −0 typetrainer/run.py
View
No changes.
View
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2010 Anton Bobrov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,4 @@
+recursive-include typetrainer *.glade
+include README.rst
+include LICENSE
+include CHANGES
View
@@ -0,0 +1,60 @@
+Type Trainer
+============
+
+This small utility allows you to grow your typing skills in soft and
+non-annoying manner. It tries to behave closely to proprietary VerseQ
+application -- adaptive typing tutor which dynamically changes exercises to help
+trainee to learn hard places thoroughly.
+
+
+Install
+=======
+
+The most easy way via pypi::
+
+ pip install typetrainer
+
+or::
+
+ easy_install typetrainer
+
+Or you can install from sources::
+
+ python setup.py build
+ sudo python setup.py install
+
+Also you need pygtk to be installed.
+
+
+Usage
+=====
+
+::
+
+ typetrainer -t tutor_package /path/to/file/with/words
+
+Where is ``tutor_package`` is one of tutors:
+
+* ``en.basic`` Basic English tutor with small-caps letters, commas and apostrophe.
+* ``ru.basic`` Basic Russian tutor with only small-caps letters.
+
+``tutor_package`` may be omitted.
+
+And words file is any text in utf8 encoding.
+
+Personally I prefer to run type trainer with fortunes::
+
+ typetrainer /usr/share/fortune/debian
+
+or::
+
+ typetrainer /usr/share/fortune/cookie
+
+
+TODO
+====
+
+* Word generator should take in action trainee errors.
+* On screen keyboard with finger zones.
+* Advanced tutor for English (will be done when I reach 250 cpm on basic level).
+* Python tutor.
View
64 run.py
@@ -1,65 +1,5 @@
#!/usr/bin/env python
-import sys
-from optparse import OptionParser
+from typetrainer.run import run
-from typetrainer.generator import make_char_chain, generate_word
-
-
-parser = OptionParser(usage="usage: %prog [options] file_with_words")
-parser.add_option("-t", "--tutor", dest="tutor", default='en.basic',
- help="Tutor maker to use (en.basic, ru.basic)", metavar="tutor")
-
-options, args = parser.parse_args()
-
-def get_chains(tutor, filename):
- package_name = 'typetrainer.tutors.' + tutor
- try:
- __import__(package_name)
- except ImportError:
- parser.error("Can't fint [%s] tutor" % tutor)
-
- pkg = sys.modules[package_name]
-
- try:
- words = list(pkg.split_to_words(open(filename).read().decode('utf-8')))
- except IOError:
- parser.error("Can't read %s" % filename)
-
- first, other = make_char_chain(words, 3)
- lengths = list(pkg.make_lengths_seq(words))
-
- return first, other, lengths
-
-if not args:
- parser.error('You should specify file with words to process')
-
-first, other, lengths = get_chains(options.tutor, args[0])
-
-
-import gtk
-import random
-import itertools
-
-from typetrainer.ui import idle
-from typetrainer.ui.main import Main
-
-def filler():
- pos = random.randint(0, len(lengths) - 1)
- left = itertools.islice(lengths, pos, None)
- right = itertools.islice(lengths, 0, pos)
-
- for t, l in itertools.cycle(itertools.chain(left, right)):
- if t == 'w':
- yield generate_word(first, other, l, 3)
- else:
- yield l
-
-app = Main(filler)
-app.window.show()
-idle(app.fill)
-
-try:
- gtk.main()
-except KeyboardInterrupt:
- pass
+run()
View
@@ -0,0 +1,28 @@
+from setuptools import setup, find_packages
+
+setup(
+ name = 'typetrainer',
+ version = '0.1',
+ author = 'Anton Bobrov',
+ author_email = 'bobrov@vl.ru',
+ description = 'Typing tutor trainer',
+ long_description = open('README.rst').read(),
+ zip_safe = False,
+ packages = find_packages(exclude=('tests', )),
+ include_package_data = True,
+ url = 'http://github.com/baverman/typetrainer',
+ entry_points = {
+ 'gui_scripts': [
+ 'typetrainer = typetrainer.run:run',
+ ]
+ },
+ classifiers = [
+ "Programming Language :: Python",
+ "License :: OSI Approved :: MIT License",
+ "Development Status :: 4 - Beta",
+ "Environment :: X11 Applications :: GTK",
+ "Intended Audience :: End Users/Desktop",
+ "Natural Language :: English",
+ "Topic :: Education"
+ ],
+)
View
@@ -0,0 +1,64 @@
+def run():
+ import sys
+ from optparse import OptionParser
+
+ from typetrainer.generator import make_char_chain, generate_word
+
+
+ parser = OptionParser(usage="usage: %prog [options] file_with_words")
+ parser.add_option("-t", "--tutor", dest="tutor", default='en.basic',
+ help="Tutor maker to use (en.basic, ru.basic)", metavar="tutor")
+
+ options, args = parser.parse_args()
+
+ def get_chains(tutor, filename):
+ package_name = 'typetrainer.tutors.' + tutor
+ try:
+ __import__(package_name)
+ except ImportError:
+ parser.error("Can't fint [%s] tutor" % tutor)
+
+ pkg = sys.modules[package_name]
+
+ try:
+ words = list(pkg.split_to_words(open(filename).read().decode('utf-8')))
+ except IOError:
+ parser.error("Can't read %s" % filename)
+
+ first, other = make_char_chain(words, 3)
+ lengths = list(pkg.make_lengths_seq(words))
+
+ return first, other, lengths
+
+ if not args:
+ parser.error('You should specify file with words to process')
+
+ first, other, lengths = get_chains(options.tutor, args[0])
+
+
+ import gtk
+ import random
+ import itertools
+
+ from typetrainer.ui import idle
+ from typetrainer.ui.main import Main
+
+ def filler():
+ pos = random.randint(0, len(lengths) - 1)
+ left = itertools.islice(lengths, pos, None)
+ right = itertools.islice(lengths, 0, pos)
+
+ for t, l in itertools.cycle(itertools.chain(left, right)):
+ if t == 'w':
+ yield generate_word(first, other, l, 3)
+ else:
+ yield l
+
+ app = Main(filler)
+ app.window.show()
+ idle(app.fill)
+
+ try:
+ gtk.main()
+ except KeyboardInterrupt:
+ pass

0 comments on commit 739fd3b

Please sign in to comment.