2
.cpirc
@ -1,7 +1,7 @@
|
|||||||
SCREEN=`cat /sys/class/graphics/fb0/modes`
|
SCREEN=`cat /sys/class/graphics/fb0/modes`
|
||||||
|
|
||||||
XORG_CONF="~/launcher/.xorg.conf"
|
XORG_CONF="~/launcher/.xorg.conf"
|
||||||
if [ -f ~/.lima ]
|
if [ -f /home/cpi/.lima ]
|
||||||
then
|
then
|
||||||
XORG_CONF="~/launcher/.xorg_lima.conf"
|
XORG_CONF="~/launcher/.xorg_lima.conf"
|
||||||
fi
|
fi
|
||||||
|
|||||||
9
.gitignore
vendored
@ -12,3 +12,12 @@ sys.py/.lang
|
|||||||
!**/Jobs/00_lowpower.sh
|
!**/Jobs/00_lowpower.sh
|
||||||
!**/Jobs/00_lowpower.alias
|
!**/Jobs/00_lowpower.alias
|
||||||
.done
|
.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
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
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
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
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.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
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.
|
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,
|
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.
|
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
|
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
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
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
|
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
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.util_funcs import midRect,FileExists
|
||||||
from UI.util_funcs import midRect
|
|
||||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.icon_pool import MyIconPool
|
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.multilabel import MultiLabel
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
|
from config import VERSION
|
||||||
|
|
||||||
class InfoPageListItem(object):
|
class InfoPageListItem(object):
|
||||||
_PosX = 0
|
_PosX = 0
|
||||||
@ -79,7 +80,7 @@ class InfoPageListItem(object):
|
|||||||
class AboutPage(Page):
|
class AboutPage(Page):
|
||||||
_FootMsg = ["Nav.","","","Back",""]
|
_FootMsg = ["Nav.","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela13"]
|
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -207,7 +208,32 @@ class AboutPage(Page):
|
|||||||
memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
|
memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
|
||||||
self._AList["memory"] = memory
|
self._AList["memory"] = memory
|
||||||
break
|
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):
|
def GenList(self):
|
||||||
|
|
||||||
self._MyList = []
|
self._MyList = []
|
||||||
@ -216,7 +242,7 @@ class AboutPage(Page):
|
|||||||
start_y = 10
|
start_y = 10
|
||||||
last_height = 0
|
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"] ):
|
#for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
|
||||||
if u not in self._AList:
|
if u not in self._AList:
|
||||||
continue
|
continue
|
||||||
@ -229,7 +255,7 @@ class AboutPage(Page):
|
|||||||
li._PosY = start_y + last_height
|
li._PosY = start_y + last_height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||||
|
|
||||||
if self._AList[u]["label"] != "":
|
if self._AList[u]["label"] != "":
|
||||||
li.Init( self._AList[u]["label"] )
|
li.Init( self._AList[u]["label"] )
|
||||||
@ -248,14 +274,14 @@ class AboutPage(Page):
|
|||||||
if self._Screen != None:
|
if self._Screen != None:
|
||||||
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
self._HWND = self._Screen._CanvasHWND
|
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._PosX = self._Index*self._Screen._Width
|
||||||
self._Width = self._Screen._Width ## equal to screen width
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = MultiIconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -267,6 +293,9 @@ class AboutPage(Page):
|
|||||||
self.CpuMhz()
|
self.CpuMhz()
|
||||||
self.Uname()
|
self.Uname()
|
||||||
|
|
||||||
|
self.LauncherVersion()
|
||||||
|
self.OsImageVersion()
|
||||||
|
|
||||||
self.GenList()
|
self.GenList()
|
||||||
|
|
||||||
self._Scroller = ListScroller()
|
self._Scroller = ListScroller()
|
||||||
@ -278,7 +307,7 @@ class AboutPage(Page):
|
|||||||
|
|
||||||
def ScrollDown(self):
|
def ScrollDown(self):
|
||||||
dis = 10
|
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._PosY -= dis
|
||||||
self._Scrolled -= dis
|
self._Scrolled -= dis
|
||||||
|
|
||||||
@ -321,16 +350,19 @@ class AboutPage(Page):
|
|||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
#self._Ps.Draw()
|
#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:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
self._DrawOnce = True
|
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:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -66,21 +65,21 @@ class AirplanePage(Page):
|
|||||||
|
|
||||||
|
|
||||||
airwire = IconItem()
|
airwire = IconItem()
|
||||||
airwire._ImgSurf = MyIconPool._Icons["airwire"]
|
airwire._ImgSurf = MyIconPool.GiveIconSurface("airwire")
|
||||||
airwire._MyType = ICON_TYPES["STAT"]
|
airwire._MyType = ICON_TYPES["STAT"]
|
||||||
airwire._Parent = self
|
airwire._Parent = self
|
||||||
airwire.Adjust(0,0,5,43,0)
|
airwire.Adjust(0,0,5,43,0)
|
||||||
self._Icons["airwire"] = airwire
|
self._Icons["airwire"] = airwire
|
||||||
|
|
||||||
GS = IconItem()
|
GS = IconItem()
|
||||||
GS._ImgSurf = MyIconPool._Icons["GS"]
|
GS._ImgSurf = MyIconPool.GiveIconSurface("GS")
|
||||||
GS._MyType = ICON_TYPES["STAT"]
|
GS._MyType = ICON_TYPES["STAT"]
|
||||||
GS._Parent = self
|
GS._Parent = self
|
||||||
GS.Adjust(0,0,72,95,0)
|
GS.Adjust(0,0,72,95,0)
|
||||||
self._Icons["GS"] = GS
|
self._Icons["GS"] = GS
|
||||||
|
|
||||||
DialogBoxs = MultiIconItem()
|
DialogBoxs = MultiIconItem()
|
||||||
DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"]
|
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("DialogBoxs")
|
||||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||||
DialogBoxs._Parent = self
|
DialogBoxs._Parent = self
|
||||||
DialogBoxs._IconWidth = 134
|
DialogBoxs._IconWidth = 134
|
||||||
@ -91,7 +90,7 @@ class AirplanePage(Page):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
bgpng = MultiIconItem()
|
bgpng = MultiIconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -100,8 +99,8 @@ class BleInfoPage(Page):
|
|||||||
_FootMsg = ["Nav","Forget","Disconnect","Back",""]
|
_FootMsg = ["Nav","Forget","Disconnect","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
_ListSmFontObj = fonts["varela12"] # small font
|
_ListSmFontObj = MySkinManager.GiveFont("varela12") # small font
|
||||||
_ListSm2FontObj= fonts["varela11"]
|
_ListSm2FontObj= MySkinManager.GiveFont("varela11")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
_Path = ""
|
_Path = ""
|
||||||
@ -380,7 +379,7 @@ class BluetoothPage(Page):
|
|||||||
_LastStatusMsg = ""
|
_LastStatusMsg = ""
|
||||||
_FootMsg = ["Nav","Info","Scan","Back","TryConnect"]
|
_FootMsg = ["Nav","Info","Scan","Back","TryConnect"]
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
_ListFontObj = fonts["notosanscjk15"]
|
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_InfoPage = None
|
_InfoPage = None
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import pygame
|
|||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
@ -99,7 +98,7 @@ class NetItem(object):
|
|||||||
self._Labels["mac_addr"] = name_label
|
self._Labels["mac_addr"] = name_label
|
||||||
|
|
||||||
done_icon = NetItemIcon()
|
done_icon = NetItemIcon()
|
||||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
done_icon._Parent = self
|
done_icon._Parent = self
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ from UI.constants import Width,Height,ICON_TYPES
|
|||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
from UI.slider import Slider
|
from UI.slider import Slider
|
||||||
@ -40,7 +39,7 @@ class BSlider(Slider):
|
|||||||
self._Height = self._Parent._Height
|
self._Height = self._Parent._Height
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["light"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("light")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -50,7 +49,7 @@ class BSlider(Slider):
|
|||||||
scale = MultiIconItem()
|
scale = MultiIconItem()
|
||||||
scale._MyType = ICON_TYPES["STAT"]
|
scale._MyType = ICON_TYPES["STAT"]
|
||||||
scale._Parent = self
|
scale._Parent = self
|
||||||
scale._ImgSurf = MyIconPool._Icons["scale"]
|
scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||||
scale._IconWidth = 82
|
scale._IconWidth = 82
|
||||||
scale._IconHeight = 63
|
scale._IconHeight = 63
|
||||||
scale.Adjust(0,0,82,63,0)
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, GetButtonsLayoutMode, SetButtonsLayoutMode, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, GetButtonsLayoutMode, SetButtonsLayoutMode, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -117,7 +116,6 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
class ButtonsLayoutPage(Page):
|
class ButtonsLayoutPage(Page):
|
||||||
_FootMsg = ["Nav.","","UpdateRetroArch","Back","Toggle"]
|
_FootMsg = ["Nav.","","UpdateRetroArch","Back","Toggle"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela13"]
|
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -155,7 +153,7 @@ class ButtonsLayoutPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
DialogBoxs = MultiIconItem()
|
DialogBoxs = MultiIconItem()
|
||||||
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
|
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("buttonslayout")
|
||||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||||
DialogBoxs._Parent = self
|
DialogBoxs._Parent = self
|
||||||
DialogBoxs._IconWidth = 300
|
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.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,FileExists
|
from UI.util_funcs import midRect,FileExists
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -78,7 +77,7 @@ class PageListItem(InfoPageListItem):
|
|||||||
class GateWayPage(Page):
|
class GateWayPage(Page):
|
||||||
_FootMsg = ["Nav","Clear All","","Back","Select"]
|
_FootMsg = ["Nav","Clear All","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -134,7 +133,7 @@ class GateWayPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
done = IconItem()
|
done = IconItem()
|
||||||
done._ImgSurf = MyIconPool._Icons["done"]
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done._MyType = ICON_TYPES["STAT"]
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
done._Parent = self
|
done._Parent = self
|
||||||
self._Icons["done"] = done
|
self._Icons["done"] = done
|
||||||
@ -319,7 +318,7 @@ class GateWayPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -77,7 +76,7 @@ class PageListItem(InfoPageListItem):
|
|||||||
class LanguagesPage(Page):
|
class LanguagesPage(Page):
|
||||||
_FootMsg = ["Nav","","","Back","Select"]
|
_FootMsg = ["Nav","","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -134,7 +133,7 @@ class LanguagesPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
done = IconItem()
|
done = IconItem()
|
||||||
done._ImgSurf = MyIconPool._Icons["done"]
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done._MyType = ICON_TYPES["STAT"]
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
done._Parent = self
|
done._Parent = self
|
||||||
self._Icons["done"] = done
|
self._Icons["done"] = done
|
||||||
@ -279,7 +278,7 @@ class LanguagesPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,33 @@ import os
|
|||||||
import pygame
|
import pygame
|
||||||
#import math
|
#import math
|
||||||
#mport subprocess
|
#mport subprocess
|
||||||
import platform
|
|
||||||
#from beeprint import pp
|
#from beeprint import pp
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
## local UI import
|
## local UI import
|
||||||
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
|
from UI.util_funcs import ArmSystem
|
||||||
from UI.lang_manager import MyLangManager
|
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):
|
class APIOBJ(object):
|
||||||
|
|
||||||
_Page = None
|
_Page = None
|
||||||
@ -17,16 +37,16 @@ class APIOBJ(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
def Init(self,main_screen):
|
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):
|
def API(self,main_screen):
|
||||||
if main_screen !=None:
|
if main_screen !=None:
|
||||||
main_screen._MsgBox.SetText("Rebooting to LauncherGo")
|
main_screen.PushPage(self._Page)
|
||||||
main_screen._MsgBox.Draw()
|
main_screen.Draw()
|
||||||
main_screen.SwapAndShow()
|
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()
|
OBJ = APIOBJ()
|
||||||
def Init(main_screen):
|
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.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.util_funcs import midRect,FileExists,ArmSystem
|
||||||
from UI.util_funcs import midRect,FileExists
|
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
@ -77,7 +76,7 @@ class PageListItem(InfoPageListItem):
|
|||||||
class GPUDriverPage(Page):
|
class GPUDriverPage(Page):
|
||||||
_FootMsg = ["Nav","","","Back","Select"]
|
_FootMsg = ["Nav","","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk12")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -102,8 +101,8 @@ class GPUDriverPage(Page):
|
|||||||
start_y = 0
|
start_y = 0
|
||||||
last_height = 0
|
last_height = 0
|
||||||
|
|
||||||
drivers = [["fbturbo","Fbturbo"],
|
drivers = [["fbturbo","FBTURBO driver (Software Rendering)"],
|
||||||
["modesetting","Lima"]]
|
["modesetting","LIMA driver (Experimental Hardware Rendering)"]]
|
||||||
|
|
||||||
|
|
||||||
for i,u in enumerate( drivers ):
|
for i,u in enumerate( drivers ):
|
||||||
@ -133,7 +132,7 @@ class GPUDriverPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
done = IconItem()
|
done = IconItem()
|
||||||
done._ImgSurf = MyIconPool._Icons["done"]
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done._MyType = ICON_TYPES["STAT"]
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
done._Parent = self
|
done._Parent = self
|
||||||
self._Icons["done"] = done
|
self._Icons["done"] = done
|
||||||
@ -171,10 +170,16 @@ class GPUDriverPage(Page):
|
|||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
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('~') )
|
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('~') )
|
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)
|
pygame.time.delay(800)
|
||||||
os.system("sudo reboot")
|
os.system("sudo reboot")
|
||||||
@ -266,7 +271,7 @@ class GPUDriverPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
@ -279,7 +284,7 @@ class APIOBJ(object):
|
|||||||
def Init(self,main_screen):
|
def Init(self,main_screen):
|
||||||
self._Page = GPUDriverPage()
|
self._Page = GPUDriverPage()
|
||||||
self._Page._Screen = main_screen
|
self._Page._Screen = main_screen
|
||||||
self._Page._Name ="GPU driver switch"
|
self._Page._Name ="GPU Driver Switch"
|
||||||
self._Page.Init()
|
self._Page.Init()
|
||||||
|
|
||||||
def API(self,main_screen):
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,FileExists,IsExecutable
|
from UI.util_funcs import midRect,FileExists,IsExecutable
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -45,7 +44,7 @@ class NotifyJobListItem(InfoPageListItem):
|
|||||||
self._Labels["Text"] = l
|
self._Labels["Text"] = l
|
||||||
|
|
||||||
done_icon = IconItem()
|
done_icon = IconItem()
|
||||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
done_icon._Parent = self
|
done_icon._Parent = self
|
||||||
|
|
||||||
@ -126,7 +125,7 @@ class NotificationPage(Page):
|
|||||||
li._PosY = start_y + counter*InfoPageListItem._Height
|
li._PosY = start_y + counter*InfoPageListItem._Height
|
||||||
li._Width = Width-10
|
li._Width = Width-10
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||||
|
|
||||||
if IsExecutable(v):
|
if IsExecutable(v):
|
||||||
li._ReadOnly = True
|
li._ReadOnly = True
|
||||||
|
|||||||
@ -7,6 +7,8 @@ from UI.constants import RUNSYS
|
|||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class PowerOffConfirmPage(ConfirmPage):
|
class PowerOffConfirmPage(ConfirmPage):
|
||||||
@ -48,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
if IsKeyStartOrA(event.key):
|
if IsKeyStartOrA(event.key):
|
||||||
if self.CheckBattery() < 20:
|
if self.CheckBattery() < 20:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||||
else:
|
else:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
|
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES,POWEROPT
|
from UI.constants import Width,Height,ICON_TYPES,POWEROPT
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -292,7 +291,7 @@ class InfoPage(Page):
|
|||||||
class PowerOptionsPage(Page):
|
class PowerOptionsPage(Page):
|
||||||
_FootMsg = ["Nav","Detail","","Back","Select"]
|
_FootMsg = ["Nav","Detail","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -379,7 +378,7 @@ class PowerOptionsPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
done = IconItem()
|
done = IconItem()
|
||||||
done._ImgSurf = MyIconPool._Icons["done"]
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done._MyType = ICON_TYPES["STAT"]
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
done._Parent = self
|
done._Parent = self
|
||||||
self._Icons["done"] = done
|
self._Icons["done"] = done
|
||||||
@ -522,7 +521,7 @@ class PowerOptionsPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
294
Menu/GameShell/10_Settings/Skins/__init__.py
Normal file
@ -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 = SoundPage()
|
||||||
|
|
||||||
myvars.SoundPage._Screen = main_screen
|
myvars.SoundPage._Screen = main_screen
|
||||||
myvars.SoundPage._Name = "Sound volume"
|
myvars.SoundPage._Name = "Sound Volume"
|
||||||
myvars.SoundPage.Init()
|
myvars.SoundPage.Init()
|
||||||
|
|||||||
@ -11,7 +11,6 @@ from UI.constants import Width,Height,ICON_TYPES
|
|||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
from UI.slider import Slider
|
from UI.slider import Slider
|
||||||
@ -44,7 +43,7 @@ class SoundSlider(Slider):
|
|||||||
self._Height = self._Parent._Height
|
self._Height = self._Parent._Height
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["vol"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("vol")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -54,7 +53,7 @@ class SoundSlider(Slider):
|
|||||||
self._Scale = MultiIconItem()
|
self._Scale = MultiIconItem()
|
||||||
self._Scale._MyType = ICON_TYPES["STAT"]
|
self._Scale._MyType = ICON_TYPES["STAT"]
|
||||||
self._Scale._Parent = self
|
self._Scale._Parent = self
|
||||||
self._Scale._ImgSurf = MyIconPool._Icons["scale"]
|
self._Scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||||
self._Scale._IconWidth = 82
|
self._Scale._IconWidth = 82
|
||||||
self._Scale._IconHeight = 63
|
self._Scale._IconHeight = 63
|
||||||
self._Scale.Adjust(0,0,82,63,0)
|
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_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
|
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
@ -55,11 +54,11 @@ class StoragePage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
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)
|
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
|
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._BGlabel.SetColor( self._HighColor )
|
||||||
|
|
||||||
self._FreeLabel = Label()
|
self._FreeLabel = Label()
|
||||||
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
|
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||||
self._FreeLabel.Init("Free",fonts["varela13"])
|
self._FreeLabel.Init("Free",MySkinManager.GiveFont("varela13"))
|
||||||
self._FreeLabel.SetColor(self._BGlabel._Color)
|
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.constants import ICON_TYPES
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.skin_manager import MySkinManager
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
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.icon_pool import MyIconPool
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.skin_manager import MySkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
from list_item import ListItem
|
from list_item import ListItem
|
||||||
|
|
||||||
|
|
||||||
@ -86,7 +85,7 @@ class TimezoneListPage(Page):
|
|||||||
_FootMsg = ["Nav","","","Back","Select"]
|
_FootMsg = ["Nav","","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_SwapMyList = []
|
_SwapMyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
_MyStack = None
|
_MyStack = None
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
@ -177,7 +176,7 @@ class TimezoneListPage(Page):
|
|||||||
self.SyncList("/usr/share/zoneinfo/posix")
|
self.SyncList("/usr/share/zoneinfo/posix")
|
||||||
|
|
||||||
icon_for_list = MultiIconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
icon_for_list._Parent = self
|
icon_for_list._Parent = self
|
||||||
|
|
||||||
@ -186,10 +185,10 @@ class TimezoneListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
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.SetLableColor(MySkinManager.GiveColor('Disabled'))
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
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_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,CmdClean,get_git_revision_short_hash
|
from UI.util_funcs import midRect,CmdClean,get_git_revision_short_hash
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
@ -157,7 +156,7 @@ class UpdatePage(Page):
|
|||||||
_Icons = {}
|
_Icons = {}
|
||||||
_FootMsg = ["Nav","","Check Update","Back",""]
|
_FootMsg = ["Nav","","Check Update","Back",""]
|
||||||
|
|
||||||
_ListFontObj = fonts["varela15"]
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
_ConfirmPage = None
|
_ConfirmPage = None
|
||||||
_AList = {}
|
_AList = {}
|
||||||
_MyList = []
|
_MyList = []
|
||||||
@ -177,7 +176,7 @@ class UpdatePage(Page):
|
|||||||
li._PosY = start_y + i*InfoPageListItem._Height
|
li._PosY = start_y + i*InfoPageListItem._Height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||||
|
|
||||||
if self._AList[v]["label"] != "":
|
if self._AList[v]["label"] != "":
|
||||||
li.Init( self._AList[v]["label"] )
|
li.Init( self._AList[v]["label"] )
|
||||||
@ -315,7 +314,7 @@ class APIOBJ(object):
|
|||||||
self._UpdatePage = UpdatePage()
|
self._UpdatePage = UpdatePage()
|
||||||
|
|
||||||
self._UpdatePage._Screen = main_screen
|
self._UpdatePage._Screen = main_screen
|
||||||
self._UpdatePage._Name = "Update"
|
self._UpdatePage._Name = "Update Launcher"
|
||||||
self._UpdatePage.Init()
|
self._UpdatePage.Init()
|
||||||
|
|
||||||
def API(self,main_screen):
|
def API(self,main_screen):
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import pygame
|
|||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
@ -138,13 +137,13 @@ class NetItem(Widget):
|
|||||||
|
|
||||||
|
|
||||||
lock_icon = NetItemIcon()
|
lock_icon = NetItemIcon()
|
||||||
lock_icon._ImgSurf = MyIconPool._Icons["lock"]
|
lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
|
||||||
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
lock_icon._Parent = self
|
lock_icon._Parent = self
|
||||||
self._Icons["lock"] = lock_icon
|
self._Icons["lock"] = lock_icon
|
||||||
|
|
||||||
done_icon = NetItemIcon()
|
done_icon = NetItemIcon()
|
||||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
done_icon._Parent = self
|
done_icon._Parent = self
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ from wicd import misc
|
|||||||
from UI.constants import Width,Height
|
from UI.constants import Width,Height
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,SwapAndShow
|
from UI.util_funcs import midRect,SwapAndShow
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -94,7 +93,7 @@ class WifiInfoPage(Page):
|
|||||||
li._PosY = start_y + i*InfoPageListItem._Height
|
li._PosY = start_y + i*InfoPageListItem._Height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MyLangManager.TrFont("varela12")
|
||||||
|
|
||||||
if self._AList[v]["label"] != "":
|
if self._AList[v]["label"] != "":
|
||||||
li.Init( self._AList[v]["label"] )
|
li.Init( self._AList[v]["label"] )
|
||||||
@ -267,7 +266,7 @@ class WifiList(Page):
|
|||||||
_FootMsg = ["Nav","Info","Scan","Back","Enter"]
|
_FootMsg = ["Nav","Info","Scan","Back","Enter"]
|
||||||
_EncMethods = None
|
_EncMethods = None
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
_ListFontObj = fonts["notosanscjk15"]
|
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_InfoPage = None
|
_InfoPage = None
|
||||||
_CurBssid = ""
|
_CurBssid = ""
|
||||||
@ -569,7 +568,23 @@ class WifiList(Page):
|
|||||||
password_inputed = "".join(myvars.PasswordPage._Textarea._MyWords)
|
password_inputed = "".join(myvars.PasswordPage._Textarea._MyWords)
|
||||||
if is_wifi_connected_now() == False:
|
if is_wifi_connected_now() == False:
|
||||||
self.ConfigWireless(password_inputed)
|
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):
|
def OnReturnBackCb(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -622,8 +637,8 @@ class WifiList(Page):
|
|||||||
for i in wicd_wirelss_encrypt_pwd:
|
for i in wicd_wirelss_encrypt_pwd:
|
||||||
if "preshared_key" in i:
|
if "preshared_key" in i:
|
||||||
if i["preshared_key"] != None:
|
if i["preshared_key"] != None:
|
||||||
if len(i["preshared_key"]) > 0:
|
if len(str(i["preshared_key"])) > 0:
|
||||||
thepass = i["preshared_key"]
|
thepass = str(i["preshared_key"])
|
||||||
break
|
break
|
||||||
|
|
||||||
myvars.PasswordPage.SetPassword(thepass)
|
myvars.PasswordPage.SetPassword(thepass)
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import pygame
|
|||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
# a item for List
|
# a item for List
|
||||||
# - - - - - - - - - - - --
|
# - - - - - - - - - - - --
|
||||||
|
|||||||
@ -9,7 +9,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height
|
from UI.constants import Width,Height
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,FileExists
|
from UI.util_funcs import midRect,FileExists
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
@ -56,18 +55,19 @@ class ListPage(Page):
|
|||||||
["","PowerOptions","Power Options"],
|
["","PowerOptions","Power Options"],
|
||||||
["","Wifi","Wi-Fi"],
|
["","Wifi","Wi-Fi"],
|
||||||
["","Bluetooth","Bluetooth"],
|
["","Bluetooth","Bluetooth"],
|
||||||
["","Sound","Sound Volume"],
|
["","Sound","Sound Volume"],
|
||||||
["","Brightness","BackLight Brightness"],
|
["","Brightness","BackLight Brightness"],
|
||||||
["","Storage",""],
|
["","Storage",""],
|
||||||
["","Time","Timezone"],
|
["","Time","Timezone"],
|
||||||
["","Languages","Languages"],
|
["","Languages","Languages"],
|
||||||
["","Notification","Notification"],
|
["","Notification","Notification"],
|
||||||
["","Update", ""],
|
["","Update", "Update Launcher"],
|
||||||
["","About", "About"],
|
["","About", "About"],
|
||||||
["","PowerOFF","Power off"],
|
["","PowerOFF","Power OFF"],
|
||||||
["","ButtonsLayout","Buttons Layout"],
|
["","ButtonsLayout","Buttons Layout"],
|
||||||
|
["","Skins","Theme Manager"],
|
||||||
["","LauncherGo","Switch to LauncherGo"],
|
["","LauncherGo","Switch to LauncherGo"],
|
||||||
["","Lima","GPU driver switch"],
|
["","Lima","GPU Driver Switch"],
|
||||||
["","GateWay","Network gateway switch"]]
|
["","GateWay","Network gateway switch"]]
|
||||||
|
|
||||||
start_x = 0
|
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
|
cp -rf pico-8 ~/.lexaloffle
|
||||||
|
|
||||||
|
mkdir ~/.lexaloffle/pico-8/carts
|
||||||
|
|
||||||
|
ln -s ~/.lexaloffle/pico-8/carts/ ~/games/PICO-8/carts
|
||||||
|
|
||||||
touch .done
|
touch .done
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
"InstallDir":"pico-8",
|
"InstallDir":"pico-8",
|
||||||
"NotFoundMsg":["Please purchase the PICO-8 \n|None|varela16",
|
"NotFoundMsg":["Please purchase the PICO-8 \n|None|varela16",
|
||||||
"and copy it to the \"~/games/PICO-8\"|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","pico-8_0.1.12_raspi.zip":"08eda95570e63089a2b9f5531503431e","pico-8_0.1.12c_raspi.zip":"1a62b0d7d4e4be65f89f23ec9757cb66","pico-8.zip":"whatever it takes"},
|
||||||
"MD5":{"pico-8_0.1.11g_raspi.zip":"a3f2995cf117499f880bd964d6a0e1f2","pico-8_0.1.11g_amd64.zip":"6726141c784afd4a41be6b7414c1b932"},
|
|
||||||
"Post-Up":"bash Post-Up.sh"
|
"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.constants import ICON_TYPES
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.skin_manager import MySkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
|||||||
@ -15,12 +15,12 @@ from beeprint import pp
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.skin_manager import MySkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ class MPDSpectrumPage(Page):
|
|||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","","","Back",""]
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["veramono12"]
|
_ListFont = MyLangManager.TrFont("veramono12")
|
||||||
_SongFont = fonts["notosanscjk12"]
|
_SongFont = MyLangManager.TrFont("notosanscjk12")
|
||||||
_PIFI = None
|
_PIFI = None
|
||||||
_FIFO = None
|
_FIFO = None
|
||||||
_Color = MySkinManager.GiveColor('Front')
|
_Color = MySkinManager.GiveColor('Front')
|
||||||
@ -136,26 +136,26 @@ class MPDSpectrumPage(Page):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
self._BGpng = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
|
|
||||||
self._SheepHead = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._SheepHead._Parent = self
|
self._SheepHead._Parent = self
|
||||||
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
|
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
|
||||||
|
|
||||||
self._SheepBody = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._SheepBody._Parent = self
|
self._SheepBody._Parent = self
|
||||||
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
|
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self._cwp_png = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._cwp_png._Parent = self
|
self._cwp_png._Parent = self
|
||||||
self._cwp_png.Adjust(0,0,79,79,0)
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
@ -85,7 +84,7 @@ class MusicLibListPage(Page):
|
|||||||
_FootMsg = ["Nav","","Scan","Back","Add to Playlist"]
|
_FootMsg = ["Nav","","Scan","Back","Add to Playlist"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_SwapMyList = []
|
_SwapMyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
_MyStack = None
|
_MyStack = None
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
@ -173,7 +172,7 @@ class MusicLibListPage(Page):
|
|||||||
self.SyncList("/")
|
self.SyncList("/")
|
||||||
|
|
||||||
icon_for_list = MultiIconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
icon_for_list._Parent = self
|
icon_for_list._Parent = self
|
||||||
|
|
||||||
@ -182,7 +181,7 @@ class MusicLibListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
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.page import Page,PageSelector
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
@ -63,7 +62,7 @@ class PlayListPage(Page):
|
|||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","Remove","RTA","Back","Play/Pause"]
|
_FootMsg = ["Nav","Remove","RTA","Back","Play/Pause"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
_CurSongTime="0:0"
|
_CurSongTime="0:0"
|
||||||
@ -181,7 +180,7 @@ class PlayListPage(Page):
|
|||||||
gobject.timeout_add(850,self.GObjectInterval)
|
gobject.timeout_add(850,self.GObjectInterval)
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("heart")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"), MyLangManager.TrFont("varela18"))
|
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.simple_name_space import SimpleNamespace
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
@ -19,7 +18,7 @@ class TinyCloudPage(Page):
|
|||||||
_FootMsg = ["Nav","","","Back",""]
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
|
|
||||||
_ListFontObj = fonts["varela13"]
|
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
_Labels = {}
|
_Labels = {}
|
||||||
@ -156,7 +155,7 @@ class TinyCloudPage(Page):
|
|||||||
self._PngSize["online"] = (75,122)
|
self._PngSize["online"] = (75,122)
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||||
@ -164,7 +163,7 @@ class TinyCloudPage(Page):
|
|||||||
self._Icons["bg"] = bgpng
|
self._Icons["bg"] = bgpng
|
||||||
|
|
||||||
onlinepng = IconItem()
|
onlinepng = IconItem()
|
||||||
onlinepng._ImgSurf = MyIconPool._Icons["online"]
|
onlinepng._ImgSurf = MyIconPool.GiveIconSurface("online")
|
||||||
onlinepng._MyType = ICON_TYPES["STAT"]
|
onlinepng._MyType = ICON_TYPES["STAT"]
|
||||||
onlinepng._Parent = self
|
onlinepng._Parent = self
|
||||||
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
|
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.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -49,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
if IsKeyStartOrA(event.key):
|
if IsKeyStartOrA(event.key):
|
||||||
if self.CheckBattery() < 20:
|
if self.CheckBattery() < 20:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||||
else:
|
else:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
|
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||||
|
|
||||||
if event.key == CurKeys["X"]:
|
if event.key == CurKeys["X"]:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
cmdpath += "sudo reboot"
|
cmdpath += "sudo reboot"
|
||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||||
|
|||||||
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.simple_name_space import SimpleNamespace
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
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.skin_manager import MySkinManager
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
from UI.text_bulletinboard import Textbulletinboard,Text
|
from UI.text_bulletinboard import Textbulletinboard,Text
|
||||||
@ -50,7 +49,7 @@ class NotFoundPage(Page):
|
|||||||
self._CanvasHWND = self._Screen._CanvasHWND
|
self._CanvasHWND = self._Screen._CanvasHWND
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
#print( MyIconPool.Width(self._BG),MyIconPool.Height(self._BG) )
|
#print( MyIconPool.Width(self._BG),MyIconPool.Height(self._BG) )
|
||||||
@ -144,7 +143,7 @@ class HashErrPage(Page):
|
|||||||
self._CanvasHWND = self._Screen._CanvasHWND
|
self._CanvasHWND = self._Screen._CanvasHWND
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.Adjust(0,0,MyIconPool.Width(self._BG),MyIconPool.Height(self._BG),0)
|
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())
|
self._Board.SetAndBlitText(a.Words()+b.Words())
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
return
|
return
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self._Leader.InstallPackage(self._Screen)
|
self._Leader.InstallPackage(self._Screen)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class MyEmulator(object):
|
|||||||
keyname = i.split(".")[0]
|
keyname = i.split(".")[0]
|
||||||
self._Icons[keyname] = pygame.image.load(basepath+"/"+i).convert_alpha()
|
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):
|
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.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,CmdClean,FileExists
|
from UI.util_funcs import midRect,CmdClean,FileExists
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
@ -94,7 +93,7 @@ class FavListPage(Page):
|
|||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","Remove","Scan","","Run"]
|
_FootMsg = ["Nav","Remove","Scan","","Run"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
_MyStack = None
|
_MyStack = None
|
||||||
_Emulator = None
|
_Emulator = None
|
||||||
_Parent = None
|
_Parent = None
|
||||||
@ -130,8 +129,11 @@ class FavListPage(Page):
|
|||||||
stats = os.stat(v)
|
stats = os.stat(v)
|
||||||
if stats.st_gid != self._Parent._FavGID: ## only favs
|
if stats.st_gid != self._Parent._FavGID: ## only favs
|
||||||
continue
|
continue
|
||||||
|
try:
|
||||||
|
dirmap["gamedir"] = v.decode("utf8","ignore")
|
||||||
|
except:
|
||||||
|
dirmap["gamedir"] = v.decode("ascii","ignore")
|
||||||
|
|
||||||
dirmap["gamedir"] = v.decode("utf8")
|
|
||||||
ret.append(dirmap)
|
ret.append(dirmap)
|
||||||
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
||||||
stats = os.stat(v)
|
stats = os.stat(v)
|
||||||
@ -142,7 +144,11 @@ class FavListPage(Page):
|
|||||||
pieces = bname.split(".")
|
pieces = bname.split(".")
|
||||||
if len(pieces) > 1:
|
if len(pieces) > 1:
|
||||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
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)
|
ret.append(dirmap)
|
||||||
|
|
||||||
# else:
|
# else:
|
||||||
@ -228,7 +234,7 @@ class FavListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["star"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("star")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.AddLabel(MyLangManager.Tr("MyFavGames"), MyLangManager.TrFont("varela18"))
|
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
|
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
|
||||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||||
else:
|
else:
|
||||||
if FileExists(self._Emulator["ROM_SO"]):
|
if FileExists(self._Emulator["ROM_SO"].split(" ")[0]):
|
||||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||||
else:
|
else:
|
||||||
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import os
|
|||||||
from UI.constants import ICON_TYPES
|
from UI.constants import ICON_TYPES
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.skin_manager import MySkinManager
|
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.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,CmdClean,FileExists
|
from UI.util_funcs import midRect,CmdClean,FileExists
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
@ -101,7 +100,7 @@ class RomListPage(Page):
|
|||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","Del","Scan","Back","Run","AddFav"]
|
_FootMsg = ["Nav","Del","Scan","Back","Run","AddFav"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
_MyStack = None
|
_MyStack = None
|
||||||
_Emulator = None
|
_Emulator = None
|
||||||
_Parent = None
|
_Parent = None
|
||||||
@ -144,7 +143,11 @@ class RomListPage(Page):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if FileExists(v+"/"+gameshell_bat):
|
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)
|
ret.append(dirmap)
|
||||||
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
||||||
stats = os.stat(v)
|
stats = os.stat(v)
|
||||||
@ -163,7 +166,11 @@ class RomListPage(Page):
|
|||||||
pieces = bname.split(".")
|
pieces = bname.split(".")
|
||||||
if len(pieces) > 1:
|
if len(pieces) > 1:
|
||||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
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)
|
ret.append(dirmap)
|
||||||
# else:
|
# else:
|
||||||
# print("not file or dir")
|
# print("not file or dir")
|
||||||
@ -262,7 +269,7 @@ class RomListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["empty"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
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
|
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
|
||||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||||
else:
|
else:
|
||||||
if FileExists(self._Emulator["ROM_SO"]):
|
if FileExists(self._Emulator["ROM_SO"].split(" ")[0]):
|
||||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||||
else:
|
else:
|
||||||
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
||||||
|
|||||||
@ -15,7 +15,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.download_process_page import DownloadProcessPage
|
from UI.download_process_page import DownloadProcessPage
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.multilabel import MultiLabel
|
from UI.multilabel import MultiLabel
|
||||||
from UI.lang_manager import MyLangManager
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
|
|||||||
@ -12,12 +12,12 @@ from icon_item import IconItem
|
|||||||
from page import Page,PageStack
|
from page import Page,PageStack
|
||||||
from title_bar import TitleBar
|
from title_bar import TitleBar
|
||||||
from foot_bar import FootBar
|
from foot_bar import FootBar
|
||||||
from constants import Width,Height,bg_color
|
from constants import Width,Height
|
||||||
from util_funcs import midRect
|
from util_funcs import midRect
|
||||||
from fonts import fonts
|
|
||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from label import Label
|
from label import Label
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
|
from lang_manager import MyLangManager
|
||||||
from widget import Widget
|
from widget import Widget
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class AboveAllPatch(Widget):
|
|||||||
_Height=120
|
_Height=120
|
||||||
|
|
||||||
_Text =""
|
_Text =""
|
||||||
_FontObj=fonts["veramono20"]
|
_FontObj= MyLangManager.TrFont("veramono20")
|
||||||
_Parent =None
|
_Parent =None
|
||||||
_Color = MySkinManager.GiveColor('Text')
|
_Color = MySkinManager.GiveColor('Text')
|
||||||
_ValColor = MySkinManager.GiveColor('URL')
|
_ValColor = MySkinManager.GiveColor('URL')
|
||||||
|
|||||||
@ -9,7 +9,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
from constants import Width,Height,ICON_TYPES
|
from constants import Width,Height,ICON_TYPES
|
||||||
from page import Page,PageSelector
|
from page import Page,PageSelector
|
||||||
from label import Label
|
from label import Label
|
||||||
from fonts import fonts
|
|
||||||
from util_funcs import midRect
|
from util_funcs import midRect
|
||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
|
|||||||
@ -12,12 +12,10 @@ from pygame.locals import *
|
|||||||
#from beeprint import pp
|
#from beeprint import pp
|
||||||
|
|
||||||
#UI lib
|
#UI lib
|
||||||
from skin_manager import MySkinManager
|
|
||||||
|
|
||||||
|
|
||||||
Width = 320
|
Width = 320
|
||||||
Height = 240
|
Height = 240
|
||||||
bg_color = MySkinManager.GiveColor('White')
|
|
||||||
|
|
||||||
icon_width = 80
|
icon_width = 80
|
||||||
icon_height = 80
|
icon_height = 80
|
||||||
|
|||||||
@ -6,17 +6,18 @@ import commands
|
|||||||
## local package import
|
## local package import
|
||||||
from constants import Width,Height,RUNSYS
|
from constants import Width,Height,RUNSYS
|
||||||
from label import Label
|
from label import Label
|
||||||
from fonts import fonts
|
|
||||||
from full_screen import FullScreen
|
from full_screen import FullScreen
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
|
from lang_manager import MyLangManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class CounterScreen(FullScreen):
|
class CounterScreen(FullScreen):
|
||||||
|
|
||||||
_CounterFont = fonts["varela120"]
|
_CounterFont = MyLangManager.TrFont("varela120")
|
||||||
_TextFont1 = fonts["varela15"]
|
_TextFont1 = MyLangManager.TrFont("varela15")
|
||||||
_TextFont2 = fonts["varela12"]
|
_TextFont2 = MyLangManager.TrFont("varela12")
|
||||||
|
|
||||||
_TopLabel = None
|
_TopLabel = None
|
||||||
_BottomLabel = None
|
_BottomLabel = None
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import shutil
|
|||||||
from constants import Width,Height,ICON_TYPES
|
from constants import Width,Height,ICON_TYPES
|
||||||
from page import Page,PageSelector
|
from page import Page,PageSelector
|
||||||
from label import Label
|
from label import Label
|
||||||
from fonts import fonts
|
|
||||||
from util_funcs import midRect
|
from util_funcs import midRect
|
||||||
from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from confirm_page import ConfirmPage
|
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.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,CmdClean,FileExists
|
from UI.util_funcs import midRect,CmdClean,FileExists
|
||||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
@ -59,14 +58,14 @@ class DownloadProcessPage(Page):
|
|||||||
self._PngSize["needwifi_bg"] = (253,132)
|
self._PngSize["needwifi_bg"] = (253,132)
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["rom_download"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("rom_download")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||||
self._Icons["bg"] = bgpng
|
self._Icons["bg"] = bgpng
|
||||||
|
|
||||||
needwifi_bg = IconItem()
|
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._MyType = ICON_TYPES["STAT"]
|
||||||
needwifi_bg._Parent = self
|
needwifi_bg._Parent = self
|
||||||
needwifi_bg.Adjust(0,0,self._PngSize["needwifi_bg"][0],self._PngSize["needwifi_bg"][1],0)
|
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 = Label()
|
||||||
self._FileNameLabel.SetCanvasHWND(self._CanvasHWND)
|
self._FileNameLabel.SetCanvasHWND(self._CanvasHWND)
|
||||||
self._FileNameLabel.Init("", fonts["varela12"])
|
self._FileNameLabel.Init("", MyLangManager.TrFont("varela12"))
|
||||||
|
|
||||||
self._SizeLabel = Label()
|
self._SizeLabel = Label()
|
||||||
self._SizeLabel.SetCanvasHWND(self._CanvasHWND)
|
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 )
|
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
|
##local import
|
||||||
from constants import Width,Height,ICON_TYPES,ALIGN
|
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 icon_item import IconItem
|
||||||
from fonts import fonts
|
|
||||||
from multi_icon_item import MultiIconItem
|
from multi_icon_item import MultiIconItem
|
||||||
from icon_pool import MyIconPool
|
from icon_pool import MyIconPool
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
from widget import Widget
|
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):
|
class FootBarIcon(MultiIconItem):
|
||||||
|
|
||||||
@ -93,7 +96,7 @@ class FootBar(Widget):
|
|||||||
|
|
||||||
round_corners._MyType = ICON_TYPES["STAT"]
|
round_corners._MyType = ICON_TYPES["STAT"]
|
||||||
round_corners._Parent = self
|
round_corners._Parent = self
|
||||||
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
|
round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
|
||||||
round_corners.Adjust(0,0,10,10,0)
|
round_corners.Adjust(0,0,10,10,0)
|
||||||
|
|
||||||
self._Icons["round_corners"] = round_corners
|
self._Icons["round_corners"] = round_corners
|
||||||
@ -133,7 +136,10 @@ class FootBar(Widget):
|
|||||||
self.Draw()
|
self.Draw()
|
||||||
|
|
||||||
def SetLabelTexts(self,texts):
|
def SetLabelTexts(self,texts):
|
||||||
barr = ["nav","y","x","b","a","select"]
|
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
|
texts2 = texts + [""] if len(texts) == 5 else texts
|
||||||
|
|
||||||
for idx,x in enumerate(barr):
|
for idx,x in enumerate(barr):
|
||||||
|
|||||||
@ -6,12 +6,12 @@ from sys import exit
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from util_funcs import SkinMap
|
from skin_manager import MySkinManager
|
||||||
##pool only store surfaces
|
##pool only store surfaces
|
||||||
|
|
||||||
class IconPool(object):
|
class IconPool(object):
|
||||||
|
|
||||||
_GameShellIconPath = SkinMap("gameshell/icons/")
|
_GameShellIconPath = MySkinManager.GiveIcon("gameshell/icons/")
|
||||||
_Icons = {}
|
_Icons = {}
|
||||||
_Sizes = {}
|
_Sizes = {}
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -33,7 +33,20 @@ class IconPool(object):
|
|||||||
def Height(self,keyname):
|
def Height(self,keyname):
|
||||||
if keyname in self._Sizes:
|
if keyname in self._Sizes:
|
||||||
return self._Sizes[keyname][1]
|
return self._Sizes[keyname][1]
|
||||||
|
|
||||||
|
def GiveIconSurface(self,imgname): ## imgname is the png file name without .png
|
||||||
|
if imgname in self._Icons:
|
||||||
|
return self._Icons[imgname]
|
||||||
|
else:
|
||||||
|
icon_file = MySkinManager.GiveIcon("gameshell/icons/"+imgname+".png")
|
||||||
|
if os.path.isfile(icon_file):
|
||||||
|
keyname = imgname
|
||||||
|
self._Icons[keyname] = pygame.image.load(icon_file).convert_alpha()
|
||||||
|
self._Sizes[keyname] = self._Icons[keyname].get_size()
|
||||||
|
return self._Icons[keyname]
|
||||||
|
|
||||||
|
return None # this will cause panic,if not found both in theme and default skin folder
|
||||||
|
|
||||||
##global Handler
|
##global Handler
|
||||||
MyIconPool = None
|
MyIconPool = None
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,6 @@ from libs import easing
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
@ -108,7 +107,7 @@ class Keyboard(Page):
|
|||||||
self._Width = self._Screen._Width
|
self._Width = self._Screen._Width
|
||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
fontobj = fonts["veramono24"]
|
fontobj = MySkinManager.GiveFont("veramono24")
|
||||||
word_margin = 15
|
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
|
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":
|
if val == "_L" or val == "_R":
|
||||||
it = KeyboardIcon()
|
it = KeyboardIcon()
|
||||||
it._ImgSurf = MyIconPool._Icons[val]
|
it._ImgSurf = MyIconPool.GiveIconSurface(val)
|
||||||
it._Parent = self
|
it._Parent = self
|
||||||
it._Str = val
|
it._Str = val
|
||||||
it.Init(start_x+it._ImgSurf.get_width()/2 ,start_y,it._ImgSurf.get_width(),it._ImgSurf.get_height(),0)
|
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:
|
else:
|
||||||
if val == "_S":
|
if val == "_S":
|
||||||
val = "Space"
|
val = "Space"
|
||||||
ti._FontObj = fonts["veramono15"]
|
ti._FontObj = MySkinManager.GiveFont("veramono15")
|
||||||
ti._Bold = True
|
ti._Bold = True
|
||||||
|
|
||||||
cur_alpha_size = ti._FontObj.size( val)
|
cur_alpha_size = ti._FontObj.size( val)
|
||||||
|
|||||||
@ -6,9 +6,8 @@ from sys import exit
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import config
|
||||||
from config import CurKeySet
|
from config import CurKeySet ## read only
|
||||||
|
|
||||||
|
|
||||||
def GetButtonsLayoutMode():
|
def GetButtonsLayoutMode():
|
||||||
lm = "xbox"
|
lm = "xbox"
|
||||||
@ -25,6 +24,7 @@ def SetButtonsLayoutMode(mode):
|
|||||||
SetXYABButtons(mode)
|
SetXYABButtons(mode)
|
||||||
with open(".buttonslayout", "w") as f:
|
with open(".buttonslayout", "w") as f:
|
||||||
f.write(mode)
|
f.write(mode)
|
||||||
|
config.ButtonsLayout = mode
|
||||||
|
|
||||||
def SetXYABButtons(mode):
|
def SetXYABButtons(mode):
|
||||||
if mode == "snes":
|
if mode == "snes":
|
||||||
|
|||||||
@ -3,8 +3,8 @@ import os
|
|||||||
import pygame
|
import pygame
|
||||||
import config
|
import config
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
from skin_manager import MySkinManager
|
||||||
from util_funcs import FileExists
|
from util_funcs import FileExists
|
||||||
from fonts import fonts
|
|
||||||
|
|
||||||
class CaseConfigParser(ConfigParser.SafeConfigParser):
|
class CaseConfigParser(ConfigParser.SafeConfigParser):
|
||||||
def optionxform(self, optionstr):
|
def optionxform(self, optionstr):
|
||||||
@ -97,12 +97,13 @@ class LangManager(object):
|
|||||||
raise Exception('font string format error')
|
raise Exception('font string format error')
|
||||||
|
|
||||||
if "English.ini" in self._ConfigFileName:
|
if "English.ini" in self._ConfigFileName:
|
||||||
return fonts[orig_font_str]
|
return MySkinManager.GiveFont(orig_font_str)
|
||||||
else:
|
else:
|
||||||
if font_size_number > 28:
|
if font_size_number > 28:
|
||||||
raise Exception('cjk font string format error '+ str(font_size_number))
|
# raise Exception('cjk font string format error '+ str(font_size_number))
|
||||||
|
return MySkinManager.GiveFont(orig_font_str)
|
||||||
return fonts["notosanscjk"+str(font_size_number)]
|
else:
|
||||||
|
return MySkinManager.GiveFont("notosanscjk%d" % font_size_number)
|
||||||
|
|
||||||
##global MyLangManager Handler
|
##global MyLangManager Handler
|
||||||
MyLangManager = None
|
MyLangManager = None
|
||||||
|
|||||||
@ -19,8 +19,8 @@ from icon_item import IconItem
|
|||||||
from page import Page,PageStack
|
from page import Page,PageStack
|
||||||
from title_bar import TitleBar
|
from title_bar import TitleBar
|
||||||
from foot_bar import FootBar
|
from foot_bar import FootBar
|
||||||
from constants import Width,Height,bg_color
|
from constants import Width,Height
|
||||||
from util_funcs import midRect,FileExists,ReplaceSuffix,ReadTheFileContent,CmdClean,MakeExecutable,SkinMap
|
from util_funcs import midRect,FileExists,ReplaceSuffix,ReadTheFileContent,CmdClean,MakeExecutable
|
||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from label import Label
|
from label import Label
|
||||||
from untitled_icon import UntitledIcon
|
from untitled_icon import UntitledIcon
|
||||||
@ -454,7 +454,7 @@ class MainScreen(Widget):
|
|||||||
|
|
||||||
files = os.listdir(_dir)
|
files = os.listdir(_dir)
|
||||||
for i in sorted(files):
|
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:
|
if pglevel == 0:
|
||||||
page = Page()
|
page = Page()
|
||||||
page._Name = self.ExtraName(i)
|
page._Name = self.ExtraName(i)
|
||||||
@ -469,8 +469,8 @@ class MainScreen(Widget):
|
|||||||
iconitem.AddLabel(MyLangManager.Tr(i2),self._IconFont)
|
iconitem.AddLabel(MyLangManager.Tr(i2),self._IconFont)
|
||||||
if FileExists( _dir+"/"+i+"/"+i2+".png"): ### 20_Prog/Prog.png , cut 20_
|
if FileExists( _dir+"/"+i+"/"+i2+".png"): ### 20_Prog/Prog.png , cut 20_
|
||||||
iconitem._ImageName = _dir+"/"+i+"/"+i2+".png"
|
iconitem._ImageName = _dir+"/"+i+"/"+i2+".png"
|
||||||
elif FileExists( SkinMap(_dir+"/"+i2+".png") ):
|
elif FileExists( MySkinManager.GiveIcon(_dir+"/"+i2+".png") ):
|
||||||
iconitem._ImageName = SkinMap(_dir+"/"+i2+".png")
|
iconitem._ImageName = MySkinManager.GiveIcon(_dir+"/"+i2+".png")
|
||||||
else:
|
else:
|
||||||
untitled = UntitledIcon()
|
untitled = UntitledIcon()
|
||||||
untitled.Init()
|
untitled.Init()
|
||||||
@ -567,7 +567,7 @@ class MainScreen(Widget):
|
|||||||
cur_page._Icons.append(iconitem)
|
cur_page._Icons.append(iconitem)
|
||||||
self.ReadTheDirIntoPages(_dir+"/"+i,pglevel+1,iconitem._LinkPage)
|
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):
|
if i.lower().endswith(icon_ext):
|
||||||
i2 = self.ExtraName(i)
|
i2 = self.ExtraName(i)
|
||||||
|
|
||||||
@ -577,8 +577,8 @@ class MainScreen(Widget):
|
|||||||
iconitem._CmdPath = os.path.realpath(_dir+"/"+i)
|
iconitem._CmdPath = os.path.realpath(_dir+"/"+i)
|
||||||
MakeExecutable(iconitem._CmdPath)
|
MakeExecutable(iconitem._CmdPath)
|
||||||
iconitem._MyType = ICON_TYPES["EXE"]
|
iconitem._MyType = ICON_TYPES["EXE"]
|
||||||
if FileExists( SkinMap( _dir+"/"+ReplaceSuffix(i2,"png"))):
|
if FileExists( MySkinManager.GiveIcon( _dir+"/"+ReplaceSuffix(i2,"png"))):
|
||||||
iconitem._ImageName = SkinMap(_dir+"/"+ReplaceSuffix(i2,"png"))
|
iconitem._ImageName = MySkinManager.GiveIcon(_dir+"/"+ReplaceSuffix(i2,"png"))
|
||||||
else:
|
else:
|
||||||
untitled = UntitledIcon()
|
untitled = UntitledIcon()
|
||||||
untitled.Init()
|
untitled.Init()
|
||||||
|
|||||||
@ -43,7 +43,11 @@ class MultiIconItem(IconItem):
|
|||||||
self._PosY+self._Parent._PosY,
|
self._PosY+self._Parent._PosY,
|
||||||
self._Width,self._Height),
|
self._Width,self._Height),
|
||||||
(0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight))
|
(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):
|
def Draw(self):
|
||||||
if self._Align==ALIGN["VCenter"]: #default
|
if self._Align==ALIGN["VCenter"]: #default
|
||||||
if self._Label != None:
|
if self._Label != None:
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
@ -6,104 +6,120 @@ from sys import exit
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import math
|
import math
|
||||||
|
import fnmatch
|
||||||
|
import random
|
||||||
|
|
||||||
|
|
||||||
from libs import easing
|
from libs import easing
|
||||||
|
|
||||||
#import base64
|
# import base64
|
||||||
#from beeprint import pp
|
# from beeprint import pp
|
||||||
|
|
||||||
### local import
|
# local import
|
||||||
from constants import ALIGN,icon_width,icon_height,Width,Height,ICON_TYPES
|
from constants import ALIGN, icon_width, icon_height, Width, Height, ICON_TYPES
|
||||||
from util_funcs import midRect
|
from util_funcs import midRect
|
||||||
from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
from keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from icon_pool import MyIconPool
|
from icon_pool import MyIconPool
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
from widget import Widget
|
from widget import Widget
|
||||||
|
|
||||||
|
|
||||||
class PageStack:
|
class PageStack:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.stack = list()
|
self.stack = list()
|
||||||
|
|
||||||
def Push(self,data):
|
def Push(self, data):
|
||||||
if data not in self.stack:
|
if data not in self.stack:
|
||||||
self.stack.append(data)
|
self.stack.append(data)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def Pop(self):
|
def Pop(self):
|
||||||
if len(self.stack)<=0:
|
if len(self.stack) <= 0:
|
||||||
return None,False
|
return None, False
|
||||||
return self.stack.pop(),True
|
return self.stack.pop(), True
|
||||||
|
|
||||||
def Length(self):
|
def Length(self):
|
||||||
return len(self.stack)
|
return len(self.stack)
|
||||||
|
|
||||||
|
|
||||||
class PageSelector(Widget):
|
class PageSelector(Widget):
|
||||||
|
|
||||||
_Parent = None
|
_Parent = None
|
||||||
_Alpha = 0
|
_Alpha = 0
|
||||||
_OnShow = True
|
_OnShow = True
|
||||||
_IconSurf = None
|
_IconSurf = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def Init(self,x,y,w,h,alpha):
|
def Init(self, x, y, w, h, alpha):
|
||||||
self._PosX = x
|
self._PosX = x
|
||||||
self._PosY = y
|
self._PosY = y
|
||||||
self._Width = w
|
self._Width = w
|
||||||
self._Height = h
|
self._Height = h
|
||||||
self._Alpha = alpha
|
self._Alpha = alpha
|
||||||
|
|
||||||
def Adjust(self,x,y,w,h,alpha):
|
def Adjust(self, x, y, w, h, alpha):
|
||||||
self._PosX = x
|
self._PosX = x
|
||||||
self._PosY = y
|
self._PosY = y
|
||||||
self._Width = w
|
self._Width = w
|
||||||
self._Height = h
|
self._Height = h
|
||||||
self._Alpha = alpha
|
self._Alpha = alpha
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
canvas = self._Parent._CanvasHWND
|
canvas = self._Parent._CanvasHWND
|
||||||
idx = self._Parent._PsIndex
|
idx = self._Parent._PsIndex
|
||||||
iconidx = self._Parent._IconIndex
|
iconidx = self._Parent._IconIndex
|
||||||
|
|
||||||
if idx < len(self._Parent._Icons):
|
if idx < len(self._Parent._Icons):
|
||||||
x = self._Parent._Icons[idx]._PosX+self._Parent._PosX
|
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
|
return
|
||||||
|
|
||||||
#color = (244,197,66,50)
|
# color = (244,197,66,50)
|
||||||
#pygame.draw.rect(canvas,color,rect,1)
|
# pygame.draw.rect(canvas,color,rect,1)
|
||||||
if self._IconSurf != None:
|
if self._IconSurf != None:
|
||||||
self._Parent._CanvasHWND.blit(self._IconSurf,rect)
|
self._Parent._CanvasHWND.blit(self._IconSurf, rect)
|
||||||
|
|
||||||
|
|
||||||
class Page(Widget):
|
class Page(Widget):
|
||||||
_Icons = []
|
_Icons = []
|
||||||
_Ps = None
|
_Ps = None
|
||||||
_PsIndex = 0
|
_PsIndex = 0
|
||||||
_IconNumbers = 0
|
_IconNumbers = 0
|
||||||
_IconIndex = 0 ## shows which icon current selected, the Selector can not move here
|
_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
|
_PrevIconIndex = 0 # for remember the Highlighted Icon ,restore it's PosY to average
|
||||||
_Index = 0
|
_Index = 0
|
||||||
_Align = ALIGN["SLeft"]
|
_Align = ALIGN["SLeft"]
|
||||||
_CanvasHWND = None #
|
_CanvasHWND = None
|
||||||
_HWND = None #
|
_HWND = None
|
||||||
_OnShow = False
|
_OnShow = False
|
||||||
_Name = ""
|
_Name = ""
|
||||||
_Screen = None ## Should be the Screen Class
|
_Screen = None # Should be the Screen Class
|
||||||
_PageIconMargin = 20
|
_PageIconMargin = 20
|
||||||
_FootMsg = ["Nav","","","","Enter"] ## Default Page Foot info
|
_FootMsg = ["Nav", "", "", "", "Enter"] # Default Page Foot info
|
||||||
|
_Wallpaper = None
|
||||||
_SelectedIconTopOffset=20
|
_SelectedIconTopOffset = 20
|
||||||
_EasingDur = 30
|
_EasingDur = 30
|
||||||
_Padding = pygame.Rect(0,0,0,0)# x,y,w,h
|
_Padding = pygame.Rect(0, 0, 0, 0) # x,y,w,h
|
||||||
_Margin = pygame.Rect(0,0,0,0)
|
_Margin = pygame.Rect(0, 0, 0, 0)
|
||||||
_ScrollStep = 1
|
_ScrollStep = 1
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._Icons = []
|
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
|
def AdjustHLeftAlign(self): ## adjust coordinator and append the PageSelector
|
||||||
@ -131,7 +147,7 @@ class Page(Widget):
|
|||||||
cnt+=1
|
cnt+=1
|
||||||
|
|
||||||
ps = PageSelector()
|
ps = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(icon_width/2, TitleBar._BarHeight+icon_height/2,92,92,128)
|
ps.Init(icon_width/2, TitleBar._BarHeight+icon_height/2,92,92,128)
|
||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
@ -155,7 +171,7 @@ class Page(Widget):
|
|||||||
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 = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(start_x,start_y,92,92,128)
|
ps.Init(start_x,start_y,92,92,128)
|
||||||
|
|
||||||
@ -185,7 +201,7 @@ class Page(Widget):
|
|||||||
it._Parent = self
|
it._Parent = self
|
||||||
it._Index = 0
|
it._Index = 0
|
||||||
it.Adjust(start_x,start_y,icon_width,icon_height,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:
|
elif self._IconNumbers == 2:
|
||||||
start_x = (self._Width - self._PageIconMargin - self._IconNumbers*icon_width) / 2 + icon_width/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._Parent = self
|
||||||
it._Index = i
|
it._Index = i
|
||||||
it.Adjust(start_x+i*self._PageIconMargin + i*icon_width,start_y, icon_width, icon_height,0)
|
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:
|
elif self._IconNumbers > 2:
|
||||||
for i in range(0,self._IconNumbers):
|
for i in range(0,self._IconNumbers):
|
||||||
@ -204,10 +220,10 @@ class Page(Widget):
|
|||||||
it._Parent = self
|
it._Parent = self
|
||||||
it._Index = i
|
it._Index = i
|
||||||
it.Adjust(start_x+i*self._PageIconMargin + i*icon_width,start_y,icon_width,icon_height,0)
|
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 = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(start_x,start_y,92,92,128)
|
ps.Init(start_x,start_y,92,92,128)
|
||||||
|
|
||||||
@ -245,7 +261,7 @@ class Page(Widget):
|
|||||||
cnt+=1
|
cnt+=1
|
||||||
|
|
||||||
ps = PageSelector()
|
ps = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(icon_width/2,icon_height/2,92,92,128)
|
ps.Init(icon_width/2,icon_height/2,92,92,128)
|
||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
@ -268,7 +284,7 @@ class Page(Widget):
|
|||||||
it.Adjust(start_x+i*icon_width,start_y,icon_width,icon_height,0)
|
it.Adjust(start_x+i*icon_width,start_y,icon_width,icon_height,0)
|
||||||
|
|
||||||
ps = PageSelector()
|
ps = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(start_x,start_y,92,92,128)
|
ps.Init(start_x,start_y,92,92,128)
|
||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
@ -287,7 +303,7 @@ class Page(Widget):
|
|||||||
|
|
||||||
|
|
||||||
ps = PageSelector()
|
ps = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(start_x,start_y-self._SelectedIconTopOffset,92,92,128)
|
ps.Init(start_x,start_y-self._SelectedIconTopOffset,92,92,128)
|
||||||
|
|
||||||
@ -323,7 +339,7 @@ class Page(Widget):
|
|||||||
|
|
||||||
if self._IconNumbers > 0:
|
if self._IconNumbers > 0:
|
||||||
ps = PageSelector()
|
ps = PageSelector()
|
||||||
ps._IconSurf = MyIconPool._Icons["blueselector"]
|
ps._IconSurf = MyIconPool.GiveIconSurface("blueselector")
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
ps.Init(start_x,start_y,icon_width+4,icon_height+4,128)
|
ps.Init(start_x,start_y,icon_width+4,icon_height+4,128)
|
||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
@ -477,25 +493,20 @@ class Page(Widget):
|
|||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
|
|
||||||
def MoveIconIndexPrev(self):
|
def MoveIconIndexPrev(self):
|
||||||
|
self._PrevIconIndex = self._IconIndex
|
||||||
self._IconIndex-=1
|
self._IconIndex-=1
|
||||||
if self._IconIndex < 0:
|
if self._IconIndex < 0:
|
||||||
self._IconIndex = 0
|
self._IconIndex = max(0, self._IconNumbers - 1) # Wrap Icon Index
|
||||||
self._PrevIconIndex = self._IconIndex
|
|
||||||
return False
|
return False
|
||||||
self._PrevIconIndex = self._IconIndex+1
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def MoveIconIndexNext(self):
|
def MoveIconIndexNext(self):
|
||||||
#True for Moved,False is boundary
|
self._PrevIconIndex = self._IconIndex
|
||||||
self._IconIndex+=1
|
self._IconIndex+=1
|
||||||
if self._IconIndex > (self._IconNumbers - 1):
|
if self._IconIndex > (self._IconNumbers - 1):
|
||||||
self._IconIndex = self._IconNumbers -1
|
self._IconIndex = 0 # Wrap Icon Index
|
||||||
self._PrevIconIndex = self._IconIndex
|
|
||||||
return False
|
return False
|
||||||
self._PrevIconIndex = self._IconIndex-1
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def IconClick(self):
|
def IconClick(self):
|
||||||
|
|
||||||
@ -517,7 +528,7 @@ class Page(Widget):
|
|||||||
self._Screen._CurrentPage = child_page
|
self._Screen._CurrentPage = child_page
|
||||||
elif cur_icon._MyType == ICON_TYPES["FUNC"]:
|
elif cur_icon._MyType == ICON_TYPES["FUNC"]:
|
||||||
print("IconClick API: %d"%(cur_icon._Index))
|
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)
|
api_cb = getattr(cur_icon._CmdPath,"API",None)
|
||||||
if api_cb != None:
|
if api_cb != None:
|
||||||
if callable(api_cb):
|
if callable(api_cb):
|
||||||
@ -528,7 +539,7 @@ class Page(Widget):
|
|||||||
def ReturnToUpLevelPage(self):
|
def ReturnToUpLevelPage(self):
|
||||||
pop_page,ok = self._Screen._MyPageStack.Pop()
|
pop_page,ok = self._Screen._MyPageStack.Pop()
|
||||||
if ok == True:
|
if ok == True:
|
||||||
#self._Screen._CurrentPage.ResetPageSelector()
|
# self._Screen._CurrentPage.ResetPageSelector()
|
||||||
pop_page.Draw()
|
pop_page.Draw()
|
||||||
self._Screen._CurrentPage = pop_page
|
self._Screen._CurrentPage = pop_page
|
||||||
on_return_back_cb = getattr(self._Screen._CurrentPage,"OnReturnBackCb",None)
|
on_return_back_cb = getattr(self._Screen._CurrentPage,"OnReturnBackCb",None)
|
||||||
@ -543,8 +554,12 @@ class Page(Widget):
|
|||||||
print("OnTopLevel ",self._Screen._PageIndex)
|
print("OnTopLevel ",self._Screen._PageIndex)
|
||||||
|
|
||||||
def ClearCanvas(self):
|
def ClearCanvas(self):
|
||||||
self._CanvasHWND.fill(self._Screen._SkinManager.GiveColor("White"))
|
if self._Wallpaper:
|
||||||
|
self._CanvasHWND.blit(self._Wallpaper,(0,0))
|
||||||
|
else:
|
||||||
|
self._CanvasHWND.fill(self._Screen._SkinManager.GiveColor("White"))
|
||||||
|
|
||||||
|
|
||||||
def ClearIcons(self):
|
def ClearIcons(self):
|
||||||
for i in range(0,self._IconNumbers):
|
for i in range(0,self._IconNumbers):
|
||||||
self._Icons[i].Clear()
|
self._Icons[i].Clear()
|
||||||
@ -553,7 +568,7 @@ class Page(Widget):
|
|||||||
for i in range(0,self._IconNumbers):
|
for i in range(0,self._IconNumbers):
|
||||||
self._Icons[i].Draw()
|
self._Icons[i].Draw()
|
||||||
|
|
||||||
##make sure the Class has the _MyList
|
# make sure the Class has the _MyList
|
||||||
def ScrollDown(self):
|
def ScrollDown(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
@ -614,25 +629,36 @@ class Page(Widget):
|
|||||||
if event.key == CurKeys["Right"]:
|
if event.key == CurKeys["Right"]:
|
||||||
if self.MoveIconIndexNext() == True:
|
if self.MoveIconIndexNext() == True:
|
||||||
if self._IconIndex == (self._IconNumbers -1) or self._PrevIconIndex == 0:
|
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:
|
else:
|
||||||
self.IconsEasingLeft(icon_width + self._PageIconMargin)
|
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._PsIndex = self._IconIndex
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
if event.key == CurKeys["Left"]:
|
if event.key == CurKeys["Left"]:
|
||||||
if self.MoveIconIndexPrev() == True:
|
if self.MoveIconIndexPrev() == True:
|
||||||
if self._IconIndex == 0 or self._PrevIconIndex == (self._IconNumbers -1):
|
if self._IconIndex == 0 or self._PrevIconIndex == (self._IconNumbers -1):
|
||||||
self.IconSmoothUp(icon_width+ self._PageIconMargin)
|
self.IconSmoothUp(icon_width + self._PageIconMargin)
|
||||||
else:
|
else:
|
||||||
self.IconsEasingRight(icon_width + self._PageIconMargin)
|
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._PsIndex = self._IconIndex
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if IsKeyStartOrA(event.key):
|
if IsKeyStartOrA(event.key):
|
||||||
self.IconClick()
|
self.IconClick()
|
||||||
@ -644,4 +670,3 @@ class Page(Widget):
|
|||||||
self.DrawIcons()
|
self.DrawIcons()
|
||||||
self.DrawPageSelector()
|
self.DrawPageSelector()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import pygame
|
|||||||
import config
|
import config
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
||||||
|
from util_funcs import FileExists
|
||||||
|
|
||||||
class CaseConfigParser(ConfigParser.SafeConfigParser):
|
class CaseConfigParser(ConfigParser.SafeConfigParser):
|
||||||
def optionxform(self, optionstr):
|
def optionxform(self, optionstr):
|
||||||
return optionstr
|
return optionstr
|
||||||
@ -21,7 +23,9 @@ class SkinManager(object):
|
|||||||
|
|
||||||
_Colors = {}
|
_Colors = {}
|
||||||
_Config = None
|
_Config = None
|
||||||
|
_Fonts = {}
|
||||||
|
DefaultSkin = "../skin/default"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.Init()
|
self.Init()
|
||||||
|
|
||||||
@ -33,7 +37,39 @@ class SkinManager(object):
|
|||||||
def Init(self):
|
def Init(self):
|
||||||
if not SkinManager._Colors:
|
if not SkinManager._Colors:
|
||||||
self.SetColors()
|
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):
|
def SetColors(self):
|
||||||
Colors = {}
|
Colors = {}
|
||||||
Colors["High"] = pygame.Color(51, 166, 255)
|
Colors["High"] = pygame.Color(51, 166, 255)
|
||||||
@ -52,7 +88,7 @@ class SkinManager(object):
|
|||||||
|
|
||||||
self._Config = CaseConfigParser()
|
self._Config = CaseConfigParser()
|
||||||
|
|
||||||
fname = "../skin/"+config.SKIN+"/config.cfg"
|
fname = config.SKIN+"/config.ini"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._Config.read(fname)
|
self._Config.read(fname)
|
||||||
@ -72,13 +108,49 @@ class SkinManager(object):
|
|||||||
print("error in ConvertToRGB %s" % str(e))
|
print("error in ConvertToRGB %s" % str(e))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
def GiveFont(self,name):
|
||||||
|
return SkinManager._Fonts[name]
|
||||||
|
|
||||||
def GiveColor(self,name):
|
def GiveColor(self,name):
|
||||||
if name in SkinManager._Colors:
|
if name in SkinManager._Colors:
|
||||||
return SkinManager._Colors[name]
|
return SkinManager._Colors[name]
|
||||||
else:
|
else:
|
||||||
return pygame.Color(255,0,0)
|
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
|
##global MySkinManager Handler
|
||||||
MySkinManager = None
|
MySkinManager = None
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@ from libs.roundrects import aa_round_rect
|
|||||||
## local UI import
|
## local UI import
|
||||||
from page import Page,PageStack,PageSelector
|
from page import Page,PageStack,PageSelector
|
||||||
from label import Label
|
from label import Label
|
||||||
from fonts import fonts
|
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
from widget import Widget
|
from widget import Widget
|
||||||
|
|||||||
@ -6,8 +6,8 @@ from libs.roundrects import aa_round_rect
|
|||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page,PageStack,PageSelector
|
from UI.page import Page,PageStack,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.skin_manager import MySkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
from UI.widget import Widget
|
from UI.widget import Widget
|
||||||
|
|
||||||
class Textarea(Widget):
|
class Textarea(Widget):
|
||||||
@ -26,7 +26,7 @@ class Textarea(Widget):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def Init(self):
|
def Init(self):
|
||||||
self._FontObj = fonts["veramono24"]
|
self._FontObj = MyLangManager.TrFont("veramono24")
|
||||||
#pygame.font.Font(fonts_path["veramono"],24)
|
#pygame.font.Font(fonts_path["veramono"],24)
|
||||||
|
|
||||||
def SubTextIndex(self):
|
def SubTextIndex(self):
|
||||||
|
|||||||
@ -13,12 +13,12 @@ import alsaaudio
|
|||||||
|
|
||||||
##local import
|
##local import
|
||||||
from constants import ICON_TYPES,Width,Height
|
from constants import ICON_TYPES,Width,Height
|
||||||
from fonts import fonts
|
|
||||||
from icon_item import IconItem
|
from icon_item import IconItem
|
||||||
from multi_icon_item import MultiIconItem
|
from multi_icon_item import MultiIconItem
|
||||||
from icon_pool import MyIconPool
|
from icon_pool import MyIconPool
|
||||||
from lang_manager import MyLangManager
|
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 widget import Widget
|
||||||
from config import Battery
|
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
|
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):
|
class TitleBar(Widget):
|
||||||
_Width = Width
|
_Width = Width
|
||||||
_Height = 25
|
_Height = 25
|
||||||
@ -259,7 +259,7 @@ class TitleBar(Widget):
|
|||||||
|
|
||||||
round_corners._MyType = ICON_TYPES["STAT"]
|
round_corners._MyType = ICON_TYPES["STAT"]
|
||||||
round_corners._Parent = self
|
round_corners._Parent = self
|
||||||
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
|
round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
|
||||||
round_corners.Adjust(0,0,10,10,0)
|
round_corners.Adjust(0,0,10,10,0)
|
||||||
|
|
||||||
self._Icons["round_corners"] = round_corners
|
self._Icons["round_corners"] = round_corners
|
||||||
@ -299,13 +299,14 @@ class TitleBar(Widget):
|
|||||||
self._Title = title
|
self._Title = title
|
||||||
|
|
||||||
cur_time = datetime.now().strftime("%H:%M")
|
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)
|
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,
|
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[1]/2+(self._BarHeight-title_text_size[1])/2,
|
||||||
title_text_size[0],title_text_size[1],Width,Height))
|
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[1]/2+(self._BarHeight-time_text_size[1])/2,
|
||||||
time_text_size[0],time_text_size[1],Width,Height))
|
time_text_size[0],time_text_size[1],Width,Height))
|
||||||
|
|
||||||
|
|||||||
@ -11,12 +11,11 @@ from datetime import datetime
|
|||||||
import base64
|
import base64
|
||||||
from beeprint import pp
|
from beeprint import pp
|
||||||
|
|
||||||
from util_funcs import midRect, SkinMap
|
from util_funcs import midRect
|
||||||
from fonts import fonts
|
|
||||||
|
|
||||||
from skin_manager import MySkinManager
|
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
|
## use blank circle as bg, Two alpha As Icon Label
|
||||||
#Upper and Lower
|
#Upper and Lower
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ class UntitledIcon(object):
|
|||||||
_Height = 80
|
_Height = 80
|
||||||
|
|
||||||
_Words = ["G", "s"]
|
_Words = ["G", "s"]
|
||||||
_FontObj = fonts["varela40"]
|
_FontObj = MySkinManager.GiveFont("varela40")
|
||||||
|
|
||||||
_BG = None # initial surface
|
_BG = None # initial surface
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import platform
|
||||||
import pygame
|
import pygame
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -13,27 +13,6 @@ import string
|
|||||||
from Xlib import X,display
|
from Xlib import X,display
|
||||||
import config
|
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():
|
def get_git_revision_hash():
|
||||||
return subprocess.check_output(['git', 'rev-parse', 'HEAD'])
|
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():
|
def SwapAndShow():
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
|
def ArmSystem(cmd):
|
||||||
|
if "arm" not in platform.machine():
|
||||||
|
return
|
||||||
|
os.system(cmd)
|
||||||
|
|
||||||
|
def InGameShell():
|
||||||
|
if "arm" not in platform.machine():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
from UI.util_funcs import FileExists,ArmSystem
|
||||||
|
|
||||||
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
||||||
|
|
||||||
@ -10,11 +13,13 @@ Battery = "/sys/class/power_supply/axp20x-battery/uevent"
|
|||||||
|
|
||||||
MPD_socket = "/tmp/mpd.socket"
|
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
|
## three timer values in seconds: dim screen, close screen,PowerOff
|
||||||
## zero means no action
|
## zero means no action
|
||||||
@ -26,5 +31,47 @@ PowerLevels["balance_saving"] = [40,0,0]
|
|||||||
|
|
||||||
PowerLevel = "balance_saving"
|
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
|
##sys.py/.powerlevel
|
||||||
|
|
||||||
|
|||||||
@ -106,3 +106,8 @@ Music Library=乐库
|
|||||||
Play/Pause=播放/暂停
|
Play/Pause=播放/暂停
|
||||||
my favorite music=我的音乐库
|
my favorite music=我的音乐库
|
||||||
Check Update=检查更新
|
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 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import platform
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import sys
|
import sys
|
||||||
import commands
|
import commands
|
||||||
|
import logging
|
||||||
|
import errno
|
||||||
|
|
||||||
from wicd import misc
|
from wicd import misc
|
||||||
##misc.to_bool
|
##misc.to_bool
|
||||||
##misc.misc.noneToString
|
##misc.misc.noneToString
|
||||||
@ -21,7 +24,7 @@ import pygame
|
|||||||
from sys import exit
|
from sys import exit
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from beeprint import pp
|
#from beeprint import pp
|
||||||
########
|
########
|
||||||
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
||||||
import dbus.glib
|
import dbus.glib
|
||||||
@ -29,10 +32,10 @@ else:
|
|||||||
from dbus.mainloop.glib import DBusGMainLoop
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
DBusGMainLoop(set_as_default=True)
|
DBusGMainLoop(set_as_default=True)
|
||||||
|
|
||||||
|
import config
|
||||||
#local UI import
|
#local UI import
|
||||||
from UI.constants import Width,Height,bg_color,icon_width,icon_height,DT,RUNEVT,RUNSYS,ICON_TYPES,POWEROPT,RESTARTUI,RUNSH
|
from UI.constants import Width,Height,icon_width,icon_height,DT,RUNEVT,RUNSYS,ICON_TYPES,POWEROPT,RESTARTUI,RUNSH
|
||||||
from UI.util_funcs import ReplaceSuffix,FileExists, ReadTheFileContent,midRect,color_surface,SwapAndShow,GetExePath,X_center_mouse
|
from UI.util_funcs import ReplaceSuffix,FileExists, ReadTheFileContent,midRect,color_surface,SwapAndShow,GetExePath,X_center_mouse,ArmSystem
|
||||||
from UI.page import PageStack,PageSelector,Page
|
from UI.page import PageStack,PageSelector,Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
@ -43,10 +46,9 @@ from UI.main_screen import MainScreen
|
|||||||
from UI.above_all_patch import SoundPatch
|
from UI.above_all_patch import SoundPatch
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.createby_screen import CreateByScreen
|
from UI.createby_screen import CreateByScreen
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
from libs.DBUS import setup_dbus
|
from libs.DBUS import setup_dbus
|
||||||
|
|
||||||
import config
|
|
||||||
|
|
||||||
if not pygame.display.get_init():
|
if not pygame.display.get_init():
|
||||||
pygame.display.init()
|
pygame.display.init()
|
||||||
@ -288,7 +290,36 @@ def RecordKeyDns(thekey,main_screen):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
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):
|
def event_process(event,main_screen):
|
||||||
global sound_patch
|
global sound_patch
|
||||||
global everytime_keydown
|
global everytime_keydown
|
||||||
@ -312,10 +343,19 @@ def event_process(event,main_screen):
|
|||||||
pygame.quit()
|
pygame.quit()
|
||||||
gobject_main_loop.quit()
|
gobject_main_loop.quit()
|
||||||
os.chdir( GetExePath())
|
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 += event.message
|
||||||
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||||
print(exec_app_cmd)
|
print(exec_app_cmd)
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
os.chdir( GetExePath())
|
os.chdir( GetExePath())
|
||||||
os.exelp("python","python"," "+myscriptname)
|
os.exelp("python","python"," "+myscriptname)
|
||||||
@ -330,10 +370,18 @@ def event_process(event,main_screen):
|
|||||||
pygame.quit()
|
pygame.quit()
|
||||||
gobject_main_loop.quit()
|
gobject_main_loop.quit()
|
||||||
os.chdir( GetExePath())
|
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 += event.message
|
||||||
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||||
print(exec_app_cmd)
|
print(exec_app_cmd)
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
os.chdir( GetExePath())
|
os.chdir( GetExePath())
|
||||||
os.exelp("python","python"," "+myscriptname)
|
os.exelp("python","python"," "+myscriptname)
|
||||||
@ -344,6 +392,7 @@ def event_process(event,main_screen):
|
|||||||
os.chdir(GetExePath())
|
os.chdir(GetExePath())
|
||||||
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||||
print(exec_app_cmd)
|
print(exec_app_cmd)
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
os.chdir( GetExePath())
|
os.chdir( GetExePath())
|
||||||
os.exelp("python","python"," "+myscriptname)
|
os.exelp("python","python"," "+myscriptname)
|
||||||
@ -352,6 +401,7 @@ def event_process(event,main_screen):
|
|||||||
pygame.quit()
|
pygame.quit()
|
||||||
gobject_main_loop.quit()
|
gobject_main_loop.quit()
|
||||||
exec_app_cmd = event.message +";"
|
exec_app_cmd = event.message +";"
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
return
|
return
|
||||||
@ -521,7 +571,7 @@ def big_loop():
|
|||||||
sound_patch.Init()
|
sound_patch.Init()
|
||||||
#pp(main_screen._Pages[0],True,6)
|
#pp(main_screen._Pages[0],True,6)
|
||||||
|
|
||||||
screen.fill(bg_color)
|
screen.fill(MySkinManager.GiveColor("White"))
|
||||||
main_screen.Draw()
|
main_screen.Draw()
|
||||||
main_screen.SwapAndShow()
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
@ -537,27 +587,6 @@ def big_loop():
|
|||||||
gobject_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()###
|
###MAIN()###
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
@ -573,8 +602,7 @@ if __name__ == '__main__':
|
|||||||
pygame.event.set_allowed([pygame.KEYDOWN,pygame.KEYUP,RUNEVT,RUNSYS,POWEROPT,RESTARTUI,RUNSH])
|
pygame.event.set_allowed([pygame.KEYDOWN,pygame.KEYUP,RUNEVT,RUNSYS,POWEROPT,RESTARTUI,RUNSH])
|
||||||
|
|
||||||
pygame.key.set_repeat(DT+DT*6+DT/2, DT+DT*3+DT/2)
|
pygame.key.set_repeat(DT+DT*6+DT/2, DT+DT*3+DT/2)
|
||||||
|
|
||||||
|
|
||||||
MyIconPool.Init()
|
MyIconPool.Init()
|
||||||
|
|
||||||
setup_dbus()
|
setup_dbus()
|
||||||
@ -591,8 +619,6 @@ if __name__ == '__main__':
|
|||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
PreparationInAdv()
|
|
||||||
|
|
||||||
crt_screen = CreateByScreen()
|
crt_screen = CreateByScreen()
|
||||||
crt_screen.Init()
|
crt_screen.Init()
|
||||||
crt_screen._HWND = screen
|
crt_screen._HWND = screen
|
||||||
|
|||||||