From 3826d3cfe2cc066a59cec3ecae05eea6abfb6b29 Mon Sep 17 00:00:00 2001 From: cuu Date: Sun, 14 Jul 2019 10:52:32 +0800 Subject: [PATCH] theme background.png --- sys.py/UI/page.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sys.py/UI/page.py b/sys.py/UI/page.py index 8986b12..11cf283 100644 --- a/sys.py/UI/page.py +++ b/sys.py/UI/page.py @@ -17,12 +17,12 @@ from libs import easing # local import from constants import ALIGN, icon_width, icon_height, Width, Height, ICON_TYPES -from util_funcs import midRect +from util_funcs import midRect,FileExists from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB from icon_pool import MyIconPool from lang_manager import MyLangManager from widget import Widget - +import config class PageStack: def __init__(self): @@ -113,15 +113,13 @@ class Page(Widget): def __init__(self): self._Icons = [] - path = '/home/cpi/launcher/skin/default/Menu/GameShell/Wallpaper/' + ## so every theme can have a background.png for displaying as the background of the launcher,except the topbar and footbar + ## https://forum.clockworkpi.com/t/give-your-gs-a-custom-wallpaper/3724 + bg_img_path = config.SKIN+"/background.png" - if os.path.exists(path): - image = os.listdir(path)[0] - if image: - self._Wallpaper = pygame.transform.scale(pygame.image.load(path+image).convert(), (320,240)) + if FileExists(bg_img_path): + self._Wallpaper = pygame.transform.scale(pygame.image.load(bg_img_path).convert(), (320,240)) - - def AdjustHLeftAlign(self): ## adjust coordinator and append the PageSelector self._PosX = self._Index*self._Screen._Width self._Width = self._Screen._Width