add autotime functionality

This commit is contained in:
chrys 2016-11-09 21:28:18 +01:00
parent fc963b14a5
commit cd1dc49fd2
7 changed files with 61 additions and 3 deletions

View File

@ -121,4 +121,6 @@ enabled=True
inactiveTimeoutSec=120 inactiveTimeoutSec=120
list= list=
[time]
enabled=False
delaySec=3600

View File

@ -123,4 +123,10 @@ enabled=True
inactiveTimeoutSec=120 inactiveTimeoutSec=120
list= list=
[time]
# automatic time anouncement
enabled=True
# present time after x seconds
delaySec=3600

View File

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

View File

@ -68,8 +68,11 @@ cursor=True
#follow highlighted text changes #follow highlighted text changes
highlight=False highlight=False
[promote] [promote]
enabled=True enabled=True
inactiveTimeoutSec=120 inactiveTimeoutSec=120
list= list=
[time]
enabled=False
delaySec=3600

View File

@ -0,0 +1,40 @@
#!/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()
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')
# 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()
def setCallback(self, callback):
pass

View File

@ -64,6 +64,10 @@ settings = {
'inactiveTimeoutSec': 120, 'inactiveTimeoutSec': 120,
'list': '', 'list': '',
}, },
'time':{
'enabled': False,
'delaySec': 3600,
},
'keyboard':{ 'keyboard':{
'driver': 'evdev', 'driver': 'evdev',
'device': 'all', 'device': 'all',

View File

@ -69,6 +69,7 @@ class fenrir():
def prepareCommand(self): def prepareCommand(self):
if self.environment['runtime']['screenManager'].isSuspendingScreen(): if self.environment['runtime']['screenManager'].isSuspendingScreen():
self.wasCommand = False
return return
if self.environment['runtime']['inputManager'].noKeyPressed(): if self.environment['runtime']['inputManager'].noKeyPressed():
return return