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

36 lines
1.3 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):
self.env = environment
self.env['runtime']['settingsManager'].loadDriver(\
self.env['runtime']['settingsManager'].getSetting('screen', 'driver'), 'screenDriver')
if self.env['runtime']['settingsManager'].getSettingAsBool('screen', 'autodetectSuspendingScreen'):
self.autoIgnoreScreens = self.env['runtime']['screenDriver'].getIgnoreScreens()
2016-09-14 17:27:19 -04:00
def shutdown(self):
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
2016-09-12 19:25:08 -04:00
def update(self):
if not self.isSuspendingScreen():
self.env['runtime']['screenDriver'].update()
self.env['screenData']['lastScreenUpdate'] = time.time()
def isSuspendingScreen(self):
currScreen = self.env['runtime']['screenDriver'].getCurrScreen()
return ((currScreen in \
self.env['runtime']['settingsManager'].getSetting('screen', 'suspendingScreen').split(',')) or
(currScreen in self.autoIgnoreScreens))
2016-09-23 03:51:47 -04:00
def isScreenChange(self):
2016-09-23 20:45:12 -04:00
return self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']