@@ -347,10 +347,7 @@ def reset_choices(self, *_: Any):
347347 return None
348348
349349 def show (self , run : bool = True ) -> None :
350- """Show this GUI.
351-
352- If any of the parent GUI is a dock widget in napari, then this will also show up
353- as a dock widget (floating if in popup mode).
350+ """Show this GUI, or the parent dock widget.
354351
355352 Parameters
356353 ----------
@@ -365,11 +362,12 @@ def show(self, run: bool = True) -> None:
365362 qt_parent = self .native .parent ()
366363
367364 if isinstance (qt_parent , QDockWidget ):
368- # if the widget is the direct parent of a dock widget in napari , show the dock
365+ # if the widget is the direct parent of a dock widget, show the dock widget
369366 qt_parent .show ()
370367 return
368+ was_not_visible = not self .visible
371369 Container .show (self , run = False )
372- if mcls_parent is not None and self .name .startswith ("_" ) and not self . visible :
370+ if mcls_parent is not None and self .name .startswith ("_" ) and was_not_visible :
373371 move_to_screen_center (self .native )
374372 self .native .activateWindow ()
375373 if run :
@@ -418,8 +416,7 @@ def _unify_label_widths(self):
418416
419417
420418def find_window_ancestor (widget : Widget ) -> SubWindowsClassGui :
421- """
422- Try to find a window ancestor of the given widget.
419+ """Try to find a window ancestor of the given widget.
423420
424421 This function is used only for subwindows.
425422 """
0 commit comments