mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58: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.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class PowerOffConfirmPage(ConfirmPage):
|
class PowerOffConfirmPage(ConfirmPage):
|
||||||
@ -48,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
if IsKeyStartOrA(event.key):
|
if IsKeyStartOrA(event.key):
|
||||||
if self.CheckBattery() < 20:
|
if self.CheckBattery() < 20:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||||
else:
|
else:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
|
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ from UI.constants import RUNSYS
|
|||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -49,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
if IsKeyStartOrA(event.key):
|
if IsKeyStartOrA(event.key):
|
||||||
if self.CheckBattery() < 20:
|
if self.CheckBattery() < 20:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||||
else:
|
else:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
|
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||||
|
|
||||||
if event.key == CurKeys["X"]:
|
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 += "sleep 3;"
|
||||||
cmdpath += "sudo reboot"
|
cmdpath += "sudo reboot"
|
||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||||
|
|||||||
@ -136,6 +136,21 @@ class SkinManager(object):
|
|||||||
else: ## if not existed both in default or custom skin ,return where it is
|
else: ## if not existed both in default or custom skin ,return where it is
|
||||||
return orig_file_or_dir
|
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
|
##global MySkinManager Handler
|
||||||
MySkinManager = None
|
MySkinManager = None
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user