2016-09-02 15:37:36 -04:00
|
|
|
#!/bin/python
|
|
|
|
import time
|
|
|
|
from utils import debug
|
|
|
|
|
|
|
|
class screenManager():
|
|
|
|
def __init__(self):
|
2016-09-13 07:04:55 -04:00
|
|
|
self.autoIgnoreScreens = []
|
2016-09-14 17:27:19 -04:00
|
|
|
|
|
|
|
def initialize(self, environment):
|
2016-09-16 19:04:03 -04:00
|
|
|
environment['runtime']['settingsManager'].loadDriver(environment,\
|
|
|
|
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'driver'), 'screenDriver')
|
2016-09-13 07:04:55 -04:00
|
|
|
if environment['runtime']['settingsManager'].getSettingAsBool(environment,'screen', 'autodetectSuspendingScreen'):
|
|
|
|
self.autoIgnoreScreens = environment['runtime']['screenDriver'].getIgnoreScreens()
|
2016-09-14 17:27:19 -04:00
|
|
|
|
2016-09-02 15:37:36 -04:00
|
|
|
def shutdown(self, environment):
|
2016-09-16 19:04:03 -04:00
|
|
|
if environment['runtime']['screenDriver']:
|
|
|
|
environment['runtime']['screenDriver'].shutdown(environment)
|
2016-09-12 19:25:08 -04:00
|
|
|
|
2016-09-02 15:37:36 -04:00
|
|
|
def update(self, environment):
|
2016-09-14 17:27:19 -04:00
|
|
|
if not self.isSuspendingScreen(environment):
|
2016-09-02 15:37:36 -04:00
|
|
|
environment = environment['runtime']['screenDriver'].update(environment)
|
2016-09-04 09:04:23 -04:00
|
|
|
environment['screenData']['lastScreenUpdate'] = time.time()
|
|
|
|
|
2016-09-02 15:37:36 -04:00
|
|
|
def isSuspendingScreen(self, environment):
|
2016-09-13 07:04:55 -04:00
|
|
|
currScreen = environment['runtime']['screenDriver'].getCurrScreen()
|
2016-09-14 17:06:56 -04:00
|
|
|
return ((currScreen in \
|
2016-09-13 07:04:55 -04:00
|
|
|
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'suspendingScreen').split(',')) or
|
2016-09-14 17:06:56 -04:00
|
|
|
(currScreen in self.autoIgnoreScreens))
|