mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
tidy
This commit is contained in:
@@ -1,44 +0,0 @@
|
|||||||
from textual import layout, events
|
|
||||||
from textual.app import App, ComposeResult
|
|
||||||
from textual.widgets import Button
|
|
||||||
|
|
||||||
|
|
||||||
class ButtonsApp(App[str]):
|
|
||||||
def compose(self) -> ComposeResult:
|
|
||||||
yield layout.Vertical(
|
|
||||||
Button("default", id="foo"),
|
|
||||||
Button("Where there is a Will"),
|
|
||||||
Button("There is a Way"),
|
|
||||||
Button("There can be only one"),
|
|
||||||
Button.success("success", id="bar"),
|
|
||||||
layout.Horizontal(
|
|
||||||
Button("Where there is a Will"),
|
|
||||||
Button("There is a Way"),
|
|
||||||
Button("There can be only one"),
|
|
||||||
Button.warning("warning", id="baz"),
|
|
||||||
Button("Where there is a Will"),
|
|
||||||
Button("There is a Way"),
|
|
||||||
Button("There can be only one"),
|
|
||||||
id="scroll",
|
|
||||||
),
|
|
||||||
Button.error("error", id="baz"),
|
|
||||||
Button("Where there is a Will"),
|
|
||||||
Button("There is a Way"),
|
|
||||||
Button("There can be only one"),
|
|
||||||
)
|
|
||||||
|
|
||||||
def on_button_pressed(self, event: Button.Pressed) -> None:
|
|
||||||
self.app.bell()
|
|
||||||
|
|
||||||
async def on_key(self, event: events.Key) -> None:
|
|
||||||
await self.dispatch_key(event)
|
|
||||||
|
|
||||||
def key_d(self):
|
|
||||||
self.dark = not self.dark
|
|
||||||
|
|
||||||
|
|
||||||
app = ButtonsApp(log_path="textual.log", css_path="buttons.css", watch_css=True)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
result = app.run()
|
|
||||||
print(repr(result))
|
|
||||||
@@ -498,8 +498,6 @@ class Widget(DOMNode):
|
|||||||
overflow_y = styles.overflow_y
|
overflow_y = styles.overflow_y
|
||||||
width, height = self.container_size
|
width, height = self.container_size
|
||||||
|
|
||||||
previous_show_vertical = self.show_vertical_scrollbar
|
|
||||||
|
|
||||||
show_horizontal = self.show_horizontal_scrollbar
|
show_horizontal = self.show_horizontal_scrollbar
|
||||||
if overflow_x == "hidden":
|
if overflow_x == "hidden":
|
||||||
show_horizontal = False
|
show_horizontal = False
|
||||||
@@ -516,16 +514,6 @@ class Widget(DOMNode):
|
|||||||
elif overflow_y == "auto":
|
elif overflow_y == "auto":
|
||||||
show_vertical = self.virtual_size.height > height
|
show_vertical = self.virtual_size.height > height
|
||||||
|
|
||||||
# if (
|
|
||||||
# not previous_show_vertical
|
|
||||||
# and show_vertical
|
|
||||||
# and show_horizontal
|
|
||||||
# and overflow_x == "auto"
|
|
||||||
# ):
|
|
||||||
# show_horizontal = (
|
|
||||||
# self.virtual_size.width - styles.scrollbar_size_vertical > width
|
|
||||||
# )
|
|
||||||
|
|
||||||
self.show_horizontal_scrollbar = show_horizontal
|
self.show_horizontal_scrollbar = show_horizontal
|
||||||
self.show_vertical_scrollbar = show_vertical
|
self.show_vertical_scrollbar = show_vertical
|
||||||
self.horizontal_scrollbar.display = show_horizontal
|
self.horizontal_scrollbar.display = show_horizontal
|
||||||
@@ -909,8 +897,6 @@ class Widget(DOMNode):
|
|||||||
scroll_y = self.scroll_y
|
scroll_y = self.scroll_y
|
||||||
self.scroll_target_y = self.scroll_y = y
|
self.scroll_target_y = self.scroll_y = y
|
||||||
scrolled_y = scroll_y != self.scroll_y
|
scrolled_y = scroll_y != self.scroll_y
|
||||||
# if scrolled_x or scrolled_y:
|
|
||||||
# self.refresh(repaint=False, layout=False)
|
|
||||||
|
|
||||||
return scrolled_x or scrolled_y
|
return scrolled_x or scrolled_y
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user