replace runtime
This commit is contained in:
parent
5864ce2e2f
commit
71f4342367
@ -24,17 +24,15 @@ class fenrir():
|
|||||||
self.threadUpdateScreen = None
|
self.threadUpdateScreen = None
|
||||||
self.threadHandleInput = None
|
self.threadHandleInput = None
|
||||||
self.threadHandleCommandQueue = None
|
self.threadHandleCommandQueue = None
|
||||||
self.runtime = environment.runtime
|
self.environment = environment.environment
|
||||||
self.runtime['inputManager'] = inputManager.inputManager()
|
self.environment['runtime']['inputManager'] = inputManager.inputManager()
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
self.runtime['debug'] = debug.debug()
|
self.environment['runtime']['debug'] = debug.debug()
|
||||||
signal.signal(signal.SIGINT, self.captureSignal)
|
signal.signal(signal.SIGINT, self.captureSignal)
|
||||||
|
|
||||||
# the following hard coded, in future we have a config loader
|
# the following hard coded, in future we have a config loader
|
||||||
self.runtime['speechDriverString'] = 'speechd'
|
self.environment['runtime']['speechDriver'] = sd.speech()
|
||||||
self.runtime['speechDriver'] = sd.speech()
|
self.environment['runtime']['screenDriver'] = lx.screenManager()
|
||||||
self.runtime['screenDriverString'] = 'linux'
|
|
||||||
self.runtime['screenDriver'] = lx.screenManager()
|
|
||||||
|
|
||||||
def proceed(self):
|
def proceed(self):
|
||||||
self.threadUpdateScreen = Thread(target=self.updateScreen, args=())
|
self.threadUpdateScreen = Thread(target=self.updateScreen, args=())
|
||||||
@ -43,28 +41,28 @@ class fenrir():
|
|||||||
self.threadUpdateScreen.start()
|
self.threadUpdateScreen.start()
|
||||||
self.threadHandleInput.start()
|
self.threadHandleInput.start()
|
||||||
self.threadCommandQueue.start()
|
self.threadCommandQueue.start()
|
||||||
while(self.runtime['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
|
||||||
def handleInput(self):
|
def handleInput(self):
|
||||||
while(self.runtime['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
self.runtime = self.runtime['inputManager'].getKeyPressed(self.runtime)
|
self.environment = self.environment['runtime']['inputManager'].getKeyPressed(self.environment)
|
||||||
|
|
||||||
def updateScreen(self):
|
def updateScreen(self):
|
||||||
while(self.runtime['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
self.runtime = self.runtime['screenDriver'].analyzeScreen(self.runtime)
|
self.environment = self.environment['runtime']['screenDriver'].analyzeScreen(self.environment)
|
||||||
|
|
||||||
def handleCommandQueue(self):
|
def handleCommandQueue(self):
|
||||||
while(self.runtime['running']):
|
while(self.environment['generalInformation']['running']):
|
||||||
self.runtime = self.runtime # command queue here
|
self.environment = self.environment # command queue here
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
self.runtime['running'] = False
|
self.environment['generalInformation']['running'] = False
|
||||||
if self.runtime['speechDriver'] != None:
|
if self.environment['runtime']['speechDriver'] != None:
|
||||||
self.runtime['speechDriver'].shutdown()
|
self.environment['runtime']['speechDriver'].shutdown()
|
||||||
if self.runtime['debug'] != None:
|
if self.environment['runtime']['debug'] != None:
|
||||||
self.runtime['debug'].closeDebugFile()
|
self.environment['runtime']['debug'].closeDebugFile()
|
||||||
|
|
||||||
def captureSignal(self, siginit, frame):
|
def captureSignal(self, siginit, frame):
|
||||||
self.shutdown()
|
self.shutdown()
|
||||||
|
Loading…
Reference in New Issue
Block a user