mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
commit
acb6774495
@ -329,7 +329,7 @@ class AboutPage(Page):
|
|||||||
self._DrawOnce = True
|
self._DrawOnce = True
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -318,7 +318,7 @@ class GateWayPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -278,7 +278,7 @@ class LanguagesPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import os
|
|||||||
import pygame
|
import pygame
|
||||||
#import math
|
#import math
|
||||||
#mport subprocess
|
#mport subprocess
|
||||||
import platform
|
|
||||||
#from beeprint import pp
|
#from beeprint import pp
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
## local UI import
|
## local UI import
|
||||||
|
from UI.util_funcs import ArmSystem
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
class APIOBJ(object):
|
class APIOBJ(object):
|
||||||
@ -24,9 +24,8 @@ class APIOBJ(object):
|
|||||||
main_screen._MsgBox.Draw()
|
main_screen._MsgBox.Draw()
|
||||||
main_screen.SwapAndShow()
|
main_screen.SwapAndShow()
|
||||||
pygame.time.delay(300)
|
pygame.time.delay(300)
|
||||||
if "arm" in platform.machine():
|
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||||
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
ArmSystem("sudo reboot")
|
||||||
os.system("sudo reboot")
|
|
||||||
|
|
||||||
OBJ = APIOBJ()
|
OBJ = APIOBJ()
|
||||||
def Init(main_screen):
|
def Init(main_screen):
|
||||||
|
|||||||
@ -267,7 +267,7 @@ class GPUDriverPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -521,7 +521,7 @@ class PowerOptionsPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
294
Menu/GameShell/10_Settings/Skins/__init__.py
Normal file
294
Menu/GameShell/10_Settings/Skins/__init__.py
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import pygame
|
||||||
|
#import commands
|
||||||
|
import glob
|
||||||
|
#from beeprint import pp
|
||||||
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
|
## local UI import
|
||||||
|
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||||
|
from UI.page import Page,PageSelector
|
||||||
|
from UI.label import Label
|
||||||
|
from UI.util_funcs import midRect,FileExists
|
||||||
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
|
from UI.scroller import ListScroller
|
||||||
|
from UI.icon_pool import MyIconPool
|
||||||
|
from UI.icon_item import IconItem
|
||||||
|
from UI.multilabel import MultiLabel
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.info_page_list_item import InfoPageListItem
|
||||||
|
from UI.info_page_selector import InfoPageSelector
|
||||||
|
|
||||||
|
import config
|
||||||
|
|
||||||
|
class ListPageSelector(InfoPageSelector):
|
||||||
|
def Draw(self):
|
||||||
|
idx = self._Parent._PsIndex
|
||||||
|
|
||||||
|
if idx < len(self._Parent._MyList):
|
||||||
|
x = self._Parent._MyList[idx]._PosX+2 ## ++
|
||||||
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
|
self._PosX = x
|
||||||
|
self._PosY = y
|
||||||
|
self._Height = h
|
||||||
|
|
||||||
|
aa_round_rect(self._Parent._CanvasHWND,
|
||||||
|
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||||
|
|
||||||
|
|
||||||
|
class PageListItem(InfoPageListItem):
|
||||||
|
_PosX = 0
|
||||||
|
_PosY = 0
|
||||||
|
_Width = 0
|
||||||
|
_Height = 30
|
||||||
|
|
||||||
|
_Labels = {}
|
||||||
|
_Icons = {}
|
||||||
|
_Fonts = {}
|
||||||
|
|
||||||
|
_LinkObj = None
|
||||||
|
|
||||||
|
_Active = False
|
||||||
|
_Value = ""
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
|
||||||
|
|
||||||
|
if self._Active == True:
|
||||||
|
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
|
||||||
|
self._Parent._Icons["done"].Draw()
|
||||||
|
|
||||||
|
self._Labels["Text"].Draw(self._Active)
|
||||||
|
|
||||||
|
if "Small" in self._Labels:
|
||||||
|
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
|
||||||
|
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
||||||
|
self._Labels["Small"].Draw()
|
||||||
|
|
||||||
|
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||||
|
|
||||||
|
class SkinsPage(Page):
|
||||||
|
_FootMsg = ["Nav","","Scan","Back","Select"]
|
||||||
|
_MyList = []
|
||||||
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
_BGwidth = 320
|
||||||
|
_BGheight = 240-24-20
|
||||||
|
|
||||||
|
_DrawOnce = False
|
||||||
|
_Scroller = None
|
||||||
|
_InfoPage = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Page.__init__(self)
|
||||||
|
self._Icons = {}
|
||||||
|
|
||||||
|
def GenList(self):
|
||||||
|
self._MyList = []
|
||||||
|
|
||||||
|
start_x = 0
|
||||||
|
start_y = 0
|
||||||
|
last_height = 0
|
||||||
|
|
||||||
|
|
||||||
|
skins = [["../skin/default","Default"]]
|
||||||
|
files_path = glob.glob("/home/cpi/skins/*")
|
||||||
|
|
||||||
|
for i ,v in enumerate(files_path):
|
||||||
|
if os.path.isdir(v):
|
||||||
|
bname = os.path.basename(v)
|
||||||
|
print(v,bname)
|
||||||
|
skins.append([v,bname])
|
||||||
|
|
||||||
|
for i,u in enumerate( skins ):
|
||||||
|
#print(i,u)
|
||||||
|
li = PageListItem()
|
||||||
|
li._Parent = self
|
||||||
|
li._PosX = start_x
|
||||||
|
li._PosY = start_y + last_height
|
||||||
|
li._Width = Width
|
||||||
|
li._Fonts["normal"] = self._ListFont
|
||||||
|
li._Active = False
|
||||||
|
li._Value = u[0]
|
||||||
|
li.Init( u[1] )
|
||||||
|
|
||||||
|
last_height += li._Height
|
||||||
|
|
||||||
|
self._MyList.append(li)
|
||||||
|
|
||||||
|
def Init(self):
|
||||||
|
if self._Screen != None:
|
||||||
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
|
self._HWND = self._Screen._CanvasHWND
|
||||||
|
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
||||||
|
|
||||||
|
self._PosX = self._Index*self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
done = IconItem()
|
||||||
|
done._ImgSurf = MyIconPool._Icons["done"]
|
||||||
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
|
done._Parent = self
|
||||||
|
self._Icons["done"] = done
|
||||||
|
|
||||||
|
ps = ListPageSelector()
|
||||||
|
ps._Parent = self
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = self._Width - 10
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
self._Scroller.SetCanvasHWND(self._HWND)
|
||||||
|
|
||||||
|
def Click(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._Active == True:
|
||||||
|
return
|
||||||
|
|
||||||
|
print(cur_li._Value)
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
cur_li._Active = True
|
||||||
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if "../skin/default" in cur_li._Value:
|
||||||
|
os.system("rm %s/.gameshell_skin" % os.path.expanduser('~') )
|
||||||
|
else:
|
||||||
|
os.system("echo %s > %s/.gameshell_skin" % (cur_li._Value,os.path.expanduser('~') ))
|
||||||
|
|
||||||
|
pygame.time.delay(700)
|
||||||
|
pygame.event.post( pygame.event.Event(RESTARTUI, message=""))
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Scrolled = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._DrawOnce = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
if config.SKIN in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
pass
|
||||||
|
"""
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
"""
|
||||||
|
def KeyDown(self,event):
|
||||||
|
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["X"]:
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
if config.SKIN in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self.ClearCanvas()
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(self._MyList) * PageListItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 11
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
if self._HWND != None:
|
||||||
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = SkinsPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Skin selection"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
@ -65,6 +65,7 @@ class ListPage(Page):
|
|||||||
["","About", "About"],
|
["","About", "About"],
|
||||||
["","PowerOFF","Power OFF"],
|
["","PowerOFF","Power OFF"],
|
||||||
["","ButtonsLayout","Buttons Layout"],
|
["","ButtonsLayout","Buttons Layout"],
|
||||||
|
["","Skins","Skins"],
|
||||||
["","LauncherGo","Switch to LauncherGo"],
|
["","LauncherGo","Switch to LauncherGo"],
|
||||||
["","Lima","GPU driver switch"],
|
["","Lima","GPU driver switch"],
|
||||||
["","GateWay","Network gateway switch"]]
|
["","GateWay","Network gateway switch"]]
|
||||||
|
|||||||
@ -12,7 +12,7 @@ from icon_item import IconItem
|
|||||||
from page import Page,PageStack
|
from page import Page,PageStack
|
||||||
from title_bar import TitleBar
|
from title_bar import TitleBar
|
||||||
from foot_bar import FootBar
|
from foot_bar import FootBar
|
||||||
from constants import Width,Height,bg_color
|
from constants import Width,Height
|
||||||
from util_funcs import midRect
|
from util_funcs import midRect
|
||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from label import Label
|
from label import Label
|
||||||
|
|||||||
@ -12,12 +12,10 @@ from pygame.locals import *
|
|||||||
#from beeprint import pp
|
#from beeprint import pp
|
||||||
|
|
||||||
#UI lib
|
#UI lib
|
||||||
from skin_manager import MySkinManager
|
|
||||||
|
|
||||||
|
|
||||||
Width = 320
|
Width = 320
|
||||||
Height = 240
|
Height = 240
|
||||||
bg_color = MySkinManager.GiveColor('White')
|
|
||||||
|
|
||||||
icon_width = 80
|
icon_width = 80
|
||||||
icon_height = 80
|
icon_height = 80
|
||||||
|
|||||||
@ -34,6 +34,19 @@ class IconPool(object):
|
|||||||
if keyname in self._Sizes:
|
if keyname in self._Sizes:
|
||||||
return self._Sizes[keyname][1]
|
return self._Sizes[keyname][1]
|
||||||
|
|
||||||
|
def GiveIconSurface(self,imgname): ## imgname is the png file name without .png
|
||||||
|
if imgname in self._Icons:
|
||||||
|
return self._Icons[imgname]
|
||||||
|
else:
|
||||||
|
icon_file = MySkinManager.GiveIcon("gameshell/icons/"+imgname+".png")
|
||||||
|
if os.path.isfile(icon_file):
|
||||||
|
keyname = imgname
|
||||||
|
self._Icons[keyname] = pygame.image.load(icon_file).convert_alpha()
|
||||||
|
self._Sizes[keyname] = self._Icons[keyname].get_size()
|
||||||
|
return self._Icons[keyname]
|
||||||
|
|
||||||
|
return None # this will cause panic,if not found both in theme and default skin folder
|
||||||
|
|
||||||
##global Handler
|
##global Handler
|
||||||
MyIconPool = None
|
MyIconPool = None
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from icon_item import IconItem
|
|||||||
from page import Page,PageStack
|
from page import Page,PageStack
|
||||||
from title_bar import TitleBar
|
from title_bar import TitleBar
|
||||||
from foot_bar import FootBar
|
from foot_bar import FootBar
|
||||||
from constants import Width,Height,bg_color
|
from constants import Width,Height
|
||||||
from util_funcs import midRect,FileExists,ReplaceSuffix,ReadTheFileContent,CmdClean,MakeExecutable
|
from util_funcs import midRect,FileExists,ReplaceSuffix,ReadTheFileContent,CmdClean,MakeExecutable
|
||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from label import Label
|
from label import Label
|
||||||
|
|||||||
@ -117,7 +117,7 @@ class SkinManager(object):
|
|||||||
else:
|
else:
|
||||||
return pygame.Color(255,0,0)
|
return pygame.Color(255,0,0)
|
||||||
|
|
||||||
def GiveIcon(self,orig_file_or_dir):
|
def GiveIcon(self,orig_file_or_dir): ## return is string,not Surface
|
||||||
#doing a wrapper for items under /home/cpi/apps/Menu/*, to be like Menu/GameShell/*
|
#doing a wrapper for items under /home/cpi/apps/Menu/*, to be like Menu/GameShell/*
|
||||||
if orig_file_or_dir.startswith("/home/cpi/apps/Menu"):
|
if orig_file_or_dir.startswith("/home/cpi/apps/Menu"):
|
||||||
orig_file_or_dir = orig_file_or_dir.replace("/home/cpi/apps/Menu/","../Menu/GameShell/")
|
orig_file_or_dir = orig_file_or_dir.replace("/home/cpi/apps/Menu/","../Menu/GameShell/")
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import platform
|
||||||
import pygame
|
import pygame
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -110,3 +110,14 @@ def DrawText(canvas,text, x,y,width,height,canWidth,canHeight,fontObj):# text fo
|
|||||||
|
|
||||||
def SwapAndShow():
|
def SwapAndShow():
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
|
def ArmSystem(cmd):
|
||||||
|
if "arm" not in platform.machine():
|
||||||
|
return
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
def InGameShell():
|
||||||
|
if "arm" not in platform.machine():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
from UI.util_funcs import FileExists,ArmSystem
|
||||||
|
|
||||||
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
||||||
|
|
||||||
@ -14,7 +17,7 @@ UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI/master/launcher_ve
|
|||||||
|
|
||||||
VERSION="stable 1.24"
|
VERSION="stable 1.24"
|
||||||
|
|
||||||
SKIN="../skin/default"
|
SKIN=None
|
||||||
|
|
||||||
## three timer values in seconds: dim screen, close screen,PowerOff
|
## three timer values in seconds: dim screen, close screen,PowerOff
|
||||||
## zero means no action
|
## zero means no action
|
||||||
@ -26,5 +29,38 @@ PowerLevels["balance_saving"] = [40,0,0]
|
|||||||
|
|
||||||
PowerLevel = "balance_saving"
|
PowerLevel = "balance_saving"
|
||||||
|
|
||||||
|
def PreparationInAdv():
|
||||||
|
global SKIN
|
||||||
|
global PowerLevel
|
||||||
|
|
||||||
|
if SKIN != None:
|
||||||
|
return
|
||||||
|
|
||||||
|
SKIN= "../skin/default"
|
||||||
|
|
||||||
|
if FileExists("%s/.gameshell_skin" % os.path.expanduser('~')) == True:
|
||||||
|
with open("%s/.gameshell_skin" % os.path.expanduser('~'),"r") as f:
|
||||||
|
gameshell_skin = f.read()
|
||||||
|
|
||||||
|
gameshell_skin = gameshell_skin.strip()
|
||||||
|
SKIN= gameshell_skin
|
||||||
|
|
||||||
|
if FileExists(".powerlevel") == False:
|
||||||
|
os.system("touch .powerlevel")
|
||||||
|
|
||||||
|
with open(".powerlevel","r") as f:
|
||||||
|
powerlevel = f.read()
|
||||||
|
|
||||||
|
powerlevel = powerlevel.strip()
|
||||||
|
if powerlevel != "":
|
||||||
|
PowerLevel = powerlevel
|
||||||
|
if powerlevel != "supersaving":
|
||||||
|
ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
|
||||||
|
else:
|
||||||
|
ArmSystem("sudo iw wlan0 set power_save on > /dev/null")
|
||||||
|
else:
|
||||||
|
ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
|
||||||
|
|
||||||
|
PreparationInAdv()
|
||||||
##sys.py/.powerlevel
|
##sys.py/.powerlevel
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import platform
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import sys
|
import sys
|
||||||
@ -24,7 +24,7 @@ import pygame
|
|||||||
from sys import exit
|
from sys import exit
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from beeprint import pp
|
#from beeprint import pp
|
||||||
########
|
########
|
||||||
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
||||||
import dbus.glib
|
import dbus.glib
|
||||||
@ -32,10 +32,10 @@ else:
|
|||||||
from dbus.mainloop.glib import DBusGMainLoop
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
DBusGMainLoop(set_as_default=True)
|
DBusGMainLoop(set_as_default=True)
|
||||||
|
|
||||||
|
import config
|
||||||
#local UI import
|
#local UI import
|
||||||
from UI.constants import Width,Height,bg_color,icon_width,icon_height,DT,RUNEVT,RUNSYS,ICON_TYPES,POWEROPT,RESTARTUI,RUNSH
|
from UI.constants import Width,Height,icon_width,icon_height,DT,RUNEVT,RUNSYS,ICON_TYPES,POWEROPT,RESTARTUI,RUNSH
|
||||||
from UI.util_funcs import ReplaceSuffix,FileExists, ReadTheFileContent,midRect,color_surface,SwapAndShow,GetExePath,X_center_mouse
|
from UI.util_funcs import ReplaceSuffix,FileExists, ReadTheFileContent,midRect,color_surface,SwapAndShow,GetExePath,X_center_mouse,ArmSystem
|
||||||
from UI.page import PageStack,PageSelector,Page
|
from UI.page import PageStack,PageSelector,Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
@ -46,10 +46,9 @@ from UI.main_screen import MainScreen
|
|||||||
from UI.above_all_patch import SoundPatch
|
from UI.above_all_patch import SoundPatch
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.createby_screen import CreateByScreen
|
from UI.createby_screen import CreateByScreen
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
from libs.DBUS import setup_dbus
|
from libs.DBUS import setup_dbus
|
||||||
|
|
||||||
import config
|
|
||||||
|
|
||||||
if not pygame.display.get_init():
|
if not pygame.display.get_init():
|
||||||
pygame.display.init()
|
pygame.display.init()
|
||||||
@ -378,6 +377,7 @@ def event_process(event,main_screen):
|
|||||||
os.chdir(GetExePath())
|
os.chdir(GetExePath())
|
||||||
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||||
print(exec_app_cmd)
|
print(exec_app_cmd)
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
os.chdir( GetExePath())
|
os.chdir( GetExePath())
|
||||||
os.exelp("python","python"," "+myscriptname)
|
os.exelp("python","python"," "+myscriptname)
|
||||||
@ -386,6 +386,7 @@ def event_process(event,main_screen):
|
|||||||
pygame.quit()
|
pygame.quit()
|
||||||
gobject_main_loop.quit()
|
gobject_main_loop.quit()
|
||||||
exec_app_cmd = event.message +";"
|
exec_app_cmd = event.message +";"
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
return
|
return
|
||||||
@ -555,7 +556,7 @@ def big_loop():
|
|||||||
sound_patch.Init()
|
sound_patch.Init()
|
||||||
#pp(main_screen._Pages[0],True,6)
|
#pp(main_screen._Pages[0],True,6)
|
||||||
|
|
||||||
screen.fill(bg_color)
|
screen.fill(MySkinManager.GiveColor("White"))
|
||||||
main_screen.Draw()
|
main_screen.Draw()
|
||||||
main_screen.SwapAndShow()
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
@ -571,34 +572,6 @@ def big_loop():
|
|||||||
gobject_loop()
|
gobject_loop()
|
||||||
|
|
||||||
|
|
||||||
def PreparationInAdv():
|
|
||||||
|
|
||||||
if "arm" not in platform.machine():
|
|
||||||
return
|
|
||||||
|
|
||||||
if FileExists("%s/.gameshell_skin" % os.path.expanduser('~')) == True:
|
|
||||||
with open("%s/.gameshell_skin" % os.path.expanduser('~'),"r") as f:
|
|
||||||
gameshell_skin = f.read()
|
|
||||||
|
|
||||||
gameshell_skin = gameshell_skin.strip()
|
|
||||||
config.SKIN= gameshell_skin
|
|
||||||
|
|
||||||
if FileExists(".powerlevel") == False:
|
|
||||||
os.system("touch .powerlevel")
|
|
||||||
|
|
||||||
with open(".powerlevel","r") as f:
|
|
||||||
powerlevel = f.read()
|
|
||||||
|
|
||||||
powerlevel = powerlevel.strip()
|
|
||||||
if powerlevel != "":
|
|
||||||
config.PowerLevel = powerlevel
|
|
||||||
if powerlevel != "supersaving":
|
|
||||||
os.system("sudo iw wlan0 set power_save off >/dev/null")
|
|
||||||
else:
|
|
||||||
os.system("sudo iw wlan0 set power_save on > /dev/null")
|
|
||||||
else:
|
|
||||||
os.system("sudo iw wlan0 set power_save off >/dev/null")
|
|
||||||
|
|
||||||
###MAIN()###
|
###MAIN()###
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
@ -615,7 +588,6 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
pygame.key.set_repeat(DT+DT*6+DT/2, DT+DT*3+DT/2)
|
pygame.key.set_repeat(DT+DT*6+DT/2, DT+DT*3+DT/2)
|
||||||
|
|
||||||
|
|
||||||
MyIconPool.Init()
|
MyIconPool.Init()
|
||||||
|
|
||||||
setup_dbus()
|
setup_dbus()
|
||||||
@ -632,8 +604,6 @@ if __name__ == '__main__':
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
PreparationInAdv()
|
|
||||||
|
|
||||||
crt_screen = CreateByScreen()
|
crt_screen = CreateByScreen()
|
||||||
crt_screen.Init()
|
crt_screen.Init()
|
||||||
crt_screen._HWND = screen
|
crt_screen._HWND = screen
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user