diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index 53e250f34..43a689a73 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -104,6 +104,33 @@ class ReceiverProxyClient(_BaseProxyClient): async def disconnect_cr(self): await self.receiver.close() +class LogWaveform(_BaseWaveform): + def __init__(self, name, width, parent=None): + _BaseWaveform.__init__(self, name, width, parent, pen=None, symbol="x") + + def onDataChange(self, data): + try: + x_data = zip(*data)[0] + self.plot_data_item.setData( + x=x_data, y=np.ones(len(x_data))) + old_msg = "" + old_x = 0 + for x, msg in data: + if x == old_x: + old_msg += "\n" + msg + else: + lbl = pg.TextItem(old_msg) + self.addItem(lbl) + lbl.setPos(old_x, 1) + old_msg = msg + old_x = x + lbl = pg.TextItem(old_msg) + self.addItem(lbl) + lbl.setPos(old_x, 1) + except: + logger.error('Error when displaying waveform: {}'.format(self.name), exc_info=True) + self.plot_data_item.setData(x=[], y=[]) + class _BackgroundItem(pg.GraphicsWidgetAnchor, pg.GraphicsWidget): def __init__(self, parent, rect):