forked from M-Labs/thermostat
linuswck
9acff86547
- Bugs fix: 1. Params Tree user input will not get overwritten by incoming report thermostat_data_model. 2. PID Autotune Sampling Period is now set according to Thermostat sampling interval 3. PID Autotune won't get stuck in Fail State 4. Various types disconnection related Bugs 5. Number of Samples stored in the plot cannot be set 6. Limit the max settable output current to be 2000mA - Improvement: 1. Params Tree settings can be changed with external json 2. Use a Tab system to show a single channel of config instead of two 3. Expose PID Autotune lookback params 4. Icon is changed to Artiq logo - Restructure: 1. Restructure the code to follow Model-View-Delegate Design Pattern
57 lines
2.0 KiB
Python
57 lines
2.0 KiB
Python
from PyQt6 import QtWidgets, QtCore
|
|
|
|
|
|
class conn_menu(QtWidgets.QMenu):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.setTitle("Connection Settings")
|
|
|
|
self.host_set_line = QtWidgets.QLineEdit()
|
|
self.host_set_line.setMinimumSize(QtCore.QSize(160, 0))
|
|
self.host_set_line.setMaximumSize(QtCore.QSize(160, 16777215))
|
|
self.host_set_line.setMaxLength(15)
|
|
self.host_set_line.setClearButtonEnabled(True)
|
|
|
|
def connect_on_enter_press():
|
|
self.connect_btn.click()
|
|
self.hide()
|
|
|
|
self.host_set_line.returnPressed.connect(connect_on_enter_press)
|
|
|
|
self.host_set_line.setText("192.168.1.26")
|
|
self.host_set_line.setPlaceholderText("IP for the Thermostat")
|
|
|
|
host = QtWidgets.QWidgetAction(self)
|
|
host.setDefaultWidget(self.host_set_line)
|
|
self.addAction(host)
|
|
self.host = host
|
|
|
|
self.port_set_spin = QtWidgets.QSpinBox()
|
|
self.port_set_spin.setMinimumSize(QtCore.QSize(70, 0))
|
|
self.port_set_spin.setMaximumSize(QtCore.QSize(70, 16777215))
|
|
self.port_set_spin.setMaximum(65535)
|
|
self.port_set_spin.setValue(23)
|
|
|
|
def connect_only_if_enter_pressed():
|
|
if (
|
|
not self.port_set_spin.hasFocus()
|
|
): # Don't connect if the spinbox only lost focus
|
|
return
|
|
connect_on_enter_press()
|
|
|
|
self.port_set_spin.editingFinished.connect(connect_only_if_enter_pressed)
|
|
|
|
port = QtWidgets.QWidgetAction(self)
|
|
port.setDefaultWidget(self.port_set_spin)
|
|
self.addAction(port)
|
|
self.port = port
|
|
|
|
self.exit_button = QtWidgets.QPushButton()
|
|
self.exit_button.setText("Exit GUI")
|
|
self.exit_button.pressed.connect(QtWidgets.QApplication.instance().quit)
|
|
|
|
exit_action = QtWidgets.QWidgetAction(self.exit_button)
|
|
exit_action.setDefaultWidget(self.exit_button)
|
|
self.addAction(exit_action)
|
|
self.exit_action = exit_action
|