Skip to content

Commit 26a4457

Browse files
committed
default allow-maximize
1 parent 063cfc7 commit 26a4457

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## Unreleased
9+
10+
### Changed
11+
12+
- `Screen.ALLOW_IN_MAXIMIZED_VIEW` will now default to `App.ALLOW_IN_MAXIMIZED_VIEW`
13+
14+
815
## [0.82.0] - 2024-10-03
916

1017
### Fixed

src/textual/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ class MyApp(App[None]):
461461
COMMAND_PALETTE_DISPLAY: ClassVar[str | None] = None
462462
"""How the command palette key should be displayed in the footer (or `None` for default)."""
463463

464+
ALLOW_IN_MAXIMIZED_VIEW: ClassVar[str] = ".textual-system,Footer"
465+
464466
BINDINGS: ClassVar[list[BindingType]] = [
465467
Binding("ctrl+c", "quit", "Quit", show=False, priority=True)
466468
]

src/textual/screen.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
_make_path_object_relative,
4242
)
4343
from textual._types import CallbackType
44+
from textual._unique import unique_ordered
4445
from textual.await_complete import AwaitComplete
4546
from textual.binding import ActiveBinding, Binding, BindingsMap
4647
from textual.css.match import match
@@ -204,8 +205,9 @@ class Screen(Generic[ScreenResultType], Widget):
204205
205206
Should be a set of [`command.Provider`][textual.command.Provider] classes.
206207
"""
207-
ALLOW_IN_MAXIMIZED_VIEW: ClassVar[str] = ".-textual-system,Footer"
208-
"""A selector for the widgets (direct children of Screen) that are allowed in the maximized view (in addition to maximized widget)."""
208+
ALLOW_IN_MAXIMIZED_VIEW: ClassVar[str | None] = None
209+
"""A selector for the widgets (direct children of Screen) that are allowed in the maximized view (in addition to maximized widget). Or
210+
`None` to default to [App.ALLOW_IN_MAXIMIZED_VIEW][textual.app.App.ALLOW_IN_MAXIMIZED_VIEW]"""
209211

210212
ESCAPE_TO_MINIMIZE: ClassVar[bool | None] = None
211213
"""Use escape key to minimize (potentially overriding bindings) or `None` to defer to [`App.ESCAPE_TO_MINIMIZE`][textual.app.App.ESCAPE_TO_MINIMIZE]."""
@@ -434,10 +436,19 @@ def _arrange(self, size: Size) -> DockArrangeResult:
434436
if cached_result is not None:
435437
return cached_result
436438

439+
allow_in_maximized_view = (
440+
self.app.ALLOW_IN_MAXIMIZED_VIEW
441+
if self.ALLOW_IN_MAXIMIZED_VIEW is None
442+
else self.ALLOW_IN_MAXIMIZED_VIEW
443+
)
437444
arrangement = self._arrangement_cache[cache_key] = arrange(
438445
self,
439446
(
440-
[self.maximized, *self.query_children(self.ALLOW_IN_MAXIMIZED_VIEW)]
447+
unique_ordered(
448+
[self.maximized],
449+
self.query_children(allow_in_maximized_view),
450+
self.query_children(".-textual-system"),
451+
)
441452
if self.maximized is not None
442453
else self._nodes
443454
),

0 commit comments

Comments
 (0)