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

QtInteractor can no longer be used with qt-designer #9

Open
truenicoco opened this issue Mar 19, 2020 · 5 comments
Open

QtInteractor can no longer be used with qt-designer #9

truenicoco opened this issue Mar 19, 2020 · 5 comments

Comments

@truenicoco
Copy link

Before pyvista 0.24.0, I could use qt-designer to design my UI and promote a widget to pv.QtInteractor.

It is probably the expected behaviour, but this version makes it impossible to do that.

Also, If I want to remove/re-add the widget, which I have to do because I dynamically want to change the number of subplots in my app, I must be careful to use the interactor attribute of the pv.QtInteractor instance and not the instance directly.

I do not expect this to change, but since it took me a while to figure out what was happening, I thought I would write it here…

My fix was to create a simple QWidget in qt-designer, and basically call this on window create and every time I want to update the number of subplots.

def update_subplots(main_window):
    # Awful hacks because pv.QtInteractor no longer heritates from QtWidget
    try:
        main_window.vlayout.removeWidget(main_window.pv_plotter.interactor)
    except AttributeError:
        main_window.vlayout.removeWidget(main_window.pv_plotter)
    del main_window.pv_plotter

I am sure there is a better way to do that, but it works…

Adding/removing subplots dynamically would be a great feature BTW.

@akaszynski
Copy link
Member

akaszynski commented Mar 19, 2020

Thanks for your interest with pyvista. pyvista==0.24.0 had some big changes with the way we implemented QtInteractor, and I can see why it broke. Let me see if I can add update_subplots to the background plotter or QtInteractor.

@truenicoco
Copy link
Author

Any news on this? I should have replied earlier, this would be a great feature. It seems that my awful hack is leaking memory all over the place…

@akaszynski
Copy link
Member

Sorry, been busy with other PRs. Would you mind opening up a PR for this?

@truenicoco
Copy link
Author

I think there is a misunderstanding, I did not develop anything usable, so I can't make a PR for this. ☺ Maybe you meant a feature request ?

@banesullivan banesullivan transferred this issue from pyvista/pyvista Jun 5, 2020
@GuillaumeFavelier
Copy link
Contributor

Could you try again with current master (37e921b) @truenicoco ? I believe this should be fixed by #25

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

No branches or pull requests

3 participants