Allows restarting of crashed persistent apps

This commit is contained in:
Andreas Völker 2018-12-31 13:52:58 +01:00
parent 9c0995a8b2
commit a2cd17ad92

16
main.py
View File

@ -95,14 +95,11 @@ if config.UseGui:
self.cv.wait()
data = self.datasource.getData()
screen.fill((0, 255, 0))
try:
for x in range(config.ScreenX):
for y in range(config.ScreenY):
i = x+y*config.ScreenX
color = (data[i*3+0], data[i*3+1], data[i*3+2])
pygame.draw.rect(screen, color, pygame.Rect(sf*x, sf*y, sf, sf))
except:
raise
for x in range(config.ScreenX):
for y in range(config.ScreenY):
i = x+y*config.ScreenX
color = (data[i*3+0], data[i*3+1], data[i*3+2])
pygame.draw.rect(screen, color, pygame.Rect(sf*x, sf*y, sf, sf))
pygame.display.flip()
logging.info("Closing GUI")
def join(self):
@ -257,7 +254,8 @@ class AppRunner(threading.Thread):
if self.app != None and not self.app.is_persistent:
self.app.stop()
self.currentApp = self.requestedApp
if self.currentApp in self.persistent_apps.keys():
if (self.currentApp in self.persistent_apps.keys()
and self.persistent_apps[self.currentApp].alive()):
self.app = self.persistent_apps[self.currentApp]
else:
self.app = self.startApp(self.requestedApp, self.param)