Closed samhaaf closed 2 years ago
Thank you for calling me out on this! It has bothered me forever, just never enough to change it. I think I like the second option better, though when a window is set is_static
it should not be moved. Since the centering itself takes place within Container
, that might require making an override function within Window
as well.
Whoops, I'm fairly certain I accidentally managed to fix this some time ago, specifically in commit 7143affee. The route I ended up taking was removing Container
resize handling.
I considered the second option, but realized that in many cases you don't want to center a window, and turning a window centered from non-centered is simpler (one call to Window.center()
), while the opposite is a tiny bit more difficult. When working with only a handful of windows manually calling center is manageable in my experience, and when making a full UI application (like I am doing with Pagoda), you probably already have WindowManager
subclassed, so adding a definition of the add
method that also centers the given window is not much overhead.
Thank you for the issue!
Hello! Twice in one day. I would make a merge request but there's a choice to make, so I defer your preference and backward compatibility.
Describe the bug Currently, a window is not centered by default but it centers on on terminal.RESIZE. I'm proposing that either windows are centered on manager.add() or not centered on terminal.RESIZE
To Reproduce 1:
2: resize terminal
Possible cause
Containers automatically center on terminal.RESIZE.
pytermgui/widgets/layouts.py:
Possible solution 1st possibility: disable line 77 above to remove the automatic centering.
2nd possibility: Center new windows by default.
/pytermgui/window_manager.py
This might be
self._centered
but I prefer option 2.