Skip to content

[BUG] - Formula Import Broken #206

@zdomke

Description

@zdomke

Describe the bug

When importing a file that contains a formula curve, an error is spit out on the console and the formula curve(s) do not get added to the ControlPanel properly. Other curves seem to be added properly though.

Expected behavior

All curves should be added to the ControlPanel regardless of type.

Steps to Reproduce

Attempt to import a file containing a formula:
pydm main.py -i examples/FormulaExample.trc

Possible solution (optional)

The problem seems to originate in TraceFileHandler.open_file() when emitting the curves & formulas from the curves_signal signal.

The real cause of the problem however is in ControlPanel.set_curves() as this method is only setup to handle curves, not formula curves.

There are 2 approaches to handling this issue:

  1. Alter ControlPanel.set_curves() to handle both curves and formulas
  2. Add another method to ControlPanel for adding formulas to the plot
    a. This also requires adding another signal to TraceFileHandler for handling formulas since they couldn't be lumped together with this approach

My platform

No response

Additional context

The console spits out the error below:

Traceback (most recent call last):
  File "<....>/trace/widgets/control_panel.py", line 369, in set_curves
    del curve_dict["channel"]  # Remove channel key to avoid conflicts with y_channel
        ~~~~~~~~~~^^^^^^^^^^^
KeyError: 'channel'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions