move some commands to onScreenUpdate (WIP)
This commit is contained in:
parent
d90c6a85e1
commit
b15efce9d7
42
src/fenrir/commands/onScreenUpdate/70000-incoming.py
Normal file
42
src/fenrir/commands/onScreenUpdate/70000-incoming.py
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('speech', 'autoReadIncoming'):
|
||||
return
|
||||
# is there something to read?
|
||||
if not self.env['runtime']['screenManager'].isDelta():
|
||||
return
|
||||
if len(self.env['screen']['newDelta']) >=2:
|
||||
return
|
||||
# its a cursor movement (experimental) - maybe also check current shortcut string?
|
||||
|
||||
#if not '$' in self.env['screen']['newDelta'] and
|
||||
# not '#' in self.env['screen']['newDelta']:
|
||||
if abs(self.env['screen']['newCursor']['x'] - self.env['screen']['oldCursor']['x']) == 1:
|
||||
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
||||
return
|
||||
if abs(self.env['screen']['newCursor']['y'] - self.env['screen']['oldCursor']['y']) == 1:
|
||||
# if len(self.env['screen']['newDelta'].strip(' \n\t0123456789')) <= 2:
|
||||
return
|
||||
self.env['runtime']['outputManager'].presentText(self.env['screen']['newDelta'], interrupt=False, flush=False)
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
39
src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py
Normal file
39
src/fenrir/commands/onScreenUpdate/75000-incoming_promote.py
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/python
|
||||
import time
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No Description found'
|
||||
|
||||
def run(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('promote', 'enabled'):
|
||||
return
|
||||
if self.env['runtime']['settingsManager'].getSetting('promote', 'list').strip(" \t\n") == '':
|
||||
return
|
||||
if len(self.env['screen']['newDelta']) <= 2:
|
||||
return
|
||||
if int(time.time() - self.env['input']['lastInputTime']) < self.env['runtime']['settingsManager'].getSettingAsInt('promote', 'inactiveTimeoutSec'):
|
||||
return
|
||||
if len(self.env['runtime']['settingsManager'].getSetting('promote', 'list')) == 0:
|
||||
return
|
||||
for promote in self.env['runtime']['settingsManager'].getSetting('promote', 'list').split(','):
|
||||
if promote in self.env['screen']['newDelta']:
|
||||
self.env['runtime']['outputManager'].playSoundIcon('PromotedText')
|
||||
self.env['input']['lastInputTime'] = time.time()
|
||||
return
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user