This commit is contained in:
Nicolas Margulies 2020-11-20 18:09:39 +01:00
parent ca57fae19d
commit 223c20e792
2 changed files with 7 additions and 5 deletions

View File

@ -91,17 +91,18 @@ class HorizontalSplit(Display):
self.pad.addstr(0, i, "")
self.pad.refresh(0, 0, self.y, self.x, self.y, self.x + self.width - 1)
class Box(Display):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.pad = self.newpad(self.rows, self.cols)
def display(self) -> None:
self.pad.addstr(0, 0, "" + "" * (self.width - 2) + "")
for i in range(1, self.height - 1):
self.pad.addstr(i, 0, "")
self.pad.addstr(i, self.width - 1, "")
self.pad.addstr(self.height - 1, 0,
"" + "" * (self.width - 2) + "")
self.pad.refresh(0, 0, self.y, self.x, self.y + self.height - 1, self.x + self.width - 1)
self.pad.addstr(self.height - 1, 0, "" + "" * (self.width - 2) + "")
self.pad.refresh(0, 0, self.y, self.x, self.y + self.height - 1,
self.x + self.width - 1)

View File

@ -81,7 +81,8 @@ class MainMenuDisplay(Display):
for i in range(len(self.title)):
self.pad.addstr(4 + i, max(self.width // 2
- len(self.title[0]) // 2 - 1, 0), self.title[i])
self.pad.refresh(0, 0, self.y, self.x, self.height + self.y - 1, self.width + self.x - 1)
self.pad.refresh(0, 0, self.y, self.x, self.height + self.y - 1,
self.width + self.x - 1)
menuwidth = min(self.menudisplay.preferred_width, self.width)
menuy, menux = len(self.title) + 8, self.width // 2 - menuwidth // 2 - 1
self.menudisplay.refresh(