diff --git a/TODO b/TODO index f5227b30..e6ecc15f 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,10 @@ ToDos in Priority order: in special cases next word skipps a word, "word<12 spaces>word2<12 spaces>word3 (storm_dragon) spellcheck triggers twice if there are two spaces after an word and you arrow over them fenrir is not able to detect the current application inside of screen. + ps -e -H -o pid,pgrp,ppid,tty,cmd + http://stackoverflow.com/questions/24861351/how-to-detect-if-python-script-is-being-run-as-a-background-process/24862213 + fd = os.open("/dev/tty5", os.O_RDONLY ) + os.tcgetpgrp(fd) - implement onScreenUpdate commands read highlighted text mode 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 e11f0a35..3e8183ba 100644 --- a/config/settings/espeak.settings.conf +++ b/config/settings/espeak.settings.conf @@ -121,4 +121,8 @@ enabled=True inactiveTimeoutSec=120 list= - +[time] +enabled=False +presentTime=True +presentDate=True +delaySec=3600 diff --git a/config/settings/settings.conf b/config/settings/settings.conf index 4053ce65..6c68c389 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -123,4 +123,12 @@ enabled=True 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.chrys b/config/settings/settings.conf.chrys index ba13d46a..82861dfb 100644 --- a/config/settings/settings.conf.chrys +++ b/config/settings/settings.conf.chrys @@ -123,4 +123,12 @@ enabled=True 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 4d2a2c3a..5b47566f 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -68,8 +68,17 @@ cursor=True #follow highlighted text changes highlight=False - [promote] enabled=True 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 new file mode 100644 index 00000000..f63461e8 --- /dev/null +++ b/src/fenrir/commands/onScreenUpdate/76000-time.py @@ -0,0 +1,46 @@ +#!/bin/python +import time +# -*- coding: utf-8 -*- + +# Fenrir TTY screen reader +# By Chrys, Storm Dragon, and contributers. + +from core import debug +import time +import datetime + +class command(): + def __init__(self): + pass + def initialize(self, environment): + self.env = environment + self.lastTime = time.time() + self.lastDateString = '' + self.lastTimeString = '' + def shutdown(self): + pass + def getDescription(self): + return 'No Description found' + + def run(self): + if not self.env['runtime']['settingsManager'].getSettingAsBool('time', 'enabled'): + return + if int(time.time() - self.lastTime) < self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec'): + return + timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat') + timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat) + + 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 6355147e..fab91ada 100644 --- a/src/fenrir/core/settings.py +++ b/src/fenrir/core/settings.py @@ -64,6 +64,12 @@ settings = { 'inactiveTimeoutSec': 120, 'list': '', }, +'time':{ + 'enabled': False, + 'presentTime': True, + 'presentDate': True, + 'delaySec': 3600, +}, 'keyboard':{ 'driver': 'evdev', 'device': 'all', diff --git a/src/fenrir/fenrir.py b/src/fenrir/fenrir.py index 2073414c..6a9389f9 100644 --- a/src/fenrir/fenrir.py +++ b/src/fenrir/fenrir.py @@ -69,6 +69,7 @@ class fenrir(): def prepareCommand(self): if self.environment['runtime']['screenManager'].isSuspendingScreen(): + self.wasCommand = False return if self.environment['runtime']['inputManager'].noKeyPressed(): return