forked from M-Labs/thermostat
Clear Graph UI changes
This commit is contained in:
parent
b98773784e
commit
f75348c69d
@ -5,6 +5,7 @@ from pglive.sources.live_plot import LiveLinePlot
|
|||||||
from pglive.sources.live_axis import LiveAxis
|
from pglive.sources.live_axis import LiveAxis
|
||||||
from collections import deque
|
from collections import deque
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
|
from pytec.gui.model.thermostat import ThermostatConnectionState
|
||||||
|
|
||||||
pg.setConfigOptions(antialias=True)
|
pg.setConfigOptions(antialias=True)
|
||||||
|
|
||||||
@ -16,6 +17,9 @@ class LiveDataPlotter(QObject):
|
|||||||
|
|
||||||
self._thermostat.report_update.connect(self.update_report)
|
self._thermostat.report_update.connect(self.update_report)
|
||||||
self._thermostat.pid_update.connect(self.update_pid)
|
self._thermostat.pid_update.connect(self.update_pid)
|
||||||
|
self._thermostat.connection_state_changed.connect(
|
||||||
|
self.thermostat_state_change_handler
|
||||||
|
)
|
||||||
|
|
||||||
self.NUM_CHANNELS = len(live_plots)
|
self.NUM_CHANNELS = len(live_plots)
|
||||||
self.graphs = []
|
self.graphs = []
|
||||||
@ -25,6 +29,11 @@ class LiveDataPlotter(QObject):
|
|||||||
live_plot[1].setTitle(f"Channel {i} Current")
|
live_plot[1].setTitle(f"Channel {i} Current")
|
||||||
self.graphs.append(_TecGraphs(live_plot[0], live_plot[1]))
|
self.graphs.append(_TecGraphs(live_plot[0], live_plot[1]))
|
||||||
|
|
||||||
|
@pyqtSlot(ThermostatConnectionState)
|
||||||
|
def thermostat_state_change_handler(self, state):
|
||||||
|
if state == ThermostatConnectionState.DISCONNECTED:
|
||||||
|
self.clear_graphs()
|
||||||
|
|
||||||
def _config_connector_max_pts(self, connector, samples):
|
def _config_connector_max_pts(self, connector, samples):
|
||||||
connector.max_points = samples
|
connector.max_points = samples
|
||||||
connector.x = deque(maxlen=int(connector.max_points))
|
connector.x = deque(maxlen=int(connector.max_points))
|
||||||
|
@ -156,7 +156,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.background_task_lbl.setText("Ready.")
|
self.background_task_lbl.setText("Ready.")
|
||||||
self.loading_spinner.hide()
|
self.loading_spinner.hide()
|
||||||
self.loading_spinner.stop()
|
self.loading_spinner.stop()
|
||||||
self.channel_graphs.clear_graphs()
|
|
||||||
self.report_box.setChecked(False)
|
self.report_box.setChecked(False)
|
||||||
for ch in range(self.NUM_CHANNELS):
|
for ch in range(self.NUM_CHANNELS):
|
||||||
if self.autotuners.get_state(ch) != PIDAutotuneState.STATE_OFF:
|
if self.autotuners.get_state(ch) != PIDAutotuneState.STATE_OFF:
|
||||||
|
Loading…
Reference in New Issue
Block a user