add widget.py

This commit is contained in:
cuu
2019-01-15 16:37:15 +08:00
parent c641c8d84a
commit 7e75d4856b
25 changed files with 213 additions and 356 deletions

View File

@@ -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()