forked from M-Labs/thermostat
Not just ip, can put domain name too, or "host"
This commit is contained in:
parent
b32062d855
commit
8ff08c1539
@ -189,7 +189,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
if args.connect:
|
||||
if args.IP:
|
||||
self.ip_set_line.setText(args.IP)
|
||||
self.host_set_line.setText(args.IP)
|
||||
if args.PORT:
|
||||
self.port_set_spin.setValue(int(args.PORT))
|
||||
self.connect_btn.click()
|
||||
@ -200,23 +200,23 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.connection_menu = QtWidgets.QMenu()
|
||||
self.connection_menu.setTitle('Connection Settings')
|
||||
|
||||
self.ip_set_line = QtWidgets.QLineEdit()
|
||||
self.host_set_line = QtWidgets.QLineEdit()
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.ip_set_line.sizePolicy().hasHeightForWidth())
|
||||
self.ip_set_line.setSizePolicy(sizePolicy)
|
||||
self.ip_set_line.setMinimumSize(QtCore.QSize(160, 0))
|
||||
self.ip_set_line.setMaximumSize(QtCore.QSize(160, 16777215))
|
||||
self.ip_set_line.setMaxLength(15)
|
||||
self.ip_set_line.setClearButtonEnabled(True)
|
||||
self.ip_set_line.setObjectName("ip_set_line")
|
||||
sizePolicy.setHeightForWidth(self.host_set_line.sizePolicy().hasHeightForWidth())
|
||||
self.host_set_line.setSizePolicy(sizePolicy)
|
||||
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)
|
||||
self.host_set_line.setObjectName("host_set_line")
|
||||
|
||||
self.ip_set_line.setText(_translate("MainWindow", "192.168.1.26"))
|
||||
self.ip_set_line.setPlaceholderText(_translate("MainWindow", "IP:port for the Thermostat"))
|
||||
self.host_set_line.setText(_translate("MainWindow", "192.168.1.26"))
|
||||
self.host_set_line.setPlaceholderText(_translate("MainWindow", "IP:port for the Thermostat"))
|
||||
|
||||
host = QtWidgets.QWidgetAction(self.connection_menu)
|
||||
host.setDefaultWidget(self.ip_set_line)
|
||||
host.setDefaultWidget(self.host_set_line)
|
||||
self.connection_menu.addAction(host)
|
||||
self.connection_menu.host = host
|
||||
|
||||
@ -383,7 +383,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.fan_group.setEnabled(result)
|
||||
self.report_group.setEnabled(result)
|
||||
|
||||
self.ip_set_line.setEnabled(not result)
|
||||
self.host_set_line.setEnabled(not result)
|
||||
self.port_set_spin.setEnabled(not result)
|
||||
self.connect_btn.setText("Disconnect" if result else "Connect")
|
||||
if result:
|
||||
@ -475,12 +475,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
@asyncSlot()
|
||||
async def on_connect_btn_clicked(self):
|
||||
ip, port = self.ip_set_line.text(), self.port_set_spin.value()
|
||||
ip, port = self.host_set_line.text(), self.port_set_spin.value()
|
||||
try:
|
||||
if not (self.tec_client.is_connecting() or self.tec_client.is_connected()):
|
||||
self.status_lbl.setText("Connecting...")
|
||||
self.connect_btn.setText("Stop")
|
||||
self.ip_set_line.setEnabled(False)
|
||||
self.host_set_line.setEnabled(False)
|
||||
self.port_set_spin.setEnabled(False)
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user