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 Plot Config #1101

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

aksharsarvesh
Copy link
Contributor

Opening the Archive Viewer, changing plot config, then saving it to a file requires that the plot config can be saved in a dictionary style data structure. This to_dict() function does that for us.

@aksharsarvesh aksharsarvesh marked this pull request as ready for review August 16, 2024 16:57
Copy link
Collaborator

@YektaY YektaY left a comment

Choose a reason for hiding this comment

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

I added a couple notes on adding doctrings

pydm/widgets/baseplot.py Show resolved Hide resolved
pydm/widgets/timeplot.py Show resolved Hide resolved
@jbellister-slac
Copy link
Collaborator

This one I think I need to be pointed to the corresponding Archive Viewer code to understand. The majority of these options are already stored in the underlying .ui file of base plots. Is the plot for the Archive Viewer using custom save/load functionality rather than a`.ui' file?

@aksharsarvesh
Copy link
Contributor Author

aksharsarvesh commented Aug 31, 2024

@zdomke may be able to answer this better than me, but yes - the goal of this is to be able to import and export whole plots with all configurations and settings. Analogous to how ArchivePlotCurveItem (and now FormulaCurveItem) has a to_dict function to store things like which color the curve is set to, its axis, and other settings, we also want to save things like plot title, whether Xgrid/ygrid is being shown, etc. Rather than storing this in a .ui file (if that’s what you’re suggesting) Zach and I opted to have an import/export file that stores a barebones dictionary of these settings for easy storage and we have functionality to read in such a dictionary and recreate the graph from the ground up.

@zdomke
Copy link
Contributor

zdomke commented Sep 3, 2024

@jbellister-slac This information is stored in the .ui file but, at least in our project, the user has the option to change all of these properties. Once they've been changed they'll no longer align with the .ui file. The Archive Viewer is using a custom save/load function, and we'd like to get the plot's state on request. We figured that a to_dict function similar to those of the plot curve items would be a good way of doing that.

For our needs we could move this to the Archive Viewer code, but we thought that it was generalized enough that other pydm users might get use of it too. Please let us know if you'd like us to move this to our side of things.

@jbellister-slac
Copy link
Collaborator

Ok, thank you both for the context! I understand better now

@jbellister-slac jbellister-slac merged commit c47529c into slaclab:master Sep 4, 2024
19 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.

4 participants