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

[widgets][editors] Don't return empty description in json dump

The field is optional
parent e5a69b2b
...@@ -109,10 +109,7 @@ class TestMockEditor: ...@@ -109,10 +109,7 @@ class TestMockEditor:
field.format_name = "value32" field.format_name = "value32"
field.format_type = "float32" field.format_type = "float32"
assert widget.dump_json() == { assert widget.dump_json() == {"field": {"value32": "float32"}}
"field": {"value32": "float32"},
"description": "",
}
qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton) qtbot.mouseClick(widget.add_field_button, QtCore.Qt.LeftButton)
fields = widget.findChildren(FieldWidget) fields = widget.findChildren(FieldWidget)
...@@ -125,6 +122,5 @@ class TestMockEditor: ...@@ -125,6 +122,5 @@ class TestMockEditor:
field.format_type = "float64" field.format_type = "float64"
assert widget.dump_json() == { assert widget.dump_json() == {
"field": {"value32": "float32", "value64": "float64"}, "field": {"value32": "float32", "value64": "float64"}
"description": "",
} }
...@@ -152,7 +152,11 @@ class AbstractAssetEditor(QWidget): ...@@ -152,7 +152,11 @@ class AbstractAssetEditor(QWidget):
def dump_json(self): def dump_json(self):
"""Returns the json representation of the asset""" """Returns the json representation of the asset"""
json_data = {"description": self.description_lineedit.text()} json_data = {}
description = self.description_lineedit.text()
if description:
json_data["description"] = description
json_data.update(self._dump_json()) json_data.update(self._dump_json())
return json_data return json_data
......
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