Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99a9590
commit ce40f8e
Showing
9 changed files
with
153 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
from plover.steno import Stroke | ||
|
||
|
||
def last_stroke(translator, stroke, cmdline): | ||
# Repeat last stroke | ||
translations = translator.get_state().translations | ||
if not translations: | ||
return | ||
stroke = Stroke(translations[-1].strokes[-1].steno_keys) | ||
translator.translate_stroke(stroke) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
from plover.translation import Translation | ||
from plover.steno import Stroke | ||
|
||
|
||
def toggle_asterisk(translator, stroke, cmdline): | ||
# Toggle asterisk of previous stroke | ||
translations = translator.get_state().translations | ||
if not translations: | ||
return | ||
t = translations[-1] | ||
translator.untranslate_translation(t) | ||
keys = set(t.strokes[-1].steno_keys) | ||
if '*' in keys: | ||
keys.remove('*') | ||
else: | ||
keys.add('*') | ||
translator.translate_stroke(Stroke(keys)) | ||
|
||
def delete_space(translator, stroke, cmdline): | ||
# Retrospective delete space | ||
translations = translator.get_state().translations | ||
if len(translations) < 2: | ||
return | ||
replaced = translations[-2:] | ||
if replaced[1].is_retrospective_command: | ||
return | ||
english = [] | ||
for t in replaced: | ||
if t.english is not None: | ||
english.append(t.english) | ||
elif len(t.rtfcre) == 1 and t.rtfcre[0].isdigit(): | ||
english.append('{&%s}' % t.rtfcre[0]) | ||
if len(english) > 1: | ||
t = Translation([stroke], '{^~|^}'.join(english)) | ||
t.replaced = replaced | ||
t.is_retrospective_command = True | ||
translator.translate_translation(t) | ||
|
||
def insert_space(translator, stroke, cmdline): | ||
# Retrospective insert space | ||
translations = translator.get_state().translations | ||
if not translations: | ||
return | ||
replaced = translations[-1] | ||
if replaced.is_retrospective_command: | ||
return | ||
lookup_stroke = replaced.strokes[-1] | ||
english = [t.english or '/'.join(t.rtfcre) | ||
for t in replaced.replaced] | ||
if english: | ||
english.append(translator.lookup([lookup_stroke]) or lookup_stroke.rtfcre) | ||
t = Translation([stroke], ' '.join(english)) | ||
t.replaced = [replaced] | ||
t.is_retrospective_command = True | ||
translator.translate_translation(t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
import sys | ||
|
||
from plover.translation import Translation | ||
|
||
|
||
if sys.platform.startswith('darwin'): | ||
BACK_STRING = '{#Alt_L(BackSpace)}{^}' | ||
else: | ||
BACK_STRING = '{#Control_L(BackSpace)}{^}' | ||
|
||
def undo(translator, stroke, cmdline): | ||
for t in reversed(translator.get_state().translations): | ||
translator.untranslate_translation(t) | ||
if t.has_undo(): | ||
return | ||
# There is no more buffer to delete from -- remove undo and add a | ||
# stroke that removes last word on the user's OS, but don't add it | ||
# to the state history. | ||
translator.flush([Translation([stroke], BACK_STRING)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ class Registry(object): | |
'gui.qt.machine_option', | ||
'gui.qt.tool', | ||
'machine', | ||
'macro', | ||
'system', | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters