mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'css' of github.com:Textualize/textual into text-input-cursor-to-click
This commit is contained in:
@@ -40,7 +40,7 @@ App > Screen {
|
||||
background: $primary-darken-2;
|
||||
color: $text-primary-darken-2 ;
|
||||
border-right: outer $primary-darken-3;
|
||||
content-align: center middle;
|
||||
content-align: center middle;
|
||||
}
|
||||
|
||||
#sidebar .user {
|
||||
@@ -168,7 +168,7 @@ OptionItem {
|
||||
height: 3;
|
||||
background: $primary;
|
||||
border-right: outer $primary-darken-2;
|
||||
border-left: hidden;
|
||||
border-left: blank;
|
||||
content-align: center middle;
|
||||
}
|
||||
|
||||
@@ -223,4 +223,4 @@ Success {
|
||||
|
||||
.horizontal {
|
||||
layout: horizontal
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,9 @@ class BasicApp(App):
|
||||
def key_x(self):
|
||||
self.panic(self.tree)
|
||||
|
||||
def key_escape(self):
|
||||
self.app.bell()
|
||||
|
||||
def key_t(self):
|
||||
# Pressing "t" toggles the content of the TweetBody widget, from a long "Lorem ipsum..." to a shorter one.
|
||||
tweet_body = self.screen.query("TweetBody").first()
|
||||
|
||||
@@ -15,4 +15,4 @@ Horizontal {
|
||||
|
||||
align: center middle;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ OUTER = 2
|
||||
|
||||
BORDER_CHARS: dict[EdgeType, tuple[str, str, str]] = {
|
||||
# Each string of the tuple represents a sub-tuple itself:
|
||||
# - 1st string represents `(top1, top2, top3)`
|
||||
# - 1st string represents (top1, top2, top3)
|
||||
# - 2nd string represents (mid1, mid2, mid3)
|
||||
# - 3rd string represents (bottom1, bottom2, bottom3)
|
||||
"": (" ", " ", " "),
|
||||
@@ -128,7 +128,7 @@ class Border:
|
||||
|
||||
This is analogous to Rich's `Box` but more flexible. Different borders may be
|
||||
applied to each of the four edges, and more advanced borders can be achieved through
|
||||
varions combinations of Widget and parent background colors.
|
||||
various combinations of Widget and parent background colors.
|
||||
|
||||
"""
|
||||
|
||||
@@ -150,12 +150,8 @@ class Border:
|
||||
(bottom, bottom_color),
|
||||
(left, left_color),
|
||||
) = edge_styles
|
||||
self._sides: tuple[EdgeType, EdgeType, EdgeType, EdgeType] = (
|
||||
top or "none",
|
||||
right or "none",
|
||||
bottom or "none",
|
||||
left or "none",
|
||||
)
|
||||
self._sides: tuple[EdgeType, EdgeType, EdgeType, EdgeType]
|
||||
self._sides = (top, right, bottom, left)
|
||||
from_color = Style.from_color
|
||||
|
||||
self._styles = (
|
||||
|
||||
@@ -94,12 +94,12 @@ class XTermParser(Parser[events.Event]):
|
||||
peek_buffer = yield self.peek_buffer()
|
||||
if not peek_buffer:
|
||||
# An escape arrived without any following characters
|
||||
on_token(events.Key(self.sender, key=ESC))
|
||||
on_token(events.Key(self.sender, key="escape"))
|
||||
continue
|
||||
if peek_buffer and peek_buffer[0] == ESC:
|
||||
# There is an escape in the buffer, so ESC ESC has arrived
|
||||
yield read1()
|
||||
on_token(events.Key(self.sender, key=ESC))
|
||||
on_token(events.Key(self.sender, key="escape"))
|
||||
# If there is no further data, it is not part of a sequence,
|
||||
# So we don't need to go in to the loop
|
||||
if len(peek_buffer) == 1 and not more_data():
|
||||
|
||||
@@ -9,7 +9,7 @@ from . import log
|
||||
from .geometry import Offset, Size
|
||||
from .message import Message
|
||||
from ._types import MessageTarget
|
||||
from .keys import Keys, KEY_BINDINGS
|
||||
from .keys import Keys, KEY_VALUES
|
||||
|
||||
MouseEventT = TypeVar("MouseEventT", bound="MouseEvent")
|
||||
|
||||
@@ -208,7 +208,7 @@ class Key(InputEvent):
|
||||
Returns:
|
||||
bool: True if the key is printable. False otherwise.
|
||||
"""
|
||||
return self.key not in KEY_BINDINGS
|
||||
return self.key not in KEY_VALUES
|
||||
|
||||
|
||||
@rich.repr.auto
|
||||
|
||||
@@ -200,11 +200,4 @@ class Keys(str, Enum):
|
||||
ShiftControlEnd = ControlShiftEnd
|
||||
|
||||
|
||||
KEY_BINDINGS = Keys._value2member_map_.values()
|
||||
|
||||
|
||||
@dataclass
|
||||
class Binding:
|
||||
action: str
|
||||
description: str
|
||||
show: bool = False
|
||||
KEY_VALUES = frozenset(Keys.__members__.values())
|
||||
|
||||
@@ -814,6 +814,8 @@ class Widget(DOMNode):
|
||||
if layout:
|
||||
self._layout_required = True
|
||||
if repaint:
|
||||
self._content_width_cache = (None, 0)
|
||||
self._content_height_cache = (None, 0)
|
||||
self.set_dirty()
|
||||
self._repaint_required = True
|
||||
self.check_idle()
|
||||
|
||||
@@ -430,7 +430,7 @@ class TextAreaChild(TextWidgetBase, can_focus=True):
|
||||
self._editor.insert_at_cursor("\n")
|
||||
elif event.key == "tab":
|
||||
self._editor.insert_at_cursor("\t")
|
||||
elif event.key == "\x1b":
|
||||
elif event.key == "escape":
|
||||
self.app.focused = None
|
||||
|
||||
def on_focus(self, event: events.Focus) -> None:
|
||||
|
||||
Reference in New Issue
Block a user