mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
still broken
This commit is contained in:
@@ -9,7 +9,6 @@ I will face my fear.
|
||||
I will permit it to pass over me and through me.
|
||||
And when it has gone past, I will turn the inner eye to see its path.
|
||||
Where the fear has gone there will be nothing. Only I will remain.
|
||||
---
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -519,9 +519,12 @@ class Compositor:
|
||||
)
|
||||
|
||||
layer_order -= 1
|
||||
|
||||
region = child_region
|
||||
|
||||
else:
|
||||
pass
|
||||
# region = child_region
|
||||
region = child_region
|
||||
# total_region = region.reset_offset
|
||||
|
||||
if visible:
|
||||
# Add any scrollbars
|
||||
@@ -538,7 +541,7 @@ class Compositor:
|
||||
chrome_region,
|
||||
)
|
||||
|
||||
map[widget] = _MapGeometry(
|
||||
map[widget] = MapGeometry(
|
||||
region + layout_offset,
|
||||
order,
|
||||
clip,
|
||||
@@ -546,10 +549,12 @@ class Compositor:
|
||||
container_size,
|
||||
virtual_region,
|
||||
)
|
||||
widget.log(widget)
|
||||
widget.log(map[widget])
|
||||
|
||||
elif visible:
|
||||
# Add the widget to the map
|
||||
map[widget] = _MapGeometry(
|
||||
map[widget] = MapGeometry(
|
||||
region + layout_offset,
|
||||
order,
|
||||
clip,
|
||||
|
||||
@@ -903,22 +903,12 @@ class Widget(DOMNode):
|
||||
@property
|
||||
def max_scroll_x(self) -> int:
|
||||
"""The maximum value of `scroll_x`."""
|
||||
return max(
|
||||
0,
|
||||
self.virtual_size.width
|
||||
- self.container_size.width
|
||||
+ self.scrollbar_size_vertical,
|
||||
)
|
||||
return max(0, self.virtual_size.width - self.size.width)
|
||||
|
||||
@property
|
||||
def max_scroll_y(self) -> int:
|
||||
"""The maximum value of `scroll_y`."""
|
||||
return max(
|
||||
0,
|
||||
self.virtual_size.height
|
||||
- self.container_size.height
|
||||
+ self.scrollbar_size_horizontal,
|
||||
)
|
||||
return max(0, self.virtual_size.height - self.size.height)
|
||||
|
||||
@property
|
||||
def scrollbar_corner(self) -> ScrollBarCorner:
|
||||
@@ -975,10 +965,15 @@ class Widget(DOMNode):
|
||||
if not self.is_scrollable or not self.container_size:
|
||||
return
|
||||
|
||||
print("----", self)
|
||||
self.log(CONTAINER_SIZE=self.container_size)
|
||||
self.log(VIRTUAL_SIZE=self.virtual_size)
|
||||
self.log(SIZE=self.size)
|
||||
styles = self.styles
|
||||
overflow_x = styles.overflow_x
|
||||
overflow_y = styles.overflow_y
|
||||
width, height = self.container_size
|
||||
self.log(OVERFLOW_X=overflow_x, OVERFLOW_Y=overflow_y)
|
||||
width, height = self.size
|
||||
|
||||
show_horizontal = self.show_horizontal_scrollbar
|
||||
if overflow_x == "hidden":
|
||||
@@ -1121,9 +1116,7 @@ class Widget(DOMNode):
|
||||
Returns:
|
||||
Screen region that contains a widget's content.
|
||||
"""
|
||||
content_region = self.region.shrink(self.styles.gutter).shrink(
|
||||
self.scrollbar_gutter
|
||||
)
|
||||
content_region = self.region.shrink(self.styles.gutter)
|
||||
return content_region
|
||||
|
||||
@property
|
||||
@@ -2232,20 +2225,27 @@ class Widget(DOMNode):
|
||||
virtual_size: Virtual size.
|
||||
"""
|
||||
self._refresh_scrollbars()
|
||||
width, height = self.container_size
|
||||
width, height = self.size
|
||||
|
||||
if self.show_vertical_scrollbar:
|
||||
self.vertical_scrollbar.window_virtual_size = virtual_size.height
|
||||
self.vertical_scrollbar.window_size = (
|
||||
height - self.scrollbar_size_horizontal
|
||||
)
|
||||
self.vertical_scrollbar.window_size = height
|
||||
if self.show_horizontal_scrollbar:
|
||||
self.horizontal_scrollbar.window_virtual_size = virtual_size.width
|
||||
self.horizontal_scrollbar.window_size = width - self.scrollbar_size_vertical
|
||||
self.horizontal_scrollbar.window_size = width
|
||||
|
||||
self.scroll_x = self.validate_scroll_x(self.scroll_x)
|
||||
self.scroll_y = self.validate_scroll_y(self.scroll_y)
|
||||
|
||||
print("SCROLL UPDATE", self)
|
||||
print("sizes", self.scrollbar_size_horizontal, self.scrollbar_size_vertical)
|
||||
self.log(self.show_horizontal_scrollbar, self.show_vertical_scrollbar)
|
||||
if (
|
||||
self.horizontal_scrollbar._repaint_required
|
||||
or self.vertical_scrollbar._repaint_required
|
||||
):
|
||||
self._refresh_scrollbars()
|
||||
|
||||
def _render_content(self) -> None:
|
||||
"""Render all lines."""
|
||||
width, height = self.size
|
||||
|
||||
@@ -160,10 +160,11 @@ class TextLog(ScrollView, can_focus=True):
|
||||
self.refresh()
|
||||
|
||||
def render_line(self, y: int) -> Strip:
|
||||
print("Render", self.size)
|
||||
scroll_x, scroll_y = self.scroll_offset
|
||||
line = self._render_line(scroll_y + y, scroll_x, self.size.width)
|
||||
strip = Strip(Segment.apply_style(line, self.rich_style), self.size.width)
|
||||
|
||||
strip = Strip(Segment.apply_style(line, self.rich_style), line.cell_length)
|
||||
|
||||
return strip
|
||||
|
||||
def render_lines(self, crop: Region) -> list[Strip]:
|
||||
@@ -175,7 +176,13 @@ class TextLog(ScrollView, can_focus=True):
|
||||
Returns:
|
||||
A list of list of segments
|
||||
"""
|
||||
print(self.virtual_size)
|
||||
print(self.vertical_scrollbar.window_size)
|
||||
print(self.vertical_scrollbar.virtual_size)
|
||||
self.log(scroll_x=self.scroll_x, max_scroll_x=self.max_scroll_x)
|
||||
self.log(scroll_y=self.scroll_y, max_scroll_y=self.max_scroll_y)
|
||||
lines = self._styles_cache.render_widget(self, crop)
|
||||
|
||||
return lines
|
||||
|
||||
def _render_line(self, y: int, scroll_x: int, width: int) -> Strip:
|
||||
@@ -193,5 +200,4 @@ class TextLog(ScrollView, can_focus=True):
|
||||
)
|
||||
|
||||
self._line_cache[key] = line
|
||||
print(line)
|
||||
return line
|
||||
|
||||
Reference in New Issue
Block a user