mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 09:48:50 +01:00
add GiveWallpaper to allow the custom wallpaper from any Theme/skin
This commit is contained in:
parent
528e79648b
commit
4f354f28c2
@ -7,6 +7,8 @@ from UI.constants import RUNSYS
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
import config
|
||||
|
||||
class PowerOffConfirmPage(ConfirmPage):
|
||||
@ -48,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self.CheckBattery() < 20:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||
else:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||
|
||||
cmdpath += "sleep 3;"
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ from UI.constants import RUNSYS
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
import config
|
||||
|
||||
@ -49,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self.CheckBattery() < 20:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||
else:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||
|
||||
cmdpath += "sleep 3;"
|
||||
|
||||
@ -61,7 +62,7 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||
|
||||
if event.key == CurKeys["X"]:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||
cmdpath += "sleep 3;"
|
||||
cmdpath += "sudo reboot"
|
||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||
|
||||
@ -135,7 +135,22 @@ class SkinManager(object):
|
||||
return ret
|
||||
else: ## if not existed both in default or custom skin ,return where it is
|
||||
return orig_file_or_dir
|
||||
|
||||
|
||||
def GiveWallpaper(self,png_name):
|
||||
#first SKIN/wallpapers/xxxx.png
|
||||
#second ../skin/default/wallpapers/xxxx.png
|
||||
#finnal gameshell/wallpaper/xxxx.png
|
||||
#loading.png,seeyou.png,updating.png,gameover.png,desktopbg.png
|
||||
wlp = "/wallpaper/"
|
||||
if FileExists(config.SKIN+wlp+png_name):
|
||||
return config.SKIN+wlp+png_name
|
||||
elif FileExists(self.DefaultSkin+wlp+png_name):
|
||||
return self.DefaultSkin+wlp+png_name
|
||||
else:
|
||||
return "gameshell/wallpaper/"+png_name
|
||||
|
||||
|
||||
|
||||
##global MySkinManager Handler
|
||||
MySkinManager = None
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user