fenrir/src/fenrir-package/core/screenManager.py

34 lines
1.4 KiB
Python
Raw Normal View History

#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
import time
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):
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
def shutdown(self, environment):
if environment['runtime']['screenDriver']:
environment['runtime']['screenDriver'].shutdown(environment)
2016-09-12 19:25:08 -04:00
def update(self, environment):
2016-09-14 17:27:19 -04:00
if not self.isSuspendingScreen(environment):
environment['runtime']['screenDriver'].update(environment)
environment['screenData']['lastScreenUpdate'] = time.time()
def isSuspendingScreen(self, environment):
2016-09-13 07:04:55 -04:00
currScreen = environment['runtime']['screenDriver'].getCurrScreen()
return ((currScreen in \
2016-09-13 07:04:55 -04:00
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'suspendingScreen').split(',')) or
(currScreen in self.autoIgnoreScreens))