prepare for remake input handling, prepare other stuff
This commit is contained in:
parent
7227f52ac7
commit
1887810e69
@ -10,14 +10,14 @@ class inputManager():
|
||||
return environment
|
||||
def shutdown(self, environment):
|
||||
return environment
|
||||
def getInput(self, environment):
|
||||
def proceedInputEvent(self, environment):
|
||||
environment, timeout = environment['runtime']['inputDriver'].getInput(environment)
|
||||
return environment, timeout
|
||||
def grabDevices(self, environment):
|
||||
environment['runtime']['inputDriver'].grabDevices(environment)
|
||||
|
||||
def releaseDevices(self, environment):
|
||||
environment['runtime']['inputDriver'].releaseDevices(environment)
|
||||
environment['runtime']['inputDriver'].releaseDevices()
|
||||
|
||||
def isConsumeInput(self, environment):
|
||||
return environment['input']['consumeKey'] and \
|
||||
|
@ -9,5 +9,6 @@ runtime = {
|
||||
'inputManager': None,
|
||||
'commandManager': None,
|
||||
'screenManager': None,
|
||||
'outputManager': None,
|
||||
'debug':None,
|
||||
}
|
||||
|
@ -16,6 +16,6 @@ class screenManager():
|
||||
return environment
|
||||
|
||||
def isSuspendingScreen(self, environment):
|
||||
return environment['generalInformation']['suspend'] = environment['runtime']['screenDriver'].getCurrScreen() in \
|
||||
return environment['runtime']['screenDriver'].getCurrScreen() in \
|
||||
environment['runtime']['settingsManager'].getSetting(environment,'screen', 'suspendingScreen').split(',')
|
||||
|
||||
|
@ -184,7 +184,7 @@ class settingsManager():
|
||||
spec = importlib.util.spec_from_file_location(driverName, 'input/' + driverName + '.py')
|
||||
driver_mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(driver_mod)
|
||||
environment['runtime']['inputDriver'] = driver_mod.screen()
|
||||
environment['runtime']['inputDriver'] = driver_mod.input()
|
||||
environment['runtime']['inputDriver'].initialize(environment)
|
||||
return environment
|
||||
|
||||
|
@ -28,7 +28,7 @@ class fenrir():
|
||||
self.shutdown()
|
||||
|
||||
def handleProcess(self):
|
||||
self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvents(self.environment)
|
||||
self.environment, timeout = self.environment['runtime']['inputManager'].proceedInputEvent(self.environment)
|
||||
try:
|
||||
self.environment = self.environment['runtime']['screenManager'].update(self.environment)
|
||||
except Exception as e:
|
||||
@ -58,10 +58,11 @@ class fenrir():
|
||||
if self.environment['runtime']['debug'] != None:
|
||||
self.environment['runtime']['debug'].closeDebugFile()
|
||||
if self.environment['runtime']['soundDriver'] != None:
|
||||
self.environment['runtime']['soundDriver'].shutdown()
|
||||
self.environment['runtime']['soundDriver'].shutdown(environment)
|
||||
if self.environment['runtime']['speechDriver'] != None:
|
||||
self.environment['runtime']['speechDriver'].shutdown()
|
||||
self.environment['runtime']['inputManager'].freeDevices()
|
||||
self.environment['runtime']['speechDriver'].shutdown(environment)
|
||||
self.environment['runtime']['inputManager'].releaseDevices(self.environment)
|
||||
self.environment = None
|
||||
|
||||
app = fenrir()
|
||||
app.proceed()
|
||||
|
@ -16,14 +16,15 @@ class screen():
|
||||
def insert_newlines(self, string, every=64):
|
||||
return '\n'.join(string[i:i+every] for i in range(0, len(string), every))
|
||||
def getCurrScreen(self):
|
||||
currScreen = -1
|
||||
try:
|
||||
currScreenFile = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||
currScreen = currScreenFile.read()[3:-1]
|
||||
currScreenFile.close()
|
||||
except Exception as e:
|
||||
environment['runtime']['debug'].writeDebugOut(environment,str(e),debug.debugLevel.ERROR)
|
||||
return -1
|
||||
return currScreen
|
||||
|
||||
return currScreen
|
||||
|
||||
def update(self, environment, trigger='updateScreen'):
|
||||
newTTY = ''
|
||||
|
@ -18,5 +18,3 @@ class sound():
|
||||
pass
|
||||
def setVolume(self, volume):
|
||||
self.volume = volume
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user