Add basic display for stdout and bokeh logger
This commit is contained in:
parent
2e737df2bf
commit
29c3b647a9
@ -1,11 +1,15 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
from bokeh.io import curdoc
|
from bokeh.io import curdoc
|
||||||
from bokeh.models import Tabs
|
from bokeh.layouts import column, row
|
||||||
|
from bokeh.models import Tabs, TextAreaInput
|
||||||
|
|
||||||
|
import panel_ccl_integrate
|
||||||
import panel_hdf_anatric
|
import panel_hdf_anatric
|
||||||
import panel_hdf_viewer
|
import panel_hdf_viewer
|
||||||
import panel_ccl_integrate
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="pyzebra", formatter_class=argparse.ArgumentDefaultsHelpFormatter
|
prog="pyzebra", formatter_class=argparse.ArgumentDefaultsHelpFormatter
|
||||||
@ -16,9 +20,32 @@ args = parser.parse_args()
|
|||||||
doc = curdoc()
|
doc = curdoc()
|
||||||
doc.title = "pyzebra"
|
doc.title = "pyzebra"
|
||||||
|
|
||||||
|
sys.stdout = StringIO()
|
||||||
|
stdout_textareainput = TextAreaInput(title="print output:", height=150)
|
||||||
|
|
||||||
|
bokeh_stream = StringIO()
|
||||||
|
bokeh_handler = logging.StreamHandler(bokeh_stream)
|
||||||
|
bokeh_handler.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
|
||||||
|
bokeh_logger = logging.getLogger('bokeh')
|
||||||
|
bokeh_logger.addHandler(bokeh_handler)
|
||||||
|
bokeh_log_textareainput = TextAreaInput(title="server output:", height=150)
|
||||||
|
|
||||||
# Final layout
|
# Final layout
|
||||||
tab_hdf_viewer = panel_hdf_viewer.create()
|
tab_hdf_viewer = panel_hdf_viewer.create()
|
||||||
tab_hdf_anatric = panel_hdf_anatric.create()
|
tab_hdf_anatric = panel_hdf_anatric.create()
|
||||||
tab_ccl_integrate = panel_ccl_integrate.create()
|
tab_ccl_integrate = panel_ccl_integrate.create()
|
||||||
|
|
||||||
doc.add_root(Tabs(tabs=[tab_hdf_viewer, tab_hdf_anatric, tab_ccl_integrate]))
|
doc.add_root(
|
||||||
|
column(
|
||||||
|
Tabs(tabs=[tab_hdf_viewer, tab_hdf_anatric, tab_ccl_integrate]),
|
||||||
|
row(stdout_textareainput, bokeh_log_textareainput, sizing_mode="scale_both"),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def update_stdout():
|
||||||
|
stdout_textareainput.value = sys.stdout.getvalue()
|
||||||
|
bokeh_log_textareainput.value = bokeh_stream.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
doc.add_periodic_callback(update_stdout, 1000)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user