diff --git a/TODO b/TODO index 914fc550..b378ee40 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,6 @@ ToDos in Priority order: set_copy_begin_mark set_copy_end_mark copy_marked - paste attributes_curr_char set_area_mark reset_area_marks @@ -145,6 +144,8 @@ except KeyboardInterrupt: enable_disable_braile #enable, disable braile enable_disable_sound #enable, disable sound enable_disable_output #enable, disable speech, braile and sound + next,prev,first,last_clipboard + paste - implement onInput commands read_line_if_cursor_change_vertical (needed if you arrow up and down, we want to announce the line) diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index a53479f4..2416c191 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -27,3 +27,14 @@ #=dec_speech_pitch #=inc_sound_volume #=dec_sound_volume +#=clear_clipboard +#=first_clipboard +#=last_clipboard +#=prev_clipboard +#=next_clipboard +#=curr_clipboard +#=set_clipboard_mark +#=read_clipboard_mark_text +#=copy_clipboard +# linux only +#=linux_paste_clipboard diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index 5a043d41..e4aeef39 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -27,3 +27,14 @@ #=dec_speech_pitch #=inc_sound_volume #=dec_sound_volume +#=clear_clipboard +#=first_clipboard +#=last_clipboard +#=prev_clipboard +#=next_clipboard +#=curr_clipboard +#=set_clipboard_mark +#=read_clipboard_mark_text +#=copy_clipboard +# linux only +#=linux_paste_clipboard diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index 47355cf0..63dca531 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -27,3 +27,16 @@ #=dec_speech_pitch #=inc_sound_volume #=dec_sound_volume +1-FENRIR,1-KEY_F2=clear_clipboard +1-FENRIR,1-KEY_A=first_clipboard +1-FENRIR,1-KEY_S=last_clipboard +1-FENRIR,1-KEY_D=prev_clipboard +1-FENRIR,1-KEY_F=next_clipboard +1-FENRIR,1-KEY_G=curr_clipboard +#- +#=set_clipboard_mark +#=read_clipboard_mark_text +#=copy_clipboard +#+ +# linux only +1-FENRIR,1-KEY_F3=linux_paste_clipboard diff --git a/config/settings/settings.conf.chrys b/config/settings/settings.conf.chrys new file mode 100644 index 00000000..48c147f0 --- /dev/null +++ b/config/settings/settings.conf.chrys @@ -0,0 +1,44 @@ +[sound] +enabled=True +driver=sox +theme=default +volume=1.0 + +[speech] +enabled=True +driver=speechd +rate=0.75 +pitch=0.5 +module=espeak +voice=de +language=de +volume=0.8 +autoReadIncomming=True + +[braille] +enabled=False +layout=en + +[screen] +driver=linux +screenUpdateDelay=0.4 + +[keyboard] +device=all +grabDevices=True +ignoreShortcuts=False +keyboardLayout=test +charEcho=True +charDeleteEcho=True +wordEcho=True +interruptOnKeyPress=False + +[general] +debugLevel=0 +punctuationLevel=1 +fenrirKeys=KEY_KP0 + +[promote] +enabled=True +inactiveTimeoutSec=120 +list=chrys,test diff --git a/src/fenrir-package/commands/commands/clear_clipboard.py b/src/fenrir-package/commands/commands/clear_clipboard.py new file mode 100644 index 00000000..cb157d8f --- /dev/null +++ b/src/fenrir-package/commands/commands/clear_clipboard.py @@ -0,0 +1,18 @@ +#!/bin/python +import fcntl +import sys +import termios + + +class command(): + def __init__(self): + pass + def run(self, environment): + environment['commandBuffer']['currClipboard'] = -1 + del environment['commandBuffer']['clipboard'][:] + environment['runtime']['outputManager'].presentText(environment, 'clipboard cleared', interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/curr_clipboard.py b/src/fenrir-package/commands/commands/curr_clipboard.py new file mode 100644 index 00000000..1ce359ba --- /dev/null +++ b/src/fenrir-package/commands/commands/curr_clipboard.py @@ -0,0 +1,19 @@ +#!/bin/python +import fcntl +import sys +import termios + + +class command(): + def __init__(self): + pass + def run(self, environment): + if len(environment['commandBuffer']['clipboard']) == 0: + environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) + return environment + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/first_clipboard.py b/src/fenrir-package/commands/commands/first_clipboard.py new file mode 100644 index 00000000..f2682aaa --- /dev/null +++ b/src/fenrir-package/commands/commands/first_clipboard.py @@ -0,0 +1,20 @@ +#!/bin/python +import fcntl +import sys +import termios + + +class command(): + def __init__(self): + pass + def run(self, environment): + if len(environment['commandBuffer']['clipboard']) == 0: + environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) + return environment + environment['commandBuffer']['currClipboard'] = 0 + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/last_clipboard.py b/src/fenrir-package/commands/commands/last_clipboard.py new file mode 100644 index 00000000..79d818eb --- /dev/null +++ b/src/fenrir-package/commands/commands/last_clipboard.py @@ -0,0 +1,20 @@ +#!/bin/python +import fcntl +import sys +import termios + + +class command(): + def __init__(self): + pass + def run(self, environment): + if len(environment['commandBuffer']['clipboard']) == 0: + environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) + return environment + environment['commandBuffer']['currClipboard'] = len(environment['commandBuffer']['clipboard']) -1 + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/linux_paste_clipboard.py b/src/fenrir-package/commands/commands/linux_paste_clipboard.py new file mode 100644 index 00000000..6ddb0cbc --- /dev/null +++ b/src/fenrir-package/commands/commands/linux_paste_clipboard.py @@ -0,0 +1,23 @@ +#!/bin/python +import fcntl +import sys +import termios +import time + +class command(): + def __init__(self): + pass + def run(self, environment): + currClipboard = environment['commandBuffer']['currClipboard'] + if currClipboard < 0: + environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) + return environment + with open("/dev/tty" + environment['screenData']['newTTY'], 'w') as fd: + for c in environment['commandBuffer']['clipboard'][currClipboard]: + fcntl.ioctl(fd, termios.TIOCSTI, c) + time.sleep(0.01) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/next_clipboard.py b/src/fenrir-package/commands/commands/next_clipboard.py new file mode 100644 index 00000000..39676a34 --- /dev/null +++ b/src/fenrir-package/commands/commands/next_clipboard.py @@ -0,0 +1,25 @@ +#!/bin/python +import fcntl +import sys +import termios + + +class command(): + def __init__(self): + pass + def run(self, environment): + if len(environment['commandBuffer']['clipboard']) == 0: + environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) + return environment + environment['commandBuffer']['currClipboard'] += 1 + if environment['commandBuffer']['currClipboard'] > len(environment['commandBuffer']['clipboard']) -1: + environment['commandBuffer']['currClipboard'] = 0 + environment['runtime']['outputManager'].presentText(environment, 'First clipboard ', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=False) + else: + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/commands/commands/prev_clipboard.py b/src/fenrir-package/commands/commands/prev_clipboard.py new file mode 100644 index 00000000..364513f9 --- /dev/null +++ b/src/fenrir-package/commands/commands/prev_clipboard.py @@ -0,0 +1,25 @@ +#!/bin/python +import fcntl +import sys +import termios + + +class command(): + def __init__(self): + pass + def run(self, environment): + if len(environment['commandBuffer']['clipboard']) == 0: + environment['runtime']['outputManager'].presentText(environment, 'clipboard empty', interrupt=True) + return environment + environment['commandBuffer']['currClipboard'] -= 1 + if environment['commandBuffer']['currClipboard'] < 0: + environment['commandBuffer']['currClipboard'] = len(environment['commandBuffer']['clipboard']) -1 + environment['runtime']['outputManager'].presentText(environment, 'Last clipboard ', interrupt=True) + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=False) + else: + environment['runtime']['outputManager'].presentText(environment, environment['commandBuffer']['clipboard'][environment['commandBuffer']['currClipboard']], interrupt=True) + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass diff --git a/src/fenrir-package/core/bindings.py b/src/fenrir-package/core/bindings.py deleted file mode 100644 index 9ea01c26..00000000 --- a/src/fenrir-package/core/bindings.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/python - -bindings = { -} diff --git a/src/fenrir-package/core/commands.py b/src/fenrir-package/core/commands.py index 771893c2..c480f8f6 100644 --- a/src/fenrir-package/core/commands.py +++ b/src/fenrir-package/core/commands.py @@ -1,12 +1,22 @@ #!/bin/python import time + +# used as shared memory between commands +# use this in your own commands +commandBuffer = { +'clipboard':['chrys\n', 'test', 'ls\n'], +'currClipboard': 0, +'clipboardMark':{'1':None, '2':None} +} + +# used by the commandManager commandInfo = { 'currCommand': '', -'commandCueue':[], 'lastCommandTime': time.time() } +# used by the commandManager commands = { 'onInput':{ }, diff --git a/src/fenrir-package/core/environment.py b/src/fenrir-package/core/environment.py index 5a7a26b4..80339ce6 100644 --- a/src/fenrir-package/core/environment.py +++ b/src/fenrir-package/core/environment.py @@ -1,8 +1,6 @@ #!/bin/python from core import settings -from core import soundIcons -from core import bindings from core import runtime from core import screenData from core import generalInformation @@ -14,9 +12,10 @@ environment = { 'runtime': runtime.runtime, 'generalInformation': generalInformation.generalInformation, 'settings': settings.settings, -'bindings': bindings.bindings, 'commands': commands.commands, -'input': input.input, 'commandInfo': commands.commandInfo, -'soundIcons': soundIcons.soundIcons, +'commandBuffer': commands.commandBuffer, +'input': input.input, +'soundIcons': {}, +'bindings': {}, } diff --git a/src/fenrir-package/core/soundIcons.py b/src/fenrir-package/core/soundIcons.py deleted file mode 100644 index 3aa0e482..00000000 --- a/src/fenrir-package/core/soundIcons.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/python - -soundIcons = { -}