[Pychord-commits] r56 - trunk/pgui

danilo at garage.maemo.org danilo at garage.maemo.org
Sun Mar 16 20:40:31 EET 2008


Author: danilo
Date: 2008-03-16 20:40:28 +0200 (Sun, 16 Mar 2008)
New Revision: 56

Modified:
   trunk/pgui/list.py
   trunk/pgui/pguiobject.py
   trunk/pgui/widget.py
Log:
- Subwidgets now just print theirselves into father-widget area

Modified: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py	2008-03-15 00:15:15 UTC (rev 55)
+++ trunk/pgui/list.py	2008-03-16 18:40:28 UTC (rev 56)
@@ -28,16 +28,17 @@
 
         container.__init__(self, father,[],position,[width, height])
         # label
-        pos = 0
         for i in text: 
-            lbl = label(self, [2,pos*ptsize+5], i, (255,255,255), fontFile = self.fontFile, ptsize = ptsize)
-            lbl.cutImg(width = width-2)
-            self.addElement(lbl)
-            pos +=1
+            self.addLine(i)
             
         self.setBackground((0,0,0))
         
         self.movedPosition = 0
+        
+        
+    def addLine(self, text):
+        lbl = label(self, [2,len(self.objects)*self.ptsize+5], text, (255,255,255), fontFile = self.fontFile, ptsize = self.ptsize)
+        container.addElement(self, lbl)
        
     def update(self):
         if self.clicked:

Modified: trunk/pgui/pguiobject.py
===================================================================
--- trunk/pgui/pguiobject.py	2008-03-15 00:15:15 UTC (rev 55)
+++ trunk/pgui/pguiobject.py	2008-03-16 18:40:28 UTC (rev 56)
@@ -56,7 +56,7 @@
             self.dirty = True
     
     
-    def draw(self, screen, force):
+    def draw(self, screen, force, rect = None):
         """
          Desenha o objeto na tela
 
@@ -66,10 +66,16 @@
 
         self.drawBackground(screen)
             
-        screen.blit(self.img, self.position)
+        if rect == None:
+            self.drawBackground(screen)     
+            screen.blit(self.img, self.position)
+        else:
+            self.drawBackground(screen)
+            newPosition = [self.position[0]+rect.left, self.position[1] + rect.top]
+            screen.blit(self.img, newPosition, rect)
         self.dirty = False
         
-                
+            
     def drawBackground(self, screen):
   
         if self.background != None:

Modified: trunk/pgui/widget.py
===================================================================
--- trunk/pgui/widget.py	2008-03-15 00:15:15 UTC (rev 55)
+++ trunk/pgui/widget.py	2008-03-16 18:40:28 UTC (rev 56)
@@ -33,11 +33,16 @@
         del(self.size)
         del(self.img)
         
-    def draw(self, screen, force = False):
+    def draw(self, screen, force = False, rect = None):
         
         # Verifing if the image really needs to be painted
-        if self.rect.colliderect(Rect(0,0,800,480)):
-            pguiobject.draw(self, screen, force)
+        if self.rect.colliderect(self.father.rect):
+            
+            #calculating what needs to be painted
+            r = self.father.rect.clip(self.rect)
+            r = r.move(-self.position[0], -self.position[1])
+            
+            pguiobject.draw(self, screen, force, r)
         
     def move(self, pos):
         if pos[0] != pos[1] or pos[1] != 0:



More information about the Pychord-commits mailing list