bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.21k stars 54 forks source link

[BUG] window reopens minimized #38

Closed toxeus closed 2 years ago

toxeus commented 2 years ago

Describe the bug I have a main window that opens child windows for certain actions. When opening the child window the second time, it opens minimized.

To Reproduce Steps to reproduce the behavior:

with ptg.WindowManager() as man:
    win2 = ptg.Window(["Close", lambda: *_: man.close(win2)])
    win2.center()
    win1 = ptg.Window(["Open win2", lambda _: man.add(win2)])
    win1.center()
    man.add(win1)
    man.run()
  1. click "Open win2"
  2. click "Close"
  3. click "Open win2"
  4. observe bug

Expected behavior

After opening win2 the second time it should appear the same as the first time.

System information

ptg 3.0.0

bczsalba commented 2 years ago

I think this is caused by the animator not resetting the height value at the end of the animation. It should be a relatively easy fix, but in the meantime you can probably either reconstruct the window when adding, or add a line that sets the window height to whatever it was before being closed.

Thanks for the comprehensive report!

bczsalba commented 2 years ago

That should have fixed it, at least it did for the example code provided. I don't think I'll push this as a minor release yet, would rather wait for more changes to bundle together.