Merge branch 'master' into storm
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
from fenrirscreenreader.utils import line_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('read line to cursor pos, use review cursor if you are in review mode, otherwhise use text cursor')
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
|
||||
x, y, currLine = \
|
||||
line_utils.getCurrentLine(cursorPos['x'], cursorPos['y'], self.env['screen']['newContentText'])
|
||||
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine[:cursorPos['x']], interrupt=True)
|
||||
self.env['runtime']['outputManager'].announceActiveCursor()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -26,8 +26,8 @@ class command():
|
||||
if currLine.isspace():
|
||||
self.env['runtime']['outputManager'].presentText(_("blank"), soundIcon='EmptyLine', interrupt=True)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText(currLine[cursorPos['x']], interrupt=True)
|
||||
self.env['runtime']['outputManager'].announceActiveCursor()
|
||||
self.env['runtime']['outputManager'].presentText(currLine[cursorPos['x']:], interrupt=True)
|
||||
self.env['runtime']['outputManager'].announceActiveCursor()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
|
@ -20,30 +20,37 @@ class command():
|
||||
return _('Export current fenrir clipboard to X or GUI clipboard')
|
||||
def run(self):
|
||||
_thread.start_new_thread(self._threadRun , ())
|
||||
|
||||
def _threadRun(self):
|
||||
try:
|
||||
if self.env['runtime']['memoryManager'].isIndexListEmpty('clipboardHistory'):
|
||||
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
|
||||
return
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
return
|
||||
|
||||
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
|
||||
user = self.env['general']['currUser']
|
||||
|
||||
for display in range(10):
|
||||
p = Popen('su ' + self.env['general']['currUser'] + ' -c "cat << \\\"EOF\\\" | xclip -d :' + str(display) + ' -selection clipboard\n' + clipboard + '\nEOF\n"', stdout=PIPE, stderr=PIPE, shell=True)
|
||||
stdout, stderr = p.communicate()
|
||||
p = Popen(
|
||||
['su', user, '-c', f"xclip -d :{display} -selection clipboard"],
|
||||
stdin=PIPE, stdout=PIPE, stderr=PIPE, preexec_fn=os.setpgrp
|
||||
)
|
||||
stdout, stderr = p.communicate(input=clipboard.encode('utf-8'))
|
||||
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
#screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding')
|
||||
|
||||
stderr = stderr.decode('utf-8')
|
||||
stdout = stdout.decode('utf-8')
|
||||
if (stderr == ''):
|
||||
break
|
||||
#stderr = stderr.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
|
||||
#stdout = stdout.decode(screenEncoding, "replace").encode('utf-8').decode('utf-8')
|
||||
|
||||
if stderr == '':
|
||||
break
|
||||
|
||||
if stderr != '':
|
||||
self.env['runtime']['outputManager'].presentText(stderr , soundIcon='', interrupt=False)
|
||||
self.env['runtime']['outputManager'].presentText(stderr, soundIcon='', interrupt=False)
|
||||
else:
|
||||
self.env['runtime']['outputManager'].presentText('exported to the X session.', interrupt=True)
|
||||
self.env['runtime']['outputManager'].presentText('exported to the X session.', interrupt=True)
|
||||
|
||||
except Exception as e:
|
||||
self.env['runtime']['outputManager'].presentText(e , soundIcon='', interrupt=False)
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(str(e), soundIcon='', interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -14,11 +14,11 @@ class command():
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('Move review to the bottom of the screen')
|
||||
return _('Move review to the bottom of the screen')
|
||||
|
||||
def run(self):
|
||||
self.env['screen']['newCursorReview'] = { 'x': 0, 'y':self.env['screen']['lines'] -1}
|
||||
self.env['runtime']['outputManager'].presentText(_("Bottom"), interrupt=True, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(_("Bottom"), interrupt=True, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -15,7 +15,7 @@ class command():
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('set review cursor to begin of current line and display the content')
|
||||
return _('set review cursor to begin of current line and display the content')
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
|
@ -0,0 +1,30 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('Move Review to the first character on the screen (left top)')
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['runtime']['cursorManager'].setReviewCursorPosition(0 ,0)
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
|
||||
char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(_("first character in screen"), interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -0,0 +1,30 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
from fenrirscreenreader.utils import char_utils
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return _('Move Review to the last character on the screen (right bottom)')
|
||||
|
||||
def run(self):
|
||||
cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor()
|
||||
self.env['runtime']['cursorManager'].setReviewCursorPosition(self.env['screen']['columns']-1 ,self.env['screen']['lines']-1)
|
||||
self.env['screen']['newCursorReview']['x'], self.env['screen']['newCursorReview']['y'], lastChar = \
|
||||
char_utils.getLastCharInLine(self.env['screen']['newCursorReview']['y'], self.env['screen']['newContentText'])
|
||||
|
||||
self.env['runtime']['outputManager'].presentText(lastChar ,interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
||||
self.env['runtime']['outputManager'].presentText(_("last character in screen"), interrupt=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -17,9 +17,15 @@ class command():
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
# enabled?
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'charEcho'):
|
||||
# enabled?
|
||||
active = self.env['runtime']['settingsManager'].getSettingAsInt('keyboard', 'charEchoMode')
|
||||
# 0 = off
|
||||
if active == 0:
|
||||
return
|
||||
# 2 = caps only
|
||||
if active == 2:
|
||||
if not self.env['input']['newCapsLock']:
|
||||
return
|
||||
# big changes are no char (but the value is bigger than one maybe the differ needs longer than you can type, so a little strange random buffer for now)
|
||||
xMove = abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x'])
|
||||
if xMove > 3:
|
||||
@ -42,6 +48,7 @@ class command():
|
||||
currDelta.strip() != '':
|
||||
currDelta = currDelta.strip()
|
||||
self.env['runtime']['outputManager'].presentText(currDelta, interrupt=True, ignorePunctuation=True, announceCapital=True, flush=False)
|
||||
print(currDelta)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/bin/python
|
||||
import time
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
@ -12,63 +11,75 @@ import datetime
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.lastTime = datetime.datetime.now()
|
||||
self.lastDateString = ''
|
||||
self.lastTimeString = ''
|
||||
self.lastTimeString = ''
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'):
|
||||
return
|
||||
onMinutes = self.env['runtime']['settingsManager'].getSetting('time', 'onMinutes')
|
||||
|
||||
onMinutes = self.env['runtime']['settingsManager'].getSetting('time', 'onMinutes')
|
||||
delaySec = self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec')
|
||||
|
||||
# no need
|
||||
if onMinutes == '' and delaySec <= 0:
|
||||
return
|
||||
|
||||
onMinutes = onMinutes.split(',')
|
||||
now = datetime.datetime.now()
|
||||
|
||||
# ignore onMinutes if there is a delaySec
|
||||
if delaySec > 0:
|
||||
if int((now-self.lastTime).total_seconds()) < delaySec:
|
||||
return
|
||||
if int((now - self.lastTime).total_seconds()) < delaySec:
|
||||
return
|
||||
else:
|
||||
# shoul announce?
|
||||
# should announce?
|
||||
if not str(now.minute).zfill(2) in onMinutes:
|
||||
return
|
||||
# already announced?
|
||||
if now.hour == self.lastTime.hour:
|
||||
if now.minute == self.lastTime.minute:
|
||||
return
|
||||
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
dateString = datetime.datetime.strftime(now, dateFormat)
|
||||
|
||||
|
||||
presentDate = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentDate') and \
|
||||
self.lastDateString != dateString
|
||||
presentTime = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime')
|
||||
self.lastDateString != dateString
|
||||
presentTime = self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime')
|
||||
|
||||
# no changed value to announce
|
||||
if not (presentDate or presentTime):
|
||||
return
|
||||
return
|
||||
|
||||
timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat')
|
||||
timeString = datetime.datetime.strftime(now, timeFormat)
|
||||
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'interrupt'):
|
||||
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'interrupt'):
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'announce'):
|
||||
self.env['runtime']['outputManager'].playSoundIcon('announce')
|
||||
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'announce'):
|
||||
self.env['runtime']['outputManager'].playSoundIcon('announce')
|
||||
|
||||
if presentTime:
|
||||
# present the time
|
||||
self.env['runtime']['outputManager'].presentText(_("It's {0}").format(timeString.replace(':00', " O'clock ").lstrip('0')), soundIcon='', interrupt=False)
|
||||
# and date if changes
|
||||
if presentDate:
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=False)
|
||||
self.lastDateString = dateString
|
||||
# Check if it's 12:00 AM
|
||||
if now.hour == 0 and now.minute == 0:
|
||||
# present the date
|
||||
self.env['runtime']['outputManager'].presentText(dateString, soundIcon='', interrupt=False)
|
||||
|
||||
self.lastTime = datetime.datetime.now()
|
||||
self.lastTimeString = timeString
|
||||
self.lastTimeString = timeString
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user