Skip to content

Commit

Permalink
Merge pull request #1102 from aksharsarvesh/exportFormulas
Browse files Browse the repository at this point in the history
ENH: Import/Export FormulaCurveItem Objects
  • Loading branch information
jbellister-slac authored Aug 31, 2024
2 parents 8fff1fa + c671740 commit fb09a5e
Showing 1 changed file with 18 additions and 4 deletions.
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

0 comments on commit fb09a5e

Please sign in to comment.