diff options
Diffstat (limited to 'examples/lock_eit.py')
-rw-r--r-- | examples/lock_eit.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 5383d8a..279c8db 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -77,8 +77,8 @@ def updateLogPlot(apparatus): log.plot() log_chart.set_figure(f) plt.close(f) - print(f're-plotting') - update_webpage() + # print(f're-plotting') + update_webpage(apparatus=apparatus) async def updateLogPlotLoop(apparatus): while True: @@ -92,7 +92,7 @@ def updateLogFile(apparatus): logFileName = apparatus.logFileName if logFileName is not None: log.save(logFileName, item_format='.15e') - print(f'Saving to {logFileName}') + # print(f'Saving to {logFileName}') async def updateLogFileLoop(apparatus): @@ -145,7 +145,7 @@ async def main(): print('========== Initial lock ===========') apparatus.state = 'Initial lock' - update_webpage() + update_webpage(apparatus=apparatus) apparatus.log = initLog() apparatus.logFileName = None apparatus.pid.reset() @@ -156,7 +156,7 @@ async def main(): print('========= Long term lock ===========') apparatus.state = 'Long term lock' - update_webpage() + update_webpage(apparatus=apparatus) apparatus.log = initLog() apparatus.logFileName = None # apparatus.logFileName = apparatus.getNextDataFile() @@ -168,14 +168,14 @@ async def main(): # apparatus.log.save(apparatus.logFileName, item_format='.15e') apparatus.state = 'Done working with hardware' - update_webpage() + update_webpage(apparatus=apparatus) return(apparatus) -def update_webpage(byWhom=None): +def update_webpage(byWhom=None, apparatus=None): timestr = time.strftime("%a, %d %b %Y, %H:%M:%S", time.localtime()) clock_upd.text = f'Last update at {timestr}' try: - status_line.text=apparatus.state + status_line.text = apparatus.state except NameError: pass jp.run_task(wp.update()) @@ -189,8 +189,11 @@ async def jp_startup(): if __name__ == '__main__': wp = jp.WebPage(delete_flag=False) d=jp.Div(text='Magnetometer log', a=wp, classes='text-white bg-blue-500 text-center text-xl') - clock_upd = jp.Div(text='Loading...', classes='w-96 text-xl m-1 p-1 bg-gray-300 font-mono', a=wp) - status_line = jp.Div(test='Status string',classes='w-96 text-xl m-1 p-1 bg-gray-300 font-mono', a=wp) + + div_status = jp.Div(classes='text-xl flex m0 p-1 space-x-4 bg-gray-300 font-mono', a=wp) + clock_upd = jp.Div(text='Clock Loading...', classes='text-xl bg-gray-400', a=div_status) + status_line = jp.Div(text='Status Loading...',classes='text-xl', a=div_status) + f = plt.figure() log_chart = jp.Matplotlib(a=wp) plt.close(f) |