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

app_window property returns misleading value in a MultiPlotter setting #588

Open
jomade opened this issue Jun 26, 2024 · 0 comments
Open

Comments

@jomade
Copy link

jomade commented Jun 26, 2024

In a MultiPlotter, the BackGroundPlotter.app_window property of the children does not contain the application window but a child (or more precise a grandchild)-window of the application window.

It seems the application consists of a Mainwindow that is parent to a QWidget that is parent to the multiple plotters. So each BackgroundPlotter in the MultiPlotter has its own MainWindow which are nested in the application.

I would have expected that:

  • Either BackGroundPlotter.app_window always returns the application window independent whether it is nested in a MultiPlotter
  • or MultiPlotter would have a MultiPlotter.app_window that contains the reference to the global application window.

Maybe adding a qt_window in the BackGroundplotter which in the MultiplotterCase contains the child-widgets, and for the single-case also contains the app-window and setting the correct app_window could resolve it - however that would be a breaking change if someone already relies on the app_window to return the child-widgets.

Some code to highlight the issue:

import pyvista as pv
from pyvistaqt import BackgroundPlotter, MultiPlotter
from PySide6 import QtGui

print("BackGroundPlotter")
plotter = BackgroundPlotter()
it = plotter.app_window
print(f'plotter.app_window: {str(it)}')
while it.parent():
    print(it.parent())
    it = it.parent()
print('done')

print("MultiPlotter")
mplotter = MultiPlotter(nrows=1, ncols=2)
plotter = mplotter[0, 0]
it = plotter.app_window
print(f'plotter.app_window: {str(it)}')
while it.parent():
    print(it.parent())
    it = it.parent()
print('done')

Which outputs:

BackGroundPlotter
plotter.app_window: <pyvistaqt.window.MainWindow(0x600000325d40) at 0x10a4c7900>
done
MultiPlotter
plotter.app_window: <pyvistaqt.window.MainWindow(0x600000336b80) at 0x12f4eef00>
<PySide6.QtWidgets.QWidget(0x600000336820) at 0x12f4ec6c0>
<pyvistaqt.window.MainWindow(0x6000003370c0) at 0x12f48bf00>
done
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

1 participant