Skip to content
Snippets Groups Projects

Table working

Merged Marc Munoz requested to merge marcmunoz/bokeh-apps:master into master
1 file
+ 48
3
Compare changes
  • Side-by-side
  • Inline
+ 48
3
@@ -11,6 +11,8 @@ from bokeh.models.widgets import PreText
import epics
import time
import datetime
from bokeh.models import ColumnDataSource
from bokeh.models.widgets import DataTable, DateFormatter, TableColumn, NumberFormatter
doc=curdoc()
@@ -83,7 +85,22 @@ def monMessage(**kws):
themessage.append(thepv)
doc.add_next_tick_callback(partial(updateMessage, message=themessage))
@gen.coroutine
def updateTable(pv):
global dataTable
global data_table
global PVNameTable
newValues=[]
for r in PVNameTable:
newValues.append( epics.PV(r).get())
sourceTable.data["Values"]=newValues
def monTable(**kws):
thepv=kws
doc.add_next_tick_callback(partial(updateTable, pv=thepv))
# add a button widget and configure with the call back
PVList=["ISrc-010:ISS-HVPf-Doors:CloseR","ISrc-010:ISS-Intf-HMI:ComIocOK"]
@@ -97,11 +114,39 @@ for PVname in PVList:
thePVList.append(epics.PV(PVname, auto_monitor=True, callback=monPV))
ButtonList.append( Button(label=DictionaryPVs[PVname]))
ButtonDictionary=dict(zip(PVList,ButtonList))
first = Panel(child=column(ButtonList), title='Interlock')
InterlockPanel = Panel(child=column(ButtonList), title='Interlock')
MessagePV=epics.PV("NSO-LCR:Ops:Msg", auto_monitor=True, callback=monMessage)
pre = PreText(text="Waiting for messages",width=500, height=100)
second = Panel(child=widgetbox(pre), title='Messages')
tabs = Tabs(tabs=[first,second])
# Create the data source and the monitor for it
PVNameTable=["ISrc-010:ISS-Magtr:ForwdPwrR","ISrc-010:ISS-HVPS:VolR", "ISrc-010:PBI-BCM-001:AI4-IPCH-RBV","LEBT-010:PBI-BCM-001:AI5-IPCH-RBV"]
PVDescriptionTable=["Forward Power", "High Voltage", "BCM ISrc ", "BCM LEBT"]
PVListTable=[]
ValuesListTable=[]
i=0
for pv in PVNameTable:
PVListTable.append(epics.PV(PVNameTable[i]))
ValuesListTable.append(PVListTable[i].get())
i=i+1
dataTable = dict(
PVNames=PVNameTable,
Description=PVDescriptionTable,
Values=ValuesListTable
)
PVmonitorTable=epics.PV("ISrc-010:ISS-EVR-Magtr:Event-14-Cnt-I", auto_monitor=True, callback=monTable)
sourceTable = ColumnDataSource(dataTable)
columns = [
TableColumn(field="Description", title="PV"),
TableColumn(field="Values", title="Value", formatter=NumberFormatter(format='0.000')),
]
data_table = DataTable(source=sourceTable, columns=columns, width=400, height=280)
StatusPanel = Panel(child=widgetbox(data_table, pre), title='Messages')
tabs = Tabs(tabs=[StatusPanel,InterlockPanel])
doc.add_root(tabs)
Loading