diff options
| author | troido <troido@hotmail.com> | 2017-12-30 01:35:41 +0100 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2017-12-30 01:35:41 +0100 |
| commit | b63f38d654814d6be7a56ee7c8c6c6567755e0b4 (patch) | |
| tree | 8cc169590bccda80f1d3d246166f002d84cb5fba /asciifarm/client/display/infopad.py | |
| parent | 29149f398986620cf13ba1fc4d2d7cca139bead0 (diff) | |
tried a new approach to remove code duplication in display
Diffstat (limited to 'asciifarm/client/display/infopad.py')
| -rw-r--r-- | asciifarm/client/display/infopad.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/asciifarm/client/display/infopad.py b/asciifarm/client/display/infopad.py index b630013..dc543bf 100644 --- a/asciifarm/client/display/infopad.py +++ b/asciifarm/client/display/infopad.py @@ -10,23 +10,20 @@ class InfoPad: def __init__(self): self.changed = False self.lines = [] - self.win = None + self.widget = None - def setWin(self, win): - self.win = win + def setWidget(self, widget): + self.widget = widget def showString(self, string): self.lines = string.split('\n') - self.changed = True + self.widget.change() - def update(self, force): - if not self.changed and not force or not self.win: - return - win = self.win + def update(self): + win = self.widget.getWin() height, width = win.getmaxyx() lines = [line[:width-1] for line in self.lines][:height] text = '\n'.join(lines) win.erase() win.addstr(0, 0, text) - self.changed = False win.noutrefresh() |
