repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
textual
tests/snapshot_tests/snapshot_apps/notifications_above_loading.py
.py
from textual.app import App, ComposeResult from textual.containers import VerticalScroll from textual.widgets import Label class LoadingOverlayApp(App[None]): CSS = """ VerticalScroll { height: 20; } Toast { max-width: 100%; width: 70%; /* We need this to cover the dots o...
30
848
textual
tests/snapshot_tests/snapshot_apps/button_outline.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button class ButtonIssue(App[None]): AUTO_FOCUS = None CSS = """ Button { outline: white; } """ def compose(self) -> ComposeResult: yield Button("Test") if __name__ == "__main__": ButtonIssue().run()
19
320
textual
tests/snapshot_tests/snapshot_apps/split_segments.py
.py
from textual.app import App, ComposeResult from textual.widgets import TextArea FAIL_TEXT = "x" class CodeApp(App): def compose(self) -> ComposeResult: yield TextArea(FAIL_TEXT, soft_wrap=False, show_line_numbers=True) if __name__ == "__main__": app = CodeApp() app.run()
15
297
textual
tests/snapshot_tests/snapshot_apps/dev_previews_border.py
.py
from textual_dev.previews import BorderApp app = BorderApp() if __name__ == "__main__": app.run()
6
103
textual
tests/snapshot_tests/snapshot_apps/input_suggestions.py
.py
from textual.app import App, ComposeResult from textual.suggester import SuggestFromList from textual.widgets import Input fruits = ["apple", "pear", "mango", "peach", "strawberry", "blueberry", "banana"] class FruitsApp(App[None]): CSS = """ Input > .input--suggestion { color: red; text-sty...
28
783
textual
tests/snapshot_tests/snapshot_apps/markdown_component_classes_reloading.py
.py
from pathlib import Path from textual.app import App, ComposeResult from textual.widgets import Markdown CSS_PATH = (Path(__file__) / "../markdown_component_classes_reloading.tcss").resolve() CSS_PATH.write_text( """\ .code_inline, .em, .strong, .s, .markdown-table--header, .markdown-table--lines, { color: y...
51
751
textual
tests/snapshot_tests/snapshot_apps/tabs_invalidate.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, TabbedContent, TabPane class TabApp(App): CSS = """ TabPane { border: solid blue; } """ def compose(self) -> ComposeResult: with TabbedContent(): with TabPane("Tab 1", id="tab-1"): ...
25
563
textual
tests/snapshot_tests/snapshot_apps/keyline.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static from textual.containers import Horizontal, Vertical, Grid class Box(Static): pass class KeylineApp(App): CSS = """ Vertical { keyline: thin red; } Horizontal { keyline: heavy green; } Grid { ...
53
980
textual
tests/snapshot_tests/snapshot_apps/data_table_row_labels.py
.py
from textual.app import App, ComposeResult from textual.widgets import DataTable ROWS = [ ("lane", "swimmer", "country", "time"), (5, "Chad le Clos", "South Africa", 51.14), (4, "Joseph Schooling", "Singapore", 50.39), (2, "Michael Phelps", "United States", 51.14), (6, "László Cseh", "Hungary", 51....
38
1,100
textual
tests/snapshot_tests/snapshot_apps/richlog_scroll.py
.py
from textual.app import App, ComposeResult from textual.widgets import RichLog from textual.containers import Horizontal class RichLogScrollApp(App): CSS = """ RichLog{ width: 1fr; height: 10; } """ def compose(self) -> ComposeResult: with Horizontal(): # Don't...
36
1,036
textual
tests/snapshot_tests/snapshot_apps/layer_order_independence.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Header, Footer, Label from textual.containers import VerticalScroll, Container class Overlay(Container): def compose(self) -> ComposeResult: yield Label("This should float over the top") class Body1(...
75
1,559
textual
tests/snapshot_tests/snapshot_apps/dock_scroll2.py
.py
from textual.app import App from textual.widgets import Header, Label, Footer # Same as dock_scroll.py but with 2 labels class TestApp(App): BINDINGS = [("ctrl+q", "app.quit", "Quit")] CSS = """ Label { border: solid red; } Footer { height: 4; } """ def compose(se...
31
600
textual
tests/snapshot_tests/snapshot_apps/bind_override.py
.py
from textual.app import App, ComposeResult from textual.widget import Widget from textual.widgets import Footer, Switch from textual.binding import Binding class MyWidget(Widget, can_focus=True): BINDINGS = [ Binding("space", "app.bell", "Bell (Widget)"), Binding("a", "app.notify('a widget')", "wi...
42
985
textual
tests/snapshot_tests/snapshot_apps/progress_gradient.py
.py
from textual.app import App, ComposeResult from textual.color import Gradient from textual.widgets import ProgressBar class ProgressApp(App[None]): def compose(self) -> ComposeResult: gradient = Gradient.from_colors( "#881177", "#aa3355", "#cc6666", "#ee9944...
30
715
textual
tests/snapshot_tests/snapshot_apps/text_selection.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label from textual.containers import VerticalGroup from textual.content import Content TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over...
60
1,568
textual
tests/snapshot_tests/snapshot_apps/button_markup.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button class ButtonsWithMarkupApp(App): def compose(self) -> ComposeResult: yield Button("[italic red]Focused[/] Button") yield Button("[italic red]Blurred[/] Button") yield Button("[italic red]Disabled[/] Button", disa...
15
407
textual
tests/snapshot_tests/snapshot_apps/key_display.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import Footer class KeyDisplayApp(App): """Tests how keys are displayed in the Footer, and ensures that overriding the key_displays works as expected. Exercises both the built-in Textual key display replace...
37
1,135
textual
tests/snapshot_tests/snapshot_apps/data_table_style_order.py
.py
from typing_extensions import Literal from textual.app import App, ComposeResult from textual.widgets import DataTable, Label data = [ "Severance", "Foundation", "Dark", ] def make_datatable( foreground_priority: Literal["css", "renderable"], background_priority: Literal["css", "renderable"], ) ...
63
1,716
textual
tests/snapshot_tests/snapshot_apps/scroll_visible.py
.py
from textual.app import App, ComposeResult from textual.containers import VerticalScroll from textual.widgets import Label, Static # Checks https://github.com/Textualize/textual/issues/2181 class MyCustomWidget(Static): def compose(self) -> ComposeResult: yield Label(("|\n" * 100)[:-1]) yield Lab...
24
611
textual
tests/snapshot_tests/snapshot_apps/hot_reloading_app.py
.py
from pathlib import Path from textual.app import App, ComposeResult from textual.containers import Container from textual.widgets import Label CSS_PATH = (Path(__file__) / "../hot_reloading_app.tcss").resolve() # Write some CSS to the file before the app loads. # Then, the test will clear all the CSS to see if the ...
32
646
textual
tests/snapshot_tests/snapshot_apps/recompose_on_mount.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Header, Footer, Static, RadioSet from textual.reactive import reactive class Profile(Static): choices: reactive[list[str]] = reactive(list, recompose=True) def compose(...
46
1,166
textual
tests/snapshot_tests/snapshot_apps/margin_multiple.py
.py
from textual.app import App, ComposeResult from textual.containers import Container, ScrollableContainer, Horizontal from textual.widgets import Label class CompoundWidget(ScrollableContainer): DEFAULT_CSS = """ #inner { width: 1fr; background: $panel; align: center middle; mar...
44
860
textual
tests/snapshot_tests/snapshot_apps/disable_widgets.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import Button class WidgetDisableTestApp(App[None]): CSS = """ Horizontal { height: auto; } Button { width: 1fr; } """ def compose(self) -> ComposeResult: for...
35
915
textual
tests/snapshot_tests/snapshot_apps/option_list.py
.py
from __future__ import annotations from rich.text import Text from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import OptionList from textual.widgets.option_list import Option class OptionListApp(App[None]): BINDINGS = [("a", "add", "add")] def comp...
59
1,680
textual
tests/snapshot_tests/snapshot_apps/notification_through_screens.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Label class StackableScreen(Screen): TARGET_DEPTH = 10 def __init__(self, count:int = TARGET_DEPTH) -> None: super().__init__() self._number = count def compose(self) -> ComposeResult...
32
824
textual
tests/snapshot_tests/snapshot_apps/sort_children.py
.py
from operator import attrgetter from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.widgets import Label class Number(Label): DEFAULT_CSS = """ Number { width: 1fr; } """ def __init__(self, number: int) -> None: self.number ...
80
1,672
textual
tests/snapshot_tests/snapshot_apps/data_table_add_row_auto_height.py
.py
from rich.panel import Panel from rich.text import Text from textual.app import App from textual.widgets import DataTable class AutoHeightRowsApp(App[None]): def compose(self): table = DataTable() self.column = table.add_column("N") table.add_column("Column", width=10) table.add_r...
26
764
textual
tests/snapshot_tests/snapshot_apps/log_write_lines.py
.py
from textual.app import App, ComposeResult from textual.widgets import Log from textual.containers import Horizontal TEXT = ( """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has g...
39
1,146
textual
tests/snapshot_tests/snapshot_apps/input_validation.py
.py
from textual.app import App, ComposeResult from textual.validation import Number from textual.widgets import Input VALIDATORS = [ Number(minimum=1, maximum=5), ] class InputApp(App): CSS = """ Input.-valid { border: tall $success 60%; } Input.-valid:focus { border: tall $success; ...
46
971
textual
tests/snapshot_tests/snapshot_apps/label_widths.py
.py
from textual.app import App from textual.widgets import Label, Static from rich.panel import Panel class LabelWrap(App): CSS = """ Screen { align: center middle; } #l_data { border: blank; background: lightgray; } #s_data { border: blank; background: l...
48
917
textual
tests/snapshot_tests/snapshot_apps/nested_auto_heights.py
.py
#!/usr/bin/env python3 from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import VerticalScroll from textual.widgets import Static class NestedAutoApp(App[None]): CSS = """ Screen { background: red; } #my-static-container { border: ...
65
1,362
textual
tests/snapshot_tests/snapshot_apps/missing_vertical_scroll.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import OptionList class MissingScrollbarApp(App[None]): CSS = """ OptionList { height: 1fr; } #left { min-width: 25; } #middle { width: 5fr; } #right { ...
35
685
textual
tests/snapshot_tests/snapshot_apps/component_text_opacity.py
.py
from textual.app import App, ComposeResult from textual.scroll_view import ScrollView from textual.strip import Strip from rich.segment import Segment class LineWidget(ScrollView): COMPONENT_CLASSES = {"faded"} DEFAULT_CSS = """ LineWidget { background:blue; color:white; &>.faded{...
34
700
textual
tests/snapshot_tests/snapshot_apps/focus_component_class.py
.py
from rich.text import Text from textual.app import App, ComposeResult, RenderResult from textual.containers import VerticalScroll from textual.widgets import Header, Footer from textual.widget import Widget class Tester(Widget, can_focus=True): COMPONENT_CLASSES = {"tester--text"} DEFAULT_CSS = """ Test...
43
944
textual
tests/snapshot_tests/snapshot_apps/pilot_resize_terminal.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label class SingleLabelApp(App[None]): """An app with a single label that's 20 x 10.""" def compose(self) -> ComposeResult: yield Label(("12345678901234567890\n" * 10).strip()) if __name__ == "__main__": SingleLabelApp().run...
14
323
textual
tests/snapshot_tests/snapshot_apps/scoped_css.py
.py
from textual.app import App, ComposeResult from textual.widget import Widget from textual.widgets import Label class MyWidget(Widget): DEFAULT_CSS = """ MyWidget { height: auto; border: magenta; } Label { border: solid green; } """ def compose(self) -> ComposeResul...
35
669
textual
tests/snapshot_tests/snapshot_apps/notification_through_modes.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Label class Mode(Screen): def compose(self) -> ComposeResult: yield Label("This is a mode screen") class NotifyThroughModesApp(App[None]): MODES = { "test": Mode } def compose(s...
27
558
textual
tests/snapshot_tests/snapshot_apps/welcome_widget.py
.py
from textual.app import App, ComposeResult from textual.widgets import Welcome class WelcomeApp(App[None]): def compose(self) -> ComposeResult: yield Welcome() if __name__ == "__main__": WelcomeApp().run()
11
225
textual
tests/snapshot_tests/snapshot_apps/option_list_multiline_options.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.widgets import OptionList, Header, Footer from textual.widgets.option_list import Option class OptionListApp(App[None]): def compose(self) -> ComposeResult: yield Header() yield OptionList( Op...
33
894
textual
tests/snapshot_tests/snapshot_apps/big_button.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button class ButtonApp(App): CSS = """ Button { height: 9; } """ def compose(self) -> ComposeResult: yield Button("Hello") yield Button("Hello\nWorld !!") if __name__ == "__main__": app = ButtonAp...
20
338
textual
tests/snapshot_tests/snapshot_apps/scrollbar_thumb_height.py
.py
from rich.segment import Segment from textual.app import App, ComposeResult from textual.widgets import Header, Footer from textual.scroll_view import ScrollView from textual.strip import Strip from textual.geometry import Size class TestScrollView(ScrollView, can_focus=True): def __init__(self, height: int, bor...
45
1,151
textual
tests/snapshot_tests/snapshot_apps/input_percentage_width.py
.py
from textual.app import App, ComposeResult from textual.widgets import Input, TextArea, Static, Button, Label class InputVsTextArea(App[None]): CSS = """ Screen > *, Screen > *:focus { width: 50%; height: 1fr; border: solid red; } App #ruler { width: 1fr; height...
36
753
textual
tests/snapshot_tests/snapshot_apps/blur_on_disabled.py
.py
from textual.app import App, ComposeResult from textual.widgets import Input class BlurApp(App): BINDINGS = [("f3", "disable")] def compose(self) -> ComposeResult: yield Input() def on_ready(self) -> None: self.query_one(Input).focus() def action_disable(self) -> None: self....
21
416
textual
tests/snapshot_tests/snapshot_apps/option_list_long.py
.py
from textual.app import App, ComposeResult from textual.widgets import OptionList from textual.widgets.option_list import Option class LongOptionListApp(App[None]): def compose(self) -> ComposeResult: yield OptionList(*[Option(f"This is option #{n}") for n in range(100)]) if __name__ == "__main__": ...
13
346
textual
tests/snapshot_tests/snapshot_apps/scroll_page.py
.py
import os from textual.app import App from textual.widgets import RichLog class RichLogTest(App): def compose(self): ri = RichLog(auto_scroll=False) suffix = "A" * 100 for i in range(1, 100): ri.write(f"This is line number {i} {suffix}") yield ri if __name__ == "__mai...
18
364
textual
tests/snapshot_tests/snapshot_apps/data_table_tabs.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import TabbedContent, DataTable class Dashboard(App): """Dashboard""" BINDINGS = [ ("d", "toggle_dark", "Toggle dark mode"), Binding("ctrl+q", "app.quit", "Quit", show=True), ] TITLE = ...
36
908
textual
tests/snapshot_tests/snapshot_apps/max_height_100.py
.py
from textual.app import App, ComposeResult from textual.widgets import DataTable, Static class HappyDataTableFunApp(App[None]): """The DataTable should expand to full the screen and show a horizontal scrollbar.""" CSS = """ #s { max-height: 100%; } DataTable { max-height: 100%; ...
31
759
textual
tests/snapshot_tests/snapshot_apps/fr_margins.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label from textual.containers import Container # Test fr dimensions and margins work in an auto container # https://github.com/Textualize/textual/issues/2220 class TestApp(App): CSS = """ Container { background: green 20%; ...
36
780
textual
tests/snapshot_tests/snapshot_apps/command_palette.py
.py
from textual.app import App from textual.command import Hit, Hits, Provider class TestSource(Provider): def goes_nowhere_does_nothing(self) -> None: pass async def search(self, query: str) -> Hits: matcher = self.matcher(query) for n in range(10): command = f"This is a tes...
30
714
textual
tests/snapshot_tests/snapshot_apps/tooltips.py
.py
from textual.app import App, ComposeResult from textual.widgets import ProgressBar class TooltipApp(App[None]): TOOLTIP_DELAY = 0.4 def compose(self) -> ComposeResult: progress_bar = ProgressBar(100, show_eta=False) progress_bar.advance(10) progress_bar.tooltip = "Hello, Tooltip!" ...
18
410
textual
tests/snapshot_tests/snapshot_apps/hot_reloading_app_with_screen_css.py
.py
from pathlib import Path from textual.app import App, ComposeResult from textual.containers import Container from textual.screen import Screen from textual.widgets import Label SCREEN_CSS_PATH = (Path(__file__) / "../hot_reloading_app_with_screen_css.tcss").resolve() # Write some CSS to the file before the app load...
42
889
textual
tests/snapshot_tests/snapshot_apps/markdown_whitespace.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import Markdown MARKDOWN = ( """\ X X X X X\tX X\t\tX """, """\ X \tX X \t \tX """, """\ [X X X\tX\t\tX \t \tX](https://example.com/) _X X X\tX\t\tX \t \tX_ **X X X\tX\t\tX \t \tX** ~~X X X...
60
960
textual
tests/snapshot_tests/snapshot_apps/hatch.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label from textual.containers import Container class HatchApp(App): CSS = """ Screen { hatch: right slateblue; } #one { hatch: left $success; margin: 2 4; } #two { hatch: cross $warning; ...
57
1,186
textual
tests/snapshot_tests/snapshot_apps/quickly_change_tabs.py
.py
"""Regression test for https://github.com/Textualize/textual/issues/2229.""" from textual.app import App, ComposeResult from textual.widgets import TabbedContent, TabPane, Tabs, Label class QuicklyChangeTabsApp(App[None]): def compose(self) -> ComposeResult: with TabbedContent(): with TabPane(...
25
712
textual
tests/snapshot_tests/snapshot_apps/dev_previews_keys.py
.py
from textual_dev.previews import KeysApp app = KeysApp() if __name__ == "__main__": app.run()
6
99
textual
tests/snapshot_tests/snapshot_apps/digits.py
.py
from textual.app import App, ComposeResult from textual.widgets import Digits class DigitApp(App): CSS = """ .left { text-align: left; } .center { text-align:center; } .right { text-align:right; } .bold { text-style: bold; } """ def compose(...
35
792
textual
tests/snapshot_tests/snapshot_apps/richlog_max_lines.py
.py
from textual.app import App from textual.widgets import RichLog class RichLogLines(App): count = 0 def compose(self): yield RichLog(max_lines=3) async def on_key(self): self.count += 1 log_widget = self.query_one(RichLog) log_widget.write(f"Key press #{self.count}") app...
21
380
textual
tests/snapshot_tests/snapshot_apps/modal_screen_bindings.py
.py
from textual.app import App, ComposeResult from textual.screen import ModalScreen from textual.widgets import Button, Footer, Header, Label, Input class Dialog(ModalScreen): def compose(self) -> ComposeResult: yield Label("Dialog") yield Input() yield Button("OK", id="ok") def on_butt...
35
893
textual
tests/snapshot_tests/snapshot_apps/sparkline.py
.py
import random from statistics import mean from textual.app import App, ComposeResult from textual.widgets import Sparkline random.seed(73) data = [random.expovariate(1 / 3) for _ in range(1000)] class SparklineApp(App[None]): DEFAULT_CSS = """ SparklineApp { Sparkline { height: 1fr; ...
29
606
textual
tests/snapshot_tests/snapshot_apps/markup.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label class ContentApp(App): def compose(self) -> ComposeResult: yield Label("[bold]Bold[/] [italic]Italic[/] [u]Underline[/] [s]Strike[/s]") yield Label( "[$primary]Primary[/] [$secondary]Secondary[/] [$warning...
25
877
textual
tests/snapshot_tests/snapshot_apps/text_area_unfocus.py
.py
"""Tests the rendering of the TextArea for all supported languages.""" from textual.app import App, ComposeResult from textual.widgets import TextArea class TextAreaUnfocusSnapshot(App): AUTO_FOCUS = None def compose(self) -> ComposeResult: text_area = TextArea.code_editor() text_area.cursor_...
18
433
textual
tests/snapshot_tests/snapshot_apps/columns_height.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import Static class HeightApp(App[None]): CSS = """ Horizontal { border: solid red; height: auto; } Static { border: solid green; width: auto; } #fill_pa...
38
719
textual
tests/snapshot_tests/snapshot_apps/auto_fr.py
.py
from textual.app import App, ComposeResult from textual.widget import Widget from textual.widgets import Label class FRApp(App): CSS = """ Screen { align: center middle; border: solid cyan; } #container { width: 30; height: auto; border: solid green...
41
808
textual
tests/snapshot_tests/snapshot_apps/scroll_visible_margin.py
.py
from textual.app import App, ComposeResult from textual.containers import VerticalScroll, Container from textual.widgets import Button class ScrollVisibleMargin(App): CSS = """ Container { height: auto; margin-top: 8; border: solid red; } """ def compose(self) -> ComposeRe...
29
686
textual
tests/snapshot_tests/snapshot_apps/dynamic_bindings.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.widgets import Footer class BindingsApp(App): """Check dynamic actions are displayed in the footer.""" BINDINGS = [ ("a", "a", "A"), ("b", "b", "B"), ("c", "c", "C"), ] def compose(self...
42
985
textual
tests/snapshot_tests/snapshot_apps/app_blur.py
.py
from textual.app import App, ComposeResult from textual.events import AppBlur from textual.widgets import Input class AppBlurApp(App[None]): CSS = """ Screen { align: center middle; } Input { width: 50%; margin-bottom: 1; &:focus { width: 75%; ...
33
668
textual
tests/snapshot_tests/snapshot_apps/bindings_screen_overrides_show.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.binding import Binding from textual.widgets import Footer class ShowBindingScreen(Screen): BINDINGS = [ Binding("p", "app.pop_screen", "Binding shown"), ] def compose(self) -> ComposeResult: yield Fo...
30
679
textual
tests/snapshot_tests/snapshot_apps/data_table_sort.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import DataTable # Shuffled around a bit to exercise sorting. ROWS = [ ("lane", "swimmer", "country", "time"), (5, "Chad le Clos", "South Africa", 51.14), (4, "Joseph Schooling", "Singapore", 50.39), (2,...
45
1,223
textual
tests/snapshot_tests/snapshot_apps/text_area_wrapping.py
.py
from textual.app import App, ComposeResult from textual.widgets import TextArea TEXT = """\ # The Wonders of Space Exploration Space exploration has *always* captured the human imagination. ダレンバーンズ \tThisissomelongtextthatshouldfoldcorrectly. \t\tダレン バーンズ """ class TextAreaWrapping(App): def compose(s...
32
534
textual
tests/snapshot_tests/snapshot_apps/scroll_to_center.py
.py
from textual.app import App, ComposeResult from textual.containers import HorizontalScroll, VerticalScroll from textual.widgets import Label class MyApp(App[None]): AUTO_FOCUS = "" CSS = """ VerticalScroll { border: round $primary; } #vertical { height: 21; } HorizontalScro...
43
1,110
textual
tests/snapshot_tests/snapshot_apps/screen_switch.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Static, Header, Footer class ScreenA(Screen): BINDINGS = [("b", "switch_to_b", "Switch to screen B")] def compose(self) -> ComposeResult: yield Header() yield Static("A") yield Foo...
39
838
textual
tests/snapshot_tests/snapshot_apps/modified_tabs.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button, TabbedContent class FiddleWithTabsApp(App[None]): CSS = """ TabPane:disabled { background: red; } """ def compose(self) -> ComposeResult: with TabbedContent(): yield Button() yie...
28
679
textual
tests/snapshot_tests/snapshot_apps/footer_classic_styling.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer class ClassicFooterStylingApp(App): """ This app attempts to replicate the styling of the classic footer in Textual before v0.63.0, in particular the distinct background color for the binding keys and spacing between the key...
46
1,067
textual
tests/snapshot_tests/snapshot_apps/width_100.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Label class Width100PCentApp(App[None]): CSS = """ Vertical { border: solid red; width: auto; Label { border: solid green; } #first { ...
37
735
textual
tests/snapshot_tests/snapshot_apps/text_area_alternate_screen.py
.py
from textual.app import App from textual.screen import Screen from textual.widgets import TextArea TEXT = """\ foo bar baz """ class AltScreen(Screen[None]): def compose(self): yield TextArea(TEXT) class TABug(App[None]): def on_mount(self): self.push_screen(AltScreen()) if __name__ == "_...
25
362
textual
tests/snapshot_tests/snapshot_apps/ansi_mapping.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label class AnsiMappingApp(App[None]): def compose(self) -> ComposeResult: ansi_colors = [ "ansi_red", "ansi_green", "ansi_yellow", "ansi_blue", "ansi_magenta", "a...
27
704
textual
tests/snapshot_tests/snapshot_apps/dock_scroll.py
.py
from textual.app import App from textual.widgets import Header, Label, Footer class TestApp(App): BINDINGS = [("ctrl+q", "app.quit", "Quit")] CSS = """ Label { border: solid red; } Footer { height: 4; } """ def compose(self): text = ( "this is ...
29
531
textual
tests/snapshot_tests/snapshot_apps/capture_print.py
.py
from textual.app import App, ComposeResult from textual import events from textual.widgets import RichLog class PrintLogger(RichLog): """A RichLog which captures printed text.""" def on_print(self, event: events.Print) -> None: self.write(event.text) class CaptureApp(App): def compose(self) -> ...
28
702
textual
tests/snapshot_tests/snapshot_apps/grid_auto.py
.py
from textual.app import App, ComposeResult from textual.containers import Grid from textual.widgets import Placeholder class KeylineApp(App): CSS = """ Grid { grid-size: 3 3; grid-gutter: 1; grid-columns: 2; grid-rows: 1; keyline: thin; width: auto; heig...
35
799
textual
tests/snapshot_tests/snapshot_apps/programmatic_scrollbar_gutter_change.py
.py
from textual.app import App from textual.containers import Grid from textual.widgets import Label class ProgrammaticScrollbarGutterChange(App[None]): CSS = """ Grid { grid-size: 2 2; scrollbar-size: 5 5; } Label { width: 100%; height: 100%; background: red; } """ def compose(self): yield ...
28
659
textual
tests/snapshot_tests/snapshot_apps/fr_with_min.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical, VerticalScroll from textual.widgets import Header, Footer, Static class ScreenSplitApp(App[None]): CSS = """ Horizontal { width: 1fr; } Vertical { width: 1fr; background: bl...
51
1,129
textual
tests/snapshot_tests/snapshot_apps/text_area.py
.py
"""Tests the rendering of the TextArea for all supported languages.""" from textual.app import App, ComposeResult from textual.widgets import TextArea class TextAreaSnapshot(App): def compose(self) -> ComposeResult: text_area = TextArea.code_editor() text_area.cursor_blink = False yield te...
16
396
textual
tests/snapshot_tests/snapshot_apps/data_table_column_cursor.py
.py
import csv import io from textual.app import App, ComposeResult from textual.widgets import DataTable CSV = """lane,swimmer,country,time 4,Joseph Schooling,Singapore,50.39 2,Michael Phelps,United States,51.14 5,Chad le Clos,South Africa,51.14 6,László Cseh,Hungary,51.14 3,Li Zhuhao,China,51.26 8,Mehdy Metella,France,...
37
883
textual
tests/snapshot_tests/snapshot_apps/auto_grid.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, Input from textual.containers import Container class GridApp(App): CSS = """ Screen { align: center middle; } Container { layout: grid; grid-size: 2; grid-columns: auto 1fr; grid-rows:...
53
1,093
textual
tests/snapshot_tests/snapshot_apps/auto_tab_active.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button, Footer, TabbedContent, TabPane class ExampleApp(App): BINDINGS = [("space", "focus_button_2_2", "Focus button 2.2")] def compose(self) -> ComposeResult: with TabbedContent(id="tabbed-root"): with TabPane("[ansi...
37
1,361
textual
tests/snapshot_tests/snapshot_apps/fr_units.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, VerticalScroll from textual.widgets import Static class StaticText(Static): pass class FRApp(App): CSS = """ StaticText { height: 1fr; background: $boost; border: heavy white; } #foo { ...
55
964
textual
tests/snapshot_tests/snapshot_apps/tabbed_content_style_leak_test.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button, Label, TabbedContent, Tabs, TabPane class TabbedContentStyleLeakTestApp(App[None]): def compose(self) -> ComposeResult: with TabbedContent(): with TabPane("Leak Test"): yield Label("This label should...
15
537
textual
tests/snapshot_tests/snapshot_apps/remove_auto.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Header, Footer, Label class VerticalRemoveApp(App[None]): CSS = """ Vertical { border: round green; height: auto; } Label { border: round yellow; background: ...
39
862
textual
tests/snapshot_tests/snapshot_apps/log_write.py
.py
from textual.app import App, ComposeResult from textual.widgets import Log from textual.containers import Horizontal class LogApp(App): def compose(self) -> ComposeResult: yield Log() def on_ready(self) -> None: log = self.query_one(Log) log.write("Hello,") log.write(" World")...
23
489
textual
tests/snapshot_tests/snapshot_apps/directory_tree_reload.py
.py
from pathlib import Path from textual.app import App, ComposeResult from textual.widgets import DirectoryTree class DirectoryTreeReloadApp(App[None]): BINDINGS = [ ("r", "reload"), ("e", "expand"), ("d", "delete"), ] async def setup(self, path_root: Path) -> None: self.pa...
59
1,603
textual
tests/snapshot_tests/snapshot_apps/multi_keys.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import Footer class MApp(App): BINDINGS = [Binding("o,ctrl+o", "options", "Options")] def compose(self) -> ComposeResult: yield Footer() if __name__ == "__main__": MApp().run()
12
299
textual
tests/snapshot_tests/snapshot_apps/notification_with_inline_link.py
.py
from textual.app import App class NotifyWithInlineLinkApp(App): def on_mount(self) -> None: self.notify("Click [@click=bell]here[/] for the bell sound.") if __name__ == "__main__": app = NotifyWithInlineLinkApp() app.run()
12
247
textual
tests/snapshot_tests/snapshot_apps/tab_rename.py
.py
from textual.app import App, ComposeResult from textual.widgets import TabbedContent, TabPane class TabRenameApp(App[None]): def compose(self) -> ComposeResult: with TabbedContent(): yield TabPane("!", id="test") for n in range(5): yield TabPane(str(n) * (n+1)) ...
17
506
textual
tests/snapshot_tests/snapshot_apps/line_api_scrollbars.py
.py
from rich.text import Text from textual.app import App, ComposeResult from textual.containers import VerticalScroll from textual.widget import Widget from textual.widgets import RichLog class MyWidget(Widget): def render(self): return Text( "\n".join(f"{n} 0123456789" for n in range(20)), ...
55
1,108
textual
tests/snapshot_tests/snapshot_apps/nested_fr.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Static class AutoApp(App): """The innermost container should push its parents outwards, to fill the screen.""" CSS = """ #outer { background: blue; height: auto; border: ...
40
857
textual
tests/snapshot_tests/snapshot_apps/select_rebuild.py
.py
"""Test https://github.com/Textualize/textual/issues/2557""" from textual.app import App, ComposeResult from textual.widgets import Select, Button class SelectRebuildApp(App[None]): def compose(self) -> ComposeResult: yield Select[int]((("1", 1), ("2", 2))) yield Button("Rebuild") def on_bu...
22
594
textual
tests/snapshot_tests/snapshot_apps/offsets.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, Static class Box(Static): DEFAULT_CSS = """ Box { border: solid white; background: darkblue; width: 16; height: auto; } """ def compose(self) -> ComposeResult: yield Label...
40
645
textual
tests/snapshot_tests/snapshot_apps/placeholder_disabled.py
.py
from textual.app import App, ComposeResult from textual.widgets import Placeholder class DisabledPlaceholderApp(App[None]): CSS = """ Placeholder { height: 1fr; } """ def compose(self) -> ComposeResult: yield Placeholder() yield Placeholder(disabled=True) if __name__ == "...
19
367
textual
tests/snapshot_tests/snapshot_apps/multiple_css/multiple_css.py
.py
"""Testing multiple CSS files, including app-level CSS -- element #one The `background` rule on #one tests a 3-way specificity clash between classvar CSS and two separate CSS files. The background ends up red because classvar CSS wins. The `color` rule tests a clash between loading two external CSS files. The color en...
35
1,036
textual
examples/breakpoints.py
.py
from textual.app import App, ComposeResult from textual.containers import Grid from textual.widgets import Footer, Markdown, Placeholder HELP = """\ ## Breakpoints A demonstration of how to make an app respond to the dimensions of the terminal. Try resizing the terminal, then have a look at the source to see how it ...
54
1,277