Skip to content

Commit

Permalink
Add machine and more instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
morinted committed Feb 7, 2017
1 parent 3ade554 commit 44d8a0e
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 16 deletions.
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Plover Palantype

A system plugin to enable Palantype support in Plover.
A plugin to enable Possum Palantype support in Plover.

This plugin enables the theory support (palan order, the layout, and Palantype dictionaries). In order to get support for the standard Palantype machine, you must also install a Palantype machine plugin.
## Installation

### Installing a Plugin

1. Make sure you have Plover v4+.
1. Find your `plover.cfg` file and, next to it, create a folder called `plugins`
1. Place the `.egg` file for Plover Palantype in that folder.

### Activating Palantype

1. In Plover's configuration, go to the `Systems` tab, and change the active system to `Possum Palantype`.
1. In Plover's machine tab, select the `Palantype` machine and ensure the settings point to your Palantype machine.
- If you do not own a Palantype machine, you can use an N-key rollover keyboard instead.
- At this time, other protocols are not supported.
1. Plover will install `sample.json` and `user.json` as dictionaries. You can remove the sample if you already have your own dictionary or want to start from scratch. Plover accepts `json` and `RTF` dictionaries. It is recommended to keep `user.json` at the bottom of the list so that new entries go there.
1. Note: at the moment only `ULFTS` is supported to backspace the last stroke.

### Common Commands

It would be a good time to define some custom commands that make using Plover much easier!

The "Add Definition" button lets you define a new dictionary entry. The first recommended entry is one that summons this dialog!

- `T+UPT`: `{PLOVER:ADD_TRANSLATION}` (think "dictionary update")

Some other useful translations for you to define (come up with your own strokes):

- `{-|}` capitalize next word
- `{^^}` suppress space
- `{#right}`, `{#left}`, `{#up}`, `{#down}` press arrow keys: right, left, up, down (recommendation is to create an arrow-key cluster on one hand with a chord on the other)
- `{#control(c)}` copy on Windows, Linux, or `{#command(c)}` for Mac
- `{#control(v)}` paste on Windows, Linux, or `{#command(v)}` for Mac
- `{#control(z)}` undo on Windows, Linux, or `{#command(z)}` for Mac
- `{#tab}` press the tab key
- `{#alt(tab tab)}` change application on Windows
- `{#backspace}` press the backspace key
- `{#escape}` press the escape key
- `{#return}` press the return/enter key
- `{^\n^}{-|}` new line, capitalize
- `{^\n\n^}{-|}` new paragraph, capitalize
66 changes: 66 additions & 0 deletions plover_palantype_machine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-

from six import iterbytes
from time import sleep
import plover.machine.base

STENO_KEY_CHART = (
('M-', '+2-', '+1-', 'H-', 'T-', 'P-', 'S-', 'C-'),
('-A', 'E-', 'O-', 'Y-', 'L-', 'N-', 'R-', 'F-'),
('-M', '-C', '-L', '-N', '-^2', '-^1', 'I', '-U'),
('', '-S', '-H', '-+', '-T', '-P', '-R', '-F'),
)

REALTIME_COMMANDS = [0x81, 0x91, 0x90, 0x93, 0xAA]
REQUEST_READ = bytearray(0x80)
END = bytearray(0x95)


class Palantype(plover.machine.base.SerialStenotypeBase):

KEYS_LAYOUT = '''
P- M- N- -N -M -P
C- T- F- L- -L -F -T -H
S- H- R- Y- O- I -A -C -R -+ -S
+1- +2- E- I -U -^1 -^2
'''

def __init__(self, params):
super(Palantype, self).__init__(params)

def run(self):
settings = self.serial_port.getSettingsDict()
settings['timeout'] = 0.01
self.serial_port.applySettingsDict(settings)
for command in REALTIME_COMMANDS:
self.serial_port.write(bytearray(command))
sleep(0.5)
self._ready()
while not self.finished.isSet():
if not self.serial_port.inWaiting():
self.serial_port.write(REQUEST_READ)
sleep(0.1) # Request a read 5 times a second

raw = self.serial_port.read(self.serial_port.inWaiting())
# Every stroke is 5 bytes and we drop the first one.
for i in range(len(raw)/5):
keys = self._parse_packet(raw[i*5+1:(i+1)*5])
steno_keys = self.keymap.keys_to_actions(keys)
if steno_keys:
self._notify(steno_keys)

if self.serial_port:
self.serial_port.write(END)

@staticmethod
def _parse_packet(packet):
keys = []
# Packet is a byte array with 4 bytes of data
for i, byte in enumerate(iterbytes(packet)):
map = STENO_KEY_CHART[i]
for i in range(8):
if not byte >> i & 1:
key = map[-i + 7]
if key:
keys.append(key)
return keys
8 changes: 7 additions & 1 deletion plover_palantype_system/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
'able': 'ible',
}

ORTHOGRAPHY_WORDLIST = ''
ORTHOGRAPHY_WORDLIST = None

KEYMAPS = {
'Keyboard': {
Expand Down Expand Up @@ -131,3 +131,9 @@
'-H': '-H',
},
}

DICTIONARIES_ROOT = 'asset:plover_palantype_system:dictionaries'
DEFAULT_DICTIONARIES = (
'sample.json',
'user.json'
)
32 changes: 19 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@


setup(
name = 'plover_palantype_system',
version = '0.0.1',
description = 'Palantype system for Plover',
author = 'Ted Morin',
author_email = '[email protected]',
license = 'GNU General Public License v2 or later (GPLv2+)',
classifiers = [
name='plover_palantype_system',
version='0.0.1',
description='Palantype system for Plover',
author='Ted Morin',
author_email='[email protected]',
license='GNU General Public License v2 or later (GPLv2+)',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Plugins',
'Intended Audience :: End Users/Desktop'
Expand All @@ -22,17 +22,23 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
install_requires = [
install_requires=[
'plover>=4.0.0.dev0',
],
packages = [
packages=[
'plover_palantype_system',
],
entry_points = '''
include_package_data=True,
py_modules=[
'plover_palantype_machine'
],
entry_points='''
[plover.system]
Palantype System = plover_palantype_system.system
Possum Palantype=plover_palantype_system.system
[plover.machine]
Palantype=plover_palantype_machine:Palantype
''',
zip_safe = True,
zip_safe=True,
)

0 comments on commit 44d8a0e

Please sign in to comment.