Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Import/Export FormulaCurveItem Objects #1102

Merged
merged 5 commits into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions pydm/widgets/archiver_time_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,22 @@ def __init__(

def to_dict(self) -> OrderedDict:
"""Returns an OrderedDict representation with values for all properties needed to recreate this curve."""
dic_ = OrderedDict([("useArchiveData", self.use_archive_data), ("liveData", self.liveData)])
dic_.update(super(ArchivePlotCurveItem, self).to_dict())
dic_ = OrderedDict(
[
("useArchiveData", self.use_archive_data),
("liveData", self.liveData),
("plot_style", self.plot_style),
("formula", self.formula),
]
)
curveDict = dict()
for header, curve in self.pvs.items():
if isinstance(curve, ArchivePlotCurveItem):
curveDict[header] = curve.address
else:
curveDict[header] = curve.formula
dic_.update({"curveDict": curveDict})
dic_.update(super(FormulaCurveItem, self).to_dict())
return dic_

@property
Expand Down Expand Up @@ -387,7 +401,8 @@ def channel(self):
return None

def checkFormula(self) -> bool:
"""Confirm that our formula is still valid. Namely, all of the curves we depend on are still in use"""
"""Make sure that our formula is still valid.
Namely, all of the input curves need to still exist in the viewer"""
for pv in self.pvs.keys():
if not self.pvs[pv].exists:
logger.warning(pv + " is no longer a valid row name")
Expand Down Expand Up @@ -423,7 +438,6 @@ def evaluate(self) -> None:
if not self.checkFormula():
self.formula_invalid_signal.emit()
return

pvArchiveData = dict()
pvLiveData = dict()
pvIndices = dict()
Expand Down
Loading