page.py 22 KB

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