first boot message improvements

This commit is contained in:
Your Name 2022-02-15 18:33:32 +00:00
parent 044f48103f
commit 4ad87bdfed
2 changed files with 30 additions and 26 deletions

View File

@ -46,20 +46,19 @@ CSV_FOLDER = 'csv/new/'
ALLOWED_EXTENSIONS = {'csv', 'png'}
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
ticker.sendline('*') # run by default
time.sleep(8)
time.sleep(2) # give the ticker time to initialise
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
time.sleep(10)
ticker.sendline('-')
system_info['first_boot'] = False
json.dump(system_info, open('csv/system_info.json', 'w'))
ticker.sendline('A') # run by default
else:
ticker.sendline('A') # run by default
def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS

View File

@ -2714,11 +2714,24 @@ class StockTicker():
elif msg == 'K': # kill
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):
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'))
self.scrollFunctionsAnimated(['Custom Messages'], repeat = False)
self.scrollFunctionsAnimated(['Custom Messages'], repeat = True)
if __name__ == '__main__':
@ -2731,21 +2744,11 @@ if __name__ == '__main__':
start_GIF = Image.open('./logos/startup_logo1.gif')
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('f')
#stock_ticker.process_msg('*')
#time.sleep(8)
#stock_ticker.process_msg('-')
#stock_ticker.process_msg('W')
#stock_ticker.process_msg('A')
@ -2776,6 +2781,6 @@ if __name__ == '__main__':
log.write('. line: ' + str(exc_tb.tb_lineno))
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])))
raise(e)