list_item.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # -*- coding: utf-8 -*-
  2. import pygame
  3. ## local UI import
  4. from UI.page import Page
  5. from UI.label import Label
  6. from UI.fonts import fonts
  7. from UI.lang_manager import MyLangManager
  8. # a item for List
  9. # - - - - - - - - - - - --
  10. # | Icon Text..... > |
  11. # ------------------------
  12. import myvars # icons_path
  13. class ListItem(object):
  14. _PosX = 0
  15. _PosY = 0
  16. _Width = 0
  17. _Height = 30
  18. _Labels = {}
  19. _Icons = {}
  20. _Fonts = {}
  21. _LinkObj = None
  22. def __init__(self):
  23. self._Labels = {}
  24. self._Icons = {}
  25. self._Fonts = {}
  26. def Init(self,text):
  27. #self._Fonts["normal"] = fonts["veramono12"]
  28. l = Label()
  29. l._PosX = 16
  30. l.SetCanvasHWND(self._Parent._CanvasHWND)
  31. text = MyLangManager.Tr(text)
  32. l.Init(text,self._Fonts["normal"])
  33. self._Labels["Text"] = l
  34. def Draw(self):
  35. self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
  36. self._Labels["Text"].Draw()
  37. pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)