diff options
| author | troido <troido@hotmail.com> | 2017-11-13 13:37:05 +0100 |
|---|---|---|
| committer | troido <troido@hotmail.com> | 2017-11-13 13:37:05 +0100 |
| commit | 227f266df78b143b0c5dd2c7f498b755199707eb (patch) | |
| tree | 9af5dac95f684e79d04fcc96b03dc81689dff78a /asciifarm/client/display/infopad.py | |
| parent | 336f6f873c52ef62e2f304436b381c166eac872f (diff) | |
display parts now use windows as arguments
Diffstat (limited to 'asciifarm/client/display/infopad.py')
| -rw-r--r-- | asciifarm/client/display/infopad.py | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/asciifarm/client/display/infopad.py b/asciifarm/client/display/infopad.py index 564d6d4..7c9fef0 100644 --- a/asciifarm/client/display/infopad.py +++ b/asciifarm/client/display/infopad.py @@ -8,25 +8,32 @@ class InfoPad: def __init__(self, size=(1,1), *args): - self.pad = curses.newpad(size[1], size[0]) - self.size = size + #self.pad = curses.newpad(size[1], size[0]) + #self.size = size self.changed = False - self.lastView = None + self.lines = [] + #self.lastView = None def showString(self, string): - self.pad.clear() - self.pad.addstr(0,0,string) + self.lines = string.split('\n') + #self.pad.clear() + #self.pad.addstr(0,0,string) self.changed = True - def update(self, screen, x, y, xmax, ymax, force=False): - if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force: + def update(self, win, force=False): + if not self.changed and not force or not win: return - self.lastView = (x, y, xmax, ymax) + #self.lastView = (x, y, xmax, ymax) + height, width = win.getmaxyx() + lines = [line[:width] for line in self.lines][:height] + text = '\n'.join(lines) + win.erase() + win.addstr(0, 0, text) self.changed = False - self.pad.noutrefresh( - 0, - 0, - y, - x, - ymax-1, - xmax-1) + win.noutrefresh() + #0, + #0, + #y, + #x, + #ymax-1, + #xmax-1) |
