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