add autotime toggle, announce date on change, make configurable what is spoken date or time or both

This commit is contained in:
chrys 2016-11-09 23:17:58 +01:00
parent 90ebbaf749
commit 3171018e6e
10 changed files with 65 additions and 12 deletions

View File

@ -75,6 +75,7 @@ KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
KEY_FENRIR,KEY_BACKSLASH=toggle_output
KEY_FENRIR,KEY_CTRL,KEY_E=toggle_emoticons
key_FENRIR,KEY_KPENTER=toggle_auto_read
#=toggle_auto_time
KEY_FENRIR,KEY_KPASTERISK=toggle_highlight_tracking
KEY_FENRIR,KEY_Q=quit_fenrir
KEY_FENRIR,KEY_T=time

View File

@ -75,6 +75,7 @@ KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
KEY_FENRIR,KEY_SHIFT,KEY_ENTER=toggle_output
KEY_FENRIR,KEY_SHIFT,KEY_E=toggle_emoticons
KEY_FENRIR,KEY_ENTER=toggle_auto_read
#=toggle_auto_time
KEY_FENRIR,KEY_Y=toggle_highlight_tracking
KEY_FENRIR,KEY_Q=quit_fenrir
KEY_FENRIR,KEY_T=time

View File

@ -75,6 +75,7 @@ KEY_FENRIR,KEY_RIGHTBRACE=toggle_auto_spell_check
KEY_FENRIR,KEY_BACKSLASH=toggle_output
#=toggle_emoticons
key_FENRIR,KEY_KPENTER=toggle_auto_read
#=toggle_auto_time
#=toggle_highlight_tracking
KEY_FENRIR,KEY_Q=quit_fenrir
KEY_FENRIR,KEY_T=time

View File

@ -123,4 +123,6 @@ list=
[time]
enabled=False
presentTime=True
presentDate=True
delaySec=3600

View File

@ -125,8 +125,10 @@ list=
[time]
# automatic time anouncement
enabled=True
enabled=False
# present time
presentTime=True
# present date (on change)
presentDate=True
# present time after x seconds
delaySec=3600

View File

@ -124,5 +124,11 @@ inactiveTimeoutSec=120
list=
[time]
# automatic time anouncement
enabled=False
# present time
presentTime=True
# present date (on change)
presentDate=True
# present time after x seconds
delaySec=3600

View File

@ -74,5 +74,11 @@ inactiveTimeoutSec=120
list=
[time]
# automatic time anouncement
enabled=False
# present time
presentTime=True
# present date (on change)
presentDate=True
# present time after x seconds
delaySec=3600

View File

@ -0,0 +1,26 @@
#!/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 'enables or disables automatic reading of time after an period'
def run(self):
self.env['runtime']['settingsManager'].setSetting('time', 'enabled', str(not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled')))
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'):
self.env['runtime']['outputManager'].presentText("autotime enabled", soundIcon='', interrupt=True)
else:
self.env['runtime']['outputManager'].presentText("autotime disabled", soundIcon='', interrupt=True)
def setCallback(self, callback):
pass

View File

@ -15,6 +15,8 @@ class command():
def initialize(self, environment):
self.env = environment
self.lastTime = time.time()
self.lastDateString = ''
self.lastTimeString = ''
def shutdown(self):
pass
def getDescription(self):
@ -26,15 +28,19 @@ class command():
if int(time.time() - self.lastTime) < self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec'):
return
timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat')
# get the time formatted
timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat)
# present the time
self.env['runtime']['outputManager'].presentText('Autotime: ' + timeString , soundIcon='', interrupt=False)
self.lastTime = time.time()
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime'):
# present the time
self.env['runtime']['outputManager'].presentText('Autotime: ' + timeString , soundIcon='', interrupt=False)
# and date if changes
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentDate'):
if self.lastDateString != dateString:
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=False)
self.lastDateString = dateString
self.lastTime = time.time()
self.lastTimeString = timeString
def setCallback(self, callback):
pass

View File

@ -66,6 +66,8 @@ settings = {
},
'time':{
'enabled': False,
'presentTime': True,
'presentDate': True,
'delaySec': 3600,
},
'keyboard':{