diff options
| author | troido <troido@hotmail.com> | 2018-01-17 20:26:16 +0100 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2018-01-17 20:26:16 +0100 |
| commit | f72c658220a78ec058ceca25118e3e9a499a6c2b (patch) | |
| tree | 2a965a693d95f0ee651732ddc47b7e22bd188030 /asciifarm/client/display/info.py | |
| parent | 0bed6616326348b41c6a907552fff62956ce6f18 (diff) | |
updated maps and refactored client: renamed display parts and removed selector
Diffstat (limited to 'asciifarm/client/display/info.py')
| -rw-r--r-- | asciifarm/client/display/info.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/asciifarm/client/display/info.py b/asciifarm/client/display/info.py new file mode 100644 index 0000000..da23ac1 --- /dev/null +++ b/asciifarm/client/display/info.py @@ -0,0 +1,25 @@ + +import curses + +class Info: + + def __init__(self): + self.changed = False + self.lines = [] + self.widget = None + + def setWidget(self, widget): + self.widget = widget + + def showString(self, string): + self.lines = string.split('\n') + self.widget.change() + + def update(self): + win = self.widget.getWin() + width, height = win.getSize() + lines = [line[:width-1] for line in self.lines][:height] + win.erase() + for i, line in enumerate(lines): + win.addLine((0, i), line) + win.noutrefresh() |
