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

Simplify using CurveItem subclasses in Plot subclasses #1042

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

flowln
Copy link
Contributor

@flowln flowln commented Oct 19, 2023

While making subclasses for TimePlot and WaveformPlot for my application, I noticed this little inconvenience with non-TimePlot plots. I think it's a good thing to have a factory method such as this in every plot! 🙂

I kept it as close as possible to the one in TimePlot, so as to not change more stuff than needed, though I figured it may be even better to pass a generic *args, **kwargs to the createCurveItem functions, so as to not constrain the signature of the CurveItem custom implementations. What do you think?

This mirrors for all the other Plot classes what was already done with
PyDMTimePlot: Have a `createCurveItem` method that returns the relevant
object for that plot, which can be overriden in the plot's subclasses
for customized CurveItem implementations.

Signed-off-by: flowln <thiago.ferreira@lnls.br>
@nstelter-slac nstelter-slac requested review from nstelter-slac and removed request for nstelter-slac October 24, 2023 18:13
@YektaY
Copy link
Collaborator

YektaY commented Oct 24, 2023

We agree, the change to pass a generic *args, **kwargs would be beneficial. Would you like to implement that with this PR?

This gives more flexibility to the subclasses to change their signatures
of __init__.

Signed-off-by: flowln <thiago.ferreira@lnls.br>
Copy link
Collaborator

@jbellister-slac jbellister-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Testing this PR did uncover a mistake I made a while back without noticing where I misnamed a keyword argument as y_channel. Would you mind changing line 522 of timeplot.py to

channel_address=y_channel,

Unfortunately github doesn't let me make suggested changes on lines that weren't edited.

Signed-off-by: flowln <thaigo.ferreira@lnls.br>
Signed-off-by: flowln <thiago.ferreira@lnls.br>
Copy link
Collaborator

@jbellister-slac jbellister-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional test case as well!

@jbellister-slac jbellister-slac merged commit e39a66e into slaclab:master Oct 26, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants