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
src/textual/_spatial_map.py
.py
from __future__ import annotations from collections import defaultdict from itertools import product from typing import Generic, Iterable, TypeVar from typing_extensions import TypeAlias from textual.geometry import Offset, Region ValueType = TypeVar("ValueType") GridCoordinate: TypeAlias = "tuple[int, int]" clas...
104
3,764
textual
src/textual/worker_manager.py
.py
""" Contains `WorkerManager`, a class to manage [workers](/guide/workers) for an app. You access this object via [App.workers][textual.app.App.workers] or [Widget.workers][textual.dom.DOMNode.workers]. """ from __future__ import annotations import asyncio from collections import Counter from operator import attrgett...
182
5,602
textual
src/textual/features.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, cast from typing_extensions import Literal if TYPE_CHECKING: from typing_extensions import Final FEATURES: Final = {"devtools", "debug", "headless"} FeatureFlag = Literal["devtools", "debug", "headless"] def parse_features(features: str) ->...
30
699
textual
src/textual/widget.py
.py
""" This module contains the `Widget` class, the base class for all widgets. """ from __future__ import annotations from asyncio import create_task, gather, wait from collections import Counter from contextlib import asynccontextmanager from fractions import Fraction from time import monotonic from types import Trac...
4,957
175,691
textual
src/textual/markup.py
.py
""" Utilities related to content markup. """ from __future__ import annotations from operator import itemgetter from textual.css.parse import substitute_references from textual.css.tokenizer import UnexpectedEnd __all__ = ["MarkupError", "escape", "to_content"] import re from string import Template from typing im...
464
13,404
textual
src/textual/_types.py
.py
from typing import TYPE_CHECKING, Any, Awaitable, Callable, List, Literal, Union from typing_extensions import Protocol if TYPE_CHECKING: from rich.segment import Segment from textual.message import Message class MessageTarget(Protocol): """Protocol that must be followed by objects that can receive mes...
58
1,935
textual
src/textual/content.py
.py
""" Content is a container for text, with spans marked up with color / style. It is equivalent to Rich's Text object, with support for more of Textual features. Unlike Rich Text, Content is *immutable* so you can't modify it in place, and most methods will return a new Content instance. This is more like the builtin s...
1,843
62,237
textual
src/textual/_keyboard_protocol.py
.py
from typing import Final # https://sw.kovidgoyal.net/kitty/keyboard-protocol/#functional-key-definitions FUNCTIONAL_KEYS: Final = { "27u": "escape", "13u": "enter", "9u": "tab", "127u": "backspace", "2~": "insert", "3~": "delete", "1D": "left", "1C": "right", "1A": "up", "1B": "...
144
3,199
textual
src/textual/_context.py
.py
from __future__ import annotations from contextvars import ContextVar from typing import TYPE_CHECKING, Any, Callable if TYPE_CHECKING: from textual.app import App from textual.message import Message from textual.message_pump import MessagePump from textual.screen import Screen class NoActiveAppErro...
29
1,028
textual
src/textual/_immutable_sequence_view.py
.py
"""Provides an immutable sequence view class.""" from __future__ import annotations from sys import maxsize from typing import TYPE_CHECKING, Generic, Iterator, Sequence, TypeVar, overload T = TypeVar("T") class ImmutableSequenceView(Generic[T]): """Class to wrap a sequence of some sort, but not allow modifica...
70
1,859
textual
src/textual/await_remove.py
.py
""" An *optionally* awaitable object returned by methods that remove widgets. """ from __future__ import annotations import asyncio from asyncio import Task, gather from typing import Generator import rich.repr from textual._callback import invoke from textual._debug import get_caller_file_and_line from textual._ty...
48
1,345
textual
src/textual/_duration.py
.py
import re _match_duration = re.compile(r"^(-?\d+\.?\d*)(s|ms)$").match class DurationError(Exception): """ Exception indicating a general issue with a CSS duration. """ class DurationParseError(DurationError): """ Indicates a malformed duration string that could not be parsed. """ def _du...
45
1,211
textual
src/textual/command.py
.py
""" This module contains classes for working with Textual's command palette. See the guide on the [Command Palette](../guide/command_palette.md) for full details. """ from __future__ import annotations from abc import ABC, abstractmethod from asyncio import ( CancelledError, Queue, Task, TimeoutErro...
1,287
43,086
textual
src/textual/_debug.py
.py
""" Functions related to debugging. """ from __future__ import annotations from textual import constants def get_caller_file_and_line() -> str | None: """Get the caller filename and line, if in debug mode, otherwise return `None`: Returns: Path and file if `constants.DEBUG==True` """ if no...
27
614
textual
src/textual/map_geometry.py
.py
from __future__ import annotations from typing import NamedTuple from textual.geometry import Region, Size, Spacing class MapGeometry(NamedTuple): """Defines the absolute location of a Widget.""" region: Region """The (screen) [region][textual.geometry.Region] occupied by the widget.""" order: tupl...
35
1,363
textual
src/textual/_styles_cache.py
.py
from __future__ import annotations from functools import lru_cache from typing import TYPE_CHECKING, Callable, Iterable, Sequence import rich.repr from rich.segment import Segment from rich.style import Style as RichStyle from rich.terminal_theme import TerminalTheme from textual import log from textual._ansi_theme ...
524
19,197
textual
src/textual/_queue.py
.py
from __future__ import annotations import asyncio from asyncio import Event from collections import deque from typing import Generic, TypeVar QueueType = TypeVar("QueueType") class Queue(Generic[QueueType]): """A cut-down version of asyncio.Queue This has just enough functionality to run the message pumps....
50
1,211
textual
src/textual/dom.py
.py
""" The module contains `DOMNode`, the base class for any object within the Textual Document Object Model, which includes all Widgets, Screens, and Apps. """ from __future__ import annotations import re import threading from functools import lru_cache, partial from inspect import getfile from typing import ( TYP...
1,945
64,878
textual
src/textual/cache.py
.py
""" Cache classes are dict-like containers used to avoid recalculating expensive operations such as rendering. You can also use them in your own apps for similar reasons. """ from __future__ import annotations from typing import TYPE_CHECKING, Dict, Generic, KeysView, TypeVar, overload CacheKey = TypeVar("CacheKe...
315
9,357
textual
src/textual/_box_drawing.py
.py
""" Box drawing utilities for Canvas. The box drawing characters have zero to four lines radiating from the center of the glyph. There are three line types: thin, heavy, and double. These are indicated by 1, 2, and 3 respectively (0 for no line). This code represents the characters as a tuple of 4 integers, (<top>, <...
367
8,159
textual
src/textual/scrollbar.py
.py
""" Contains the widgets that manage Textual scrollbars. !!! note You will not typically need this for most apps. """ from __future__ import annotations from math import ceil from typing import ClassVar, Type import rich.repr from rich.color import Color from rich.console import Console, ConsoleOptions, Rende...
412
13,956
textual
src/textual/message_pump.py
.py
""" A `MessagePump` is a base class for any object which processes messages, which includes Widget, Screen, and App. !!! tip Most of the method here are useful in general app development. """ from __future__ import annotations import asyncio import threading from asyncio import CancelledError, QueueEmpty, Tas...
921
32,221
textual
src/textual/validation.py
.py
""" This module provides a number of classes for validating input. See [Validating Input](/widgets/input/#validating-input) for details. """ from __future__ import annotations import math import re from abc import ABC, abstractmethod from dataclasses import dataclass, field from typing import Callable, Pattern, Se...
520
18,715
textual
src/textual/_ansi_theme.py
.py
from __future__ import annotations from rich.terminal_theme import TerminalTheme def rgb(red: int, green: int, blue: int) -> tuple[int, int, int]: """Define an RGB color. This exists mainly so that a VSCode extension can render the colors inline. Args: red: Red component. green: Green c...
73
1,509
textual
src/textual/reactive.py
.py
""" This module contains the `Reactive` class which implements [reactivity](/guide/reactivity/). """ from __future__ import annotations from functools import partial from inspect import isawaitable from typing import ( TYPE_CHECKING, Any, Awaitable, Callable, ClassVar, Generic, Type, ...
533
18,056
textual
src/textual/_tree_sitter.py
.py
from __future__ import annotations from importlib import import_module from textual import log try: from tree_sitter import Language _LANGUAGE_CACHE: dict[str, Language] = {} _tree_sitter = True def get_language(language_name: str) -> Language | None: if language_name in _LANGUAGE_CACHE: ...
45
1,299
textual
src/textual/strip.py
.py
""" This module contains the `Strip` class and related objects. A `Strip` contains the result of rendering a widget. See [Line API](/guide/widgets#line-api) for how to use Strips. """ from __future__ import annotations from functools import lru_cache from typing import Any, Iterable, Iterator, Sequence import rich....
818
26,717
textual
src/textual/theme.py
.py
from __future__ import annotations from dataclasses import dataclass, field from functools import partial from operator import attrgetter from typing import Callable from textual.command import DiscoveryHit, Hit, Hits, Provider from textual.design import ColorSystem @dataclass class Theme: """Defines a theme fo...
545
16,788
textual
src/textual/_partition.py
.py
from __future__ import annotations from typing import Callable, Iterable, TypeVar T = TypeVar("T") def partition( predicate: Callable[[T], object], iterable: Iterable[T] ) -> tuple[list[T], list[T]]: """Partition a sequence into two list from a given predicate. The first list will contain the values whe...
28
844
textual
src/textual/_wait.py
.py
from asyncio import sleep from time import monotonic, process_time SLEEP_GRANULARITY: float = 1 / 50 SLEEP_IDLE: float = SLEEP_GRANULARITY / 20.0 async def wait_for_idle( min_sleep: float = SLEEP_GRANULARITY, max_sleep: float = 1 ) -> None: """Wait until the process isn't working very hard. This will co...
42
1,446
textual
src/textual/getters.py
.py
""" Descriptors to define properties on your widget, screen, or App. """ from __future__ import annotations from inspect import isclass from typing import TYPE_CHECKING, Callable, Generic, TypeVar, overload from textual._context import NoActiveAppError, active_app from textual.css.query import NoMatches, QueryType,...
226
6,864
textual
src/textual/_auto_scroll.py
.py
from textual.geometry import Region def get_auto_scroll_regions( widget_region: Region, auto_scroll_lines: int ) -> tuple[Region, Region]: """Get non-overlapping regions which should auto scroll when selecting. Args: widget_region: The region occupied by the widget. auto_scroll_lines: Num...
31
1,080
textual
src/textual/events.py
.py
""" Builtin events sent by Textual. Events may be marked as "Bubbles" and "Verbose". See the [events guide](/guide/events/#bubbling) for an explanation of bubbling. Verbose events are excluded from the textual console, unless you explicitly request them with the `-v` switch as follows: ``` textual console -v ``` """...
997
26,355
textual
src/textual/visual.py
.py
from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from itertools import islice from typing import TYPE_CHECKING, Callable, Protocol import rich.repr from rich.console import Console, ConsoleOptions, RenderableType from rich.measure import Measurement from rich.pr...
432
13,870
textual
src/textual/actions.py
.py
from __future__ import annotations import ast import re from functools import lru_cache from typing import Any from typing_extensions import TypeAlias ActionParseResult: TypeAlias = "tuple[str, str, tuple[object, ...]]" """An action is its name and the arbitrary tuple of its arguments.""" class SkipAction(Exceptio...
60
1,669
textual
src/textual/highlight.py
.py
from __future__ import annotations import os from typing import Tuple from pygments.lexer import Lexer from pygments.lexers import get_lexer_by_name, guess_lexer_for_filename from pygments.token import Token from pygments.util import ClassNotFound from textual.content import Content, Span TokenType = Tuple[str, ......
239
7,952
textual
src/textual/demo/demo_app.py
.py
from __future__ import annotations from textual.app import App from textual.binding import Binding from textual.demo.game import GameScreen from textual.demo.home import HomeScreen from textual.demo.projects import ProjectsScreen from textual.demo.widgets import WidgetsScreen class DemoApp(App): """The demo app ...
106
2,965
textual
src/textual/demo/_project_stars.py
.py
STARS = { "Posting": "11.4k", "Memray": "14.9k", "Toolong": "3.9k", "Dolphie": "1.1k", "Harlequin": "5.8k", "Elia": "2.4k", "Trogon": "2.8k", "TFTUI - The Terraform textual UI": "1.3k", "RecoverPy": "1.7k", "Frogmouth": "3.1k", "oterm": "2.3k", "logmerger": "250", "do...
16
335
textual
src/textual/demo/_project_stargazer_updater.py
.py
import httpx import os import json from rich.console import Console # Not using the Absolute reference because # I can't get python to run it. from _project_data import PROJECTS console = Console() error_console = Console(stderr=True, style="bold red") def main() -> None: STARS = {} for project in PROJECTS...
51
1,523
textual
src/textual/demo/game.py
.py
""" An implementation of the "Sliding Tile" puzzle. Textual isn't a game engine exactly, but it wasn't hard to build this. """ from __future__ import annotations from asyncio import sleep from collections import defaultdict from dataclasses import dataclass from itertools import product from random import choice fr...
590
19,438
textual
src/textual/demo/home.py
.py
from __future__ import annotations import asyncio from importlib.metadata import version try: import httpx HTTPX_AVAILABLE = True except ImportError: HTTPX_AVAILABLE = False from textual import work from textual.app import ComposeResult from textual.containers import Horizontal, Vertical, VerticalScroll...
269
8,588
textual
src/textual/demo/__main__.py
.py
from textual.demo.demo_app import DemoApp if __name__ == "__main__": app = DemoApp() app.run()
6
104
textual
src/textual/demo/page.py
.py
from __future__ import annotations import inspect from rich.syntax import Syntax from textual import work from textual.app import ComposeResult from textual.binding import Binding from textual.containers import ScrollableContainer from textual.screen import ModalScreen, Screen from textual.widgets import Static cl...
95
2,527
textual
src/textual/demo/data.py
.py
import json COUNTRIES = [ "Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize"...
459
15,435
textual
src/textual/demo/projects.py
.py
from __future__ import annotations from textual import events, on from textual.app import ComposeResult from textual.binding import Binding from textual.containers import Center, Horizontal, ItemGrid, Vertical, VerticalScroll from textual.demo._project_data import PROJECTS, ProjectInfo from textual.demo._project_stars...
138
3,824
textual
src/textual/demo/_project_data.py
.py
from dataclasses import dataclass @dataclass class ProjectInfo: """Dataclass for storing project information.""" title: str author: str url: str description: str repo_url_part: str PROJECTS = [ ProjectInfo( "Posting", "Darren Burns", "https://posting.sh/", ...
108
3,444
textual
src/textual/demo/widgets.py
.py
from __future__ import annotations import csv import io from math import sin from rich.syntax import Syntax from rich.table import Table from rich.traceback import Traceback from textual import containers, events, lazy, on from textual.app import ComposeResult from textual.binding import Binding from textual.demo.da...
823
23,870
textual
src/textual/widgets/_text_area.py
.py
from __future__ import annotations import dataclasses import re from collections import defaultdict from dataclasses import dataclass from functools import lru_cache from pathlib import Path from typing import TYPE_CHECKING, ClassVar, Iterable, Optional, Sequence, Tuple from rich.console import RenderableType from ri...
2,799
102,337
textual
src/textual/widgets/tabbed_content.py
.py
from textual.widgets._tabbed_content import ContentTab, ContentTabs __all__ = [ "ContentTab", "ContentTabs", ]
7
120
textual
src/textual/widgets/_footer.py
.py
from __future__ import annotations from collections import defaultdict from itertools import groupby from typing import TYPE_CHECKING import rich.repr from rich.text import Text from textual import events from textual.app import ComposeResult from textual.binding import Binding from textual.containers import Horizon...
334
10,585
textual
src/textual/widgets/_welcome.py
.py
"""Provides a Textual welcome widget.""" from rich.markdown import Markdown from textual.app import ComposeResult from textual.containers import Container from textual.widgets._button import Button from textual.widgets._static import Static WELCOME_MD = """\ # Welcome! Textual is a TUI, or *Text User Interface*, fr...
60
1,535
textual
src/textual/widgets/_masked_input.py
.py
from __future__ import annotations import re from dataclasses import dataclass from enum import Flag, auto from typing import TYPE_CHECKING, Iterable, Pattern from rich.console import RenderableType from rich.segment import Segment from rich.text import Text from typing_extensions import Literal from textual import ...
708
26,291
textual
src/textual/widgets/_key_panel.py
.py
from __future__ import annotations from collections import defaultdict from itertools import groupby from operator import itemgetter from typing import TYPE_CHECKING from rich import box from rich.table import Table from rich.text import Text from textual.app import ComposeResult from textual.binding import Binding ...
183
5,569
textual
src/textual/widgets/_radio_button.py
.py
"""Provides a radio button widget.""" from __future__ import annotations from textual.widgets._toggle_button import ToggleButton class RadioButton(ToggleButton): """A radio button widget that represents a boolean value. Note: A `RadioButton` is best used within a [RadioSet][textual.widgets.RadioSet...
34
1,037
textual
src/textual/widgets/_tabbed_content.py
.py
from __future__ import annotations from asyncio import gather from dataclasses import dataclass from itertools import zip_longest from typing import Awaitable from rich.repr import Result from typing_extensions import Final from textual import events from textual.app import ComposeResult from textual.await_complete ...
717
23,958
textual
src/textual/widgets/_pretty.py
.py
"""Provides a pretty-printing widget.""" from __future__ import annotations from typing import Any from rich.pretty import Pretty as PrettyRenderable from textual.app import RenderResult from textual.widget import Widget class Pretty(Widget): """A pretty-printing widget. Used to pretty-print any object. ...
57
1,379
textual
src/textual/widgets/directory_tree.py
.py
from textual.widgets._directory_tree import DirEntry __all__ = ["DirEntry"]
4
77
textual
src/textual/widgets/_checkbox.py
.py
"""Provides a check box widget.""" from __future__ import annotations from textual.widgets._toggle_button import ToggleButton class Checkbox(ToggleButton): """A check box widget that represents a boolean value.""" class Changed(ToggleButton.Changed): """Posted when the value of the checkbox changes...
27
803
textual
src/textual/widgets/_input.py
.py
from __future__ import annotations import re from dataclasses import dataclass from typing import TYPE_CHECKING, ClassVar, Iterable, NamedTuple from rich.cells import cell_len, get_character_cell_size from rich.console import RenderableType from rich.highlighter import Highlighter from rich.text import Text from typi...
1,134
41,180
textual
src/textual/widgets/_markdown.py
.py
from __future__ import annotations import asyncio import re import weakref from contextlib import suppress from functools import partial from pathlib import Path, PurePath from typing import Callable, Iterable, Optional from urllib.parse import unquote from markdown_it import MarkdownIt from markdown_it.token import ...
1,724
54,844
textual
src/textual/widgets/data_table.py
.py
from textual.widgets._data_table import ( CellDoesNotExist, CellKey, CellType, Column, ColumnDoesNotExist, ColumnKey, CursorType, DuplicateKey, Row, RowDoesNotExist, RowKey, StringKey, ) __all__ = [ "CellDoesNotExist", "CellKey", "CellType", "Column", ...
30
465
textual
src/textual/widgets/_toggle_button.py
.py
"""Provides the base code and implementations of toggle widgets. In particular it provides `Checkbox`, `RadioButton` and `RadioSet`. """ from __future__ import annotations from typing import TYPE_CHECKING, ClassVar from rich.console import RenderableType from textual.binding import Binding, BindingType from textua...
286
8,942
textual
src/textual/widgets/_sparkline.py
.py
from __future__ import annotations from typing import Callable, ClassVar, Optional, Sequence from textual.app import RenderResult from textual.color import Color from textual.reactive import reactive from textual.renderables.sparkline import Sparkline as SparklineRenderable from textual.widget import Widget def _ma...
110
3,884
textual
src/textual/widgets/_link.py
.py
from __future__ import annotations from textual.binding import Binding from textual.reactive import reactive from textual.widgets import Static class Link(Static, can_focus=True): """A simple, clickable link that opens a URL.""" DEFAULT_CSS = """ Link { width: auto; height: auto; ...
72
1,978
textual
src/textual/widgets/_list_item.py
.py
"""Provides a list item widget for use with `ListView`.""" from __future__ import annotations from textual import events, on from textual.message import Message from textual.reactive import reactive from textual.widget import Widget class ListItem(Widget, can_focus=False): """A widget that is an item within a `...
40
1,199
textual
src/textual/widgets/_help_panel.py
.py
from __future__ import annotations from textwrap import dedent from textual.app import ComposeResult from textual.css.query import NoMatches from textual.widget import Widget from textual.widgets import KeyPanel, Markdown class HelpPanel(Widget): """ Shows context sensitive help for the currently focused wi...
114
2,900
textual
src/textual/widgets/_directory_tree.py
.py
from __future__ import annotations import asyncio from asyncio import Queue from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Callable, ClassVar, Iterable, Iterator from rich.style import Style from rich.text import Text, TextType from textual import work from textual.await...
586
20,281
textual
src/textual/widgets/button.py
.py
from textual.widgets._button import ButtonVariant __all__ = ["ButtonVariant"]
4
79
textual
src/textual/widgets/__init__.py
.py
from __future__ import annotations import typing from importlib import import_module from textual.case import camel_to_snake # For any new built-in Widget we create, not only do we have to import them here and add them to `__all__`, # but also to the `__init__.pyi` file in this same folder - otherwise text editors a...
117
3,817
textual
src/textual/widgets/markdown.py
.py
from textual.widgets._markdown import ( Markdown, MarkdownBlock, MarkdownFence, MarkdownStream, MarkdownTableOfContents, TableOfContentsType, ) __all__ = [ "Markdown", "MarkdownBlock", "MarkdownFence", "MarkdownStream", "MarkdownTableOfContents", "TableOfContentsType", ]...
18
321
textual
src/textual/widgets/rule.py
.py
from textual.widgets._rule import ( InvalidLineStyle, InvalidRuleOrientation, LineStyle, RuleOrientation, ) __all__ = [ "InvalidLineStyle", "InvalidRuleOrientation", "LineStyle", "RuleOrientation", ]
14
233
textual
src/textual/widgets/_list_view.py
.py
from __future__ import annotations from typing import ClassVar, Iterable, Optional from typing_extensions import TypeGuard from textual._loop import loop_from_index from textual.await_complete import AwaitComplete from textual.await_remove import AwaitRemove from textual.binding import Binding, BindingType from text...
397
14,297
textual
src/textual/widgets/selection_list.py
.py
from textual.widgets._selection_list import ( MessageSelectionType, Selection, SelectionError, SelectionType, ) __all__ = ["MessageSelectionType", "Selection", "SelectionError", "SelectionType"]
9
212
textual
src/textual/widgets/input.py
.py
from textual.widgets._input import Selection __all__ = ["Selection"]
4
70
textual
src/textual/widgets/_content_switcher.py
.py
"""Provides a widget for switching between the display of its immediate children.""" from __future__ import annotations from typing import Optional from textual.await_complete import AwaitComplete from textual.containers import Container from textual.css.query import NoMatches from textual.events import Mount from t...
133
4,326
textual
src/textual/widgets/_static.py
.py
from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from textual.app import RenderResult from textual.visual import Visual, VisualType, visualize from textual.widget import Widget class Static(Widget, inherit_bindings=False): """A widget to display simple static content, o...
96
3,220
textual
src/textual/widgets/_markdown_viewer.py
.py
from textual.widgets._markdown import MarkdownViewer __all__ = ["MarkdownViewer"]
4
83
textual
src/textual/widgets/_log.py
.py
from __future__ import annotations import re from typing import TYPE_CHECKING, Iterable, Optional, Sequence from rich.cells import cell_len from rich.highlighter import Highlighter, ReprHighlighter from rich.style import Style from rich.text import Text from textual import work from textual._line_split import line_s...
363
11,504
textual
src/textual/widgets/_tab.py
.py
from textual.widgets._tabs import Tab __all__ = ["Tab"]
4
57
textual
src/textual/widgets/option_list.py
.py
from textual.widgets._option_list import DuplicateID, Option, OptionDoesNotExist __all__ = ["DuplicateID", "Option", "OptionDoesNotExist"]
4
140
textual
src/textual/widgets/_rich_log.py
.py
"""Provides a scrollable text-logging widget.""" from __future__ import annotations from collections import deque from typing import TYPE_CHECKING, NamedTuple, Optional, cast from rich.console import RenderableType from rich.highlighter import Highlighter, ReprHighlighter from rich.measure import measure_renderables...
321
12,192
textual
src/textual/widgets/_collapsible.py
.py
from __future__ import annotations from textual import events from textual.app import ComposeResult from textual.binding import Binding from textual.containers import Container from textual.content import Content, ContentText from textual.css.query import NoMatches from textual.message import Message from textual.reac...
251
7,775
textual
src/textual/widgets/select.py
.py
from textual.widgets._select import ( NULL, EmptySelectError, InvalidSelectValueError, NoSelection, ) __all__ = ["EmptySelectError", "InvalidSelectValueError", "NoSelection", "NULL"]
9
200
textual
src/textual/widgets/_tree.py
.py
"""Provides a tree widget.""" from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, ClassVar, Generic, Iterable, NewType, TypeVar, cast import rich.repr from rich.style import NULL_STYLE, Style from rich.text import Text, TextType from textual import events, on from ...
1,602
51,557
textual
src/textual/widgets/_data_table.py
.py
from __future__ import annotations import functools from dataclasses import dataclass from itertools import chain, zip_longest from operator import itemgetter from typing import ( Any, Callable, ClassVar, Generic, Iterable, NamedTuple, TypeVar, Union, ) import rich.repr from rich.conso...
2,865
108,987
textual
src/textual/widgets/_option_list.py
.py
from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING, ClassVar, Iterable, Sequence, cast import rich.repr from rich.segment import Segment from textual import _widget_navigation, events from textual._loop import loop_last from textual.binding import Binding, Bi...
1,040
34,230
textual
src/textual/widgets/_progress_bar.py
.py
"""Implements a progress bar widget.""" from __future__ import annotations from typing import Optional, Type from rich.style import Style from textual._types import UnusedParameter from textual.app import ComposeResult, RenderResult from textual.clock import Clock from textual.color import Gradient from textual.eta...
386
13,150
textual
src/textual/widgets/_rule.py
.py
from __future__ import annotations from typing import Iterable from rich.console import Console, ConsoleOptions from rich.segment import Segment from rich.style import Style from typing_extensions import Literal from textual.app import RenderResult from textual.css._error_tools import friendly_list from textual.geom...
269
7,481
textual
src/textual/widgets/_header.py
.py
"""Provides a Textual application header widget.""" from __future__ import annotations from datetime import datetime from rich.text import Text from textual.app import ComposeResult, RenderResult from textual.content import Content from textual.dom import NoScreen from textual.events import Click, Mount from textua...
229
6,299
textual
src/textual/widgets/tree.py
.py
"""Make non-widget Tree support classes available.""" from textual.widgets._tree import ( AddNodeError, EventTreeDataType, NodeID, RemoveRootError, TreeDataType, TreeNode, UnknownNodeID, ) __all__ = [ "AddNodeError", "EventTreeDataType", "NodeID", "RemoveRootError", "Tr...
22
372
textual
src/textual/widgets/_button.py
.py
from __future__ import annotations from functools import partial from typing import TYPE_CHECKING, cast import rich.repr from rich.cells import cell_len from rich.console import ConsoleRenderable, RenderableType from typing_extensions import Literal, Self from textual import events if TYPE_CHECKING: from textua...
559
17,246
textual
src/textual/widgets/_placeholder.py
.py
"""Provides a Textual placeholder widget; useful when designing an app's layout.""" from __future__ import annotations from itertools import cycle from typing import TYPE_CHECKING from weakref import WeakKeyDictionary from typing_extensions import Literal, Self from textual import events if TYPE_CHECKING: from...
187
6,435
textual
src/textual/widgets/_loading_indicator.py
.py
from __future__ import annotations from time import time from typing import TYPE_CHECKING from rich.style import Style from rich.text import Text if TYPE_CHECKING: from textual.app import RenderResult from textual import on from textual.color import Gradient from textual.events import InputEvent, Mount from tex...
94
2,545
textual
src/textual/widgets/_select.py
.py
from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING, Generic, Hashable, Iterable, TypeVar import rich.repr from rich.console import RenderableType from rich.text import Text from textual import events, on from textual.binding import Binding from textual.containers im...
720
23,970
textual
src/textual/widgets/_selection_list.py
.py
"""Provides a selection list widget, allowing one or more items to be selected.""" from __future__ import annotations from dataclasses import dataclass from typing import Callable, ClassVar, Generic, Iterable, TypeVar, cast from rich.repr import Result from rich.segment import Segment from rich.style import Style fr...
716
25,078
textual
src/textual/widgets/_tabs.py
.py
from __future__ import annotations from dataclasses import dataclass from typing import ClassVar import rich.repr from rich.style import Style from rich.text import Text from textual import events from textual.app import ComposeResult, RenderResult from textual.await_complete import AwaitComplete from textual.bindin...
875
27,190
textual
src/textual/widgets/_label.py
.py
"""Provides a simple Label widget.""" from __future__ import annotations from typing import Literal from textual.visual import VisualType from textual.widgets._static import Static LabelVariant = Literal["success", "error", "warning", "primary", "secondary", "accent"] class Label(Static): """A simple label wi...
74
1,762
textual
src/textual/widgets/_digits.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, cast from rich.align import Align, AlignMethod if TYPE_CHECKING: from textual.app import RenderResult from textual.geometry import Size from textual.renderables.digits import Digits as DigitsRenderable from textual.selection import Selection f...
113
3,478
textual
src/textual/widgets/text_area.py
.py
from textual._text_area_theme import TextAreaTheme from textual.document._document import ( Document, DocumentBase, EditResult, Location, Selection, ) from textual.document._document_navigator import DocumentNavigator from textual.document._edit import Edit from textual.document._history import Edit...
44
1,025
textual
src/textual/widgets/_tooltip.py
.py
from __future__ import annotations from textual.widgets import Static class Tooltip(Static, inherit_css=False): DEFAULT_CSS = """ Tooltip { layer: _tooltips; margin: 1 0; padding: 1 2; background: $panel; width: auto; height: auto; constrain: inside inf...
25
519