main_screen.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import pygame
  2. import config_manager as config
  3. import skin_manager as SkinManager
  4. import GdUI as UI
  5. class MainScreen(UI.Container):
  6. def __init__(self, width, height):
  7. super().__init__(x=0, y=0, width=width, height=height)
  8. self._TitleBar = UI.FlowContainer(x=0, y=0, width=width, height=25)
  9. self._TitleBar.set_bgcolor(SkinManager.get_color("title_bg"))
  10. self._TitleBar_line = UI.Widget(x=0, y=24, width=width, height=1,
  11. bg_color=SkinManager.get_color("line"))
  12. self._FootBar = UI.FlowContainer(x=0, y=height - 20, width=width, height=20)
  13. self._FootBar.set_bgcolor(SkinManager.get_color("white"))
  14. self._FootBar_line = UI.Widget(x=0, y=0, width=width, height=1,
  15. bg_color=SkinManager.get_color("line"))
  16. self._AppletContainer = UI.Container(x=0, y=25, width=width, height=height-25-20,
  17. bg_color=SkinManager.get_color("bgcolor"))
  18. self._corner_ul = UI.Image(x=0, y=0, image=UI.ImageManager.get_sprite("corners_tiles", 10, 10, 1))
  19. self._corner_ur = UI.Image(x=width - 10, y=0,
  20. image=UI.ImageManager.get_sprite("corners_tiles", 10, 10, 2))
  21. self._corner_dl = UI.Image(x=0, y=height - 10,
  22. image=UI.ImageManager.get_sprite("corners_tiles", 10, 10, 3))
  23. self._corner_dr = UI.Image(x=width - 10, y=height - 10,
  24. image=UI.ImageManager.get_sprite("corners_tiles", 10, 10, 4))
  25. self.add_child(self._TitleBar)
  26. self.add_child(self._FootBar)
  27. self._FootBar.add_child(self._FootBar_line)
  28. self._TitleBar.add_child(self._TitleBar_line)
  29. self.add_child(self._AppletContainer)
  30. self.add_child(self._corner_ul)
  31. self.add_child(self._corner_ur)
  32. self.add_child(self._corner_dl)
  33. self.add_child(self._corner_dr)
  34. # Title on top
  35. self._Title = "GameShell"
  36. self._TitleLbl = UI.Label(color=SkinManager.get_color("text"), font_obj=UI.FontManager.get_font("varela_16"),
  37. text=self._Title)
  38. self._TitleBar.add_left_child(self._TitleLbl)
  39. def reload(self):
  40. # Do nothing for now, later reload info from skinmanager
  41. pass