aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-15 23:15:10 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-12-15 23:15:10 -0500
commit3e3afe82a2291c14b74b8721d8dc8793c9962618 (patch)
tree27d714e69c28676507d1fd78b054a532573c7c98 /examples
parent8f15837d857388666078cc43a22c541e3f36df91 (diff)
downloadpyExpControl-3e3afe82a2291c14b74b8721d8dc8793c9962618.tar.gz
pyExpControl-3e3afe82a2291c14b74b8721d8dc8793c9962618.zip
cleaner status report
Diffstat (limited to 'examples')
-rw-r--r--examples/lock_eit.py23
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)