Fix for missing edges on some boxes

This commit is contained in:
Will McGugan
2022-05-20 13:59:36 +01:00
parent fe99c72c9e
commit ba48050721
3 changed files with 14 additions and 15 deletions

View File

@@ -40,7 +40,7 @@ App > Screen {
background: $primary-darken-2; background: $primary-darken-2;
color: $text-primary-darken-2 ; color: $text-primary-darken-2 ;
border-right: outer $primary-darken-3; border-right: outer $primary-darken-3;
content-align: center middle; content-align: center middle;
} }
#sidebar .user { #sidebar .user {
@@ -168,7 +168,7 @@ OptionItem {
height: 3; height: 3;
background: $primary; background: $primary;
border-right: outer $primary-darken-2; border-right: outer $primary-darken-2;
border-left: hidden; border-left: blank;
content-align: center middle; content-align: center middle;
} }
@@ -223,4 +223,4 @@ Success {
.horizontal { .horizontal {
layout: horizontal layout: horizontal
} }

View File

@@ -7,12 +7,14 @@ Horizontal {
.test { .test {
width: auto; width: auto;
height: auto; height: auto;
height: 5;
background: white 50%; background: white 50%;
border:solid green; /* border:solid green; */
border-right: outer green;
border-left: outer blue;
padding: 0; padding: 0;
margin:3; margin:3;
align: center middle; align: center middle;
box-sizing: content-box; box-sizing: border-box;
} }

View File

@@ -22,7 +22,7 @@ OUTER = 2
BORDER_CHARS: dict[EdgeType, tuple[str, str, str]] = { BORDER_CHARS: dict[EdgeType, tuple[str, str, str]] = {
# Each string of the tuple represents a sub-tuple itself: # 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) # - 2nd string represents (mid1, mid2, mid3)
# - 3rd string represents (bottom1, bottom2, bottom3) # - 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 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 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), (bottom, bottom_color),
(left, left_color), (left, left_color),
) = edge_styles ) = edge_styles
self._sides: tuple[EdgeType, EdgeType, EdgeType, EdgeType] = ( self._sides: tuple[EdgeType, EdgeType, EdgeType, EdgeType]
top or "none", self._sides = (top, right, bottom, left)
right or "none",
bottom or "none",
left or "none",
)
from_color = Style.from_color from_color = Style.from_color
self._styles = ( self._styles = (
@@ -204,6 +200,7 @@ class Border:
def __rich_console__( def __rich_console__(
self, console: "Console", options: "ConsoleOptions" self, console: "Console", options: "ConsoleOptions"
) -> "RenderResult": ) -> "RenderResult":
top, right, bottom, left = self._sides top, right, bottom, left = self._sides
style = console.get_style(self.inner_style) style = console.get_style(self.inner_style)
outer_style = console.get_style(self.outer_style) outer_style = console.get_style(self.outer_style)