-
Notifications
You must be signed in to change notification settings - Fork 27
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
Exclude animation dock widget from viewer screenshot #23
Comments
I guess the use case is for creating animations showing how to do things in the viewer/the effect of changing things in the viewer? Makes sense, will have a think |
@katherine-hutchings @cormsby626 this would be a slightly more technical place to contribute which could be fun! The whole dock widget will need to be hidden, not just the As before, feel free to ping me any time if you choose to take this on, either here or on the napari zulip |
nope, but I'd say it's ultimately the same request as napari/napari#2203 and napari/napari#3944 (which needs someone to love it) |
Hi Guys I had a go at implementing this in the way suggested, however it did not seem to work as expected. Hiding the instance of I tried to make a minimal example in napari, but could not reproduce so the issue must be something to do with napari-animation. import napari
from magicgui import magicgui
viewer = napari.Viewer()
widget_name = 'widget'
@magicgui
def my_func():
viewer.window._dock_widgets[widget_name].hide()
viewer.window.add_dock_widget(my_func, name=widget_name)
napari.run() @tlambert03 @Czaki - @alisterburt mentioned you guys know a lot about Qt, is this something you immediately know the cause of? |
yeah, hiding a specific dock widget will do just that: hide the dock widget. But what you really need to manipulate here is the QMainWindow instance itself... specifically, with removeDockWidget and from contextlib import contextmanager
@contextmanager
def hidden_dock_widget(window: QMainWindow, widget: QDockWidget):
window.removeDockWidget(widget)
try:
yield
finally:
window.restoreDockWidget(widget) with hidden_dock_widget(viewer.window._qt_window, your_dock_widget):
# render |
Thank you very much, I will look into this :) |
One thing that might be nice is to figure out how to exclude the animation dock widget from the viewer screenshot if it is not wanted. I guess the widget can always be undocked, but it is something we might want to consider
The text was updated successfully, but these errors were encountered: