This commit is contained in:
Will McGugan
2022-09-18 15:52:29 +01:00
parent 4e732ce309
commit f402692b5b
6 changed files with 7 additions and 69 deletions

View File

@@ -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()

View File

@@ -191,11 +191,6 @@ class Scalar(NamedTuple):
return "auto"
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
def is_cells(self) -> bool:
"""Check if the Scalar is explicit cells."""

View File

@@ -870,7 +870,7 @@ class RenderStyles(StylesBase):
@property
def animate(self) -> BoundAnimator:
"""Get an animator to animate attributes on this widget.
"""Get an animator to animate style.
Example:
```python

View File

@@ -480,22 +480,6 @@ class MessagePump(metaclass=MessagePumpMeta):
self._message_queue.put_nowait(message)
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:
if self._closing or self._closed:
return False

View File

@@ -79,18 +79,3 @@ class TerminalSupportsSynchronizedOutput(Message):
Used to make the App aware that the terminal emulator supports synchronised output.
@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

View File

@@ -243,7 +243,6 @@ class Widget(DOMNode):
Args:
value (bool): Show horizontal scrollbar flag.
"""
# self.refresh(layout=True)
if not value:
# reset the scroll position if the scrollbar is hidden.
self.scroll_to(0, 0, animate=False)
@@ -254,7 +253,6 @@ class Widget(DOMNode):
Args:
value (bool): Show vertical scrollbar flag.
"""
# self.refresh(layout=True)
if not value:
# reset the scroll position if the scrollbar is hidden.
self.scroll_to(0, 0, animate=False)
@@ -1465,12 +1463,15 @@ class Widget(DOMNode):
self._container_size = container_size
if self.is_scrollable:
self._scroll_update(virtual_size)
# self.refresh(layout=True)
# self.scroll_to(self.scroll_x, self.scroll_y)
else:
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()
width, height = self.container_size
if self.show_vertical_scrollbar: