[Pychord-commits] r46 - / trunk/pgui trunk/pychord2
danilo at garage.maemo.org
danilo at garage.maemo.org
Thu Mar 6 04:54:01 EET 2008
Author: danilo
Date: 2008-03-06 04:53:59 +0200 (Thu, 06 Mar 2008)
New Revision: 46
Added:
trunk/pgui/list.py
Modified:
.pydevproject
trunk/pgui/__init__.py
trunk/pgui/pguiobject.py
trunk/pychord2/main_window.py
Log:
List widget added.
Modified: .pydevproject
===================================================================
--- .pydevproject 2008-03-06 01:01:38 UTC (rev 45)
+++ .pydevproject 2008-03-06 02:53:59 UTC (rev 46)
@@ -4,6 +4,8 @@
<pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/pychord2/trunk</path>
+<path>/pychord2/trunk/pgui</path>
+<path>/pychord2/trunk/pychord2</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
</pydev_project>
Modified: trunk/pgui/__init__.py
===================================================================
--- trunk/pgui/__init__.py 2008-03-06 01:01:38 UTC (rev 45)
+++ trunk/pgui/__init__.py 2008-03-06 02:53:59 UTC (rev 46)
@@ -6,5 +6,6 @@
from input import *
from button import *
from combo import *
+from list import *
from locale import *
\ No newline at end of file
Added: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py (rev 0)
+++ trunk/pgui/list.py 2008-03-06 02:53:59 UTC (rev 46)
@@ -0,0 +1,41 @@
+from label import *
+from container import *
+from locale import *
+
+class list (container):
+
+
+ def __init__(self, father, position, text = [], ptsize = pguiDefFontSize, width = 700, height = 480, bsize = 1):
+ """
+
+ @param string text : default text
+ @param List pos : Posicao inicial onde o widget vai
+aparecer, relativo a janela
+ @return :
+ @author
+ """
+ #Saving the text
+ self.text = text
+ self.bsize = bsize
+ self.position = position
+ self.ptsize = ptsize
+
+ 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), ptsize = ptsize)
+ self.addElement(lbl)
+ pos +=1
+
+
+ def update(self):
+ if self.clicked:
+ pos = pygame.mouse.get_rel()
+ self.move(pos[1])
+
+
+ def move(self,pos):
+
+ for i in self.objects:
+ i.move([0,pos])
\ No newline at end of file
Modified: trunk/pgui/pguiobject.py
===================================================================
--- trunk/pgui/pguiobject.py 2008-03-06 01:01:38 UTC (rev 45)
+++ trunk/pgui/pguiobject.py 2008-03-06 02:53:59 UTC (rev 46)
@@ -79,9 +79,9 @@
self.mouseOn = True
self.onMouseOn()
else:
- if not self.rect.collidepoint(pos):
+ if not self.rect.collidepoint(pos):
self.mouseOn = False
- self.onMouseOff()
+ self.onMouseOff()
def onMouseOn(self):
pass
@@ -90,11 +90,13 @@
pass
def onClick(self):
+
self.mouseOn = True
self.clicked = True
self.onMouseOn()
def onClickRelease(self):
+
if self.mouseOn:
self.click()
@@ -106,6 +108,7 @@
pass
def click(self):
+
for functionName,vars in self.onClickSlots:
if vars != None:
functionName(vars)
Modified: trunk/pychord2/main_window.py
===================================================================
--- trunk/pychord2/main_window.py 2008-03-06 01:01:38 UTC (rev 45)
+++ trunk/pychord2/main_window.py 2008-03-06 02:53:59 UTC (rev 46)
@@ -7,6 +7,7 @@
from pgui import Tbutton
from pgui import Ibutton
from pgui import combo
+from pgui import list
import pygame
@@ -28,17 +29,24 @@
btX.registerClickSlot(self.close)
self.addElement(btX)
- lbl = label(self, [10,70],"Search By:")
- self.addElement(lbl)
-
- inp = input(self, [10, 110],"",width=700)
- self.addElement(inp)
-
- lbl = label(self, [10,200],"Search on:")
- self.addElement(lbl)
-
- cmb = combo(self, [10, 240], {'tab':'By Word','artist':'By Artist','song':'By Music'} ,width=700)
- self.addElement(cmb)
-
- btSearch = Tbutton(self, [410,300], "Search", width = 300, bsize = 3, padding = 6)
- self.addElement(btSearch)
+# lbl = label(self, [10,70],"Search By:")
+# self.addElement(lbl)
+#
+# inp = input(self, [10, 110],"",width=700)
+# self.addElement(inp)
+#
+# lbl = label(self, [10,200],"Search on:")
+# self.addElement(lbl)
+#
+# cmb = combo(self, [10, 240], {'tab':'By Word','artist':'By Artist','song':'By Music'} ,width=700)
+# self.addElement(cmb)
+#
+# btSearch = Tbutton(self, [410,300], "Search", width = 300, bsize = 3, padding = 6)
+# self.addElement(btSearch)
+
+ lst = list(self, [0,0],["Ola mundo, bla bla bla", "Ola mundo, bla bla bla",
+ "Ola mundo, bla bla bla","Ola mundo, bla bla bla","Ola mundo, bla bla bla",
+ "Ola mundo, bla bla bla","Ola mundo, bla bla bla","Ola mundo, bla bla bla"])
+ lst.setBackground((50,50,50))
+ self.addElement(lst)
+
\ No newline at end of file
More information about the Pychord-commits
mailing list