forked from M-Labs/thermostat
Implement IPv4 settings dialog
This commit is contained in:
parent
2a31cdb1af
commit
39a78b92c4
|
@ -330,6 +330,32 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
self.actionEnter_DFU_Mode.triggered.connect(dfu_mode)
|
||||
self.thermostat_menu.addAction(self.actionEnter_DFU_Mode)
|
||||
|
||||
@asyncSlot(bool)
|
||||
async def network_settings(_):
|
||||
ask_network = QtWidgets.QInputDialog(self)
|
||||
ask_network.setWindowTitle(_translate("MainWindow", "Network Settings"))
|
||||
ask_network.setLabelText(_translate("MainWindow", "Set the Thermostat's IPv4 address, netmask and gateway (optional)"))
|
||||
ask_network.setTextValue((await self.client.ipv4())['addr'])
|
||||
|
||||
@pyqtSlot(str)
|
||||
def set_ipv4(ipv4_settings):
|
||||
sure = QtWidgets.QMessageBox(self)
|
||||
sure.setWindowTitle(_translate("MainWindow", "Set network?"))
|
||||
sure.setText(f"Setting this as network and disconnecting:<br>{ipv4_settings}")
|
||||
|
||||
@asyncSlot(object)
|
||||
async def really_set(button):
|
||||
await self.client.set_param("ipv4", ipv4_settings)
|
||||
await self.client.disconnect()
|
||||
|
||||
await self._on_connection_changed(False)
|
||||
|
||||
sure.buttonClicked.connect(really_set)
|
||||
sure.show()
|
||||
ask_network.textValueSelected.connect(set_ipv4)
|
||||
ask_network.show()
|
||||
|
||||
self.actionNetwork_Settings.triggered.connect(network_settings)
|
||||
self.thermostat_menu.addAction(self.actionNetwork_Settings)
|
||||
|
||||
@asyncSlot(bool)
|
||||
|
|
Loading…
Reference in New Issue