add initial clipboard management for pasting

This commit is contained in:
chrys 2016-08-23 00:51:39 +02:00
parent 0c7a103eab
commit 57f61e80f5
16 changed files with 246 additions and 15 deletions

3
TODO
View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +0,0 @@
#!/bin/python
bindings = {
}

View File

@ -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':{
},

View File

@ -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': {},
}

View File

@ -1,4 +0,0 @@
#!/bin/python
soundIcons = {
}