polish clipboard stuff
This commit is contained in:
parent
3f869b65ed
commit
eb323eeedf
@ -13,7 +13,7 @@
|
|||||||
#=curr_screen
|
#=curr_screen
|
||||||
#=last_incomming
|
#=last_incomming
|
||||||
1-FENRIR,1-KEY_F2=toggle_braille
|
1-FENRIR,1-KEY_F2=toggle_braille
|
||||||
1-FENRIR,1-KEY_F3=toggle_sound
|
#1-FENRIR,1-KEY_F3=toggle_sound
|
||||||
1-FENRIR,1-KEY_F4=toggle_speech
|
1-FENRIR,1-KEY_F4=toggle_speech
|
||||||
#=toggle_output
|
#=toggle_output
|
||||||
#=toggle_autoRead
|
#=toggle_autoRead
|
||||||
@ -28,14 +28,14 @@
|
|||||||
#=inc_sound_volume
|
#=inc_sound_volume
|
||||||
#=dec_sound_volume
|
#=dec_sound_volume
|
||||||
1-FENRIR,1-KEY_F2=clear_clipboard
|
1-FENRIR,1-KEY_F2=clear_clipboard
|
||||||
#=remove_marks
|
1-FENRIR,1-KEY_X=remove_marks
|
||||||
1-FENRIR,1-KEY_A=first_clipboard
|
1-FENRIR,1-KEY_A=first_clipboard
|
||||||
1-FENRIR,1-KEY_S=last_clipboard
|
1-FENRIR,1-KEY_S=last_clipboard
|
||||||
1-FENRIR,1-KEY_D=prev_clipboard
|
1-FENRIR,1-KEY_D=prev_clipboard
|
||||||
1-FENRIR,1-KEY_F=next_clipboard
|
1-FENRIR,1-KEY_F=next_clipboard
|
||||||
1-FENRIR,1-KEY_G=curr_clipboard
|
1-FENRIR,1-KEY_G=curr_clipboard
|
||||||
#=set_mark
|
1-FENRIR,1-KEY_Q=set_mark
|
||||||
#=marked_text
|
#1-FENRIR,1-KEY_V=marked_text
|
||||||
#=copy_marked_to_clipboard
|
1-FENRIR,1-KEY_V=copy_marked_to_clipboard
|
||||||
# linux only
|
# linux only
|
||||||
1-FENRIR,1-KEY_F3=linux_paste_clipboard
|
1-FENRIR,1-KEY_F3=linux_paste_clipboard
|
||||||
|
@ -1,54 +1,21 @@
|
|||||||
[sound]
|
[sound]
|
||||||
# Turn sound on or off:
|
|
||||||
enabled=True
|
enabled=True
|
||||||
|
|
||||||
# Select the driver used to play sounds, choices are sox and gstreamer.
|
|
||||||
# Sox is the default.
|
|
||||||
driver=sox
|
driver=sox
|
||||||
|
|
||||||
# Sound themes. This is the pack of sounds used for sound alerts.
|
|
||||||
# Sound packs may be located at /usr/share/sounds
|
|
||||||
# For system wide availability, or ~/.local/share/fenrir/sounds
|
|
||||||
# For the current user.
|
|
||||||
theme=default
|
theme=default
|
||||||
|
|
||||||
# Sound volume controls how loud the sounds for your chosen soundpack are.
|
|
||||||
# 0 is quietest, 1.0 is loudest.
|
|
||||||
volume=1.0
|
volume=1.0
|
||||||
|
|
||||||
[speech]
|
[speech]
|
||||||
# Turn speech on or off:
|
|
||||||
enabled=True
|
enabled=True
|
||||||
|
|
||||||
# Select speech driver, options are speechd (default) or espeak:
|
|
||||||
driver=speechd
|
driver=speechd
|
||||||
|
rate=0.75
|
||||||
# The rate selects how fast fenrir will speak. Options range from 0, slowest, to 1.0, fastest.
|
|
||||||
rate=0.45
|
|
||||||
|
|
||||||
# Pitch controls the pitch of the voice, select from 0, lowest, to 1.0, highest.
|
|
||||||
pitch=0.5
|
pitch=0.5
|
||||||
|
|
||||||
# Volume controls the loudness of the voice, select from 0, quietest, to 1.0, loudest.
|
|
||||||
volume=1.0
|
|
||||||
|
|
||||||
# Module is used for speech-dispatcher, to select the speech module you want to use.
|
|
||||||
# Consult speech-dispatcher's configuration and help ti find out which modules are available.
|
|
||||||
# The default is espeak.
|
|
||||||
module=espeak
|
module=espeak
|
||||||
|
voice=de
|
||||||
# Voice selects the varient you want to use, for example, f5 will use the female voice #5 in espeak,
|
language=de
|
||||||
# or if using the espeak module in speech-dispatcher. To find out which voices are available, consult the documentation provided with your chosen synthesizer.
|
volume=0.8
|
||||||
voice=
|
|
||||||
|
|
||||||
# Select the language you want fenrir to use.
|
|
||||||
language=english-us
|
|
||||||
|
|
||||||
# Read new text as it happens?
|
|
||||||
autoReadIncomming=True
|
autoReadIncomming=True
|
||||||
|
|
||||||
[braille]
|
[braille]
|
||||||
#braille is not implemented yet
|
|
||||||
enabled=False
|
enabled=False
|
||||||
layout=en
|
layout=en
|
||||||
|
|
||||||
@ -58,29 +25,20 @@ screenUpdateDelay=0.4
|
|||||||
|
|
||||||
[keyboard]
|
[keyboard]
|
||||||
device=all
|
device=all
|
||||||
# gives fenrir exclusive access to the keyboard and let consume keystrokes. just disable on problems.
|
|
||||||
grabDevices=True
|
grabDevices=True
|
||||||
ignoreShortcuts=False
|
ignoreShortcuts=False
|
||||||
# the current shortcut layout located in /etc/fenrir/keyboard
|
keyboardLayout=test
|
||||||
keyboardLayout=desktop
|
charEcho=True
|
||||||
# echo chars while typing.
|
|
||||||
charEcho=False
|
|
||||||
# echo deleted chars
|
|
||||||
charDeleteEcho=True
|
charDeleteEcho=True
|
||||||
# echo word after pressing space
|
|
||||||
wordEcho=True
|
wordEcho=True
|
||||||
# interrupt speech on any keypress
|
|
||||||
interruptOnKeyPress=False
|
interruptOnKeyPress=False
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
debugLevel=0
|
debugLevel=1
|
||||||
punctuationLevel=1
|
punctuationLevel=1
|
||||||
# define the current fenrir key
|
|
||||||
fenrirKeys=KEY_KP0
|
fenrirKeys=KEY_KP0
|
||||||
|
|
||||||
[promote]
|
[promote]
|
||||||
enabled=True
|
enabled=True
|
||||||
inactiveTimeoutSec=120
|
inactiveTimeoutSec=120
|
||||||
list=
|
list=chrys,test
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,14 +5,16 @@ class command():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
|
print('run')
|
||||||
if (environment['commandBuffer']['Marks']['1'] == None) or \
|
if (environment['commandBuffer']['Marks']['1'] == None) or \
|
||||||
(environment['commandBuffer']['Marks']['2'] == None):
|
(environment['commandBuffer']['Marks']['2'] == None):
|
||||||
environment['runtime']['outputManager'].presentText(environment, "two marks needed", interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "two marks needed", interrupt=True)
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
marked = mark_utils.getTextBetweenMarks(environment['commandBuffer']['Marks']['1'], environment['commandBuffer']['Marks']['2'], environment['screenData']['newContentText'].split('\n'))
|
marked = mark_utils.getTextBetweenMarks(environment['commandBuffer']['Marks']['1'], environment['commandBuffer']['Marks']['2'], environment['screenData']['newContentText'].split('\n'))
|
||||||
|
|
||||||
environment['commandBuffer']['clipboard'] = [marked] + environment['commandBuffer']['clipboard'][:9]
|
environment['commandBuffer']['clipboard'] = [marked] + environment['commandBuffer']['clipboard'][:9]
|
||||||
environment['commandBuffer']['clipboard'] = 0
|
environment['commandBuffer']['currClipboard'] = 0
|
||||||
|
|
||||||
if marked.strip(" \t\n") == '':
|
if marked.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||||
|
@ -11,7 +11,7 @@ class command():
|
|||||||
return environment
|
return environment
|
||||||
|
|
||||||
marked = mark_utils.getTextBetweenMarks(environment['commandBuffer']['Marks']['1'], environment['commandBuffer']['Marks']['2'], environment['screenData']['newContentText'].split('\n'))
|
marked = mark_utils.getTextBetweenMarks(environment['commandBuffer']['Marks']['1'], environment['commandBuffer']['Marks']['2'], environment['screenData']['newContentText'].split('\n'))
|
||||||
|
print(marked)
|
||||||
if marked.strip(" \t\n") == '':
|
if marked.strip(" \t\n") == '':
|
||||||
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, "blank", soundIcon='EmptyLine', interrupt=True)
|
||||||
else:
|
else:
|
||||||
|
@ -6,14 +6,16 @@ class command():
|
|||||||
def run(self, environment):
|
def run(self, environment):
|
||||||
if environment['screenData']['newCursorReview'] == None:
|
if environment['screenData']['newCursorReview'] == None:
|
||||||
environment['runtime']['outputManager'].presentText(environment, 'no review cursor', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, 'no review cursor', interrupt=True)
|
||||||
|
return environment
|
||||||
|
|
||||||
if environment['commandBuffer']['Marks']['1'] == None:
|
if environment['commandBuffer']['Marks']['1'] == None:
|
||||||
environment['commandBuffer']['Marks']['1'] = environment['screenData']['newCursorReview']
|
environment['commandBuffer']['Marks']['1'] = environment['screenData']['newCursorReview'].copy()
|
||||||
else:
|
else:
|
||||||
environment['commandBuffer']['Marks']['2'] = environment['screenData']['newCursorReview']
|
environment['commandBuffer']['Marks']['2'] = environment['screenData']['newCursorReview'].copy()
|
||||||
|
|
||||||
environment['runtime']['outputManager'].presentText(environment, 'set mark', interrupt=True)
|
environment['runtime']['outputManager'].presentText(environment, 'set mark', interrupt=True)
|
||||||
return environment
|
|
||||||
|
return environment
|
||||||
def setCallback(self, callback):
|
def setCallback(self, callback):
|
||||||
pass
|
pass
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
|
@ -3,6 +3,7 @@ import importlib.util
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from utils import debug
|
||||||
|
|
||||||
class commandManager():
|
class commandManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -27,6 +28,7 @@ class commandManager():
|
|||||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||||
continue
|
continue
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
def executeTriggerCommands(self, environment, trigger):
|
def executeTriggerCommands(self, environment, trigger):
|
||||||
for cmd in sorted(environment['commands'][trigger]):
|
for cmd in sorted(environment['commands'][trigger]):
|
||||||
try:
|
try:
|
||||||
|
@ -5,7 +5,7 @@ import time
|
|||||||
# used as shared memory between commands
|
# used as shared memory between commands
|
||||||
# use this in your own commands
|
# use this in your own commands
|
||||||
commandBuffer = {
|
commandBuffer = {
|
||||||
'clipboard':['chrys\n', 'test', 'ls\n'],
|
'clipboard':[],
|
||||||
'currClipboard': 0,
|
'currClipboard': 0,
|
||||||
'Marks':{'1':None, '2':None}
|
'Marks':{'1':None, '2':None}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import evdev
|
|||||||
from evdev import InputDevice, UInput
|
from evdev import InputDevice, UInput
|
||||||
from select import select
|
from select import select
|
||||||
import time
|
import time
|
||||||
|
from utils import debug
|
||||||
|
|
||||||
class inputManager():
|
class inputManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#!/bin/python
|
#!/bin/python
|
||||||
from utils import debug
|
from utils import debug
|
||||||
|
|
||||||
class outputManager():
|
class outputManager():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -15,12 +15,15 @@ def getTextBetweenMarks(firstMark, secondMark, inText):
|
|||||||
startY = startMark['y']
|
startY = startMark['y']
|
||||||
textPart = ''
|
textPart = ''
|
||||||
while startY <= endMark['y']:
|
while startY <= endMark['y']:
|
||||||
if startY < endMark['y']:
|
if startMark['y'] == endMark['y']:
|
||||||
textPart += inText[startY][startX:]
|
textPart += inText[startY][startX:endMark['x'] + 1]
|
||||||
if len(textPart) - len(textPart[::-1].strip()) > 0:
|
|
||||||
textPart = textPart[:len(textPart[::-1].strip())] + "\n"
|
|
||||||
else:
|
else:
|
||||||
textPart += inText[startY][:startX + 1]
|
if startY < endMark['y']:
|
||||||
|
textPart += inText[startY][startX:]
|
||||||
|
if len(textPart) - len(textPart[::-1].strip()) > 0:
|
||||||
|
textPart = textPart[:len(textPart[::-1].strip())] + "\n"
|
||||||
|
else:
|
||||||
|
textPart += inText[startY][:startX + 1]
|
||||||
startX = 0
|
startX = 0
|
||||||
startY += 1
|
startY += 1
|
||||||
return textPart
|
return textPart
|
||||||
|
Loading…
Reference in New Issue
Block a user