[Pychord-commits] r57 - trunk/pgui

danilo at garage.maemo.org danilo at garage.maemo.org
Sun Mar 16 21:14:42 EET 2008


Author: danilo
Date: 2008-03-16 21:14:42 +0200 (Sun, 16 Mar 2008)
New Revision: 57

Modified:
   trunk/pgui/container.py
   trunk/pgui/list.py
Log:
- Add the click method into list widget.
  Now, itens can be clickable into list widget.

Modified: trunk/pgui/container.py
===================================================================
--- trunk/pgui/container.py	2008-03-16 18:40:28 UTC (rev 56)
+++ trunk/pgui/container.py	2008-03-16 19:14:42 UTC (rev 57)
@@ -83,4 +83,10 @@
             if obj.rect.collidepoint(pygame.mouse.get_pos()):
                 obj.onClick()
                 self.objPressed = obj
-                return
\ No newline at end of file
+                return
+            
+    def whoIsPress(self):
+        for obj in self.objects:
+            # For widgets
+            if obj.rect.collidepoint(pygame.mouse.get_pos()):
+                return obj
\ No newline at end of file

Modified: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py	2008-03-16 18:40:28 UTC (rev 56)
+++ trunk/pgui/list.py	2008-03-16 19:14:42 UTC (rev 57)
@@ -35,10 +35,23 @@
         
         self.movedPosition = 0
         
+        self.lastMove = 0
+    
+    def onClickRelease(self):
         
+        
+        if self.lastMove > -4 and self.lastMove < 4:
+            obj = self.whoIsPress()
+            obj.click()
+        
+        
+        container.onClickRelease(self)
+        self.lastMove = 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)
+        return lbl
        
     def update(self):
         if self.clicked:
@@ -61,6 +74,7 @@
     def move(self,pos):
         
         self.movedPosition +=pos
+        self.lastMove += pos
         
         for i in self.objects:
             i.move([0,pos])



More information about the Pychord-commits mailing list