2
.cpirc
@ -1,7 +1,7 @@
|
||||
SCREEN=`cat /sys/class/graphics/fb0/modes`
|
||||
|
||||
XORG_CONF="~/launcher/.xorg.conf"
|
||||
if [ -f ~/.lima ]
|
||||
if [ -f /home/cpi/.lima ]
|
||||
then
|
||||
XORG_CONF="~/launcher/.xorg_lima.conf"
|
||||
fi
|
||||
|
||||
9
.gitignore
vendored
@ -12,3 +12,12 @@ sys.py/.lang
|
||||
!**/Jobs/00_lowpower.sh
|
||||
!**/Jobs/00_lowpower.alias
|
||||
.done
|
||||
bios
|
||||
bios/*
|
||||
screenshots
|
||||
screenshots/*
|
||||
.pcsx
|
||||
.pcsx/*
|
||||
*.log
|
||||
.DS_Store
|
||||
sys.py/.*
|
||||
|
||||
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "Pcsx"]
|
||||
path = Menu/GameShell/20_Retro Games/Pcsx
|
||||
url = https://github.com/cuu/Pcsx.git
|
||||
8
LICENSE
@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
@ -12,15 +12,16 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.icon_item import IconItem
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.multilabel import MultiLabel
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
|
||||
from config import VERSION
|
||||
|
||||
class InfoPageListItem(object):
|
||||
_PosX = 0
|
||||
@ -79,7 +80,7 @@ class InfoPageListItem(object):
|
||||
class AboutPage(Page):
|
||||
_FootMsg = ["Nav.","","","Back",""]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela13"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@ -208,6 +209,31 @@ class AboutPage(Page):
|
||||
self._AList["memory"] = memory
|
||||
break
|
||||
|
||||
def LauncherVersion(self):
|
||||
launcher_version = {}
|
||||
launcher_version["key"] = "launcher_ver"
|
||||
launcher_version["label"] = "Launcher:"
|
||||
launcher_version["value"] = VERSION
|
||||
self._AList["launcher_ver"] = launcher_version
|
||||
|
||||
def OsImageVersion(self):
|
||||
if FileExists("/etc/clockworkpi_os_image_version"):
|
||||
try:
|
||||
with open("/etc/clockworkpi_os_image_version") as f:
|
||||
content = f.readlines()
|
||||
content = [x.strip() for x in content]
|
||||
|
||||
except:
|
||||
print("open %s failed" % "/etc/clockworkpi_os_image_version")
|
||||
content = None
|
||||
|
||||
if content != None and len(content) > 0:
|
||||
os_image_ver = {}
|
||||
os_image_ver["key"] = "os_image_ver"
|
||||
os_image_ver["label"] = "OS Image:"
|
||||
os_image_ver["value"] = content[0][:12]
|
||||
self._AList["os_image_ver"] = os_image_ver
|
||||
|
||||
def GenList(self):
|
||||
|
||||
self._MyList = []
|
||||
@ -216,7 +242,7 @@ class AboutPage(Page):
|
||||
start_y = 10
|
||||
last_height = 0
|
||||
|
||||
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname"] ):
|
||||
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver"] ):
|
||||
#for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
|
||||
if u not in self._AList:
|
||||
continue
|
||||
@ -229,7 +255,7 @@ class AboutPage(Page):
|
||||
li._PosY = start_y + last_height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
|
||||
if self._AList[u]["label"] != "":
|
||||
li.Init( self._AList[u]["label"] )
|
||||
@ -248,14 +274,14 @@ class AboutPage(Page):
|
||||
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._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight+50) )
|
||||
|
||||
self._PosX = self._Index*self._Screen._Width
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
||||
bgpng = MultiIconItem()
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@ -267,6 +293,9 @@ class AboutPage(Page):
|
||||
self.CpuMhz()
|
||||
self.Uname()
|
||||
|
||||
self.LauncherVersion()
|
||||
self.OsImageVersion()
|
||||
|
||||
self.GenList()
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
@ -278,7 +307,7 @@ class AboutPage(Page):
|
||||
|
||||
def ScrollDown(self):
|
||||
dis = 10
|
||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 50:
|
||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 100:
|
||||
self._PosY -= dis
|
||||
self._Scrolled -= dis
|
||||
|
||||
@ -321,16 +350,19 @@ class AboutPage(Page):
|
||||
self.ClearCanvas()
|
||||
#self._Ps.Draw()
|
||||
|
||||
self._Icons["bg"].NewCoord(self._Width/2,self._Height/2 + (self._BGheight - Height)/2 + self._Screen._TitleBar._Height)
|
||||
self._Icons["bg"].Draw()
|
||||
|
||||
for i in self._MyList:
|
||||
i.Draw()
|
||||
|
||||
self._DrawOnce = True
|
||||
|
||||
self._Icons["bg"].DrawRect((230,0,82,184),(228,0,82,184))
|
||||
|
||||
y = self._MyList[len(self._MyList)-1]._PosY+30
|
||||
|
||||
self._Icons["bg"].DrawRect(( (self._Width-191)/2,y,191,68),(65,232,191,68))
|
||||
|
||||
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 ) )
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -66,21 +65,21 @@ class AirplanePage(Page):
|
||||
|
||||
|
||||
airwire = IconItem()
|
||||
airwire._ImgSurf = MyIconPool._Icons["airwire"]
|
||||
airwire._ImgSurf = MyIconPool.GiveIconSurface("airwire")
|
||||
airwire._MyType = ICON_TYPES["STAT"]
|
||||
airwire._Parent = self
|
||||
airwire.Adjust(0,0,5,43,0)
|
||||
self._Icons["airwire"] = airwire
|
||||
|
||||
GS = IconItem()
|
||||
GS._ImgSurf = MyIconPool._Icons["GS"]
|
||||
GS._ImgSurf = MyIconPool.GiveIconSurface("GS")
|
||||
GS._MyType = ICON_TYPES["STAT"]
|
||||
GS._Parent = self
|
||||
GS.Adjust(0,0,72,95,0)
|
||||
self._Icons["GS"] = GS
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"]
|
||||
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("DialogBoxs")
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 134
|
||||
@ -91,7 +90,7 @@ class AirplanePage(Page):
|
||||
|
||||
"""
|
||||
bgpng = MultiIconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
@ -15,7 +15,6 @@ from libs.DBUS import bus, adapter,devices
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -100,8 +99,8 @@ class BleInfoPage(Page):
|
||||
_FootMsg = ["Nav","Forget","Disconnect","Back",""]
|
||||
_MyList = []
|
||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||
_ListSmFontObj = fonts["varela12"] # small font
|
||||
_ListSm2FontObj= fonts["varela11"]
|
||||
_ListSmFontObj = MySkinManager.GiveFont("varela12") # small font
|
||||
_ListSm2FontObj= MySkinManager.GiveFont("varela11")
|
||||
|
||||
_AList = {}
|
||||
_Path = ""
|
||||
@ -380,7 +379,7 @@ class BluetoothPage(Page):
|
||||
_LastStatusMsg = ""
|
||||
_FootMsg = ["Nav","Info","Scan","Back","TryConnect"]
|
||||
_Scroller = None
|
||||
_ListFontObj = fonts["notosanscjk15"]
|
||||
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_InfoPage = None
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ import pygame
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
@ -99,7 +98,7 @@ class NetItem(object):
|
||||
self._Labels["mac_addr"] = name_label
|
||||
|
||||
done_icon = NetItemIcon()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.slider import Slider
|
||||
@ -40,7 +39,7 @@ class BSlider(Slider):
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["light"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("light")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@ -50,7 +49,7 @@ class BSlider(Slider):
|
||||
scale = MultiIconItem()
|
||||
scale._MyType = ICON_TYPES["STAT"]
|
||||
scale._Parent = self
|
||||
scale._ImgSurf = MyIconPool._Icons["scale"]
|
||||
scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||
scale._IconWidth = 82
|
||||
scale._IconHeight = 63
|
||||
scale.Adjust(0,0,82,63,0)
|
||||
|
||||
@ -9,7 +9,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, GetButtonsLayoutMode, SetButtonsLayoutMode, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -117,7 +116,6 @@ class UpdateConfirmPage(ConfirmPage):
|
||||
class ButtonsLayoutPage(Page):
|
||||
_FootMsg = ["Nav.","","UpdateRetroArch","Back","Toggle"]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela13"]
|
||||
|
||||
_AList = {}
|
||||
|
||||
@ -155,7 +153,7 @@ class ButtonsLayoutPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
|
||||
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("buttonslayout")
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 300
|
||||
|
||||
@ -11,7 +11,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -78,7 +77,7 @@ class PageListItem(InfoPageListItem):
|
||||
class GateWayPage(Page):
|
||||
_FootMsg = ["Nav","Clear All","","Back","Select"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@ -134,7 +133,7 @@ class GateWayPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@ -319,7 +318,7 @@ class GateWayPage(Page):
|
||||
i.Draw()
|
||||
|
||||
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 ) )
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -77,7 +76,7 @@ class PageListItem(InfoPageListItem):
|
||||
class LanguagesPage(Page):
|
||||
_FootMsg = ["Nav","","","Back","Select"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@ -134,7 +133,7 @@ class LanguagesPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@ -279,7 +278,7 @@ class LanguagesPage(Page):
|
||||
i.Draw()
|
||||
|
||||
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 ) )
|
||||
|
||||
|
||||
@ -3,12 +3,32 @@ import os
|
||||
import pygame
|
||||
#import math
|
||||
#mport subprocess
|
||||
import platform
|
||||
#from beeprint import pp
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.util_funcs import ArmSystem
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.confirm_page import ConfirmPage
|
||||
|
||||
class SwitchToLauncherGoConfirmPage(ConfirmPage):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
ArmSystem("sudo reboot")
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
@ -17,16 +37,16 @@ class APIOBJ(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
pass
|
||||
self._Page = SwitchToLauncherGoConfirmPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Switch To LauncherGo"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
main_screen._MsgBox.Draw()
|
||||
main_screen.PushPage(self._Page)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
if "arm" in platform.machine():
|
||||
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
os.system("sudo reboot")
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
|
||||
@ -11,8 +11,7 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.util_funcs import midRect,FileExists,ArmSystem
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
from UI.icon_pool import MyIconPool
|
||||
@ -77,7 +76,7 @@ class PageListItem(InfoPageListItem):
|
||||
class GPUDriverPage(Page):
|
||||
_FootMsg = ["Nav","","","Back","Select"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk12")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@ -102,8 +101,8 @@ class GPUDriverPage(Page):
|
||||
start_y = 0
|
||||
last_height = 0
|
||||
|
||||
drivers = [["fbturbo","Fbturbo"],
|
||||
["modesetting","Lima"]]
|
||||
drivers = [["fbturbo","FBTURBO driver (Software Rendering)"],
|
||||
["modesetting","LIMA driver (Experimental Hardware Rendering)"]]
|
||||
|
||||
|
||||
for i,u in enumerate( drivers ):
|
||||
@ -133,7 +132,7 @@ class GPUDriverPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@ -171,10 +170,16 @@ class GPUDriverPage(Page):
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if "modesetting" in cur_li._Value:
|
||||
if "modesetting" in cur_li._Value: ## enable lima
|
||||
os.system("touch %s/.lima" % os.path.expanduser('~') )
|
||||
else:
|
||||
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima /usr/lib/xorg/modules/drivers/modesetting_drv.so")
|
||||
ArmSystem("sudo sed -i '/^#.*lima/s/^#//' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
|
||||
ArmSystem("sudo ldconfig")
|
||||
else: #disable lima
|
||||
os.system("rm %s/.lima" % os.path.expanduser('~') )
|
||||
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima")
|
||||
ArmSystem("sudo sed -i 's/^[^#]*lima/#&/' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
|
||||
ArmSystem("sudo ldconfig")
|
||||
|
||||
pygame.time.delay(800)
|
||||
os.system("sudo reboot")
|
||||
@ -266,7 +271,7 @@ class GPUDriverPage(Page):
|
||||
i.Draw()
|
||||
|
||||
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 ) )
|
||||
|
||||
@ -279,7 +284,7 @@ class APIOBJ(object):
|
||||
def Init(self,main_screen):
|
||||
self._Page = GPUDriverPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="GPU driver switch"
|
||||
self._Page._Name ="GPU Driver Switch"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
|
||||
@ -15,7 +15,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,FileExists,IsExecutable
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -45,7 +44,7 @@ class NotifyJobListItem(InfoPageListItem):
|
||||
self._Labels["Text"] = l
|
||||
|
||||
done_icon = IconItem()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
@ -126,7 +125,7 @@ class NotificationPage(Page):
|
||||
li._PosY = start_y + counter*InfoPageListItem._Height
|
||||
li._Width = Width-10
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
|
||||
if IsExecutable(v):
|
||||
li._ReadOnly = True
|
||||
|
||||
@ -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;"
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES,POWEROPT
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -292,7 +291,7 @@ class InfoPage(Page):
|
||||
class PowerOptionsPage(Page):
|
||||
_FootMsg = ["Nav","Detail","","Back","Select"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@ -379,7 +378,7 @@ class PowerOptionsPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@ -522,7 +521,7 @@ class PowerOptionsPage(Page):
|
||||
i.Draw()
|
||||
|
||||
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 ) )
|
||||
|
||||
|
||||
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.GiveIconSurface("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)
|
||||
|
||||
|
||||
@ -9,5 +9,5 @@ def InitSoundPage(main_screen):
|
||||
myvars.SoundPage = SoundPage()
|
||||
|
||||
myvars.SoundPage._Screen = main_screen
|
||||
myvars.SoundPage._Name = "Sound volume"
|
||||
myvars.SoundPage._Name = "Sound Volume"
|
||||
myvars.SoundPage.Init()
|
||||
|
||||
@ -11,7 +11,6 @@ from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.icon_item import IconItem
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.slider import Slider
|
||||
@ -44,7 +43,7 @@ class SoundSlider(Slider):
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["vol"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("vol")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@ -54,7 +53,7 @@ class SoundSlider(Slider):
|
||||
self._Scale = MultiIconItem()
|
||||
self._Scale._MyType = ICON_TYPES["STAT"]
|
||||
self._Scale._Parent = self
|
||||
self._Scale._ImgSurf = MyIconPool._Icons["scale"]
|
||||
self._Scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||
self._Scale._IconWidth = 82
|
||||
self._Scale._IconHeight = 63
|
||||
self._Scale.Adjust(0,0,82,63,0)
|
||||
|
||||
@ -11,7 +11,6 @@ from UI.constants import ICON_TYPES,Width,Height
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
@ -55,11 +54,11 @@ class StoragePage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["icon_sd"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("icon_sd")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
|
||||
self._BGpng.AddLabel(self._BGmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]), fonts["varela15"])
|
||||
self._BGpng.AddLabel(self._BGmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]), MySkinManager.GiveFont("varela15"))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
|
||||
@ -68,12 +67,12 @@ class StoragePage(Page):
|
||||
|
||||
usage_percent = (self._DskUsg[0]/self._DskUsg[1] )*100.0
|
||||
|
||||
self._BGlabel.Init("%d%%"% int(usage_percent),fonts["varela25"])
|
||||
self._BGlabel.Init("%d%%"% int(usage_percent),MySkinManager.GiveFont("varela25"))
|
||||
self._BGlabel.SetColor( self._HighColor )
|
||||
|
||||
self._FreeLabel = Label()
|
||||
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._FreeLabel.Init("Free",fonts["varela13"])
|
||||
self._FreeLabel.Init("Free",MySkinManager.GiveFont("varela13"))
|
||||
self._FreeLabel.SetColor(self._BGlabel._Color)
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import ICON_TYPES
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
@ -10,7 +10,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
@ -18,7 +17,7 @@ from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.scroller import ListScroller
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
from UI.lang_manager import MyLangManager
|
||||
from list_item import ListItem
|
||||
|
||||
|
||||
@ -86,7 +85,7 @@ class TimezoneListPage(Page):
|
||||
_FootMsg = ["Nav","","","Back","Select"]
|
||||
_MyList = []
|
||||
_SwapMyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
|
||||
_Scroller = None
|
||||
@ -177,7 +176,7 @@ class TimezoneListPage(Page):
|
||||
self.SyncList("/usr/share/zoneinfo/posix")
|
||||
|
||||
icon_for_list = MultiIconItem()
|
||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
||||
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
|
||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||
icon_for_list._Parent = self
|
||||
|
||||
@ -186,10 +185,10 @@ class TimezoneListPage(Page):
|
||||
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("No timezones found on system!", fonts["varela22"])
|
||||
self._BGpng.AddLabel("No timezones found on system!", MyLangManager.TrFont("varela22"))
|
||||
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ from UI.constants import ICON_TYPES,Width,Height,RUNEVT,RUNSH
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,CmdClean,get_git_revision_short_hash
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
@ -157,7 +156,7 @@ class UpdatePage(Page):
|
||||
_Icons = {}
|
||||
_FootMsg = ["Nav","","Check Update","Back",""]
|
||||
|
||||
_ListFontObj = fonts["varela15"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||
_ConfirmPage = None
|
||||
_AList = {}
|
||||
_MyList = []
|
||||
@ -177,7 +176,7 @@ class UpdatePage(Page):
|
||||
li._PosY = start_y + i*InfoPageListItem._Height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
|
||||
if self._AList[v]["label"] != "":
|
||||
li.Init( self._AList[v]["label"] )
|
||||
@ -315,7 +314,7 @@ class APIOBJ(object):
|
||||
self._UpdatePage = UpdatePage()
|
||||
|
||||
self._UpdatePage._Screen = main_screen
|
||||
self._UpdatePage._Name = "Update"
|
||||
self._UpdatePage._Name = "Update Launcher"
|
||||
self._UpdatePage.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
|
||||
@ -5,7 +5,6 @@ import pygame
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
@ -138,13 +137,13 @@ class NetItem(Widget):
|
||||
|
||||
|
||||
lock_icon = NetItemIcon()
|
||||
lock_icon._ImgSurf = MyIconPool._Icons["lock"]
|
||||
lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
|
||||
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
lock_icon._Parent = self
|
||||
self._Icons["lock"] = lock_icon
|
||||
|
||||
done_icon = NetItemIcon()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ from wicd import misc
|
||||
from UI.constants import Width,Height
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,SwapAndShow
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -94,7 +93,7 @@ class WifiInfoPage(Page):
|
||||
li._PosY = start_y + i*InfoPageListItem._Height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MyLangManager.TrFont("varela12")
|
||||
|
||||
if self._AList[v]["label"] != "":
|
||||
li.Init( self._AList[v]["label"] )
|
||||
@ -267,7 +266,7 @@ class WifiList(Page):
|
||||
_FootMsg = ["Nav","Info","Scan","Back","Enter"]
|
||||
_EncMethods = None
|
||||
_Scroller = None
|
||||
_ListFontObj = fonts["notosanscjk15"]
|
||||
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_InfoPage = None
|
||||
_CurBssid = ""
|
||||
@ -569,6 +568,22 @@ class WifiList(Page):
|
||||
password_inputed = "".join(myvars.PasswordPage._Textarea._MyWords)
|
||||
if is_wifi_connected_now() == False:
|
||||
self.ConfigWireless(password_inputed)
|
||||
else:
|
||||
for i in range(0,10):
|
||||
if is_wifi_connected_now() == True:
|
||||
self.ShowBox(MyLangManager.Tr("Launching"))
|
||||
self._Daemon.Disconnect()
|
||||
self._Daemon.SetForcedDisconnect(True)
|
||||
self._Connecting = False
|
||||
else:
|
||||
break
|
||||
|
||||
pygame.time.delay(100)
|
||||
|
||||
if is_wifi_connected_now() == False:
|
||||
self.ConfigWireless(password_inputed)
|
||||
else:
|
||||
self.ShowBox(MyLangManager.Tr("Disconnect first"))
|
||||
|
||||
def OnReturnBackCb(self):
|
||||
pass
|
||||
@ -622,8 +637,8 @@ class WifiList(Page):
|
||||
for i in wicd_wirelss_encrypt_pwd:
|
||||
if "preshared_key" in i:
|
||||
if i["preshared_key"] != None:
|
||||
if len(i["preshared_key"]) > 0:
|
||||
thepass = i["preshared_key"]
|
||||
if len(str(i["preshared_key"])) > 0:
|
||||
thepass = str(i["preshared_key"])
|
||||
break
|
||||
|
||||
myvars.PasswordPage.SetPassword(thepass)
|
||||
|
||||
@ -7,7 +7,6 @@ import pygame
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.lang_manager import MyLangManager
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
|
||||
@ -9,7 +9,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
@ -62,12 +61,13 @@ class ListPage(Page):
|
||||
["","Time","Timezone"],
|
||||
["","Languages","Languages"],
|
||||
["","Notification","Notification"],
|
||||
["","Update", ""],
|
||||
["","Update", "Update Launcher"],
|
||||
["","About", "About"],
|
||||
["","PowerOFF","Power off"],
|
||||
["","PowerOFF","Power OFF"],
|
||||
["","ButtonsLayout","Buttons Layout"],
|
||||
["","Skins","Theme Manager"],
|
||||
["","LauncherGo","Switch to LauncherGo"],
|
||||
["","Lima","GPU driver switch"],
|
||||
["","Lima","GPU Driver Switch"],
|
||||
["","GateWay","Network gateway switch"]]
|
||||
|
||||
start_x = 0
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
ROM=/home/cpi/games/MAME
|
||||
ROM_SO=/home/cpi/apps/emulators/mame2003_plus_libretro.so
|
||||
EXT=zip
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=MAME Roms
|
||||
EXCLUDE=neogeo.zip
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mame2003_plus_libretro.so.zip
|
||||
@ -1,6 +0,0 @@
|
||||
ROM=/home/cpi/games/MGBA
|
||||
ROM_SO=/home/cpi/apps/emulators/mgba_libretro.so
|
||||
EXT=gb,gbc,gba,gbx
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=MGBA Roms
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mgba_libretro.so.zip
|
||||
@ -1,7 +0,0 @@
|
||||
ROM=/home/cpi/games/NESTOPIA
|
||||
ROM_SO=/home/cpi/apps/emulators/nestopia_libretro.so
|
||||
EXT=zip,nes
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=NESTOPIA Roms
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/nestopia_libretro.so.zip
|
||||
|
||||
@ -1 +0,0 @@
|
||||
Subproject commit c532cedb5387697c633777f37a52e11f95fa3352
|
||||
6
Menu/GameShell/32_ChocoDM/action.config
Normal file
@ -0,0 +1,6 @@
|
||||
ROM=/home/cpi/games/ChocoDM
|
||||
ROM_SO=
|
||||
EXT=wad
|
||||
LAUNCHER=chocolate-doom -iwad
|
||||
TITLE=ChocoDM
|
||||
SO_URL=
|
||||
@ -1 +0,0 @@
|
||||
chocolate-doom -iwad /home/cpi/games/FreeDM/freedoom1.wad
|
||||
@ -4,5 +4,9 @@ mkdir ~/.lexaloffle
|
||||
|
||||
cp -rf pico-8 ~/.lexaloffle
|
||||
|
||||
mkdir ~/.lexaloffle/pico-8/carts
|
||||
|
||||
ln -s ~/.lexaloffle/pico-8/carts/ ~/games/PICO-8/carts
|
||||
|
||||
touch .done
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
"InstallDir":"pico-8",
|
||||
"NotFoundMsg":["Please purchase the PICO-8 \n|None|varela16",
|
||||
"and copy it to the \"~/games/PICO-8\"|None|varela16"],
|
||||
|
||||
"MD5":{"pico-8_0.1.11g_raspi.zip":"a3f2995cf117499f880bd964d6a0e1f2","pico-8_0.1.11g_amd64.zip":"6726141c784afd4a41be6b7414c1b932"},
|
||||
"MD5":{"pico-8_0.1.11g_raspi.zip":"a3f2995cf117499f880bd964d6a0e1f2","pico-8_0.1.11g_amd64.zip":"6726141c784afd4a41be6b7414c1b932","pico-8_0.1.12_raspi.zip":"08eda95570e63089a2b9f5531503431e","pico-8_0.1.12c_raspi.zip":"1a62b0d7d4e4be65f89f23ec9757cb66","pico-8.zip":"whatever it takes"},
|
||||
"Post-Up":"bash Post-Up.sh"
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import ICON_TYPES
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
@ -15,12 +15,12 @@ from beeprint import pp
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.skin_manager import MySkinManager
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
from threading import Thread
|
||||
|
||||
@ -79,8 +79,8 @@ class MPDSpectrumPage(Page):
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","","","Back",""]
|
||||
_MyList = []
|
||||
_ListFont = fonts["veramono12"]
|
||||
_SongFont = fonts["notosanscjk12"]
|
||||
_ListFont = MyLangManager.TrFont("veramono12")
|
||||
_SongFont = MyLangManager.TrFont("notosanscjk12")
|
||||
_PIFI = None
|
||||
_FIFO = None
|
||||
_Color = MySkinManager.GiveColor('Front')
|
||||
@ -136,26 +136,26 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
"""
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["sheep_bg"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("sheep_bg")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
self._SheepHead = IconItem()
|
||||
self._SheepHead._ImgSurf = MyIconPool._Icons["sheep_head"]
|
||||
self._SheepHead._ImgSurf = MyIconPool.GiveIconSurface("sheep_head")
|
||||
self._SheepHead._MyType = ICON_TYPES["STAT"]
|
||||
self._SheepHead._Parent = self
|
||||
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
|
||||
|
||||
self._SheepBody = IconItem()
|
||||
self._SheepBody._ImgSurf = MyIconPool._Icons["sheep_body"]
|
||||
self._SheepBody._ImgSurf = MyIconPool.GiveIconSurface("sheep_body")
|
||||
self._SheepBody._MyType = ICON_TYPES["STAT"]
|
||||
self._SheepBody._Parent = self
|
||||
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
|
||||
"""
|
||||
|
||||
self._cwp_png = IconItem()
|
||||
self._cwp_png._ImgSurf = MyIconPool._Icons["tape"]
|
||||
self._cwp_png._ImgSurf = MyIconPool.GiveIconSurface("tape")
|
||||
self._cwp_png._MyType = ICON_TYPES["STAT"]
|
||||
self._cwp_png._Parent = self
|
||||
self._cwp_png.Adjust(0,0,79,79,0)
|
||||
|
||||
@ -8,7 +8,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
@ -85,7 +84,7 @@ class MusicLibListPage(Page):
|
||||
_FootMsg = ["Nav","","Scan","Back","Add to Playlist"]
|
||||
_MyList = []
|
||||
_SwapMyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
|
||||
_Scroller = None
|
||||
@ -173,7 +172,7 @@ class MusicLibListPage(Page):
|
||||
self.SyncList("/")
|
||||
|
||||
icon_for_list = MultiIconItem()
|
||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
||||
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
|
||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||
icon_for_list._Parent = self
|
||||
|
||||
@ -182,7 +181,7 @@ class MusicLibListPage(Page):
|
||||
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
||||
|
||||
@ -10,7 +10,6 @@ from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.icon_item import IconItem
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.icon_pool import MyIconPool
|
||||
@ -63,7 +62,7 @@ class PlayListPage(Page):
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","Remove","RTA","Back","Play/Pause"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_Scroller = None
|
||||
_CurSongTime="0:0"
|
||||
@ -181,7 +180,7 @@ class PlayListPage(Page):
|
||||
gobject.timeout_add(850,self.GObjectInterval)
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("heart")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"), MyLangManager.TrFont("varela18"))
|
||||
|
||||
@ -6,7 +6,6 @@ from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.simple_name_space import SimpleNamespace
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
@ -19,7 +18,7 @@ class TinyCloudPage(Page):
|
||||
_FootMsg = ["Nav","","","Back",""]
|
||||
_MyList = []
|
||||
|
||||
_ListFontObj = fonts["varela13"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
_Labels = {}
|
||||
@ -156,7 +155,7 @@ class TinyCloudPage(Page):
|
||||
self._PngSize["online"] = (75,122)
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||
@ -164,7 +163,7 @@ class TinyCloudPage(Page):
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
onlinepng = IconItem()
|
||||
onlinepng._ImgSurf = MyIconPool._Icons["online"]
|
||||
onlinepng._ImgSurf = MyIconPool.GiveIconSurface("online")
|
||||
onlinepng._MyType = ICON_TYPES["STAT"]
|
||||
onlinepng._Parent = self
|
||||
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
|
||||
|
||||
@ -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))
|
||||
|
||||
10
bluetooth_firmware.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
FIRM=`cat /proc/driver/brcmf_fw`
|
||||
|
||||
if [[ $FIRM =~ .*a0.* ]]
|
||||
then
|
||||
brcm_patchram_plus --patchram /lib/firmware/brcm/bcm43438a0.hcd --enable_hci --bd_addr B0:F1:EC:2D:07:5B --no2bytes --tosleep 5000 /dev/ttyS1 &
|
||||
else
|
||||
brcm_patchram_plus --patchram /lib/firmware/brcm/bcm43438a1.hcd --enable_hci --bd_addr B0:F1:EC:2D:07:5B --no2bytes --tosleep 5000 /dev/ttyS1 &
|
||||
fi
|
||||
BIN
skin/default/Menu/GameShell/20_Retro Games/Coleco.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/Fuse.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/GGEAR.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/GPSP.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/LYNX.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.5 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/Pcsx+.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/PicoDrive+.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/PocketSNES+.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/SFC9X.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/UAE+.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/gpSP+.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
skin/default/Menu/GameShell/20_Retro Games/mupen64+.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
skin/default/Menu/GameShell/21_Indie Games/2048.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
skin/default/Menu/GameShell/21_Indie Games/Hurrican.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
skin/default/Menu/GameShell/21_Indie Games/No.909.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
skin/default/Menu/GameShell/21_Indie Games/NyanCat.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
skin/default/Menu/GameShell/21_Indie Games/Planet-Busters.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
skin/default/Menu/GameShell/ChocoDM.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
skin/default/Menu/GameShell/Indie Games.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
skin/default/Menu/GameShell/Love2D.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.0 KiB |
BIN
skin/default/Menu/GameShell/TIC-80.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
skin/default/Menu/GameShell/Utils.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
@ -27,10 +27,9 @@ from UI.constants import Width,Height,ICON_TYPES,RUNEVT,RESTARTUI
|
||||
#from UI.simple_name_space import SimpleNamespace
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.keys_def import CurKeys,IsKeyMenuOrB,IsKeyStartOrA
|
||||
from UI.skin_manager import MySkinManager
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.text_bulletinboard import Textbulletinboard,Text
|
||||
@ -50,7 +49,7 @@ class NotFoundPage(Page):
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons[self._BG]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
#print( MyIconPool.Width(self._BG),MyIconPool.Height(self._BG) )
|
||||
@ -144,7 +143,7 @@ class HashErrPage(Page):
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons[self._BG]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.Adjust(0,0,MyIconPool.Width(self._BG),MyIconPool.Height(self._BG),0)
|
||||
@ -209,13 +208,13 @@ class HashErrPage(Page):
|
||||
self._Board.SetAndBlitText(a.Words()+b.Words())
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
return
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Leader.InstallPackage(self._Screen)
|
||||
return
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class MyEmulator(object):
|
||||
keyname = i.split(".")[0]
|
||||
self._Icons[keyname] = pygame.image.load(basepath+"/"+i).convert_alpha()
|
||||
"""
|
||||
self._Icons["sys"] = MyIconPool._Icons["sys"]
|
||||
self._Icons["sys"] = MyIconPool.GiveIconSurface("sys")
|
||||
|
||||
|
||||
def InitDeleteConfirmPage(self,main_screen):
|
||||
|
||||
@ -11,7 +11,6 @@ from UI.constants import Width,Height,ICON_TYPES,RUNEVT
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,CmdClean,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
@ -94,7 +93,7 @@ class FavListPage(Page):
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","Remove","Scan","","Run"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
_Emulator = None
|
||||
_Parent = None
|
||||
@ -130,8 +129,11 @@ class FavListPage(Page):
|
||||
stats = os.stat(v)
|
||||
if stats.st_gid != self._Parent._FavGID: ## only favs
|
||||
continue
|
||||
try:
|
||||
dirmap["gamedir"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["gamedir"] = v.decode("ascii","ignore")
|
||||
|
||||
dirmap["gamedir"] = v.decode("utf8")
|
||||
ret.append(dirmap)
|
||||
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
||||
stats = os.stat(v)
|
||||
@ -142,7 +144,11 @@ class FavListPage(Page):
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v.decode("utf8")
|
||||
try:
|
||||
dirmap["file"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["file"] = v.decode("ascii","ignore")
|
||||
|
||||
ret.append(dirmap)
|
||||
|
||||
# else:
|
||||
@ -228,7 +234,7 @@ class FavListPage(Page):
|
||||
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["star"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("star")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.AddLabel(MyLangManager.Tr("MyFavGames"), MyLangManager.TrFont("varela18"))
|
||||
@ -336,7 +342,7 @@ class FavListPage(Page):
|
||||
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
if FileExists(self._Emulator["ROM_SO"]):
|
||||
if FileExists(self._Emulator["ROM_SO"].split(" ")[0]):
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
||||
|
||||
@ -8,7 +8,6 @@ import os
|
||||
from UI.constants import ICON_TYPES
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
@ -18,7 +18,6 @@ from UI.constants import Width,Height,ICON_TYPES,RUNEVT
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,CmdClean,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
@ -101,7 +100,7 @@ class RomListPage(Page):
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","Del","Scan","Back","Run","AddFav"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
_Emulator = None
|
||||
_Parent = None
|
||||
@ -144,7 +143,11 @@ class RomListPage(Page):
|
||||
continue
|
||||
|
||||
if FileExists(v+"/"+gameshell_bat):
|
||||
dirmap["gamedir"] = v.decode("utf8")
|
||||
try:
|
||||
dirmap["gamedir"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["gamedir"] = v.decode("ascii","ignore")
|
||||
|
||||
ret.append(dirmap)
|
||||
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
||||
stats = os.stat(v)
|
||||
@ -163,7 +166,11 @@ class RomListPage(Page):
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v.decode("utf8")
|
||||
try:
|
||||
dirmap["file"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["file"] = v.decode("ascii","ignore")
|
||||
|
||||
ret.append(dirmap)
|
||||
# else:
|
||||
# print("not file or dir")
|
||||
@ -262,7 +269,7 @@ class RomListPage(Page):
|
||||
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
||||
@ -377,7 +384,7 @@ class RomListPage(Page):
|
||||
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
if FileExists(self._Emulator["ROM_SO"]):
|
||||
if FileExists(self._Emulator["ROM_SO"].split(" ")[0]):
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
||||
|
||||
@ -15,7 +15,6 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.download_process_page import DownloadProcessPage
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.fonts import fonts
|
||||
from UI.multilabel import MultiLabel
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
|
||||
@ -12,12 +12,12 @@ from icon_item import IconItem
|
||||
from page import Page,PageStack
|
||||
from title_bar import TitleBar
|
||||
from foot_bar import FootBar
|
||||
from constants import Width,Height,bg_color
|
||||
from constants import Width,Height
|
||||
from util_funcs import midRect
|
||||
from fonts import fonts
|
||||
from keys_def import CurKeys
|
||||
from label import Label
|
||||
from skin_manager import MySkinManager
|
||||
from lang_manager import MyLangManager
|
||||
from widget import Widget
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ class AboveAllPatch(Widget):
|
||||
_Height=120
|
||||
|
||||
_Text =""
|
||||
_FontObj=fonts["veramono20"]
|
||||
_FontObj= MyLangManager.TrFont("veramono20")
|
||||
_Parent =None
|
||||
_Color = MySkinManager.GiveColor('Text')
|
||||
_ValColor = MySkinManager.GiveColor('URL')
|
||||
|
||||
@ -9,7 +9,6 @@ from libs.roundrects import aa_round_rect
|
||||
from constants import Width,Height,ICON_TYPES
|
||||
from page import Page,PageSelector
|
||||
from label import Label
|
||||
from fonts import fonts
|
||||
from util_funcs import midRect
|
||||
from keys_def import CurKeys
|
||||
from skin_manager import MySkinManager
|
||||
|
||||
@ -12,12 +12,10 @@ from pygame.locals import *
|
||||
#from beeprint import pp
|
||||
|
||||
#UI lib
|
||||
from skin_manager import MySkinManager
|
||||
|
||||
|
||||
Width = 320
|
||||
Height = 240
|
||||
bg_color = MySkinManager.GiveColor('White')
|
||||
|
||||
icon_width = 80
|
||||
icon_height = 80
|
||||
|
||||
@ -6,17 +6,18 @@ import commands
|
||||
## local package import
|
||||
from constants import Width,Height,RUNSYS
|
||||
from label import Label
|
||||
from fonts import fonts
|
||||
|
||||
from full_screen import FullScreen
|
||||
from skin_manager import MySkinManager
|
||||
from lang_manager import MyLangManager
|
||||
|
||||
import config
|
||||
|
||||
class CounterScreen(FullScreen):
|
||||
|
||||
_CounterFont = fonts["varela120"]
|
||||
_TextFont1 = fonts["varela15"]
|
||||
_TextFont2 = fonts["varela12"]
|
||||
_CounterFont = MyLangManager.TrFont("varela120")
|
||||
_TextFont1 = MyLangManager.TrFont("varela15")
|
||||
_TextFont2 = MyLangManager.TrFont("varela12")
|
||||
|
||||
_TopLabel = None
|
||||
_BottomLabel = None
|
||||
|
||||
@ -9,7 +9,6 @@ import shutil
|
||||
from constants import Width,Height,ICON_TYPES
|
||||
from page import Page,PageSelector
|
||||
from label import Label
|
||||
from fonts import fonts
|
||||
from util_funcs import midRect
|
||||
from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from confirm_page import ConfirmPage
|
||||
|
||||
@ -13,7 +13,6 @@ from UI.constants import Width,Height,ICON_TYPES,RUNEVT
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,CmdClean,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
@ -59,14 +58,14 @@ class DownloadProcessPage(Page):
|
||||
self._PngSize["needwifi_bg"] = (253,132)
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["rom_download"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("rom_download")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
needwifi_bg = IconItem()
|
||||
needwifi_bg._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
||||
needwifi_bg._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||
needwifi_bg._MyType = ICON_TYPES["STAT"]
|
||||
needwifi_bg._Parent = self
|
||||
needwifi_bg.Adjust(0,0,self._PngSize["needwifi_bg"][0],self._PngSize["needwifi_bg"][1],0)
|
||||
@ -76,11 +75,11 @@ class DownloadProcessPage(Page):
|
||||
|
||||
self._FileNameLabel = Label()
|
||||
self._FileNameLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._FileNameLabel.Init("", fonts["varela12"])
|
||||
self._FileNameLabel.Init("", MyLangManager.TrFont("varela12"))
|
||||
|
||||
self._SizeLabel = Label()
|
||||
self._SizeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._SizeLabel.Init("0/0Kb",fonts["varela12"])
|
||||
self._SizeLabel.Init("0/0Kb",MyLangManager.TrFont("varela12"))
|
||||
self._SizeLabel.SetColor( self._URLColor )
|
||||
|
||||
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
from pygame.locals import *
|
||||
from sys import exit
|
||||
import os
|
||||
import sys
|
||||
|
||||
import config
|
||||
|
||||
if not pygame.font.get_init():
|
||||
pygame.font.init()
|
||||
|
||||
fonts = {}
|
||||
if not fonts:
|
||||
skinpath = "../skin/"+config.SKIN+"/truetype"
|
||||
fonts_path = {}
|
||||
|
||||
fonts_path["varela"] = "%s/VarelaRound-Regular.ttf" % skinpath
|
||||
fonts_path["veramono"] = "%s/VeraMono.ttf" % skinpath
|
||||
fonts_path["noto"] = "%s/NotoSansMono-Regular.ttf" % skinpath
|
||||
fonts_path["notocjk"] = "%s/NotoSansCJK-Regular.ttf" % skinpath
|
||||
|
||||
fonts["varela10"] = pygame.font.Font(fonts_path["varela"],10)
|
||||
fonts["varela11"] = pygame.font.Font(fonts_path["varela"],11)
|
||||
fonts["varela12"] = pygame.font.Font(fonts_path["varela"],12)
|
||||
fonts["varela13"] = pygame.font.Font(fonts_path["varela"],13)
|
||||
fonts["varela14"] = pygame.font.Font(fonts_path["varela"],14)
|
||||
fonts["varela15"] = pygame.font.Font(fonts_path["varela"],15)
|
||||
|
||||
fonts["varela16"] = pygame.font.Font(fonts_path["varela"],16)
|
||||
fonts["varela18"] = pygame.font.Font(fonts_path["varela"],18)
|
||||
fonts["varela20"] = pygame.font.Font(fonts_path["varela"],20)
|
||||
fonts["varela22"] = pygame.font.Font(fonts_path["varela"],22)
|
||||
fonts["varela23"] = pygame.font.Font(fonts_path["varela"],23)
|
||||
fonts["varela24"] = pygame.font.Font(fonts_path["varela"],24)
|
||||
fonts["varela25"] = pygame.font.Font(fonts_path["varela"],25)
|
||||
fonts["varela26"] = pygame.font.Font(fonts_path["varela"],26)
|
||||
fonts["varela27"] = pygame.font.Font(fonts_path["varela"],27)
|
||||
fonts["varela28"] = pygame.font.Font(fonts_path["varela"],28)
|
||||
fonts["varela34"] = pygame.font.Font(fonts_path["varela"],34)
|
||||
fonts["varela40"] = pygame.font.Font(fonts_path["varela"],40)
|
||||
fonts["varela120"] = pygame.font.Font(fonts_path["varela"],120)
|
||||
|
||||
fonts["veramono25"] = pygame.font.Font(fonts_path["veramono"],25)
|
||||
fonts["veramono24"] = pygame.font.Font(fonts_path["veramono"],24)
|
||||
fonts["veramono23"] = pygame.font.Font(fonts_path["veramono"],23)
|
||||
fonts["veramono22"] = pygame.font.Font(fonts_path["veramono"],22)
|
||||
fonts["veramono21"] = pygame.font.Font(fonts_path["veramono"],21)
|
||||
fonts["veramono20"] = pygame.font.Font(fonts_path["veramono"],20)
|
||||
fonts["veramono18"] = pygame.font.Font(fonts_path["veramono"],18)
|
||||
fonts["veramono16"] = pygame.font.Font(fonts_path["veramono"],16)
|
||||
fonts["veramono15"] = pygame.font.Font(fonts_path["veramono"],15)
|
||||
fonts["veramono14"] = pygame.font.Font(fonts_path["veramono"],14)
|
||||
fonts["veramono13"] = pygame.font.Font(fonts_path["veramono"],13)
|
||||
fonts["veramono12"] = pygame.font.Font(fonts_path["veramono"],12)
|
||||
fonts["veramono11"] = pygame.font.Font(fonts_path["veramono"],11)
|
||||
fonts["veramono10"] = pygame.font.Font(fonts_path["veramono"],10)
|
||||
|
||||
for i in range(10,28):
|
||||
fonts["notosansmono"+str(i)] = pygame.font.Font(fonts_path["noto"],i)
|
||||
|
||||
for i in range(10,28):
|
||||
fonts["notosanscjk"+str(i)] = pygame.font.Font(fonts_path["notocjk"],i)
|
||||
|
||||
fonts["arial"] = pygame.font.SysFont("arial",16)
|
||||
|
||||
@ -6,15 +6,18 @@ import os
|
||||
|
||||
##local import
|
||||
from constants import Width,Height,ICON_TYPES,ALIGN
|
||||
from util_funcs import FileExists,midRect,SkinMap
|
||||
from util_funcs import FileExists,midRect
|
||||
from icon_item import IconItem
|
||||
from fonts import fonts
|
||||
from multi_icon_item import MultiIconItem
|
||||
from icon_pool import MyIconPool
|
||||
from libs.roundrects import aa_round_rect
|
||||
from lang_manager import MyLangManager
|
||||
from widget import Widget
|
||||
icon_base_path = SkinMap("gameshell/footbar_icons/")
|
||||
from skin_manager import MySkinManager
|
||||
|
||||
import config
|
||||
|
||||
icon_base_path = MySkinManager.GiveIcon("gameshell/footbar_icons/")
|
||||
|
||||
class FootBarIcon(MultiIconItem):
|
||||
|
||||
@ -93,7 +96,7 @@ class FootBar(Widget):
|
||||
|
||||
round_corners._MyType = ICON_TYPES["STAT"]
|
||||
round_corners._Parent = self
|
||||
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
|
||||
round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
|
||||
round_corners.Adjust(0,0,10,10,0)
|
||||
|
||||
self._Icons["round_corners"] = round_corners
|
||||
@ -133,7 +136,10 @@ class FootBar(Widget):
|
||||
self.Draw()
|
||||
|
||||
def SetLabelTexts(self,texts):
|
||||
if config.ButtonsLayout == "xbox":
|
||||
barr = ["nav","y","x","b","a","select"]
|
||||
else:
|
||||
barr = ["nav","x","y","a","b","select"]
|
||||
texts2 = texts + [""] if len(texts) == 5 else texts
|
||||
|
||||
for idx,x in enumerate(barr):
|
||||
|
||||
@ -6,12 +6,12 @@ from sys import exit
|
||||
import os
|
||||
import sys
|
||||
|
||||
from util_funcs import SkinMap
|
||||
from skin_manager import MySkinManager
|
||||
##pool only store surfaces
|
||||
|
||||
class IconPool(object):
|
||||
|
||||
_GameShellIconPath = SkinMap("gameshell/icons/")
|
||||
_GameShellIconPath = MySkinManager.GiveIcon("gameshell/icons/")
|
||||
_Icons = {}
|
||||
_Sizes = {}
|
||||
def __init__(self):
|
||||
@ -34,6 +34,19 @@ class IconPool(object):
|
||||
if keyname in self._Sizes:
|
||||
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
|
||||
MyIconPool = None
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ from libs import easing
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.icon_item import IconItem
|
||||
@ -108,7 +107,7 @@ class Keyboard(Page):
|
||||
self._Width = self._Screen._Width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
fontobj = fonts["veramono24"]
|
||||
fontobj = MySkinManager.GiveFont("veramono24")
|
||||
word_margin = 15
|
||||
|
||||
start_x = (self._Width - fontobj.size( "".join(self._Secs[0][0]))[0]-len(self._Secs[0][0])*word_margin)/2+word_margin/2
|
||||
@ -129,7 +128,7 @@ class Keyboard(Page):
|
||||
|
||||
if val == "_L" or val == "_R":
|
||||
it = KeyboardIcon()
|
||||
it._ImgSurf = MyIconPool._Icons[val]
|
||||
it._ImgSurf = MyIconPool.GiveIconSurface(val)
|
||||
it._Parent = self
|
||||
it._Str = val
|
||||
it.Init(start_x+it._ImgSurf.get_width()/2 ,start_y,it._ImgSurf.get_width(),it._ImgSurf.get_height(),0)
|
||||
@ -141,7 +140,7 @@ class Keyboard(Page):
|
||||
else:
|
||||
if val == "_S":
|
||||
val = "Space"
|
||||
ti._FontObj = fonts["veramono15"]
|
||||
ti._FontObj = MySkinManager.GiveFont("veramono15")
|
||||
ti._Bold = True
|
||||
|
||||
cur_alpha_size = ti._FontObj.size( val)
|
||||
|
||||
@ -6,9 +6,8 @@ from sys import exit
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
from config import CurKeySet
|
||||
|
||||
import config
|
||||
from config import CurKeySet ## read only
|
||||
|
||||
def GetButtonsLayoutMode():
|
||||
lm = "xbox"
|
||||
@ -25,6 +24,7 @@ def SetButtonsLayoutMode(mode):
|
||||
SetXYABButtons(mode)
|
||||
with open(".buttonslayout", "w") as f:
|
||||
f.write(mode)
|
||||
config.ButtonsLayout = mode
|
||||
|
||||
def SetXYABButtons(mode):
|
||||
if mode == "snes":
|
||||
|
||||
@ -3,8 +3,8 @@ import os
|
||||
import pygame
|
||||
import config
|
||||
import ConfigParser
|
||||
from skin_manager import MySkinManager
|
||||
from util_funcs import FileExists
|
||||
from fonts import fonts
|
||||
|
||||
class CaseConfigParser(ConfigParser.SafeConfigParser):
|
||||
def optionxform(self, optionstr):
|
||||
@ -97,12 +97,13 @@ class LangManager(object):
|
||||
raise Exception('font string format error')
|
||||
|
||||
if "English.ini" in self._ConfigFileName:
|
||||
return fonts[orig_font_str]
|
||||
return MySkinManager.GiveFont(orig_font_str)
|
||||
else:
|
||||
if font_size_number > 28:
|
||||
raise Exception('cjk font string format error '+ str(font_size_number))
|
||||
|
||||
return fonts["notosanscjk"+str(font_size_number)]
|
||||
# raise Exception('cjk font string format error '+ str(font_size_number))
|
||||
return MySkinManager.GiveFont(orig_font_str)
|
||||
else:
|
||||
return MySkinManager.GiveFont("notosanscjk%d" % font_size_number)
|
||||
|
||||
##global MyLangManager Handler
|
||||
MyLangManager = None
|
||||
|
||||
@ -19,8 +19,8 @@ from icon_item import IconItem
|
||||
from page import Page,PageStack
|
||||
from title_bar import TitleBar
|
||||
from foot_bar import FootBar
|
||||
from constants import Width,Height,bg_color
|
||||
from util_funcs import midRect,FileExists,ReplaceSuffix,ReadTheFileContent,CmdClean,MakeExecutable,SkinMap
|
||||
from constants import Width,Height
|
||||
from util_funcs import midRect,FileExists,ReplaceSuffix,ReadTheFileContent,CmdClean,MakeExecutable
|
||||
from keys_def import CurKeys
|
||||
from label import Label
|
||||
from untitled_icon import UntitledIcon
|
||||
@ -454,7 +454,7 @@ class MainScreen(Widget):
|
||||
|
||||
files = os.listdir(_dir)
|
||||
for i in sorted(files):
|
||||
if os.path.isdir(_dir+"/"+i): # TOPLEVEL only is dir
|
||||
if os.path.isdir(_dir+"/"+i) and i.startswith(".") == False: # TOPLEVEL only is dir
|
||||
if pglevel == 0:
|
||||
page = Page()
|
||||
page._Name = self.ExtraName(i)
|
||||
@ -469,8 +469,8 @@ class MainScreen(Widget):
|
||||
iconitem.AddLabel(MyLangManager.Tr(i2),self._IconFont)
|
||||
if FileExists( _dir+"/"+i+"/"+i2+".png"): ### 20_Prog/Prog.png , cut 20_
|
||||
iconitem._ImageName = _dir+"/"+i+"/"+i2+".png"
|
||||
elif FileExists( SkinMap(_dir+"/"+i2+".png") ):
|
||||
iconitem._ImageName = SkinMap(_dir+"/"+i2+".png")
|
||||
elif FileExists( MySkinManager.GiveIcon(_dir+"/"+i2+".png") ):
|
||||
iconitem._ImageName = MySkinManager.GiveIcon(_dir+"/"+i2+".png")
|
||||
else:
|
||||
untitled = UntitledIcon()
|
||||
untitled.Init()
|
||||
@ -567,7 +567,7 @@ class MainScreen(Widget):
|
||||
cur_page._Icons.append(iconitem)
|
||||
self.ReadTheDirIntoPages(_dir+"/"+i,pglevel+1,iconitem._LinkPage)
|
||||
|
||||
elif os.path.isfile(_dir+"/"+i) and pglevel > 0:
|
||||
elif os.path.isfile(_dir+"/"+i) and i.startswith(".") == False and pglevel > 0:
|
||||
if i.lower().endswith(icon_ext):
|
||||
i2 = self.ExtraName(i)
|
||||
|
||||
@ -577,8 +577,8 @@ class MainScreen(Widget):
|
||||
iconitem._CmdPath = os.path.realpath(_dir+"/"+i)
|
||||
MakeExecutable(iconitem._CmdPath)
|
||||
iconitem._MyType = ICON_TYPES["EXE"]
|
||||
if FileExists( SkinMap( _dir+"/"+ReplaceSuffix(i2,"png"))):
|
||||
iconitem._ImageName = SkinMap(_dir+"/"+ReplaceSuffix(i2,"png"))
|
||||
if FileExists( MySkinManager.GiveIcon( _dir+"/"+ReplaceSuffix(i2,"png"))):
|
||||
iconitem._ImageName = MySkinManager.GiveIcon(_dir+"/"+ReplaceSuffix(i2,"png"))
|
||||
else:
|
||||
untitled = UntitledIcon()
|
||||
untitled.Init()
|
||||
|
||||
@ -44,6 +44,10 @@ class MultiIconItem(IconItem):
|
||||
self._Width,self._Height),
|
||||
(0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight))
|
||||
|
||||
def DrawRect(self,rect1,rect2):
|
||||
if self._ImgSurf != None:
|
||||
self._Parent._CanvasHWND.blit(self._ImgSurf,rect1,rect2)
|
||||
|
||||
def Draw(self):
|
||||
if self._Align==ALIGN["VCenter"]: #default
|
||||
if self._Label != None:
|
||||
|
||||
@ -6,55 +6,61 @@ from sys import exit
|
||||
import os
|
||||
import sys
|
||||
import math
|
||||
import fnmatch
|
||||
import random
|
||||
|
||||
|
||||
from libs import easing
|
||||
|
||||
#import base64
|
||||
#from beeprint import pp
|
||||
# import base64
|
||||
# from beeprint import pp
|
||||
|
||||
### local import
|
||||
from constants import ALIGN,icon_width,icon_height,Width,Height,ICON_TYPES
|
||||
# local import
|
||||
from constants import ALIGN, icon_width, icon_height, Width, Height, ICON_TYPES
|
||||
from util_funcs import midRect
|
||||
from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from icon_pool import MyIconPool
|
||||
from lang_manager import MyLangManager
|
||||
from widget import Widget
|
||||
|
||||
|
||||
class PageStack:
|
||||
def __init__(self):
|
||||
self.stack = list()
|
||||
|
||||
def Push(self,data):
|
||||
def Push(self, data):
|
||||
if data not in self.stack:
|
||||
self.stack.append(data)
|
||||
return True
|
||||
return False
|
||||
|
||||
def Pop(self):
|
||||
if len(self.stack)<=0:
|
||||
return None,False
|
||||
return self.stack.pop(),True
|
||||
if len(self.stack) <= 0:
|
||||
return None, False
|
||||
return self.stack.pop(), True
|
||||
|
||||
def Length(self):
|
||||
return len(self.stack)
|
||||
|
||||
|
||||
class PageSelector(Widget):
|
||||
|
||||
_Parent = None
|
||||
_Alpha = 0
|
||||
_OnShow = True
|
||||
_IconSurf = None
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def Init(self,x,y,w,h,alpha):
|
||||
def Init(self, x, y, w, h, alpha):
|
||||
self._PosX = x
|
||||
self._PosY = y
|
||||
self._Width = w
|
||||
self._Height = h
|
||||
self._Alpha = alpha
|
||||
|
||||
def Adjust(self,x,y,w,h,alpha):
|
||||
def Adjust(self, x, y, w, h, alpha):
|
||||
self._PosX = x
|
||||
self._PosY = y
|
||||
self._Width = w
|
||||
@ -68,42 +74,52 @@ class PageSelector(Widget):
|
||||
|
||||
if idx < len(self._Parent._Icons):
|
||||
x = self._Parent._Icons[idx]._PosX+self._Parent._PosX
|
||||
y = self._Parent._Icons[iconidx]._PosY ## only use current icon's PosY
|
||||
# only use current icon's PosY
|
||||
y = self._Parent._Icons[iconidx]._PosY
|
||||
|
||||
rect = midRect(x,y,self._Width,self._Height,self._Parent._Width,self._Parent._Height)
|
||||
if rect.width <=0 or rect.height <= 0 :
|
||||
rect = midRect(x, y, self._Width, self._Height,
|
||||
self._Parent._Width, self._Parent._Height)
|
||||
if rect.width <= 0 or rect.height <= 0:
|
||||
return
|
||||
|
||||
#color = (244,197,66,50)
|
||||
#pygame.draw.rect(canvas,color,rect,1)
|
||||
# color = (244,197,66,50)
|
||||
# pygame.draw.rect(canvas,color,rect,1)
|
||||
if self._IconSurf != None:
|
||||
self._Parent._CanvasHWND.blit(self._IconSurf,rect)
|
||||
self._Parent._CanvasHWND.blit(self._IconSurf, rect)
|
||||
|
||||
|
||||
class Page(Widget):
|
||||
_Icons = []
|
||||
_Ps = None
|
||||
_PsIndex = 0
|
||||
_IconNumbers = 0
|
||||
_IconIndex = 0 ## shows which icon current selected, the Selector can not move here
|
||||
_PrevIconIndex = 0 ## for remember the Highlighted Icon ,restore it's PosY to average
|
||||
_IconIndex = 0 # shows which icon current selected, the Selector can not move here
|
||||
_PrevIconIndex = 0 # for remember the Highlighted Icon ,restore it's PosY to average
|
||||
_Index = 0
|
||||
_Align = ALIGN["SLeft"]
|
||||
_CanvasHWND = None #
|
||||
_HWND = None #
|
||||
_CanvasHWND = None
|
||||
_HWND = None
|
||||
_OnShow = False
|
||||
_Name = ""
|
||||
_Screen = None ## Should be the Screen Class
|
||||
_Screen = None # Should be the Screen Class
|
||||
_PageIconMargin = 20
|
||||
_FootMsg = ["Nav","","","","Enter"] ## Default Page Foot info
|
||||
|
||||
_SelectedIconTopOffset=20
|
||||
_FootMsg = ["Nav", "", "", "", "Enter"] # Default Page Foot info
|
||||
_Wallpaper = None
|
||||
_SelectedIconTopOffset = 20
|
||||
_EasingDur = 30
|
||||
_Padding = pygame.Rect(0,0,0,0)# x,y,w,h
|
||||
_Margin = pygame.Rect(0,0,0,0)
|
||||
_Padding = pygame.Rect(0, 0, 0, 0) # x,y,w,h
|
||||
_Margin = pygame.Rect(0, 0, 0, 0)
|
||||
_ScrollStep = 1
|
||||
|
||||
def __init__(self):
|
||||
self._Icons = []
|
||||
path = '/home/cpi/launcher/skin/default/Menu/GameShell/Wallpaper/'
|
||||
|
||||
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))
|
||||
|
||||
|
||||
|
||||
def AdjustHLeftAlign(self): ## adjust coordinator and append the PageSelector
|
||||
@ -131,7 +147,7 @@ class Page(Widget):
|
||||
cnt+=1
|
||||
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(icon_width/2, TitleBar._BarHeight+icon_height/2,92,92,128)
|
||||
self._Ps = ps
|
||||
@ -155,7 +171,7 @@ class Page(Widget):
|
||||
it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(start_x,start_y,92,92,128)
|
||||
|
||||
@ -185,7 +201,7 @@ class Page(Widget):
|
||||
it._Parent = self
|
||||
it._Index = 0
|
||||
it.Adjust(start_x,start_y,icon_width,icon_height,0)
|
||||
#it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
# it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
|
||||
elif self._IconNumbers == 2:
|
||||
start_x = (self._Width - self._PageIconMargin - self._IconNumbers*icon_width) / 2 + icon_width/2
|
||||
@ -196,7 +212,7 @@ class Page(Widget):
|
||||
it._Parent = self
|
||||
it._Index = i
|
||||
it.Adjust(start_x+i*self._PageIconMargin + i*icon_width,start_y, icon_width, icon_height,0)
|
||||
#it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
# it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
|
||||
elif self._IconNumbers > 2:
|
||||
for i in range(0,self._IconNumbers):
|
||||
@ -204,10 +220,10 @@ class Page(Widget):
|
||||
it._Parent = self
|
||||
it._Index = i
|
||||
it.Adjust(start_x+i*self._PageIconMargin + i*icon_width,start_y,icon_width,icon_height,0)
|
||||
#it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
# it._ImgSurf = pygame.transform.smoothscale(it._ImgSurf,(it._Width,it._Height))
|
||||
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(start_x,start_y,92,92,128)
|
||||
|
||||
@ -245,7 +261,7 @@ class Page(Widget):
|
||||
cnt+=1
|
||||
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(icon_width/2,icon_height/2,92,92,128)
|
||||
self._Ps = ps
|
||||
@ -268,7 +284,7 @@ class Page(Widget):
|
||||
it.Adjust(start_x+i*icon_width,start_y,icon_width,icon_height,0)
|
||||
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(start_x,start_y,92,92,128)
|
||||
self._Ps = ps
|
||||
@ -287,7 +303,7 @@ class Page(Widget):
|
||||
|
||||
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(start_x,start_y-self._SelectedIconTopOffset,92,92,128)
|
||||
|
||||
@ -323,7 +339,7 @@ class Page(Widget):
|
||||
|
||||
if self._IconNumbers > 0:
|
||||
ps = PageSelector()
|
||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
||||
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||
ps._Parent = self
|
||||
ps.Init(start_x,start_y,icon_width+4,icon_height+4,128)
|
||||
self._Ps = ps
|
||||
@ -477,26 +493,21 @@ class Page(Widget):
|
||||
self._Ps.Draw()
|
||||
|
||||
def MoveIconIndexPrev(self):
|
||||
|
||||
self._PrevIconIndex = self._IconIndex
|
||||
self._IconIndex-=1
|
||||
if self._IconIndex < 0:
|
||||
self._IconIndex = 0
|
||||
self._PrevIconIndex = self._IconIndex
|
||||
self._IconIndex = max(0, self._IconNumbers - 1) # Wrap Icon Index
|
||||
return False
|
||||
self._PrevIconIndex = self._IconIndex+1
|
||||
return True
|
||||
|
||||
def MoveIconIndexNext(self):
|
||||
#True for Moved,False is boundary
|
||||
self._PrevIconIndex = self._IconIndex
|
||||
self._IconIndex+=1
|
||||
if self._IconIndex > (self._IconNumbers - 1):
|
||||
self._IconIndex = self._IconNumbers -1
|
||||
self._PrevIconIndex = self._IconIndex
|
||||
self._IconIndex = 0 # Wrap Icon Index
|
||||
return False
|
||||
self._PrevIconIndex = self._IconIndex-1
|
||||
return True
|
||||
|
||||
|
||||
def IconClick(self):
|
||||
|
||||
if self._IconIndex > (len(self._Icons) -1):
|
||||
@ -517,7 +528,7 @@ class Page(Widget):
|
||||
self._Screen._CurrentPage = child_page
|
||||
elif cur_icon._MyType == ICON_TYPES["FUNC"]:
|
||||
print("IconClick API: %d"%(cur_icon._Index))
|
||||
#print("%s"% cur_icon._CmdPath)
|
||||
# print("%s"% cur_icon._CmdPath)
|
||||
api_cb = getattr(cur_icon._CmdPath,"API",None)
|
||||
if api_cb != None:
|
||||
if callable(api_cb):
|
||||
@ -528,7 +539,7 @@ class Page(Widget):
|
||||
def ReturnToUpLevelPage(self):
|
||||
pop_page,ok = self._Screen._MyPageStack.Pop()
|
||||
if ok == True:
|
||||
#self._Screen._CurrentPage.ResetPageSelector()
|
||||
# self._Screen._CurrentPage.ResetPageSelector()
|
||||
pop_page.Draw()
|
||||
self._Screen._CurrentPage = pop_page
|
||||
on_return_back_cb = getattr(self._Screen._CurrentPage,"OnReturnBackCb",None)
|
||||
@ -543,8 +554,12 @@ class Page(Widget):
|
||||
print("OnTopLevel ",self._Screen._PageIndex)
|
||||
|
||||
def ClearCanvas(self):
|
||||
if self._Wallpaper:
|
||||
self._CanvasHWND.blit(self._Wallpaper,(0,0))
|
||||
else:
|
||||
self._CanvasHWND.fill(self._Screen._SkinManager.GiveColor("White"))
|
||||
|
||||
|
||||
def ClearIcons(self):
|
||||
for i in range(0,self._IconNumbers):
|
||||
self._Icons[i].Clear()
|
||||
@ -553,7 +568,7 @@ class Page(Widget):
|
||||
for i in range(0,self._IconNumbers):
|
||||
self._Icons[i].Draw()
|
||||
|
||||
##make sure the Class has the _MyList
|
||||
# make sure the Class has the _MyList
|
||||
def ScrollDown(self):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
@ -614,21 +629,32 @@ class Page(Widget):
|
||||
if event.key == CurKeys["Right"]:
|
||||
if self.MoveIconIndexNext() == True:
|
||||
if self._IconIndex == (self._IconNumbers -1) or self._PrevIconIndex == 0:
|
||||
self.IconSmoothUp(icon_width+ self._PageIconMargin) # only move up selected icon,no horizontal translation
|
||||
self.IconSmoothUp(icon_width + self._PageIconMargin)
|
||||
else:
|
||||
self.IconsEasingLeft(icon_width + self._PageIconMargin)
|
||||
else:
|
||||
screen_icons = int(math.floor(self._Screen._Width / (icon_width + self._PageIconMargin)))
|
||||
if self._IconNumbers > screen_icons:
|
||||
self.IconsEasingRight((icon_width + self._PageIconMargin) * (self._IconNumbers - screen_icons))
|
||||
elif self._IconNumbers > 0:
|
||||
self.IconSmoothUp(icon_width+ self._PageIconMargin)
|
||||
|
||||
self._PsIndex = self._IconIndex
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
if event.key == CurKeys["Left"]:
|
||||
if self.MoveIconIndexPrev() == True:
|
||||
if self._IconIndex == 0 or self._PrevIconIndex == (self._IconNumbers -1):
|
||||
self.IconSmoothUp(icon_width+ self._PageIconMargin)
|
||||
self.IconSmoothUp(icon_width + self._PageIconMargin)
|
||||
else:
|
||||
self.IconsEasingRight(icon_width + self._PageIconMargin)
|
||||
else:
|
||||
screen_icons = int(math.floor(self._Screen._Width / (icon_width + self._PageIconMargin)))
|
||||
if self._IconNumbers > screen_icons:
|
||||
self.IconsEasingLeft((icon_width + self._PageIconMargin) * (self._IconNumbers - screen_icons))
|
||||
elif self._IconNumbers > 0:
|
||||
self.IconSmoothUp(icon_width+ self._PageIconMargin)
|
||||
|
||||
self._PsIndex = self._IconIndex
|
||||
self._Screen.Draw()
|
||||
@ -644,4 +670,3 @@ class Page(Widget):
|
||||
self.DrawIcons()
|
||||
self.DrawPageSelector()
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@ import pygame
|
||||
import config
|
||||
import ConfigParser
|
||||
|
||||
from util_funcs import FileExists
|
||||
|
||||
class CaseConfigParser(ConfigParser.SafeConfigParser):
|
||||
def optionxform(self, optionstr):
|
||||
return optionstr
|
||||
@ -21,6 +23,8 @@ class SkinManager(object):
|
||||
|
||||
_Colors = {}
|
||||
_Config = None
|
||||
_Fonts = {}
|
||||
DefaultSkin = "../skin/default"
|
||||
|
||||
def __init__(self):
|
||||
self.Init()
|
||||
@ -33,6 +37,38 @@ class SkinManager(object):
|
||||
def Init(self):
|
||||
if not SkinManager._Colors:
|
||||
self.SetColors()
|
||||
if not SkinManager._Fonts:
|
||||
self.SetFonts()
|
||||
|
||||
def SetFonts(self):
|
||||
if not pygame.font.get_init():
|
||||
pygame.font.init()
|
||||
|
||||
skinpath = config.SKIN+"/truetype"
|
||||
fonts_path = {}
|
||||
fonts_path["varela"] = "%s/VarelaRound-Regular.ttf" % skinpath
|
||||
print(fonts_path["varela"])
|
||||
fonts_path["veramono"] = "%s/VeraMono.ttf" % skinpath
|
||||
fonts_path["noto"] = "%s/NotoSansMono-Regular.ttf" % skinpath
|
||||
fonts_path["notocjk"] = "%s/NotoSansCJK-Regular.ttf" % skinpath
|
||||
|
||||
for i in range(10,29):
|
||||
self._Fonts["varela%d"%i] = pygame.font.Font(fonts_path["varela"],i)
|
||||
|
||||
self._Fonts["varela34"] = pygame.font.Font(fonts_path["varela"],34)
|
||||
self._Fonts["varela40"] = pygame.font.Font(fonts_path["varela"],40)
|
||||
self._Fonts["varela120"] = pygame.font.Font(fonts_path["varela"],120)
|
||||
|
||||
for i in range(10,26):
|
||||
self._Fonts["veramono%d"%i] = pygame.font.Font(fonts_path["veramono"],i)
|
||||
|
||||
for i in range(10,28):
|
||||
self._Fonts["notosansmono%d"%i] = pygame.font.Font(fonts_path["noto"],i)
|
||||
|
||||
for i in range(10,28):
|
||||
self._Fonts["notosanscjk%d"%i] = pygame.font.Font(fonts_path["notocjk"],i)
|
||||
|
||||
self._Fonts["arial"] = pygame.font.SysFont("arial",16)
|
||||
|
||||
def SetColors(self):
|
||||
Colors = {}
|
||||
@ -52,7 +88,7 @@ class SkinManager(object):
|
||||
|
||||
self._Config = CaseConfigParser()
|
||||
|
||||
fname = "../skin/"+config.SKIN+"/config.cfg"
|
||||
fname = config.SKIN+"/config.ini"
|
||||
|
||||
try:
|
||||
self._Config.read(fname)
|
||||
@ -72,12 +108,48 @@ class SkinManager(object):
|
||||
print("error in ConvertToRGB %s" % str(e))
|
||||
continue
|
||||
|
||||
def GiveFont(self,name):
|
||||
return SkinManager._Fonts[name]
|
||||
|
||||
def GiveColor(self,name):
|
||||
if name in SkinManager._Colors:
|
||||
return SkinManager._Colors[name]
|
||||
else:
|
||||
return pygame.Color(255,0,0)
|
||||
|
||||
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/*
|
||||
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/")
|
||||
|
||||
if orig_file_or_dir.startswith(".."):
|
||||
ret = orig_file_or_dir.replace("..",config.SKIN)
|
||||
if FileExists(ret) == False:
|
||||
ret = orig_file_or_dir.replace("..",self.DefaultSkin)
|
||||
else:
|
||||
ret = config.SKIN+"/sys.py/"+orig_file_or_dir
|
||||
if FileExists(ret) == False:
|
||||
ret = self.DefaultSkin+"/sys.py/"+orig_file_or_dir
|
||||
|
||||
if FileExists( ret ):
|
||||
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
|
||||
|
||||
@ -6,7 +6,6 @@ from libs.roundrects import aa_round_rect
|
||||
## local UI import
|
||||
from page import Page,PageStack,PageSelector
|
||||
from label import Label
|
||||
from fonts import fonts
|
||||
from skin_manager import MySkinManager
|
||||
from lang_manager import MyLangManager
|
||||
from widget import Widget
|
||||
|
||||
@ -6,8 +6,8 @@ from libs.roundrects import aa_round_rect
|
||||
## local UI import
|
||||
from UI.page import Page,PageStack,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.skin_manager import MySkinManager
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.widget import Widget
|
||||
|
||||
class Textarea(Widget):
|
||||
@ -26,7 +26,7 @@ class Textarea(Widget):
|
||||
pass
|
||||
|
||||
def Init(self):
|
||||
self._FontObj = fonts["veramono24"]
|
||||
self._FontObj = MyLangManager.TrFont("veramono24")
|
||||
#pygame.font.Font(fonts_path["veramono"],24)
|
||||
|
||||
def SubTextIndex(self):
|
||||
|
||||
@ -13,12 +13,12 @@ import alsaaudio
|
||||
|
||||
##local import
|
||||
from constants import ICON_TYPES,Width,Height
|
||||
from fonts import fonts
|
||||
from icon_item import IconItem
|
||||
from multi_icon_item import MultiIconItem
|
||||
from icon_pool import MyIconPool
|
||||
from lang_manager import MyLangManager
|
||||
from util_funcs import midRect,SwapAndShow,SkinMap
|
||||
from util_funcs import midRect,SwapAndShow
|
||||
from skin_manager import MySkinManager
|
||||
from widget import Widget
|
||||
from config import Battery
|
||||
|
||||
@ -26,7 +26,7 @@ from libs.roundrects import aa_round_rect
|
||||
|
||||
from libs.DBUS import is_wifi_connected_now,wifi_strength
|
||||
|
||||
icon_base_path = SkinMap("gameshell/titlebar_icons/")
|
||||
icon_base_path = MySkinManager.GiveIcon("gameshell/titlebar_icons/")
|
||||
class TitleBar(Widget):
|
||||
_Width = Width
|
||||
_Height = 25
|
||||
@ -259,7 +259,7 @@ class TitleBar(Widget):
|
||||
|
||||
round_corners._MyType = ICON_TYPES["STAT"]
|
||||
round_corners._Parent = self
|
||||
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
|
||||
round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
|
||||
round_corners.Adjust(0,0,10,10,0)
|
||||
|
||||
self._Icons["round_corners"] = round_corners
|
||||
@ -299,13 +299,14 @@ class TitleBar(Widget):
|
||||
self._Title = title
|
||||
|
||||
cur_time = datetime.now().strftime("%H:%M")
|
||||
time_text_size = fonts["varela12"].size(cur_time)
|
||||
time_text_font = MySkinManager.GiveFont("varela12")
|
||||
time_text_size = time_text_font.size(cur_time)
|
||||
title_text_size = MyLangManager.TrFont("varela16").size(title)
|
||||
|
||||
self._CanvasHWND.blit(MyLangManager.TrFont("varela16").render(title,True,self._SkinManager.GiveColor("Text")),midRect(title_text_size[0]/2+self._LOffset,
|
||||
title_text_size[1]/2+(self._BarHeight-title_text_size[1])/2,
|
||||
title_text_size[0],title_text_size[1],Width,Height))
|
||||
self._CanvasHWND.blit( fonts["varela12"].render(cur_time,True,self._SkinManager.GiveColor("Text")),midRect(Width-time_text_size[0]/2-self._ROffset,
|
||||
self._CanvasHWND.blit( time_text_font.render(cur_time,True,self._SkinManager.GiveColor("Text")),midRect(Width-time_text_size[0]/2-self._ROffset,
|
||||
time_text_size[1]/2+(self._BarHeight-time_text_size[1])/2,
|
||||
time_text_size[0],time_text_size[1],Width,Height))
|
||||
|
||||
|
||||
@ -11,12 +11,11 @@ from datetime import datetime
|
||||
import base64
|
||||
from beeprint import pp
|
||||
|
||||
from util_funcs import midRect, SkinMap
|
||||
from fonts import fonts
|
||||
from util_funcs import midRect
|
||||
|
||||
from skin_manager import MySkinManager
|
||||
|
||||
BlankPng = SkinMap("gameshell/blank.png") # 80x80
|
||||
BlankPng = MySkinManager.GiveIcon("gameshell/blank.png") # 80x80
|
||||
## use blank circle as bg, Two alpha As Icon Label
|
||||
#Upper and Lower
|
||||
|
||||
@ -28,7 +27,7 @@ class UntitledIcon(object):
|
||||
_Height = 80
|
||||
|
||||
_Words = ["G", "s"]
|
||||
_FontObj = fonts["varela40"]
|
||||
_FontObj = MySkinManager.GiveFont("varela40")
|
||||
|
||||
_BG = None # initial surface
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import platform
|
||||
import pygame
|
||||
import os
|
||||
import subprocess
|
||||
@ -13,27 +13,6 @@ import string
|
||||
from Xlib import X,display
|
||||
import config
|
||||
|
||||
def SkinMap(orig_file_or_dir):
|
||||
DefaultSkin = "default"
|
||||
|
||||
#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"):
|
||||
orig_file_or_dir = orig_file_or_dir.replace("/home/cpi/apps/Menu/","../Menu/GameShell/")
|
||||
|
||||
if orig_file_or_dir.startswith(".."):
|
||||
ret = orig_file_or_dir.replace("..","../skin/"+config.SKIN)
|
||||
if FileExists(ret) == False:
|
||||
ret = orig_file_or_dir.replace("..","../skin/"+DefaultSkin)
|
||||
else:
|
||||
ret = "../skin/"+config.SKIN+"/sys.py/"+orig_file_or_dir
|
||||
if FileExists(ret) == False:
|
||||
ret = "../skin/"+DefaultSkin+"/sys.py/"+orig_file_or_dir
|
||||
|
||||
if FileExists( ret ):
|
||||
return ret
|
||||
else: ## if not existed both in default or custom skin ,return where it is
|
||||
return orig_file_or_dir
|
||||
|
||||
def get_git_revision_hash():
|
||||
return subprocess.check_output(['git', 'rev-parse', 'HEAD'])
|
||||
|
||||
@ -131,3 +110,14 @@ def DrawText(canvas,text, x,y,width,height,canWidth,canHeight,fontObj):# text fo
|
||||
|
||||
def SwapAndShow():
|
||||
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 -*-
|
||||
import os
|
||||
import platform
|
||||
from UI.util_funcs import FileExists,ArmSystem
|
||||
|
||||
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
||||
|
||||
@ -10,11 +13,13 @@ Battery = "/sys/class/power_supply/axp20x-battery/uevent"
|
||||
|
||||
MPD_socket = "/tmp/mpd.socket"
|
||||
|
||||
UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI/master/launcher_ver.json"
|
||||
UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI/master/launcher_ver0.4.json"
|
||||
|
||||
VERSION="stable 1.24"
|
||||
VERSION="stable 1.25"
|
||||
|
||||
SKIN="default"
|
||||
SKIN=None
|
||||
|
||||
ButtonsLayout="xbox"
|
||||
|
||||
## three timer values in seconds: dim screen, close screen,PowerOff
|
||||
## zero means no action
|
||||
@ -26,5 +31,47 @@ PowerLevels["balance_saving"] = [40,0,0]
|
||||
|
||||
PowerLevel = "balance_saving"
|
||||
|
||||
def PreparationInAdv():
|
||||
global SKIN,ButtonsLayout
|
||||
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(".buttonslayout") == True:
|
||||
with open(".buttonslayout") as f:
|
||||
btnlayout = f.read()
|
||||
|
||||
btnlayout = btnlayout.strip()
|
||||
ButtonsLayout = btnlayout
|
||||
if ButtonsLayout != "xbox" and ButtonsLayout != "snes":
|
||||
ButtonsLayout = "xbox"
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -106,3 +106,8 @@ Music Library=乐库
|
||||
Play/Pause=播放/暂停
|
||||
my favorite music=我的音乐库
|
||||
Check Update=检查更新
|
||||
Switch to LauncherGo=切换至LauncherGo
|
||||
GPU driver switch=切换GPU驱动
|
||||
Network gateway switch=切换网关
|
||||
Rebooting to LauncherGo=正在重启至LauncherGo...
|
||||
Awaiting Input=等待输入中...
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import platform
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
import sys
|
||||
import commands
|
||||
import logging
|
||||
import errno
|
||||
|
||||
from wicd import misc
|
||||
##misc.to_bool
|
||||
##misc.misc.noneToString
|
||||
@ -21,7 +24,7 @@ import pygame
|
||||
from sys import exit
|
||||
import os
|
||||
|
||||
from beeprint import pp
|
||||
#from beeprint import pp
|
||||
########
|
||||
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
||||
import dbus.glib
|
||||
@ -29,10 +32,10 @@ else:
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
||||
|
||||
import config
|
||||
#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.util_funcs import ReplaceSuffix,FileExists, ReadTheFileContent,midRect,color_surface,SwapAndShow,GetExePath,X_center_mouse
|
||||
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,ArmSystem
|
||||
from UI.page import PageStack,PageSelector,Page
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
@ -43,10 +46,9 @@ from UI.main_screen import MainScreen
|
||||
from UI.above_all_patch import SoundPatch
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.createby_screen import CreateByScreen
|
||||
|
||||
from UI.skin_manager import MySkinManager
|
||||
from libs.DBUS import setup_dbus
|
||||
|
||||
import config
|
||||
|
||||
if not pygame.display.get_init():
|
||||
pygame.display.init()
|
||||
@ -289,6 +291,35 @@ def RecordKeyDns(thekey,main_screen):
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def release_self_fds():
|
||||
fds_flags= ["pipe","socket",".ttf"]
|
||||
"""List process currently open FDs and their target """
|
||||
if sys.platform != 'linux2':
|
||||
raise NotImplementedError('Unsupported platform: %s' % sys.platform)
|
||||
|
||||
ret = {}
|
||||
base = '/proc/self/fd'
|
||||
for num in os.listdir(base):
|
||||
path = None
|
||||
try:
|
||||
path = os.readlink(os.path.join(base, num))
|
||||
except OSError as err:
|
||||
# Last FD is always the "listdir" one (which may be closed)
|
||||
if err.errno != errno.ENOENT:
|
||||
raise
|
||||
ret[int(num)] = path
|
||||
|
||||
for key in ret:
|
||||
if ret[key] != None and isinstance(ret[key], str):
|
||||
for i in fds_flags:
|
||||
if i in ret[key]:
|
||||
os.close(key)
|
||||
break
|
||||
return ret
|
||||
|
||||
|
||||
def event_process(event,main_screen):
|
||||
global sound_patch
|
||||
global everytime_keydown
|
||||
@ -312,10 +343,19 @@ def event_process(event,main_screen):
|
||||
pygame.quit()
|
||||
gobject_main_loop.quit()
|
||||
os.chdir( GetExePath())
|
||||
exec_app_cmd = "cd "+os.path.dirname(event.message)+";"
|
||||
|
||||
endpos = len(event.message)
|
||||
space_break_pos = endpos
|
||||
for i in range(0,endpos):
|
||||
if event.message[i] == "/" and event.message[i-1] == " " and i > 6:
|
||||
space_break_pos = i-1
|
||||
break
|
||||
|
||||
exec_app_cmd = "cd "+os.path.dirname(event.message[:space_break_pos])+";"
|
||||
exec_app_cmd += event.message
|
||||
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||
print(exec_app_cmd)
|
||||
release_self_fds()
|
||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||
os.chdir( GetExePath())
|
||||
os.exelp("python","python"," "+myscriptname)
|
||||
@ -330,10 +370,18 @@ def event_process(event,main_screen):
|
||||
pygame.quit()
|
||||
gobject_main_loop.quit()
|
||||
os.chdir( GetExePath())
|
||||
exec_app_cmd = "cd "+os.path.dirname(event.message)+";"
|
||||
endpos = len(event.message)
|
||||
space_break_pos = endpos
|
||||
for i in range(0,endpos):
|
||||
if event.message[i] == "/" and event.message[i-1] == " " and i > 6:
|
||||
space_break_pos = i-1
|
||||
break
|
||||
|
||||
exec_app_cmd = "cd "+os.path.dirname(event.message[:space_break_pos])+";"
|
||||
exec_app_cmd += event.message
|
||||
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||
print(exec_app_cmd)
|
||||
release_self_fds()
|
||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||
os.chdir( GetExePath())
|
||||
os.exelp("python","python"," "+myscriptname)
|
||||
@ -344,6 +392,7 @@ def event_process(event,main_screen):
|
||||
os.chdir(GetExePath())
|
||||
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||
print(exec_app_cmd)
|
||||
release_self_fds()
|
||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||
os.chdir( GetExePath())
|
||||
os.exelp("python","python"," "+myscriptname)
|
||||
@ -352,6 +401,7 @@ def event_process(event,main_screen):
|
||||
pygame.quit()
|
||||
gobject_main_loop.quit()
|
||||
exec_app_cmd = event.message +";"
|
||||
release_self_fds()
|
||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||
sys.exit(-1)
|
||||
return
|
||||
@ -521,7 +571,7 @@ def big_loop():
|
||||
sound_patch.Init()
|
||||
#pp(main_screen._Pages[0],True,6)
|
||||
|
||||
screen.fill(bg_color)
|
||||
screen.fill(MySkinManager.GiveColor("White"))
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
@ -537,27 +587,6 @@ def big_loop():
|
||||
gobject_loop()
|
||||
|
||||
|
||||
def PreparationInAdv():
|
||||
|
||||
if "arm" not in platform.machine():
|
||||
return
|
||||
|
||||
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()###
|
||||
if __name__ == '__main__':
|
||||
|
||||
@ -574,7 +603,6 @@ if __name__ == '__main__':
|
||||
|
||||
pygame.key.set_repeat(DT+DT*6+DT/2, DT+DT*3+DT/2)
|
||||
|
||||
|
||||
MyIconPool.Init()
|
||||
|
||||
setup_dbus()
|
||||
@ -591,8 +619,6 @@ if __name__ == '__main__':
|
||||
exit()
|
||||
|
||||
|
||||
PreparationInAdv()
|
||||
|
||||
crt_screen = CreateByScreen()
|
||||
crt_screen.Init()
|
||||
crt_screen._HWND = screen
|
||||
|
||||