[Pychord-commits] r75 - in trunk: pgui pychord2
danilo at garage.maemo.org
danilo at garage.maemo.org
Fri Mar 28 17:50:56 EET 2008
Author: danilo
Date: 2008-03-28 17:50:55 +0200 (Fri, 28 Mar 2008)
New Revision: 75
Modified:
trunk/pgui/list.py
trunk/pychord2/window_show.py
Log:
- Adding list scroll limits
Modified: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py 2008-03-26 15:09:44 UTC (rev 74)
+++ trunk/pgui/list.py 2008-03-28 15:50:55 UTC (rev 75)
@@ -27,15 +27,18 @@
self.autoScroll(0)
container.__init__(self, father,[],position,[width, height])
+
+ self.movedPosition = 0
+
+ self.lastMove = 0
+
+ self.totalSize = 0
+
# label
for i in text:
self.addLine(i)
self.setBackground((0,0,0))
-
- self.movedPosition = 0
-
- self.lastMove = 0
def onClickRelease(self):
@@ -51,8 +54,13 @@
def addLine(self, text):
lbl = label(self, [2,len(self.objects)*self.ptsize+10], text, (255,255,255), fontFile = self.fontFile, ptsize = self.ptsize)
- container.addElement(self, lbl)
+ self.addElement(lbl)
return lbl
+
+ def addElement(self, obj):
+ container.addElement(self, obj)
+ if self.totalSize < obj.size[1] + obj.rel_pos[1]:
+ self.totalSize = obj.size[1] + obj.rel_pos[1]
def update(self):
if self.clicked:
@@ -74,6 +82,19 @@
def move(self,pos):
+ # It don't need to scroll
+ if self.totalSize <= self.size[1]:
+ return
+
+ if self.movedPosition + pos > 0:
+ self.move(pos - 1)
+ return
+
+ if -self.movedPosition + pos + self.size[1] > self.totalSize:
+ if pos < 0:
+ self.move(pos + 1)
+ return
+
self.movedPosition +=pos
self.lastMove += pos
Modified: trunk/pychord2/window_show.py
===================================================================
--- trunk/pychord2/window_show.py 2008-03-26 15:09:44 UTC (rev 74)
+++ trunk/pychord2/window_show.py 2008-03-28 15:50:55 UTC (rev 75)
@@ -37,7 +37,6 @@
lines = lines.splitlines()
lst = chordlist(self, [0,0],lines) # creating the widget
lst.setBackground((10,10,10))
- lst.autoScroll(2)
self.addElement(lst)
self.chordList = lst
More information about the Pychord-commits
mailing list