add autotime functionality
This commit is contained in:
parent
fc963b14a5
commit
cd1dc49fd2
@ -121,4 +121,6 @@ enabled=True
|
|||||||
inactiveTimeoutSec=120
|
inactiveTimeoutSec=120
|
||||||
list=
|
list=
|
||||||
|
|
||||||
|
[time]
|
||||||
|
enabled=False
|
||||||
|
delaySec=3600
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,4 +123,6 @@ enabled=True
|
|||||||
inactiveTimeoutSec=120
|
inactiveTimeoutSec=120
|
||||||
list=
|
list=
|
||||||
|
|
||||||
|
[time]
|
||||||
|
enabled=False
|
||||||
|
delaySec=3600
|
||||||
|
@ -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
|
||||||
|
40
src/fenrir/commands/onScreenUpdate/76000-time.py
Normal file
40
src/fenrir/commands/onScreenUpdate/76000-time.py
Normal 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
|
||||||
|
|
@ -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',
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user