-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FigureCanvas Designer #11423
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
FigureCanvas Designer #11423
Conversation
def createWidget(self, parent): | ||
"""Create a FigureCanvasQT instance""" | ||
# Create the Canvas with a new Figure | ||
fig = FigureCanvasQT(Figure()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this a bit? I'm a bit surprised that you already add the figure to the canvas here. What if the user wants to use a different figure? (This may be a stupid question, as I've never worked with Designer.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure of a way to pass in an existing Figure
inside the QtDesigner
. The idea is that the user creates the .ui
file before any Python code is ever written. They then can access this figure (as shown above) by loading the .ui
file. I'm not sure how to swap this order and have the Designer be aware of an arbitrary Figure
created in user code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy with this order of operations an the .ui
figure now provides a fully functional Figure
to work with.
I have no idea how useful this is in total, i.e. if this is a thing many people would actually use. But just suppose it is, I fear people would not be aware of it. |
I think the right place to put the plugin is in https://github.com/matplotlib/matplotlib/tree/master/examples/user_interfaces which is where we keep the glade file for wx (which I believe is the same thing, but for WX). Not a slick to use as it being directly importable, but it is at least in the codebase / documentation. The module it is currently in is a vendored interface generator that we use for the artist editor dialogue in Qt. |
On a bit more consideration (and looking at the gtk install code) maybe the plugin should go in https://github.com/matplotlib/matplotlib/tree/master/lib/matplotlib/mpl-data |
As much as I want this, punting to 3.1 😞 |
Sorry I've been neglecting this. I can drag it to completion. Just so I understand what else is needed.
|
@teddyrendahl Yes. I would be willing to merge this after the RC so in the next week or so. |
Awesome. Also should I create a merge commit here or would you prefer rebase? |
I addition, as said already, there should be some example or description available. I could imagine that an example inside the Embedding Matplotlib in graphical user interfaces section of the gallery would make sense. This would need to be named with |
On the other hand we don't install the data directory by default any more.... |
We definitely still install mpl-data by default (and it's not as if we could really change that). |
Okay. Spoke a little too soon. Figured out I needed the the |
Thanks a lot for the contribution. I'm going to close this as having had no action for quite a while. OTOH, if there is still a community that wants this, please feel free to re-open, with my apologies! |
PR Summary
This adds a
QtDesignerPlugin
forFigureCanvasQt
.Usage
PYQTDESIGNERPATH
environment variable to the file system directory where the newfigure_plugin.py
file livesdesigner
, drag and drop theFigureCanvasQt
into your widget and save the filepyuic
and access theFigureCanvasQT
.Notes
QtDesigner
module in either version ofPySide
. This works inPyQt4
installed from source but it looks like the version hosted onconda-forge
is built with the--no-designer-plugin
option.matplotlib
logo that ships with the repository? I could add it?Closes #758
PR Checklist