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/dev_previews_easing.py
.py
from textual_dev.previews import EasingApp app = EasingApp() if __name__ == "__main__": app.run()
6
103
textual
tests/snapshot_tests/snapshot_apps/mount_style_fix.py
.py
from textual import __version__ from textual.app import App, ComposeResult from textual.widgets import Static # Regression test for https://github.com/Textualize/textual/issues/3858 class BrokenClassesApp(App[None]): CSS = """ Screen { align: center middle; } Static { width: 50%; ...
33
669
textual
tests/snapshot_tests/snapshot_apps/loading.py
.py
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 = """ Si...
57
1,402
textual
tests/snapshot_tests/snapshot_apps/border_alpha.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Label class BorderAlphaApp(App[None]): CSS = """ .boxes { height: 3; width: 100%; } #box0 { border: heavy green 0%; } #box1 { border: heavy gre...
41
771
textual
tests/snapshot_tests/snapshot_apps/layer_fix.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Header, Footer, Label from textual.binding import Binding class Dialog(Vertical): def compose(self) -> ComposeResult: """Compose the child widgets.""" yield Label("This should not cause a...
49
1,034
textual
tests/snapshot_tests/snapshot_apps/viewport_units.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class ViewportUnits(App): CSS = """Static {width: 100vw; height: 100vh; border: solid cyan;} """ def compose(self) -> ComposeResult: yield Static("Hello, world!") app = ViewportUnits() if __name__ == '__main__': app.r...
15
325
textual
tests/snapshot_tests/snapshot_apps/button_multiline_label.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button class ButtonWithMultilineLabelApp(App): def compose(self) -> ComposeResult: yield Button("Button\nwith\nmulti-line\nlabel") if __name__ == "__main__": app = ButtonWithMultilineLabelApp() app.run()
13
299
textual
tests/snapshot_tests/snapshot_apps/auto_width_input.py
.py
from textual.app import App, ComposeResult from textual.widgets import Header, Footer, Input class InputWidthAutoApp(App[None]): CSS = """ Input.auto { width: auto; max-width: 100%; } """ def compose(self) -> ComposeResult: yield Header() yield Input(placeholder="T...
21
439
textual
tests/snapshot_tests/snapshot_apps/data_table_cell_padding.py
.py
from textual.app import App, ComposeResult from textual.widgets import DataTable class TableApp(App): CSS = """ DataTable { margin: 1; } """ def compose(self) -> ComposeResult: for cell_padding in range(5): dt = DataTable(cell_padding=cell_padding) dt.add_c...
29
633
textual
tests/snapshot_tests/snapshot_apps/alignment_containers.py
.py
""" App to test alignment containers. """ from textual.app import App, ComposeResult from textual.containers import Center, Middle from textual.widgets import Button class AlignContainersApp(App[None]): CSS = """ Center { tint: $primary 10%; } Middle { tint: $accent 10%; } """...
30
562
textual
tests/snapshot_tests/snapshot_apps/recompose.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.reactive import reactive from textual.widgets import Digits, ProgressBar class Numbers(Vertical): DEFAULT_CSS = """ Digits { border: red; } """ d...
57
1,447
textual
tests/snapshot_tests/snapshot_apps/rules.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal, Vertical from textual.widgets import Rule RULE_STYLES = [ "ascii", "blank", "dashed", "double", "heavy", "hidden", "none", "solid", "thick", ] class RuleApp(App): def compose(self) -> Compose...
31
628
textual
tests/snapshot_tests/snapshot_apps/button_widths.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import Button class HorizontalWidthAutoApp(App[None]): CSS = """ Horizontal { border: solid red; height: auto; width: auto; } """ def compose(self) -> ComposeResult: ...
26
631
textual
tests/snapshot_tests/snapshot_apps/layout_containers.py
.py
""" App to test layout containers. """ from typing import Iterable from textual.app import App, ComposeResult from textual.containers import ( Grid, Horizontal, HorizontalScroll, Vertical, VerticalScroll, ) from textual.widget import Widget from textual.widgets import Button, Input, Label def su...
57
1,171
textual
tests/snapshot_tests/snapshot_apps/masked_input.py
.py
from textual.app import App, ComposeResult from textual.widgets import MaskedInput class TemplateApp(App[None]): def compose(self) -> ComposeResult: yield MaskedInput(">NNNNN-NNNNN-NNNNN-NNNNN;_") yield MaskedInput("9999-99-99", placeholder="YYYY-MM-DD") if __name__ == "__main__": app = Temp...
13
343
textual
tests/snapshot_tests/snapshot_apps/vertical_max_height.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Placeholder class VerticalApp(App): CSS = """ #top { height: 1fr; border: white; } #bottom { height:3fr; border: white; max-height: 10; } ...
27
529
textual
tests/snapshot_tests/snapshot_apps/toggle_style_order.py
.py
from textual.app import App from textual.widgets import Checkbox, Label class CheckboxApp(App): CSS = """ Checkbox > .toggle--label, Label { color: white; text-opacity: 50%; } """ def compose(self): yield Checkbox("[red bold]This is just[/] some text.") yield Label...
20
414
textual
tests/snapshot_tests/snapshot_apps/data_table_add_column.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import DataTable, Footer MOVIES = [ "Severance", "Foundation", "Dark", "The Boys", "The Last of Us", "Lost in Space", "Altered Carbon", ] class AddColumn(App): BINDINGS = [ Bind...
39
921
textual
tests/snapshot_tests/snapshot_apps/data_table_row_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
880
textual
tests/snapshot_tests/snapshot_apps/text_area_line_number_start.py
.py
from textual.app import App, ComposeResult from textual.widgets import TextArea TEXT = """\ Foo Bar Baz """ class LineNumbersReactive(App[None]): START_LINE_NUMBER = 9999 def compose(self) -> ComposeResult: yield TextArea( TEXT, soft_wrap=True, show_line_numbers=T...
26
460
textual
tests/snapshot_tests/snapshot_apps/data_table_remove_row.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding 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), ...
52
1,451
textual
tests/snapshot_tests/snapshot_apps/vertical_min_height.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Placeholder class VerticalApp(App): CSS = """ #top { min-height: 10; height: 1fr; border: white; } #bottom { height:3fr; border: white; } ...
27
529
textual
tests/snapshot_tests/snapshot_apps/unscoped_css.py
.py
from textual.app import App, ComposeResult from textual.widget import Widget from textual.widgets import Label class MyWidget(Widget): SCOPED_CSS = False DEFAULT_CSS = """ MyWidget { height: auto; border: magenta; } Label { border: solid green; } """ def compos...
36
689
textual
tests/snapshot_tests/snapshot_apps/command_palette_key.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer class NewPaletteBindingApp(App): COMMAND_PALETTE_BINDING = "ctrl+backslash" COMMAND_PALETTE_DISPLAY = "ctrl+\\" def compose(self) -> ComposeResult: yield Footer() if __name__ == "__main__": app = NewPaletteBinding...
16
340
textual
tests/snapshot_tests/snapshot_apps/remove_tab.py
.py
from textual.app import App from textual.binding import Binding from textual.widgets import Label, TabbedContent, TabPane class ReproApp(App[None]): BINDINGS = [ Binding("space", "close_pane"), ] def __init__(self): super().__init__() self.animation_level = "none" def compose...
31
793
textual
tests/snapshot_tests/snapshot_apps/text_log_blank_write.py
.py
from textual.app import App, ComposeResult from textual.widgets import RichLog class RichLogApp(App): def compose(self) -> ComposeResult: yield RichLog() def on_mount(self) -> None: tl = self.query_one(RichLog) tl.write("Hello") tl.write("") tl.write("World") if __na...
19
377
textual
tests/snapshot_tests/snapshot_apps/dev_previews_color.py
.py
from textual_dev.previews import ColorsApp app = ColorsApp() if __name__ == "__main__": app.run()
6
103
textual
tests/snapshot_tests/snapshot_apps/pretty_grid_gutter_interaction.py
.py
"""App used as regression test for https://github.com/Textualize/textual/pull/4219.""" from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import Grid from textual.widgets import Pretty, Label class MyGrid(Grid): """A simple grid with 2 columns and 2 rows.""" ...
42
864
textual
tests/snapshot_tests/snapshot_apps/grid_gutter.py
.py
from rich.markdown import Markdown from textual.app import App, ComposeResult from textual.containers import Grid, Vertical from textual.widgets import Label, TabbedContent, TabPane class FooApp(App): TITLE = "Demonstrator" CSS = """ Screen { align: center middle; } ...
43
1,322
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