summaryrefslogtreecommitdiff
path: root/asciifarm/client/display/infopad.py
diff options
context:
space:
mode:
Diffstat (limited to 'asciifarm/client/display/infopad.py')
-rw-r--r--asciifarm/client/display/infopad.py37
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)