Commit faab3c71 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][plottereditor] Make resistant to "empty" JSON

Empty as in "{}"
parent 6be11db0
...@@ -210,15 +210,12 @@ class PlotterEditor(AbstractAssetEditor): ...@@ -210,15 +210,12 @@ class PlotterEditor(AbstractAssetEditor):
self.language = json_object.get("language", "") self.language = json_object.get("language", "")
selected_dataformat = json_object.get("dataformat", {}) selected_dataformat = json_object.get("dataformat", "")
index = self.dataformat_combobox.findText( index = self.dataformat_combobox.findText(
selected_dataformat, Qt.MatchFixedString selected_dataformat, Qt.MatchFixedString
) )
if index >= 0: self.dataformat_combobox.setCurrentIndex(index)
self.dataformat_combobox.setCurrentIndex(index)
else:
raise RuntimeError("Invalid default value")
self.libraries_widget.set_available_libraries(self.library_model.stringList()) self.libraries_widget.set_available_libraries(self.library_model.stringList())
self.libraries_widget.set_used_libraries(json_object.get("uses", {})) self.libraries_widget.set_used_libraries(json_object.get("uses", {}))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment