page.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. # -*- coding: utf-8 -*-
  2. import pygame
  3. from pygame.locals import *
  4. from sys import exit
  5. import os
  6. import sys
  7. import math
  8. from libs import easing
  9. #import base64
  10. #from beeprint import pp
  11. ### local import
  12. from constants import ALIGN,icon_width,icon_height,Width,Height,ICON_TYPES
  13. from util_funcs import midRect
  14. from keys_def import CurKeys
  15. from icon_pool import MyIconPool
  16. from lang_manager import MyLangManager
  17. from widget import Widget
  18. class PageStack:
  19. def __init__(self):
  20. self.stack = list()
  21. def Push(self,data):
  22. if data not in self.stack:
  23. self.stack.append(data)
  24. return True
  25. return False
  26. def Pop(self):
  27. if len(self.stack)<=0:
  28. return None,False
  29. return self.stack.pop(),True
  30. def Length(self):
  31. return len(self.stack)
  32. class PageSelector(Widget):
  33. _Parent = None
  34. _Alpha = 0
  35. _OnShow = True
  36. _IconSurf = None
  37. def __init__(self):
  38. pass
  39. def Init(self,x,y,w,h,alpha):
  40. self._PosX = x
  41. self._PosY = y
  42. self._Width = w
  43. self._Height = h
  44. self._Alpha = alpha
  45. def Adjust(self,x,y,w,h,alpha):
  46. self._PosX = x
  47. self._PosY = y
  48. self._Width = w
  49. self._Height = h
  50. self._Alpha = alpha
  51. def Draw(self):
  52. canvas = self._Parent._CanvasHWND
  53. idx = self._Parent._PsIndex
  54. iconidx = self._Parent._IconIndex
  55. if idx < len(self._Parent._Icons):
  56. x = self._Parent._Icons[idx]._PosX+self._Parent._PosX
  57. y = self._Parent._Icons[iconidx]._PosY ## only use current icon's PosY
  58. rect = midRect(x,y,self._Width,self._Height,self._Parent._Width,self._Parent._Height)
  59. if rect.width <=0 or rect.height <= 0 :
  60. return
  61. #color = (244,197,66,50)
  62. #pygame.draw.rect(canvas,color,rect,1)
  63. if self._IconSurf != None:
  64. self._Parent._CanvasHWND.blit(self._IconSurf,rect)
  65. class Page(Widget):
  66. _Icons = []
  67. _Ps = None
  68. _PsIndex = 0
  69. _IconNumbers = 0
  70. _IconIndex = 0 ## shows which icon current selected, the Selector can not move here
  71. _PrevIconIndex = 0 ## for remember the Highlighted Icon ,restore it's PosY to average
  72. _Index = 0
  73. _Align = ALIGN["SLeft"]
  74. _CanvasHWND = None #
  75. _HWND = None #
  76. _OnShow = False
  77. _Name = ""
  78. _Screen = None ## Should be the Screen Class
  79. _PageIconMargin = 20
  80. _FootMsg = ["Nav","","","","Enter"] ## Default Page Foot info
  81. _SelectedIconTopOffset=20
  82. _EasingDur = 30
  83. def __init__(self):
  84. self._Icons = []
  85. def AdjustHLeftAlign(self): ## adjust coordinator and append the PageSelector
  86. self._PosX = self._Index*self._Screen._Width
  87. self._Width = self._Screen._Width
  88. self._Height = self._Screen._Height
  89. cols = int(Width /icon_width)
  90. rows = int( (self._IconNumbers * icon_width)/Width + 1)
  91. if rows < 1:
  92. rows = 1
  93. cnt = 0
  94. for i in range(0,rows):
  95. for j in range(0,cols):
  96. start_x = icon_width/2 + j*icon_width
  97. start_y = icon_height/2 + i*icon_height
  98. icon = self._Icons[cnt]
  99. icon.Adjust(start_x,start_y,icon_width-4,icon_height-4,0)
  100. icon._Index = cnt
  101. icon._Parent = self
  102. if cnt >= (self._IconNumbers -1):
  103. break
  104. cnt+=1
  105. ps = PageSelector()
  106. ps._IconSurf = MyIconPool._Icons["blueselector"]
  107. ps._Parent = self
  108. ps.Init(icon_width/2, TitleBar._BarHeight+icon_height/2,92,92,128)
  109. self._Ps = ps
  110. self._PsIndex = 0
  111. self._OnShow = False
  112. def AdjustSLeftAlign(self): ## adjust coordinator and append the PageSelector
  113. self._PosX = self._Index*self._Screen._Width
  114. self._Width = self._Screen._Width
  115. self._Height = self._Screen._Height
  116. start_x = (self._PageIconMargin + icon_width+self._PageIconMargin) /2
  117. start_y = self._Height/2
  118. for i in range(0,self._IconNumbers):
  119. it = self._Icons[i]
  120. it._Parent = self
  121. it._Index = i
  122. it.Adjust(start_x+i*self._PageIconMargin+i*icon_width,start_y,icon_width-6,icon_height-6,0)
  123. it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
  124. ps = PageSelector()
  125. ps._IconSurf = MyIconPool._Icons["blueselector"]
  126. ps._Parent = self
  127. ps.Init(start_x,start_y,92,92,128)
  128. self._Ps = ps
  129. self._PsIndex = 0
  130. self._OnShow = False
  131. if self._IconNumbers > 1:
  132. self._PsIndex = 1
  133. self._IconIndex = self._PsIndex
  134. self._PrevIconIndex = self._IconIndex
  135. self._Icons[self._IconIndex]._PosY -= self._SelectedIconTopOffset
  136. def AdjustSAutoLeftAlign(self): ## adjust coordinator and append the PageSelector
  137. self._PosX = self._Index*self._Screen._Width
  138. self._Width = self._Screen._Width
  139. self._Height = self._Screen._Height
  140. start_x = (self._PageIconMargin + icon_width+self._PageIconMargin) /2
  141. start_y = self._Height/2
  142. if self._IconNumbers == 1:
  143. start_x = self._Width / 2
  144. start_y = self._Height/2
  145. it = self._Icons[0]
  146. it._Parent = self
  147. it._Index = 0
  148. it.Adjust(start_x,start_y,icon_width,icon_height,0)
  149. #it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
  150. elif self._IconNumbers == 2:
  151. start_x = (self._Width - self._PageIconMargin - self._IconNumbers*icon_width) / 2 + icon_width/2
  152. start_y = self._Height /2
  153. for i in range(0,self._IconNumbers):
  154. it = self._Icons[i]
  155. it._Parent = self
  156. it._Index = i
  157. it.Adjust(start_x+i*self._PageIconMargin + i*icon_width,start_y, icon_width, icon_height,0)
  158. #it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
  159. elif self._IconNumbers > 2:
  160. for i in range(0,self._IconNumbers):
  161. it = self._Icons[i]
  162. it._Parent = self
  163. it._Index = i
  164. it.Adjust(start_x+i*self._PageIconMargin + i*icon_width,start_y,icon_width,icon_height,0)
  165. #it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
  166. ps = PageSelector()
  167. ps._IconSurf = MyIconPool._Icons["blueselector"]
  168. ps._Parent = self
  169. ps.Init(start_x,start_y,92,92,128)
  170. self._Ps = ps
  171. self._PsIndex = 0
  172. self._OnShow = False
  173. if self._IconNumbers > 1:
  174. self._PsIndex = 1
  175. self._IconIndex = self._PsIndex
  176. self._PrevIconIndex = self._IconIndex
  177. self._Icons[self._IconIndex]._PosY -= self._SelectedIconTopOffset
  178. def InitLeftAlign(self):
  179. self._PosX = self._Index*Width
  180. self._Width = self._Screen._Width
  181. self._Height = self._Screen._Height
  182. cols = int(self._Width /icon_width)
  183. rows = int((self._IconNumbers * icon_width)/self._Width + 1)
  184. if rows < 1:
  185. rows = 1
  186. cnt = 0
  187. for i in range(0,rows):
  188. for j in range(0,cols):
  189. start_x = icon_width/2 + j*icon_width
  190. start_y = TitleBar._BarHeight + icon_height/2 + i*icon_height
  191. icon = IconItem()
  192. icon.Init(start_x,start_y,icon_width-4,icon_height-4,0)
  193. icon._Index = cnt
  194. icon._Parent = self
  195. self._Icons.append(icon)
  196. if cnt >= (self._IconNumbers -1):
  197. break
  198. cnt+=1
  199. ps = PageSelector()
  200. ps._IconSurf = MyIconPool._Icons["blueselector"]
  201. ps._Parent = self
  202. ps.Init(icon_width/2,icon_height/2,92,92,128)
  203. self._Ps = ps
  204. self._PsIndex = 0
  205. self._OnShow = False
  206. def Adjust(self): ## default init way,
  207. self._PosX = self._Index*self._Screen._Width
  208. self._Width = self._Screen._Width ## equal to screen width
  209. self._Height = self._Screen._Height
  210. if self._Align == ALIGN["HLeft"]:
  211. start_x = (self._Width - self._IconNumbers*icon_width)/2 + icon_width/2
  212. start_y = self._Height/2
  213. for i in range(0,self._IconNumbers):
  214. it = self._Icons[i]
  215. it._Parent = self
  216. it._Index = i
  217. it.Adjust(start_x+i*icon_width,start_y,icon_width,icon_height,0)
  218. ps = PageSelector()
  219. ps._IconSurf = MyIconPool._Icons["blueselector"]
  220. ps._Parent = self
  221. ps.Init(start_x,start_y,92,92,128)
  222. self._Ps = ps
  223. self._PsIndex = 0
  224. self._OnShow = False
  225. elif self._Align == ALIGN["SLeft"]:
  226. start_x = (self._PageIconMargin + icon_width+self._PageIconMargin) /2
  227. start_y = self._Height/2
  228. for i in range(0,self._IconNumbers):
  229. it = self._Icons[i]
  230. it._Parent = self
  231. it._Index = i
  232. it.Adjust(start_x+i*self._PageIconMargin+i*icon_width,start_y,icon_width,icon_height,0)
  233. ps = PageSelector()
  234. ps._IconSurf = MyIconPool._Icons["blueselector"]
  235. ps._Parent = self
  236. ps.Init(start_x,start_y-self._SelectedIconTopOffset,92,92,128)
  237. self._Ps = ps
  238. self._PsIndex = 0
  239. self._OnShow = False
  240. if self._IconNumbers > 1:
  241. self._PsIndex = 1
  242. self._IconIndex = self._PsIndex
  243. self._PrevIconIndex = self._IconIndex
  244. self._Icons[self._IconIndex]._PosY -= self._SelectedIconTopOffset
  245. def Init(self): ## default init way,
  246. if self._Screen != None:
  247. if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
  248. self._CanvasHWND = self._Screen._CanvasHWND
  249. self._PosX = self._Index*self._Screen._Width
  250. self._Width = self._Screen._Width ## equal to screen width
  251. self._Height = self._Screen._Height
  252. start_x = (self._Width - self._IconNumbers*icon_width)/2 + icon_width/2
  253. start_y = self._Height/2
  254. for i in range(0,self._IconNumbers):
  255. it = IconItem()
  256. it._Parent = self
  257. it._Index = i
  258. it.Init(start_x+i*icon_width,start_y,icon_width,icon_height,0)
  259. self._Icons.append(it)
  260. if self._IconNumbers > 0:
  261. ps = PageSelector()
  262. ps._IconSurf = MyIconPool._Icons["blueselector"]
  263. ps._Parent = self
  264. ps.Init(start_x,start_y,icon_width+4,icon_height+4,128)
  265. self._Ps = ps
  266. self._PsIndex = 0
  267. self._OnShow = False
  268. def IconStepMoveData(self,icon_eh,cuts):## no Sine,No curve,plain movement steps data
  269. all_pieces = []
  270. piece = icon_eh / cuts
  271. c = 0.0
  272. prev = 0.0
  273. for i in range(0,cuts):
  274. c+=piece
  275. dx = c-prev
  276. if dx < 0.5:
  277. dx = 1.0
  278. all_pieces.append( math.ceil(dx) )
  279. if c >= icon_eh:
  280. break
  281. c = 0
  282. bidx = 0
  283. for i in all_pieces:
  284. c+=i
  285. bidx+=1
  286. if c >= icon_eh:
  287. break
  288. all_pieces = all_pieces[0:bidx]
  289. if len(all_pieces) < cuts:
  290. dff = cuts - len(all_pieces)
  291. diffa = []
  292. for i in range(0,dff):
  293. diffa.append(0)
  294. all_pieces.extend( diffa)
  295. return all_pieces
  296. def EasingData(self,start,distance):##generate easing steps data
  297. current_time = 0.0
  298. start_posx = 0.0
  299. current_posx = start_posx
  300. final_posx = float(distance)
  301. posx_init = start
  302. dur = self._EasingDur
  303. last_posx = 0.0
  304. all_last_posx = []
  305. for i in range(0,distance*dur):
  306. current_posx = easing.SineIn(current_time,start_posx,final_posx-start_posx,float(dur))
  307. if current_posx >= final_posx:
  308. current_posx = final_posx
  309. dx = current_posx - last_posx
  310. all_last_posx.append(int(dx))
  311. current_time+=1
  312. last_posx = current_posx
  313. if current_posx >= final_posx:
  314. break
  315. c = 0
  316. for i in all_last_posx:
  317. c+=i
  318. if c < final_posx -start_posx:
  319. all_last_posx.append(final_posx - c)
  320. return all_last_posx
  321. def IconSmoothUp(self,icon_ew):
  322. data = self.EasingData(self._PosX,icon_ew)
  323. data2 = self.IconStepMoveData(self._SelectedIconTopOffset,len(data))
  324. for i,v in enumerate(data):
  325. self.ClearCanvas()
  326. self._Icons[self._IconIndex]._PosY -= data2[i]
  327. if self._Icons[self._PrevIconIndex]._PosY < self._Height/2:
  328. self._Icons[self._PrevIconIndex]._PosY+=data2[i]
  329. self.DrawIcons()
  330. self._Screen.SwapAndShow()
  331. def IconsEasingLeft(self,icon_ew):
  332. data = self.EasingData(self._PosX,icon_ew)
  333. data2 = self.IconStepMoveData(self._SelectedIconTopOffset,len(data))
  334. for i,v in enumerate(data):
  335. self.ClearCanvas()
  336. self._PosX -= v
  337. self._Icons[self._IconIndex]._PosY -= data2[i]
  338. if self._Icons[self._PrevIconIndex]._PosY < self._Height/2:
  339. self._Icons[self._PrevIconIndex]._PosY+=data2[i]
  340. self.DrawIcons()
  341. self._Screen.SwapAndShow()
  342. def IconsEasingRight(self,icon_ew):
  343. data = self.EasingData(self._PosX,icon_ew)
  344. data2 = self.IconStepMoveData(self._SelectedIconTopOffset,len(data))
  345. for i,v in enumerate(data):
  346. self.ClearCanvas()
  347. self._PosX += v
  348. self._Icons[self._IconIndex]._PosY-=data2[i]
  349. if self._Icons[self._PrevIconIndex]._PosY < self._Height/2:
  350. self._Icons[self._PrevIconIndex]._PosY+=data2[i]
  351. self.DrawIcons()
  352. self._Screen.SwapAndShow()
  353. def EasingLeft(self,ew): #ew int
  354. data = self.EasingData(self._PosX,ew)
  355. for i in data:
  356. self._PosX -=i
  357. self.Draw()
  358. self._Screen.SwapAndShow()
  359. def EasingRight(self,ew):
  360. data = self.EasingData(self._PosX,ew)
  361. for i in data:
  362. self._PosX += i
  363. self.Draw()
  364. self._Screen.SwapAndShow()
  365. def MoveLeft(self,ew):
  366. self._PosX -= ew
  367. def MoveRight(self,ew):
  368. self._PosX += ew
  369. def ResetPageSelector(self):
  370. self._PsIndex = 0
  371. self._IconIndex = 0
  372. self._Ps._OnShow = True
  373. def DrawPageSelector(self):
  374. if self._Ps._OnShow == True:
  375. self._Ps.Draw()
  376. def MoveIconIndexPrev(self):
  377. self._IconIndex-=1
  378. if self._IconIndex < 0:
  379. self._IconIndex = 0
  380. self._PrevIconIndex = self._IconIndex
  381. return False
  382. self._PrevIconIndex = self._IconIndex+1
  383. return True
  384. def MoveIconIndexNext(self):
  385. #True for Moved,False is boundary
  386. self._IconIndex+=1
  387. if self._IconIndex > (self._IconNumbers - 1):
  388. self._IconIndex = self._IconNumbers -1
  389. self._PrevIconIndex = self._IconIndex
  390. return False
  391. self._PrevIconIndex = self._IconIndex-1
  392. return True
  393. def IconClick(self):
  394. if self._IconIndex > (len(self._Icons) -1):
  395. return
  396. cur_icon = self._Icons[self._IconIndex]
  397. if self._Ps._OnShow == False:
  398. return
  399. if cur_icon._MyType == ICON_TYPES["EXE"]:
  400. print("IconClick: %s %d"%(cur_icon._CmdPath,cur_icon._Index))
  401. self._Screen.RunEXE(cur_icon._CmdPath)
  402. elif cur_icon._MyType == ICON_TYPES["DIR"]:
  403. child_page = self._Icons[self._IconIndex]._LinkPage
  404. if child_page != None:
  405. child_page.Draw()
  406. self._Screen._MyPageStack.Push(self._Screen._CurrentPage)
  407. self._Screen._CurrentPage = child_page
  408. elif cur_icon._MyType == ICON_TYPES["FUNC"]:
  409. print("IconClick API: %d"%(cur_icon._Index))
  410. #print("%s"% cur_icon._CmdPath)
  411. api_cb = getattr(cur_icon._CmdPath,"API",None)
  412. if api_cb != None:
  413. if callable(api_cb):
  414. cur_icon._CmdPath.API(self._Screen)
  415. elif cur_icon._MyType == ICON_TYPES["Emulator"]:
  416. cur_icon._CmdPath.API(self._Screen)
  417. def ReturnToUpLevelPage(self):
  418. pop_page,ok = self._Screen._MyPageStack.Pop()
  419. if ok == True:
  420. #self._Screen._CurrentPage.ResetPageSelector()
  421. pop_page.Draw()
  422. self._Screen._CurrentPage = pop_page
  423. on_return_back_cb = getattr(self._Screen._CurrentPage,"OnReturnBackCb",None)
  424. if on_return_back_cb != None:
  425. if callable(on_return_back_cb):
  426. self._Screen._CurrentPage.OnReturnBackCb()
  427. else:
  428. if self._Screen._MyPageStack.Length() == 0:
  429. if len(self._Screen._Pages) > 0:
  430. self._Screen._CurrentPage = self._Screen._Pages[self._Screen._PageIndex]
  431. self._Screen._CurrentPage.Draw()
  432. print("OnTopLevel ",self._Screen._PageIndex)
  433. def ClearCanvas(self):
  434. self._CanvasHWND.fill(self._Screen._SkinManager.GiveColor("White"))
  435. def ClearIcons(self):
  436. for i in range(0,self._IconNumbers):
  437. self._Icons[i].Clear()
  438. def DrawIcons(self):
  439. for i in range(0,self._IconNumbers):
  440. self._Icons[i].Draw()
  441. ##make sure the Class has the _MyList
  442. def ScrollDown(self):
  443. if len(self._MyList) == 0:
  444. return
  445. self._PsIndex +=1
  446. if self._PsIndex >= len(self._MyList):
  447. self._PsIndex = len(self._MyList) -1
  448. cur_li = self._MyList[self._PsIndex]
  449. if cur_li._PosY +cur_li._Height > self._Height:
  450. for i in range(0,len(self._MyList)):
  451. self._MyList[i]._PosY -= self._MyList[i]._Height
  452. def ScrollUp(self):
  453. if len(self._MyList) == 0:
  454. return
  455. self._PsIndex -= 1
  456. if self._PsIndex < 0:
  457. self._PsIndex = 0
  458. cur_li = self._MyList[self._PsIndex]
  459. if cur_li._PosY < 0:
  460. for i in range(0, len(self._MyList)):
  461. self._MyList[i]._PosY += self._MyList[i]._Height
  462. def FScrollUp(self,Step=1):
  463. if len(self._MyList) == 0:
  464. return
  465. tmp = self._PsIndex
  466. self._PsIndex -= Step
  467. if self._PsIndex < 0:
  468. self._PsIndex = 0
  469. dy = tmp-self._PsIndex
  470. cur_li = self._MyList[self._PsIndex]
  471. if cur_li._PosY < 0:
  472. for i in range(0, len(self._MyList)):
  473. self._MyList[i]._PosY += self._MyList[i]._Height*dy
  474. def FScrollDown(self,Step=1):
  475. if len(self._MyList) == 0:
  476. return
  477. tmp = self._PsIndex
  478. self._PsIndex +=Step
  479. if self._PsIndex >= len(self._MyList):
  480. self._PsIndex = len(self._MyList) -1
  481. dy = self._PsIndex - tmp
  482. cur_li = self._MyList[self._PsIndex]
  483. if cur_li._PosY +cur_li._Height > self._Height:
  484. for i in range(0,len(self._MyList)):
  485. self._MyList[i]._PosY -= self._MyList[i]._Height*dy
  486. def KeyDown(self,event):##default keydown,every inherited page class should have it's own KeyDown
  487. if event.key == CurKeys["A"]:
  488. if self._FootMsg[3] == "Back":
  489. self.ReturnToUpLevelPage()
  490. self._Screen.Draw()
  491. self._Screen.SwapAndShow()
  492. return
  493. if event.key == CurKeys["Menu"]:
  494. self.ReturnToUpLevelPage()
  495. self._Screen.Draw()
  496. self._Screen.SwapAndShow()
  497. if event.key == CurKeys["Right"]:
  498. if self.MoveIconIndexNext() == True:
  499. if self._IconIndex == (self._IconNumbers -1) or self._PrevIconIndex == 0:
  500. self.IconSmoothUp(icon_width+ self._PageIconMargin) # only move up selected icon,no horizontal translation
  501. else:
  502. self.IconsEasingLeft(icon_width + self._PageIconMargin)
  503. self._PsIndex = self._IconIndex
  504. self._Screen.Draw()
  505. self._Screen.SwapAndShow()
  506. if event.key == CurKeys["Left"]:
  507. if self.MoveIconIndexPrev() == True:
  508. if self._IconIndex == 0 or self._PrevIconIndex == (self._IconNumbers -1):
  509. self.IconSmoothUp(icon_width+ self._PageIconMargin)
  510. else:
  511. self.IconsEasingRight(icon_width + self._PageIconMargin)
  512. self._PsIndex = self._IconIndex
  513. self._Screen.Draw()
  514. self._Screen.SwapAndShow()
  515. if event.key == CurKeys["Enter"]:
  516. self.IconClick()
  517. self._Screen.Draw()
  518. self._Screen.SwapAndShow()
  519. def Draw(self):
  520. self.ClearCanvas()
  521. self.DrawIcons()
  522. self.DrawPageSelector()