forked from M-Labs/thermostat
Fix info boxes for load/saving from flash
This commit is contained in:
parent
93d09e9467
commit
d5e2abfac7
@ -6,9 +6,10 @@ from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag
|
|||||||
|
|
||||||
|
|
||||||
class ThermostatCtrlMenu(QtWidgets.QMenu):
|
class ThermostatCtrlMenu(QtWidgets.QMenu):
|
||||||
def __init__(self, thermostat, style):
|
def __init__(self, thermostat, info_box, style):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._thermostat = thermostat
|
self._thermostat = thermostat
|
||||||
|
self._info_box = info_box
|
||||||
self._style = style
|
self._style = style
|
||||||
self.setTitle("Thermostat settings")
|
self.setTitle("Thermostat settings")
|
||||||
|
|
||||||
@ -69,11 +70,9 @@ class ThermostatCtrlMenu(QtWidgets.QMenu):
|
|||||||
async def load(_):
|
async def load(_):
|
||||||
await self._thermostat.load_cfg()
|
await self._thermostat.load_cfg()
|
||||||
|
|
||||||
loaded = QtWidgets.QMessageBox(self)
|
self._info_box.display_info_box(
|
||||||
loaded.setWindowTitle("Config loaded")
|
"Config loaded", "All channel configs have been loaded from flash."
|
||||||
loaded.setText("All channel configs have been loaded from flash.")
|
)
|
||||||
loaded.setIcon(QtWidgets.QMessageBox.Icon.Information)
|
|
||||||
loaded.show()
|
|
||||||
|
|
||||||
self.actionLoad_all_configs = QtGui.QAction("Load Config", self)
|
self.actionLoad_all_configs = QtGui.QAction("Load Config", self)
|
||||||
self.actionLoad_all_configs.triggered.connect(load)
|
self.actionLoad_all_configs.triggered.connect(load)
|
||||||
@ -83,11 +82,9 @@ class ThermostatCtrlMenu(QtWidgets.QMenu):
|
|||||||
async def save(_):
|
async def save(_):
|
||||||
await self._thermostat.save_cfg()
|
await self._thermostat.save_cfg()
|
||||||
|
|
||||||
saved = QtWidgets.QMessageBox(self)
|
self._info_box.display_info_box(
|
||||||
saved.setWindowTitle("Config saved")
|
"Config saved", "All channel configs have been saved to flash."
|
||||||
saved.setText("All channel configs have been saved to flash.")
|
)
|
||||||
saved.setIcon(QtWidgets.QMessageBox.Icon.Information)
|
|
||||||
saved.show()
|
|
||||||
|
|
||||||
self.actionSave_all_configs = QtGui.QAction("Save Config", self)
|
self.actionSave_all_configs = QtGui.QAction("Save Config", self)
|
||||||
self.actionSave_all_configs.triggered.connect(save)
|
self.actionSave_all_configs.triggered.connect(save)
|
||||||
|
@ -116,7 +116,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.conn_menu = ConnMenu()
|
self.conn_menu = ConnMenu()
|
||||||
self.connect_btn.setMenu(self.conn_menu)
|
self.connect_btn.setMenu(self.conn_menu)
|
||||||
|
|
||||||
self.thermostat_ctrl_menu = ThermostatCtrlMenu(self.thermostat, self.style())
|
self.thermostat_ctrl_menu = ThermostatCtrlMenu(
|
||||||
|
self.thermostat, self.info_box, self.style()
|
||||||
|
)
|
||||||
self.thermostat_settings.setMenu(self.thermostat_ctrl_menu)
|
self.thermostat_settings.setMenu(self.thermostat_ctrl_menu)
|
||||||
|
|
||||||
self.loading_spinner.hide()
|
self.loading_spinner.hide()
|
||||||
|
Loading…
Reference in New Issue
Block a user