diff --git a/pytlu/online_monitor/pytlu_receiver.py b/pytlu/online_monitor/pytlu_receiver.py index 5bdcc6e..a7c2fc4 100644 --- a/pytlu/online_monitor/pytlu_receiver.py +++ b/pytlu/online_monitor/pytlu_receiver.py @@ -1,14 +1,11 @@ import time -from PyQt5 import Qt +from PyQt5 import QtWidgets import pyqtgraph as pg -from pyqtgraph.Qt import QtGui from pyqtgraph.dockarea import DockArea, Dock -import pyqtgraph.ptime as ptime from online_monitor.utils import utils from online_monitor.receiver.receiver import Receiver -from zmq.utils import jsonapi class PyTLU(Receiver): @@ -26,17 +23,17 @@ def setup_widgets(self, parent, name): dock_area.addDock(dock_status, 'top') # Status dock on top - cw = QtGui.QWidget() + cw = QtWidgets.QWidget() cw.setStyleSheet("QWidget {background-color:white}") - layout = QtGui.QGridLayout() + layout = QtWidgets.QGridLayout() cw.setLayout(layout) - self.rate_label = QtGui.QLabel("Readout Rate\n0 Hz") - self.timestamp_label = QtGui.QLabel("Data Timestamp\n") - self.plot_delay_label = QtGui.QLabel("Plot Delay\n") - self.spin_box = Qt.QSpinBox(value=0) + self.rate_label = QtWidgets.QLabel("Readout Rate\n0 Hz") + self.timestamp_label = QtWidgets.QLabel("Data Timestamp\n") + self.plot_delay_label = QtWidgets.QLabel("Plot Delay\n") + self.spin_box = QtWidgets.QSpinBox(value=0) self.spin_box.setMaximum(1000000) self.spin_box.setSuffix(" Readouts") - self.reset_button = QtGui.QPushButton('Reset') + self.reset_button = QtWidgets.QPushButton('Reset') layout.addWidget(self.timestamp_label, 0, 0, 0, 1) layout.addWidget(self.plot_delay_label, 0, 1, 0, 1) layout.addWidget(self.rate_label, 0, 2, 0, 1) @@ -104,6 +101,6 @@ def handle_data_if_active(self, data): # set timestamp, plot delay and readour rate self.rate_label.setText("Readout Rate\n%d Hz" % data['fps']) self.timestamp_label.setText("Data Timestamp\n%s" % time.asctime(time.localtime(data['timestamp_stop']))) - now = ptime.time() + now = time.time() self.plot_delay = self.plot_delay * 0.9 + (now - data['timestamp_stop']) * 0.1 self.plot_delay_label.setText("Plot Delay\n%s" % 'not realtime' if abs(self.plot_delay) > 5 else "%1.2f ms" % (self.plot_delay * 1.e3))