Added vertical and horizontal lines as display elements
This commit is contained in:
parent
62599ea72c
commit
7e63607836
@ -50,3 +50,43 @@ class Display:
|
||||
@property
|
||||
def cols(self) -> int:
|
||||
return curses.COLS if self.screen else 42
|
||||
|
||||
|
||||
class VerticalSplit(Display):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.pad = self.newpad(self.rows, 1)
|
||||
|
||||
@property
|
||||
def width(self) -> int:
|
||||
return 1
|
||||
|
||||
@width.setter
|
||||
def width(self, val: Any) -> None:
|
||||
pass
|
||||
|
||||
def display(self) -> None:
|
||||
for i in range(self.height):
|
||||
self.pad.addstr(i, 0, "┃")
|
||||
self.pad.refresh(0, 0, self.y, self.x, self.y + self.height, self.x)
|
||||
|
||||
|
||||
class HorizontalSplit(Display):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.pad = self.newpad(1, self.cols)
|
||||
|
||||
@property
|
||||
def height(self) -> int:
|
||||
return 1
|
||||
|
||||
@height.setter
|
||||
def height(self, val: Any) -> None:
|
||||
pass
|
||||
|
||||
def display(self) -> None:
|
||||
for i in range(self.width):
|
||||
self.pad.addstr(0, i, "━")
|
||||
self.pad.refresh(0, 0, self.y, self.x, self.y, self.x + self.width)
|
||||
|
Loading…
Reference in New Issue
Block a user