Merge branch 'master' into wordWrappingEndOfScreenBell
This commit is contained in:
commit
59384f4f28
@ -125,4 +125,7 @@ list=
|
||||
enabled=False
|
||||
presentTime=True
|
||||
presentDate=True
|
||||
delaySec=3600
|
||||
delaySec=0
|
||||
# present time after to given minutes example every 15 minutes: 00,15,30,45
|
||||
# if delaySec is >0 onMinutes is ignored
|
||||
onMinutes=00,30
|
||||
|
@ -130,5 +130,8 @@ enabled=False
|
||||
presentTime=True
|
||||
# present date (on change)
|
||||
presentDate=True
|
||||
# present time after x seconds
|
||||
delaySec=3600
|
||||
# present time after a given period of seconds
|
||||
delaySec=0
|
||||
# present time after to given minutes example every 15 minutes: 00,15,30,45
|
||||
# if delaySec is >0 onMinutes is ignored
|
||||
onMinutes=00,30
|
||||
|
@ -131,4 +131,7 @@ presentTime=True
|
||||
# present date (on change)
|
||||
presentDate=True
|
||||
# present time after x seconds
|
||||
delaySec=3600
|
||||
delaySec=0
|
||||
# present time after to given minutes example every 15 minutes: 00,15,30,45
|
||||
# if delaySec is >0 onMinutes is ignored
|
||||
onMinutes=00,30
|
||||
|
@ -81,4 +81,7 @@ presentTime=True
|
||||
# present date (on change)
|
||||
presentDate=True
|
||||
# present time after x seconds
|
||||
delaySec=3600
|
||||
delaySec=0
|
||||
# present time after to given minutes example every 15 minutes: 00,15,30,45
|
||||
# if delaySec is >0 onMinutes is ignored
|
||||
onMinutes=00,30
|
||||
|
@ -14,7 +14,7 @@ class command():
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.lastTime = time.time()
|
||||
self.lastTime = datetime.datetime.now()
|
||||
self.lastDateString = ''
|
||||
self.lastTimeString = ''
|
||||
def shutdown(self):
|
||||
@ -25,13 +25,31 @@ class command():
|
||||
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'):
|
||||
onMinutes = self.env['runtime']['settingsManager'].getSetting('time', 'onMinutes')
|
||||
delaySec = self.env['runtime']['settingsManager'].getSettingAsInt('time', 'delaySec')
|
||||
# no need
|
||||
if onMinutes == '' and delaySec <= 0:
|
||||
return
|
||||
onMinutes = onMinutes.split(',')
|
||||
now = datetime.datetime.now()
|
||||
# ignore onMinutes if there is a delaySec
|
||||
if delaySec > 0:
|
||||
if int((now-self.lastTime).total_seconds()) < delaySec:
|
||||
return
|
||||
else:
|
||||
# shoul announce?
|
||||
if not str(now.minute) in onMinutes:
|
||||
return
|
||||
# already announced?
|
||||
if now.hour == self.lastTime.hour:
|
||||
if now.minute == self.lastTime.minute:
|
||||
return
|
||||
|
||||
timeFormat = self.env['runtime']['settingsManager'].getSetting('general', 'timeFormat')
|
||||
timeString = datetime.datetime.strftime(datetime.datetime.now(), timeFormat)
|
||||
timeString = datetime.datetime.strftime(now, timeFormat)
|
||||
|
||||
dateFormat = self.env['runtime']['settingsManager'].getSetting('general', 'dateFormat')
|
||||
dateString = datetime.datetime.strftime(datetime.datetime.now(), dateFormat)
|
||||
dateString = datetime.datetime.strftime(now, dateFormat)
|
||||
if self.env['runtime']['settingsManager'].getSettingAsBool('time', 'presentTime'):
|
||||
# present the time
|
||||
self.env['runtime']['outputManager'].presentText('Autotime: ' + timeString , soundIcon='', interrupt=False)
|
||||
@ -40,7 +58,7 @@ class command():
|
||||
if self.lastDateString != dateString:
|
||||
self.env['runtime']['outputManager'].presentText(dateString , soundIcon='', interrupt=False)
|
||||
self.lastDateString = dateString
|
||||
self.lastTime = time.time()
|
||||
self.lastTime = datetime.datetime.now()
|
||||
self.lastTimeString = timeString
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
@ -68,7 +68,8 @@ settings = {
|
||||
'enabled': False,
|
||||
'presentTime': True,
|
||||
'presentDate': True,
|
||||
'delaySec': 3600,
|
||||
'delaySec': 0,
|
||||
'onMinutes': '00,30',
|
||||
},
|
||||
'keyboard':{
|
||||
'driver': 'evdev',
|
||||
|
Loading…
Reference in New Issue
Block a user