mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
clean
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
from textual.app import App, ComposeResult
|
|
||||||
|
|
||||||
from textual.widgets import Static, TextLog
|
|
||||||
|
|
||||||
|
|
||||||
class BubbleApp(App):
|
|
||||||
|
|
||||||
CSS = """
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
Static("Foo", id="static")
|
|
||||||
yield TextLog()
|
|
||||||
|
|
||||||
def on_key(self) -> None:
|
|
||||||
log = self.query_one(TextLog)
|
|
||||||
self.query_one(TextLog).write(self.tree)
|
|
||||||
log.write(repr((log.size, log.virtual_size)))
|
|
||||||
|
|
||||||
|
|
||||||
app = BubbleApp()
|
|
||||||
if __name__ == "__main__":
|
|
||||||
app.run()
|
|
||||||
@@ -191,11 +191,6 @@ class Scalar(NamedTuple):
|
|||||||
return "auto"
|
return "auto"
|
||||||
return f"{int(value) if value.is_integer() else value}{self.symbol}"
|
return f"{int(value) if value.is_integer() else value}{self.symbol}"
|
||||||
|
|
||||||
@property
|
|
||||||
def is_flexible(self) -> bool:
|
|
||||||
"""Check if this unit is flexible (resolves relative to another dimension)."""
|
|
||||||
return self.unit != Unit.CELLS
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_cells(self) -> bool:
|
def is_cells(self) -> bool:
|
||||||
"""Check if the Scalar is explicit cells."""
|
"""Check if the Scalar is explicit cells."""
|
||||||
|
|||||||
@@ -870,7 +870,7 @@ class RenderStyles(StylesBase):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def animate(self) -> BoundAnimator:
|
def animate(self) -> BoundAnimator:
|
||||||
"""Get an animator to animate attributes on this widget.
|
"""Get an animator to animate style.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```python
|
```python
|
||||||
|
|||||||
@@ -480,22 +480,6 @@ class MessagePump(metaclass=MessagePumpMeta):
|
|||||||
self._message_queue.put_nowait(message)
|
self._message_queue.put_nowait(message)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def forward_message(self, target: MessagePump, message: Message) -> None:
|
|
||||||
"""Forward a message. Ensures that a message is sent after processing all messages
|
|
||||||
in this message pump.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
target (MessagePump): Where to forward the message to.
|
|
||||||
message (Message): The message.
|
|
||||||
"""
|
|
||||||
|
|
||||||
forward = messages.ForwardMessage(self, target, message)
|
|
||||||
self._message_queue.put_nowait(forward)
|
|
||||||
self.check_idle()
|
|
||||||
|
|
||||||
async def _on_forward_message(self, message: messages.ForwardMessage) -> None:
|
|
||||||
await message.target.post_message(message.message)
|
|
||||||
|
|
||||||
async def _post_message_from_child(self, message: Message) -> bool:
|
async def _post_message_from_child(self, message: Message) -> bool:
|
||||||
if self._closing or self._closed:
|
if self._closing or self._closed:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -79,18 +79,3 @@ class TerminalSupportsSynchronizedOutput(Message):
|
|||||||
Used to make the App aware that the terminal emulator supports synchronised output.
|
Used to make the App aware that the terminal emulator supports synchronised output.
|
||||||
@link https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
|
@link https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@rich.repr.auto
|
|
||||||
class ForwardMessage(Message):
|
|
||||||
def __init__(
|
|
||||||
self, sender: MessagePump, target: MessagePump, message: Message
|
|
||||||
) -> None:
|
|
||||||
super().__init__(sender)
|
|
||||||
self.target = target
|
|
||||||
self.message = message
|
|
||||||
|
|
||||||
def __rich_repr__(self) -> rich.repr.Result:
|
|
||||||
yield from super().__rich_repr__()
|
|
||||||
yield "target", self.target
|
|
||||||
yield "message", self.message
|
|
||||||
|
|||||||
@@ -243,7 +243,6 @@ class Widget(DOMNode):
|
|||||||
Args:
|
Args:
|
||||||
value (bool): Show horizontal scrollbar flag.
|
value (bool): Show horizontal scrollbar flag.
|
||||||
"""
|
"""
|
||||||
# self.refresh(layout=True)
|
|
||||||
if not value:
|
if not value:
|
||||||
# reset the scroll position if the scrollbar is hidden.
|
# reset the scroll position if the scrollbar is hidden.
|
||||||
self.scroll_to(0, 0, animate=False)
|
self.scroll_to(0, 0, animate=False)
|
||||||
@@ -254,7 +253,6 @@ class Widget(DOMNode):
|
|||||||
Args:
|
Args:
|
||||||
value (bool): Show vertical scrollbar flag.
|
value (bool): Show vertical scrollbar flag.
|
||||||
"""
|
"""
|
||||||
# self.refresh(layout=True)
|
|
||||||
if not value:
|
if not value:
|
||||||
# reset the scroll position if the scrollbar is hidden.
|
# reset the scroll position if the scrollbar is hidden.
|
||||||
self.scroll_to(0, 0, animate=False)
|
self.scroll_to(0, 0, animate=False)
|
||||||
@@ -1465,12 +1463,15 @@ class Widget(DOMNode):
|
|||||||
self._container_size = container_size
|
self._container_size = container_size
|
||||||
if self.is_scrollable:
|
if self.is_scrollable:
|
||||||
self._scroll_update(virtual_size)
|
self._scroll_update(virtual_size)
|
||||||
# self.refresh(layout=True)
|
|
||||||
# self.scroll_to(self.scroll_x, self.scroll_y)
|
|
||||||
else:
|
else:
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def _scroll_update(self, virtual_size):
|
def _scroll_update(self, virtual_size: Size) -> None:
|
||||||
|
"""Update scrollbars visiblity and dimensions.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
virtual_size (Size): Virtual size.
|
||||||
|
"""
|
||||||
self._refresh_scrollbars()
|
self._refresh_scrollbars()
|
||||||
width, height = self.container_size
|
width, height = self.container_size
|
||||||
if self.show_vertical_scrollbar:
|
if self.show_vertical_scrollbar:
|
||||||
|
|||||||
Reference in New Issue
Block a user