2008-04-20 23:10:25 -04:00
|
|
|
import color
|
|
|
|
from point import Point
|
|
|
|
|
|
|
|
class RenderString(object):
|
2008-05-03 15:41:06 -04:00
|
|
|
def __init__(self, s, y=0, x=0, attrs=None, name=""):
|
2008-04-20 23:10:25 -04:00
|
|
|
if attrs is None:
|
|
|
|
attrs = color.build('default', 'default')
|
2008-05-03 15:41:06 -04:00
|
|
|
|
2008-04-20 23:10:25 -04:00
|
|
|
self.string = s
|
2008-05-03 15:41:06 -04:00
|
|
|
self.y = y
|
2008-04-20 23:10:25 -04:00
|
|
|
self.x = x
|
|
|
|
self.attrs = attrs
|
2008-05-03 15:41:06 -04:00
|
|
|
self.name = name
|
2008-04-20 23:10:25 -04:00
|
|
|
def draw(self, cwin, y, x):
|
2008-04-25 10:20:40 -04:00
|
|
|
try:
|
2008-05-03 15:41:06 -04:00
|
|
|
cwin.addstr(self.y + y, self.x + x, self.string, self.attrs)
|
2008-04-25 10:20:40 -04:00
|
|
|
except:
|
|
|
|
#return
|
|
|
|
raise Exception, "cwin.addstr(%d, %d + %d, %r, %r) failed" % \
|
|
|
|
(y, self.x, x, self.string, self.attrs)
|