mirror of
https://github.com/clockworkpi/launcher.git
synced 2026-03-24 04:42:40 +01:00
add widget.py
This commit is contained in:
@@ -200,35 +200,6 @@ class TimezoneListPage(Page):
|
||||
self._Scroller._PosY = 2
|
||||
self._Scroller.Init()
|
||||
|
||||
|
||||
def ScrollUp(self,Step=1):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
tmp = self._PsIndex
|
||||
self._PsIndex -= Step
|
||||
|
||||
if self._PsIndex < 0:
|
||||
self._PsIndex = 0
|
||||
dy = tmp-self._PsIndex
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
if cur_li._PosY < 0:
|
||||
for i in range(0, len(self._MyList)):
|
||||
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
||||
|
||||
|
||||
def ScrollDown(self,Step=1):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
tmp = self._PsIndex
|
||||
self._PsIndex +=Step
|
||||
if self._PsIndex >= len(self._MyList):
|
||||
self._PsIndex = len(self._MyList) -1
|
||||
dy = self._PsIndex - tmp
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
if cur_li._PosY +cur_li._Height > self._Height:
|
||||
for i in range(0,len(self._MyList)):
|
||||
self._MyList[i]._PosY -= self._MyList[i]._Height*dy
|
||||
|
||||
def Click(self):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
@@ -275,12 +246,12 @@ class TimezoneListPage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Right"]:
|
||||
self.ScrollDown(Step=5)
|
||||
self.FScrollDown(Step=5)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Left"]:
|
||||
self.ScrollUp(Step=5)
|
||||
self.FScrollUp(Step=5)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user