diff --git a/pytec/pytec/gui/model/pid_autotuner.py b/pytec/pytec/gui/model/pid_autotuner.py index 676d88f..cfa2b96 100644 --- a/pytec/pytec/gui/model/pid_autotuner.py +++ b/pytec/pytec/gui/model/pid_autotuner.py @@ -4,10 +4,9 @@ from autotune import PIDAutotuneState, PIDAutotune class PIDAutoTuner(QObject): - def __init__(self, parent, client, thermostat, num_of_channel): + def __init__(self, parent, thermostat, num_of_channel): super().__init__() - self._client = client self._thermostat = thermostat self.autotuners = [PIDAutotune(25) for _ in range(num_of_channel)] self.target_temp = [20.0 for _ in range(num_of_channel)] diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index d6e6a8d..4666dd2 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -3,6 +3,7 @@ from qasync import asyncSlot from pytec.gui.model.property import Property, PropertyMeta import asyncio import logging +from pytec.aioclient import Client class Thermostat(QObject, metaclass=PropertyMeta): @@ -17,9 +18,9 @@ class Thermostat(QObject, metaclass=PropertyMeta): info_box_trigger = pyqtSignal(str, str) connection_error = pyqtSignal() - def __init__(self, parent, client, update_s): + def __init__(self, parent, update_s): self._update_s = update_s - self._client = client + self._client = Client() self._watch_task = None self._report_mode_task = None self._poll_for_report = True diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 4c59f39..17d8df1 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -8,7 +8,6 @@ from pytec.gui.view.ctrl_panel import CtrlPanel from pytec.gui.view.info_box import InfoBox from pytec.gui.model.pid_autotuner import PIDAutoTuner from pytec.gui.model.thermostat import Thermostat -from pytec.aioclient import Client import json from autotune import PIDAutotuneState from qasync import asyncSlot, asyncClose @@ -69,10 +68,8 @@ class MainWindow(QtWidgets.QMainWindow): self.hw_rev_data = None self.info_box = InfoBox() - self.client = Client() - self.thermostat = Thermostat( - self, self.client, self.report_refresh_spin.value() + self, self.report_refresh_spin.value() ) def handle_connection_error(): @@ -85,7 +82,7 @@ class MainWindow(QtWidgets.QMainWindow): self.thermostat.connection_error.connect(handle_connection_error) - self.autotuners = PIDAutoTuner(self, self.client, self.thermostat, 2) + self.autotuners = PIDAutoTuner(self, self.thermostat, 2) def get_ctrl_panel_config(args): with open(args.param_tree, "r") as f: