mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-11 08:33:02 +03:00
Fix AssertionError in bring_to_front
This commit is contained in:
parent
42ca86f7eb
commit
076b4bd681
@ -140,7 +140,12 @@ class Window(Container):
|
||||
|
||||
def bring_to_front(self) -> None:
|
||||
"""Reorder the window to be last so it renders on top."""
|
||||
assert isinstance(self.parent, Widget)
|
||||
if not self.parent:
|
||||
# Can happen when saying Yes to "Save changes to X?" prompt during Save As
|
||||
# I got this using automation (so it might need to be fast to happen):
|
||||
# textual run --dev "src/textual_paint/paint.py --language en --clear-screen --inspect-layout --restart-on-changes question_icon.ans" --press ctrl+shift+s,.,_,r,i,c,h,_,c,o,n,s,o,l,e,_,m,a,r,k,u,p,enter,enter
|
||||
return
|
||||
assert isinstance(self.parent, Widget), "Window parent should be a Widget, but got: " + repr(self.parent)
|
||||
if self.parent.children[-1] is not self:
|
||||
self.parent.move_child(self, after=self.parent.children[-1])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user