[shpy-commit] r2879 - shpy/trunk/dist/shpy/ui_pygame

arigo@codespeak.net arigo@codespeak.net
Thu, 22 Jan 2004 19:27:39 +0100 (MET)


Author: arigo
Date: Thu Jan 22 19:27:39 2004
New Revision: 2879

Modified:
   shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py
Log:
color hack on lines, for the fun of it


Modified: shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py
==============================================================================
--- shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py	(original)
+++ shpy/trunk/dist/shpy/ui_pygame/ui_pygame.py	Thu Jan 22 19:27:39 2004
@@ -101,7 +101,15 @@
 
 class Line(decorate.Decorator):
     typeid = 'line:0'
-    slots = 'content',
+    slots = 'content', 'color',
+
+    def getcolor(self):
+        return getattr(self, 'color', (0, 0, 0))
+
+    def __setattr__(self, attr, value):
+        if attr == 'content':
+            self.color = self.terminal.cursor.color
+        decorate.Decorator.__setattr__(self, attr, value)
 
 
 class Terminal:
@@ -190,7 +198,7 @@
         for line in lines:
             if ypos > screenheight:
                 break
-            lineimage = self.font.render(line.content or ' ', 1, (0,0,0))
+            lineimage = self.font.render(line.content or ' ', 1, line.getcolor())
             self.screen.blit(lineimage, (0, ypos))
             self.line2ypos[line] = ypos
             ypos += self.fontheight