Add info boxes when loading/saving configs

This commit is contained in:
atse 2023-09-29 10:19:17 +08:00
parent 442450667b
commit 6005caf8b7

View File

@ -443,6 +443,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
@asyncSlot(bool) @asyncSlot(bool)
async def load(_): async def load(_):
await self.client.load_config() await self.client.load_config()
loaded = QtWidgets.QMessageBox(self)
loaded.setWindowTitle("Config loaded")
loaded.setText(f"All channel configs have been loaded from flash.")
loaded.setIcon(QtWidgets.QMessageBox.Icon.Information)
loaded.show()
self.actionLoad_all_configs.triggered.connect(load) self.actionLoad_all_configs.triggered.connect(load)
self.thermostat_menu.addAction(self.actionLoad_all_configs) self.thermostat_menu.addAction(self.actionLoad_all_configs)
@ -450,6 +455,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
@asyncSlot(bool) @asyncSlot(bool)
async def save(_): async def save(_):
await self.client.save_config() await self.client.save_config()
saved = QtWidgets.QMessageBox(self)
saved.setWindowTitle("Config saved")
saved.setText(f"All channel configs have been saved to flash.")
saved.setIcon(QtWidgets.QMessageBox.Icon.Information)
saved.show()
self.actionSave_all_configs.triggered.connect(save) self.actionSave_all_configs.triggered.connect(save)
self.thermostat_menu.addAction(self.actionSave_all_configs) self.thermostat_menu.addAction(self.actionSave_all_configs)
@ -685,12 +695,22 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
@asyncSlot() @asyncSlot()
async def save(_, ch=i): async def save(_, ch=i):
await self.client.save_config(ch) await self.client.save_config(ch)
saved = QtWidgets.QMessageBox(self)
saved.setWindowTitle("Config saved")
saved.setText(f"Channel {ch} Config has been saved to flash.")
saved.setIcon(QtWidgets.QMessageBox.Icon.Information)
saved.show()
self.params[i].child('Save to flash').sigActivated.connect(save) self.params[i].child('Save to flash').sigActivated.connect(save)
@asyncSlot() @asyncSlot()
async def load(_, ch=i): async def load(_, ch=i):
await self.client.load_config(ch) await self.client.load_config(ch)
loaded = QtWidgets.QMessageBox(self)
loaded.setWindowTitle("Config loaded")
loaded.setText(f"Channel {ch} Config has been loaded from flash.")
loaded.setIcon(QtWidgets.QMessageBox.Icon.Information)
loaded.show()
self.params[i].child('Load from flash').sigActivated.connect(load) self.params[i].child('Load from flash').sigActivated.connect(load)