diff --git a/config/keyboard/desktop.conf b/config/keyboard/desktop.conf index 0eb82837..df260a4a 100644 --- a/config/keyboard/desktop.conf +++ b/config/keyboard/desktop.conf @@ -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 diff --git a/config/keyboard/laptop.conf b/config/keyboard/laptop.conf index be214ad7..27caf6e8 100644 --- a/config/keyboard/laptop.conf +++ b/config/keyboard/laptop.conf @@ -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 diff --git a/config/keyboard/test.conf b/config/keyboard/test.conf index 2c1e4867..4cea5c5b 100644 --- a/config/keyboard/test.conf +++ b/config/keyboard/test.conf @@ -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 diff --git a/config/settings/espeak.settings.conf b/config/settings/espeak.settings.conf index 8ba3eef1..3e8183ba 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -123,4 +123,6 @@ list= [time] enabled=False +presentTime=True +presentDate=True delaySec=3600 diff --git a/config/settings/settings.conf b/config/settings/settings.conf index a44a1de4..c3b007f5 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -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 - - diff --git a/config/settings/settings.conf.chrys b/config/settings/settings.conf.chrys index 10dc89c7..82861dfb 100644 --- a/config/settings/settings.conf.chrys +++ b/config/settings/settings.conf.chrys @@ -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 diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 6be9f982..5b47566f 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -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 diff --git a/src/fenrir/commands/commands/toggle_auto_time.py b/src/fenrir/commands/commands/toggle_auto_time.py new file mode 100644 index 00000000..98f7c5d3 --- /dev/null +++ b/src/fenrir/commands/commands/toggle_auto_time.py @@ -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 diff --git a/src/fenrir/commands/onScreenUpdate/76000-time.py b/src/fenrir/commands/onScreenUpdate/76000-time.py index 10ac2272..f63461e8 100644 --- a/src/fenrir/commands/onScreenUpdate/76000-time.py +++ b/src/fenrir/commands/onScreenUpdate/76000-time.py @@ -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 - diff --git a/src/fenrir/core/settings.py b/src/fenrir/core/settings.py index 5468a968..fab91ada 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settings.py @@ -66,6 +66,8 @@ settings = { }, 'time':{ 'enabled': False, + 'presentTime': True, + 'presentDate': True, 'delaySec': 3600, }, 'keyboard':{