first boot message improvements
This commit is contained in:
parent
044f48103f
commit
4ad87bdfed
13
server.py
13
server.py
@ -46,20 +46,19 @@ CSV_FOLDER = 'csv/new/'
|
|||||||
ALLOWED_EXTENSIONS = {'csv', 'png'}
|
ALLOWED_EXTENSIONS = {'csv', 'png'}
|
||||||
|
|
||||||
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
||||||
ticker.sendline('*') # run by default
|
time.sleep(2) # give the ticker time to initialise
|
||||||
time.sleep(8)
|
|
||||||
|
|
||||||
system_info = json.load(open('csv/system_info.json'))
|
system_info = json.load(open('csv/system_info.json'))
|
||||||
|
|
||||||
|
ticker.sendline('*') # run startup gif by default
|
||||||
|
time.sleep(8)
|
||||||
if system_info['first_boot']: # let startup message display
|
if system_info['first_boot']: # let startup message display
|
||||||
|
|
||||||
time.sleep(10)
|
ticker.sendline('-')
|
||||||
system_info['first_boot'] = False
|
system_info['first_boot'] = False
|
||||||
json.dump(system_info, open('csv/system_info.json', 'w'))
|
json.dump(system_info, open('csv/system_info.json', 'w'))
|
||||||
|
else:
|
||||||
|
ticker.sendline('A') # run by default
|
||||||
ticker.sendline('A') # run by default
|
|
||||||
|
|
||||||
def allowed_file(filename):
|
def allowed_file(filename):
|
||||||
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||||
|
@ -2713,12 +2713,25 @@ class StockTicker():
|
|||||||
|
|
||||||
elif msg == 'K': # kill
|
elif msg == 'K': # kill
|
||||||
self.resetMatrix()
|
self.resetMatrix()
|
||||||
|
|
||||||
|
elif msg =='-':
|
||||||
|
self.run_intro_screen()
|
||||||
|
|
||||||
|
elif msg == '*':
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
self.displayGIF(start_GIF, delay = 0.02, repeat = False)
|
||||||
|
#stock_ticker.setImage(start_image)
|
||||||
|
time.sleep(2)
|
||||||
|
self.resetMatrix()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run_intro_screen(self):
|
def run_intro_screen(self):
|
||||||
dct = {"feature": "Custom Messages", "speed": "Slow", "animation": "Down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic", "text_colour": "White", "size": "Large", "background_colour": "Black"}]}
|
dct = {"feature": "Custom Messages", "speed": "Medium", "animation": "Down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic!", "text_colour": "White", "size": "Large", "background_colour": "Black"}, {"name": "get_started", "text": "To get started, connect your device to the \"Fintic Hotspot\" and access \"fintic.local:1024\" on your web browser. You can connect your ticker to Wi-Fi there.", "text_colour": "White", "size": "Small", "background_colour": "Black"}]}
|
||||||
json.dump(dct, open('csv/message_settings.json', 'w'))
|
json.dump(dct, open('csv/message_settings.json', 'w'))
|
||||||
self.scrollFunctionsAnimated(['Custom Messages'], repeat = False)
|
self.scrollFunctionsAnimated(['Custom Messages'], repeat = True)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
@ -2731,21 +2744,11 @@ if __name__ == '__main__':
|
|||||||
start_GIF = Image.open('./logos/startup_logo1.gif')
|
start_GIF = Image.open('./logos/startup_logo1.gif')
|
||||||
|
|
||||||
msg = getInput()
|
msg = getInput()
|
||||||
if msg =='*':
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
stock_ticker.displayGIF(start_GIF, delay = 0.02, repeat = False)
|
|
||||||
#stock_ticker.setImage(start_image)
|
|
||||||
time.sleep(2)
|
|
||||||
stock_ticker.resetMatrix()
|
|
||||||
|
|
||||||
system_info = json.load(open('csv/system_info.json'))
|
|
||||||
|
|
||||||
|
|
||||||
if system_info['first_boot']:
|
|
||||||
stock_ticker.run_intro_screen()
|
|
||||||
stock_ticker.resetMatrix()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2757,8 +2760,10 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
#stock_ticker.process_msg('G')
|
#stock_ticker.process_msg('*')
|
||||||
#stock_ticker.process_msg('f')
|
#time.sleep(8)
|
||||||
|
|
||||||
|
#stock_ticker.process_msg('-')
|
||||||
#stock_ticker.process_msg('W')
|
#stock_ticker.process_msg('W')
|
||||||
#stock_ticker.process_msg('A')
|
#stock_ticker.process_msg('A')
|
||||||
|
|
||||||
@ -2768,7 +2773,7 @@ if __name__ == '__main__':
|
|||||||
msg = getInput()
|
msg = getInput()
|
||||||
stock_ticker.process_msg(msg)
|
stock_ticker.process_msg(msg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||||
log.write(str(e))
|
log.write(str(e))
|
||||||
@ -2776,6 +2781,6 @@ if __name__ == '__main__':
|
|||||||
log.write('. line: ' + str(exc_tb.tb_lineno))
|
log.write('. line: ' + str(exc_tb.tb_lineno))
|
||||||
log.write('. type: ' + str(exc_type))
|
log.write('. type: ' + str(exc_type))
|
||||||
log.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
log.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
|
||||||
raise(e)
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user