Commit 17ea4b25 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[widgets][[plottereditor] Implement creation of a valid plotter

The prototype while conceptually valid doesn't contain valid
data. This commit fixes that by selecting a valid Dataformat
automatically.

Fixes #244
parent e8bfebf9
......@@ -46,6 +46,7 @@ from ..backend.assetmodel import AssetModel
from .scrollwidget import ScrollWidget
from .parameterwidget import ParameterWidget
from .dialogs import AssetCreationDialog
from .editor import AbstractAssetEditor
from .libraries import LibrariesWidget
......@@ -229,6 +230,25 @@ class PlotterEditor(AbstractAssetEditor):
if self.parameter_viewers:
QTimer.singleShot(100, self.__showLatestParameter)
def _createNewAsset(self, creation_type, asset_info):
"""Re-implement to ensure we"""
plotter, data = super(PlotterEditor, self)._createNewAsset(
creation_type, asset_info
)
if creation_type == AssetCreationDialog.NEW:
declaration = plotter.declaration
valid_dataformats = [
df
for df in self.dataformat_model.stringList()
if df.startswith("plot/")
]
declaration["dataformat"] = valid_dataformats[0]
plotter.declaration = declaration
return plotter, data
def _load_json(self, json_object):
"""Load the json object passed as parameter"""
......
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