Fix airwing config not properly saving or loading (#437)

* fix airwing config not properly saving or loading

* add helper message to save function

* bugfixes

* remove unnecessary import used during testing

* yet another forgotten import

* change raise error to log warning
This commit is contained in:
Druss99
2025-01-01 09:56:08 -05:00
committed by GitHub
parent 164873d3b1
commit dd408f392b
3 changed files with 50 additions and 3 deletions

View File

@@ -817,12 +817,25 @@ class AirWingConfigurationDialog(QDialog):
layout.addLayout(buttons_layout)
def save_config(self) -> None:
result = QMessageBox.information(
None,
"Save Air Wing?",
"Revert will not be possible after saving a different Air Wing.<br />"
"Are you sure you want to continue?",
QMessageBox.StandardButton.Yes,
QMessageBox.StandardButton.No,
)
if result == QMessageBox.StandardButton.No:
return
awd = airwing_dir()
fd = QFileDialog(
caption="Save Air Wing", directory=str(awd), filter="*.yaml;*.yml"
)
fd.setAcceptMode(QFileDialog.AcceptMode.AcceptSave)
if fd.exec_():
for tab in self.tabs:
tab.apply()
airwing = self._build_air_wing()
filename = fd.selectedFiles()[0]
with open(filename, "w") as f:
@@ -836,7 +849,7 @@ class AirWingConfigurationDialog(QDialog):
for s in sqs:
cp = s.location.at
if isinstance(cp, Point):
key = s.location.name
key = s.location.full_name
else:
key = cp.id
name = (