-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* simplify loading * ws removal * no need for this * simplify * gutter * tests and refactor * ws * ws * restore * move to compositor * words * tweak timeout in snapshot
- Loading branch information
1 parent
87ef1bb
commit b263e44
Showing
11 changed files
with
510 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
417 changes: 368 additions & 49 deletions
417
tests/snapshot_tests/__snapshots__/test_snapshots.ambr
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from rich.console import RenderableType | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Horizontal | ||
from textual.widget import Widget | ||
from textual.widgets import OptionList | ||
|
||
|
||
class SimpleLoadingIndicator(Widget): | ||
"""A loading indicator that doesn't animate.""" | ||
|
||
DEFAULT_CSS = """ | ||
SimpleLoadingIndicator { | ||
width: 100%; | ||
height: 100%; | ||
min-height: 1; | ||
content-align: center middle; | ||
color: $accent; | ||
} | ||
SimpleLoadingIndicator.-textual-loading-indicator { | ||
layer: _loading; | ||
background: $boost; | ||
dock: top; | ||
} | ||
""" | ||
|
||
def render(self) -> RenderableType: | ||
return "Loading!" | ||
|
||
|
||
class LoadingOverlayRedux(App[None]): | ||
CSS = """ | ||
OptionList { | ||
scrollbar-gutter: stable; | ||
width: 1fr; | ||
height: 1fr; | ||
} | ||
""" | ||
|
||
BINDINGS = [("space", "toggle")] | ||
|
||
def get_loading_widget(self) -> Widget: | ||
return SimpleLoadingIndicator() | ||
|
||
def compose(self) -> ComposeResult: | ||
with Horizontal(): | ||
yield OptionList(*[("hello world " * 5) for _ in range(100)]) | ||
yield OptionList(*[("foo bar" * 5) for _ in range(100)]) | ||
|
||
def action_toggle(self) -> None: | ||
option_list = self.query(OptionList).first() | ||
option_list.loading = not option_list.loading | ||
|
||
|
||
if __name__ == "__main__": | ||
LoadingOverlayRedux().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters