Input
Note
All of the custom Input widgets have their Changed, Submitted and Blurred messages disabled by default.
Info
All inputs have an AbstractInput.action_adjust_time
action which allows the user to adjust the value depending on the keyboard cursor location.
This spinbox functionality can be accessed through clicking then dragging up/down, mouse wheel usage and up/down arrows.
textual_timepiece.pickers.DateInput
¶
Bases: AbstractInput[Date]
Date picker for full dates.
PARAMETER | DESCRIPTION |
---|---|
day
|
Initial value to set.
TYPE:
|
name
|
Name of the widget.
TYPE:
|
id
|
Unique dom identifier value.
TYPE:
|
classes
|
Any dom classes to add.
TYPE:
|
tooltip
|
Tooltip to show when hovering the widget.
TYPE:
|
disabled
|
Whether to disable the widget.
TYPE:
|
select_on_focus
|
Whether to place the cursor on focus.
TYPE:
|
spinbox_sensitivity
|
Sensitivity setting for spinbox functionality.
TYPE:
|
CLASS | DESCRIPTION |
---|---|
DateChanged |
Message sent when the date changed. |
METHOD | DESCRIPTION |
---|---|
action_adjust_time |
Adjust date with an offset depending on the text cursor position. |
ATTRIBUTE | DESCRIPTION |
---|---|
DEFAULT_CSS |
TYPE:
|
BINDINGS |
All bindings for an
TYPE:
|
date |
Date that is set. Bound if using within a picker.
|
Source code in src/textual_timepiece/pickers/_date_picker.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
|
BINDINGS
class-attribute
¶
BINDINGS: list[BindingType] = [
Binding("escape", "leave", "Defocus", tooltip="Defocus the input."),
Binding(
"up",
"adjust_time(1)",
"Increment",
tooltip="Increment value depending on keyboard cursor location.",
priority=True,
),
Binding(
"down",
"adjust_time(-1)",
"Decrement",
tooltip="Decrement value depending on keyboard cursor location.",
priority=True,
),
]
All bindings for an AbstractInput
.
Key(s) | Description |
---|---|
escape | Defocus the input. |
up | Increment value depending on keyboard cursor location. |
down | Decrement value depending on keyboard cursor location. |
date
class-attribute
instance-attribute
¶
Date that is set. Bound if using within a picker.
DateChanged
dataclass
¶
Bases: BaseMessage
Message sent when the date changed.
Source code in src/textual_timepiece/pickers/_date_picker.py
862 863 864 865 866 867 |
|
action_adjust_time
¶
action_adjust_time(offset: int) -> None
Adjust date with an offset depending on the text cursor position.
Source code in src/textual_timepiece/pickers/_date_picker.py
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 |
|
textual_timepiece.pickers.TimeInput
¶
Bases: AbstractInput[Time]
Time input for a HH:MM:SS format
CLASS | DESCRIPTION |
---|---|
TimeChanged |
Message sent when the time is updated. |
METHOD | DESCRIPTION |
---|---|
action_adjust_time |
Adjust time with an offset depending on the text cursor position. |
ATTRIBUTE | DESCRIPTION |
---|---|
DEFAULT_CSS |
TYPE:
|
BINDINGS |
All bindings for an
TYPE:
|
time |
Currently set time or none if its empty.
|
Source code in src/textual_timepiece/pickers/_time_picker.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
|
BINDINGS
class-attribute
¶
BINDINGS: list[BindingType] = [
Binding("escape", "leave", "Defocus", tooltip="Defocus the input."),
Binding(
"up",
"adjust_time(1)",
"Increment",
tooltip="Increment value depending on keyboard cursor location.",
priority=True,
),
Binding(
"down",
"adjust_time(-1)",
"Decrement",
tooltip="Decrement value depending on keyboard cursor location.",
priority=True,
),
]
All bindings for an AbstractInput
.
Key(s) | Description |
---|---|
escape | Defocus the input. |
up | Increment value depending on keyboard cursor location. |
down | Decrement value depending on keyboard cursor location. |
time
class-attribute
instance-attribute
¶
Currently set time or none if its empty.
TimeChanged
dataclass
¶
Bases: BaseMessage
Message sent when the time is updated.
Source code in src/textual_timepiece/pickers/_time_picker.py
496 497 498 499 500 501 |
|
action_adjust_time
¶
action_adjust_time(offset: int) -> None
Adjust time with an offset depending on the text cursor position.
Source code in src/textual_timepiece/pickers/_time_picker.py
573 574 575 576 577 578 579 580 |
|
textual_timepiece.pickers.DurationInput
¶
Bases: AbstractInput[TimeDelta]
Duration input for time deltas.
CLASS | DESCRIPTION |
---|---|
DurationChanged |
Message sent when the duration changes through input or spinbox. |
METHOD | DESCRIPTION |
---|---|
action_adjust_time |
Adjust time with an offset depending on the text cursor position. |
ATTRIBUTE | DESCRIPTION |
---|---|
DEFAULT_CSS |
TYPE:
|
BINDINGS |
All bindings for an
TYPE:
|
duration |
Current duration in a
|
Source code in src/textual_timepiece/pickers/_time_picker.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
|
BINDINGS
class-attribute
¶
BINDINGS: list[BindingType] = [
Binding("escape", "leave", "Defocus", tooltip="Defocus the input."),
Binding(
"up",
"adjust_time(1)",
"Increment",
tooltip="Increment value depending on keyboard cursor location.",
priority=True,
),
Binding(
"down",
"adjust_time(-1)",
"Decrement",
tooltip="Decrement value depending on keyboard cursor location.",
priority=True,
),
]
All bindings for an AbstractInput
.
Key(s) | Description |
---|---|
escape | Defocus the input. |
up | Increment value depending on keyboard cursor location. |
down | Decrement value depending on keyboard cursor location. |
duration
class-attribute
instance-attribute
¶
Current duration in a TimeDelta
or None if empty.
This value is capped at 99 hours, 59 minutes and 59 seconds.
DurationChanged
dataclass
¶
Bases: BaseMessage
Message sent when the duration changes through input or spinbox.
Source code in src/textual_timepiece/pickers/_time_picker.py
322 323 324 325 326 327 |
|
action_adjust_time
¶
action_adjust_time(offset: int) -> None
Adjust time with an offset depending on the text cursor position.
Source code in src/textual_timepiece/pickers/_time_picker.py
373 374 375 376 377 378 379 380 381 382 |
|
textual_timepiece.pickers.DateTimeInput
¶
Bases: AbstractInput[LocalDateTime]
Input that combines both date and time into one.
CLASS | DESCRIPTION |
---|---|
DateTimeChanged |
Sent when the datetime is changed. |
METHOD | DESCRIPTION |
---|---|
action_adjust_time |
Adjust date with an offset depending on the text cursor position. |
ATTRIBUTE | DESCRIPTION |
---|---|
DEFAULT_CSS |
TYPE:
|
BINDINGS |
All bindings for an
TYPE:
|
datetime |
Current datetime or none if nothing is set.
|
Source code in src/textual_timepiece/pickers/_datetime_picker.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
BINDINGS
class-attribute
¶
BINDINGS: list[BindingType] = [
Binding("escape", "leave", "Defocus", tooltip="Defocus the input."),
Binding(
"up",
"adjust_time(1)",
"Increment",
tooltip="Increment value depending on keyboard cursor location.",
priority=True,
),
Binding(
"down",
"adjust_time(-1)",
"Decrement",
tooltip="Decrement value depending on keyboard cursor location.",
priority=True,
),
]
All bindings for an AbstractInput
.
Key(s) | Description |
---|---|
escape | Defocus the input. |
up | Increment value depending on keyboard cursor location. |
down | Decrement value depending on keyboard cursor location. |
datetime
class-attribute
instance-attribute
¶
datetime = var[LocalDateTime | None](None, init=False)
Current datetime or none if nothing is set.
DateTimeChanged
dataclass
¶
Bases: BaseMessage
Sent when the datetime is changed.
Source code in src/textual_timepiece/pickers/_datetime_picker.py
73 74 75 76 77 78 |
|
action_adjust_time
¶
action_adjust_time(offset: int) -> None
Adjust date with an offset depending on the text cursor position.
Source code in src/textual_timepiece/pickers/_datetime_picker.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|