diff --git a/Menu/GameShell/95_Music Player/music_lib_list_page.py b/Menu/GameShell/95_Music Player/music_lib_list_page.py index 2af0ca5..1f9ebe1 100644 --- a/Menu/GameShell/95_Music Player/music_lib_list_page.py +++ b/Menu/GameShell/95_Music Player/music_lib_list_page.py @@ -94,6 +94,8 @@ class MusicLibListPage(Page): _BGheight = 70 _Backspace = False + + _ItemsPerPage = 6 def __init__(self): Page.__init__(self) @@ -102,7 +104,57 @@ class MusicLibListPage(Page): self._MyList = [] self._SwapMyList = [] self._MyStack = MusicLibStack() + + def ScrollUp(self): + if len(self._MyList) <= 1: + return + tmp = self._PsIndex + self._PsIndex -= self._ScrollStep + + if self._PsIndex < 0: + self._PsIndex = len(self._MyList) - 1 # to end + + dy = abs(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 + + # loop scroll, to end + if self._PsIndex == len(self._MyList) - 1: + # check items per page + if len(self._MyList) > self._ItemsPerPage: + self._ItemsPerPage -= 1 # not include current item + for i in range(0, len(self._MyList)): + self._MyList[i]._PosY -= self._MyList[i]._Height * (dy - self._ItemsPerPage) + self._ItemsPerPage = 6 # reset to 6 + + def ScrollDown(self): + if len(self._MyList) <= 1: + return + + tmp = self._PsIndex + self._PsIndex +=self._ScrollStep + + if self._PsIndex >= len(self._MyList): + self._PsIndex = 0 # to first + + dy = abs(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 + + # loop scroll, to first + if self._PsIndex == 0: + # check items per page + if len(self._MyList) > self._ItemsPerPage: + self._ItemsPerPage -= 1 # not include current item + for i in range(0, len(self._MyList)): + self._MyList[i]._PosY += self._MyList[i]._Height * (dy - self._ItemsPerPage) + self._ItemsPerPage = 6 # reset to 6 + def SyncList(self,path): if myvars.Poller == None: return