Compare commits
217 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e15f6155cd | |||
| 6e005cf435 | |||
| 13ed96d83c | |||
| 83de5fc575 | |||
| 95a14f6dfc | |||
| 8aee33e672 | |||
| f030dc52ff | |||
| e701756207 | |||
| 2f263ff707 | |||
| 2b136fae3c | |||
| 8dcdc977a8 | |||
| 76e61b521c | |||
| 15424129f0 | |||
| e6fefe5779 | |||
| de9248f87e | |||
| d55fed3a78 | |||
| 75b74e4c6a | |||
| 661250f7b1 | |||
| e15cf60412 | |||
| 712ce14fc5 | |||
| 6e9d146e80 | |||
| 5180b74a91 | |||
| 18c1b186af | |||
| 879a734666 | |||
| c4a12ce2d2 | |||
| 8d662e0f19 | |||
| 9b5e3b411b | |||
| df170b71ab | |||
| 987587c5af | |||
| b0d5517b5e | |||
| ac61a305ba | |||
| 7ea30feba7 | |||
| e9db2ac4d1 | |||
| d7b75ddec5 | |||
| 557cd04b64 | |||
| 6ba59fc9c0 | |||
| 9062cc8e9b | |||
| edbcd7d47a | |||
| 5be4bc20ff | |||
| 1219a615fa | |||
| 3febbf7425 | |||
| c9d9ad64fe | |||
| 708c863a33 | |||
| f9a62573de | |||
| 743c82fc26 | |||
| 58877ba643 | |||
| 639f4c1700 | |||
| ad4a82bad5 | |||
| 9b1c89af4c | |||
| 46b67bc12f | |||
| 31f117d65f | |||
| 42fd86bce6 | |||
| 5db3db2ee3 | |||
| 128e37e06a | |||
| 7e6d172512 | |||
| 0af791192f | |||
| ccb11daa44 | |||
| 579164ce19 | |||
| 66d0558dfa | |||
| 9c69b6a637 | |||
| 103838c531 | |||
| b725a86b9e | |||
| 3371393733 | |||
| 85d67dc218 | |||
| ebe816ba5f | |||
| 2bb22f3914 | |||
| 764aa61b7f | |||
| e9ed6d7cf1 | |||
| 1aac399de6 | |||
| ac0df61352 | |||
| f605b4bf91 | |||
| 0b42901e26 | |||
| 105a5fa596 | |||
| 888fdbbd18 | |||
| c54191505d | |||
| f55cb1aa8d | |||
| 972219570c | |||
| e0dfe211a9 | |||
| 4e7bebbdb2 | |||
| afe616de9e | |||
| c9f06d2a55 | |||
| 3829a2a7f9 | |||
| 1c6bd61575 | |||
| 784edd007a | |||
| 870e71b85b | |||
| 852610914d | |||
| 98e39edcdf | |||
| 818916e0fb | |||
| 087a10da31 | |||
| 03302a3f70 | |||
| b26b9f7fbd | |||
| 7fcdf54385 | |||
| ab07fadf71 | |||
| 9597203d8f | |||
| a6accdad18 | |||
| 4245bb3085 | |||
| a6b2c1cdb8 | |||
| f4d0766edb | |||
| 2e472ae11c | |||
| 2a6899cb52 | |||
| 78c5bb3d76 | |||
| 0730d86fa4 | |||
| 0f1b4bd57f | |||
| 58e9d1430a | |||
| 07805d7fd5 | |||
| 07fc53c11d | |||
| f08d0faebf | |||
| 3dd659860e | |||
| a8b3a7084c | |||
| 29ca4c4ac6 | |||
| 1e1c8f7f4c | |||
| e09d197be0 | |||
| 9de0f722c8 | |||
| e22a3286f3 | |||
| c4411fc1aa | |||
| a89304b250 | |||
| 3557feb44c | |||
| ad94fbebfd | |||
| 2ca466257b | |||
| 86fa05e619 | |||
| 3826d3cfe2 | |||
| 63a30be0f6 | |||
| 8113002aa7 | |||
| 8f2fe08400 | |||
| 48bb893a5c | |||
| 41729a4b2a | |||
| 954f158f73 | |||
| be3f53850b | |||
| 04120e0841 | |||
| 467a5623f6 | |||
| 546523359b | |||
| 9b63fc4c8f | |||
| b6fb439ae1 | |||
| e94897c5ec | |||
| 9c9896b06e | |||
| d4a6c417bb | |||
| 75300a6e7b | |||
| 4f354f28c2 | |||
| 80c732b261 | |||
| 528e79648b | |||
| eb0f43fd07 | |||
| 7d9146c6cf | |||
| 2c75adb1ae | |||
| 4e9d7a42f0 | |||
| b520e83dd6 | |||
| 273db99c78 | |||
| 638f23a8b8 | |||
| 3673da1bf4 | |||
| badeb13268 | |||
| 0f2cf846eb | |||
| 8c0c6ac86a | |||
| 0b733435f6 | |||
| 24abd55f86 | |||
| 03e0385cda | |||
| d17a89e80c | |||
| fb0c45229c | |||
| 457adc1b21 | |||
| 8e943d2751 | |||
| dd6aa87ee6 | |||
| 1c7ca69a8f | |||
| 70a4c48c67 | |||
| aad54336e8 | |||
| fb8937fe0f | |||
| ef0d5a6b52 | |||
| 5ef12f8081 | |||
| a9a179fe47 | |||
| 2b1952c59d | |||
| 68d3ec052c | |||
| 9a3161eb05 | |||
| 380c972b13 | |||
| 77707a8118 | |||
| 16f521b8da | |||
| b435507935 | |||
| 8468102ee5 | |||
| 7da6542a1e | |||
| 3ad1c48fce | |||
| dd92daa60f | |||
| 7a592353b0 | |||
| 055ee12867 | |||
| 4d67c053ff | |||
| 29cbe9297a | |||
| c559728454 | |||
| acb6774495 | |||
| baae2545f1 | |||
| 5aa744cb6b | |||
| d75fcc6f1c | |||
| 58fd2e6a1a | |||
| bac3f7899d | |||
| 0302741ac2 | |||
| 16b226dbc3 | |||
| 8c77f3ffc5 | |||
| da29679180 | |||
| e73c9138ea | |||
| 9ce60ff62f | |||
| fe44274594 | |||
| 1b1cbbca28 | |||
| 858540bb7d | |||
| 8018bbfe1f | |||
| 24d711e538 | |||
| a9220fc66e | |||
| ed8699d6d4 | |||
| e3624948d0 | |||
| ce72585632 | |||
| 75975dea37 | |||
| 1b48ca875b | |||
| 1590ea44b8 | |||
| d360b72007 | |||
| 67148d102b | |||
| c9221e5a2a | |||
| d6a5294afb | |||
| 1753a687e4 | |||
| 8ee95d9648 | |||
| 29e52bbaea | |||
| 0dc85f2407 | |||
| fb156214f9 | |||
| 1b783d3ce2 | |||
| 201f2fb89c |
@@ -1,7 +1,7 @@
|
||||
SCREEN=`cat /sys/class/graphics/fb0/modes`
|
||||
|
||||
XORG_CONF="~/launcher/.xorg.conf"
|
||||
if [ -f ~/.lima ]
|
||||
if [ -f /home/cpi/.lima ]
|
||||
then
|
||||
XORG_CONF="~/launcher/.xorg_lima.conf"
|
||||
fi
|
||||
|
||||
@@ -12,3 +12,14 @@ sys.py/.lang
|
||||
!**/Jobs/00_lowpower.sh
|
||||
!**/Jobs/00_lowpower.alias
|
||||
.done
|
||||
bios
|
||||
bios/*
|
||||
screenshots
|
||||
screenshots/*
|
||||
.pcsx
|
||||
.pcsx/*
|
||||
*.log
|
||||
.DS_Store
|
||||
sys.py/.*
|
||||
sys.py/*.db
|
||||
launcher.sublime-workspace
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[submodule "Pcsx"]
|
||||
path = Menu/GameShell/20_Retro Games/Pcsx
|
||||
url = https://github.com/cuu/Pcsx.git
|
||||
[submodule "sys.py/pyaria2_rpc"]
|
||||
path = sys.py/pyaria2_rpc
|
||||
url = https://github.com/cuu/pyaria2_rpc.git
|
||||
|
||||
@@ -2,14 +2,18 @@ session=${1:-gameshell}
|
||||
|
||||
case $session in
|
||||
hdmi )
|
||||
exec aria2c --conf-path=/home/cpi/launcher/aria2.conf &
|
||||
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg
|
||||
cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
|
||||
exec ~/launcher/load.sh &
|
||||
exec ~/launcher/sys.py/gsnotify/gsnotify-arm daemon &
|
||||
#exec /usr/bin/twm -f ~/launcher/.twmrc
|
||||
exec ~/launcher/dwm-mod
|
||||
;;
|
||||
gameshell )
|
||||
gameshell )
|
||||
exec aria2c --conf-path=/home/cpi/launcher/aria2.conf &
|
||||
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png
|
||||
cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
|
||||
exec ~/launcher/load.sh &
|
||||
exec ~/launcher/sys.py/gsnotify/gsnotify-arm &
|
||||
#exec awesome -c ~/launcher/awesome/rc.lua
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
@@ -12,15 +12,17 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.util_funcs import midRect
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.icon_item import IconItem
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.multilabel import MultiLabel
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
from config import VERSION
|
||||
|
||||
class InfoPageListItem(object):
|
||||
_PosX = 0
|
||||
_PosY = 0
|
||||
@@ -206,7 +208,32 @@ class AboutPage(Page):
|
||||
memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
|
||||
self._AList["memory"] = memory
|
||||
break
|
||||
|
||||
|
||||
def LauncherVersion(self):
|
||||
launcher_version = {}
|
||||
launcher_version["key"] = "launcher_ver"
|
||||
launcher_version["label"] = "Launcher:"
|
||||
launcher_version["value"] = VERSION
|
||||
self._AList["launcher_ver"] = launcher_version
|
||||
|
||||
def OsImageVersion(self):
|
||||
if FileExists("/etc/clockworkpi_os_image_version"):
|
||||
try:
|
||||
with open("/etc/clockworkpi_os_image_version") as f:
|
||||
content = f.readlines()
|
||||
content = [x.strip() for x in content]
|
||||
|
||||
except:
|
||||
print("open %s failed" % "/etc/clockworkpi_os_image_version")
|
||||
content = None
|
||||
|
||||
if content != None and len(content) > 0:
|
||||
os_image_ver = {}
|
||||
os_image_ver["key"] = "os_image_ver"
|
||||
os_image_ver["label"] = "OS Image:"
|
||||
os_image_ver["value"] = content[0][:12]
|
||||
self._AList["os_image_ver"] = os_image_ver
|
||||
|
||||
def GenList(self):
|
||||
|
||||
self._MyList = []
|
||||
@@ -215,7 +242,7 @@ class AboutPage(Page):
|
||||
start_y = 10
|
||||
last_height = 0
|
||||
|
||||
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname"] ):
|
||||
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver"] ):
|
||||
#for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
|
||||
if u not in self._AList:
|
||||
continue
|
||||
@@ -247,14 +274,14 @@ class AboutPage(Page):
|
||||
if self._Screen != None:
|
||||
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||
self._HWND = self._Screen._CanvasHWND
|
||||
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
||||
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight+50) )
|
||||
|
||||
self._PosX = self._Index*self._Screen._Width
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
||||
bgpng = MultiIconItem()
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@@ -266,6 +293,9 @@ class AboutPage(Page):
|
||||
self.CpuMhz()
|
||||
self.Uname()
|
||||
|
||||
self.LauncherVersion()
|
||||
self.OsImageVersion()
|
||||
|
||||
self.GenList()
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
@@ -277,7 +307,7 @@ class AboutPage(Page):
|
||||
|
||||
def ScrollDown(self):
|
||||
dis = 10
|
||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 50:
|
||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 100:
|
||||
self._PosY -= dis
|
||||
self._Scrolled -= dis
|
||||
|
||||
@@ -320,16 +350,19 @@ class AboutPage(Page):
|
||||
self.ClearCanvas()
|
||||
#self._Ps.Draw()
|
||||
|
||||
self._Icons["bg"].NewCoord(self._Width/2,self._Height/2 + (self._BGheight - Height)/2 + self._Screen._TitleBar._Height)
|
||||
self._Icons["bg"].Draw()
|
||||
|
||||
for i in self._MyList:
|
||||
i.Draw()
|
||||
|
||||
self._DrawOnce = True
|
||||
|
||||
self._Icons["bg"].DrawRect((230,0,82,184),(228,0,82,184))
|
||||
|
||||
y = self._MyList[len(self._MyList)-1]._PosY+30
|
||||
|
||||
self._Icons["bg"].DrawRect(( (self._Width-191)/2,y,191,68),(65,232,191,68))
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
|
||||
@@ -65,21 +65,21 @@ class AirplanePage(Page):
|
||||
|
||||
|
||||
airwire = IconItem()
|
||||
airwire._ImgSurf = MyIconPool._Icons["airwire"]
|
||||
airwire._ImgSurf = MyIconPool.GiveIconSurface("airwire")
|
||||
airwire._MyType = ICON_TYPES["STAT"]
|
||||
airwire._Parent = self
|
||||
airwire.Adjust(0,0,5,43,0)
|
||||
self._Icons["airwire"] = airwire
|
||||
|
||||
GS = IconItem()
|
||||
GS._ImgSurf = MyIconPool._Icons["GS"]
|
||||
GS._ImgSurf = MyIconPool.GiveIconSurface("GS")
|
||||
GS._MyType = ICON_TYPES["STAT"]
|
||||
GS._Parent = self
|
||||
GS.Adjust(0,0,72,95,0)
|
||||
self._Icons["GS"] = GS
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"]
|
||||
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("DialogBoxs")
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 134
|
||||
@@ -90,7 +90,7 @@ class AirplanePage(Page):
|
||||
|
||||
"""
|
||||
bgpng = MultiIconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
@@ -98,7 +98,7 @@ class NetItem(object):
|
||||
self._Labels["mac_addr"] = name_label
|
||||
|
||||
done_icon = NetItemIcon()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class BSlider(Slider):
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["light"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("light")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@@ -49,7 +49,7 @@ class BSlider(Slider):
|
||||
scale = MultiIconItem()
|
||||
scale._MyType = ICON_TYPES["STAT"]
|
||||
scale._Parent = self
|
||||
scale._ImgSurf = MyIconPool._Icons["scale"]
|
||||
scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||
scale._IconWidth = 82
|
||||
scale._IconHeight = 63
|
||||
scale.Adjust(0,0,82,63,0)
|
||||
|
||||
@@ -153,7 +153,7 @@ class ButtonsLayoutPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
|
||||
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("buttonslayout")
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 300
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import platform
|
||||
import pygame
|
||||
import glob
|
||||
#import math
|
||||
import commands
|
||||
|
||||
#from beeprint import pp
|
||||
from libs.roundrects import aa_round_rect
|
||||
#import gobject
|
||||
#from wicd import misc
|
||||
## local UI import
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.util_funcs import midRect,FileExists,IsExecutable,ArmSystem,CmdClean
|
||||
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.confirm_page import ConfirmPage
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.multilabel import MultiLabel
|
||||
from UI.info_page_list_item import InfoPageListItem
|
||||
from UI.info_page_selector import InfoPageSelector
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
|
||||
class DeleteCoreConfirmPage(ConfirmPage):
|
||||
|
||||
_ConfirmText = MyLangManager.Tr("Awaiting Input")
|
||||
_FootMsg = ["Nav","","","Cancel","OK"]
|
||||
CallbackA = None
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Screen._MsgBox.SetText("Applying")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
pygame.time.delay(638)
|
||||
|
||||
self.CallbackA()
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
class CoresPage(Page):
|
||||
_FootMsg = ["Nav","Del","Scan","Back",""]
|
||||
_MyList = []
|
||||
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
|
||||
_Scrolled = 0
|
||||
|
||||
_BGwidth = 320
|
||||
_BGheight = 240-24-20
|
||||
|
||||
_DrawOnce = False
|
||||
_Scroller = None
|
||||
|
||||
_EasingDur = 30
|
||||
|
||||
_CORES_PATH = "%s/apps/emulators" % os.path.expanduser('~')
|
||||
|
||||
_Config =None
|
||||
_AllowedExts = [".so",".bin"]
|
||||
_HiddenSos = ["chailove_libretro.so","nxengine_libretro.so"]
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._Icons = {}
|
||||
|
||||
if "arm" in platform.machine():
|
||||
pass
|
||||
|
||||
def GenList(self):
|
||||
|
||||
self._MyList = []
|
||||
## map ini to self._AList
|
||||
files_path = glob.glob(self._CORES_PATH+"/*")
|
||||
|
||||
start_x = 10
|
||||
start_y = 0
|
||||
counter = 0
|
||||
for i,v in enumerate( files_path):
|
||||
if os.path.basename(v) in self._HiddenSos:
|
||||
continue
|
||||
|
||||
filename, file_extension = os.path.splitext(v)
|
||||
|
||||
alias_file = filename+file_extension + ".alias"
|
||||
|
||||
if file_extension in self._AllowedExts:
|
||||
li = InfoPageListItem()
|
||||
li._Parent = self
|
||||
li._PosX = start_x
|
||||
li._PosY = start_y + counter*InfoPageListItem._Height
|
||||
li._Width = Width-10
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
li._ReadOnly = True
|
||||
|
||||
if os.path.isfile(alias_file):
|
||||
fp = open(alias_file, "r")
|
||||
alias = fp.read()
|
||||
alias = alias.strip()
|
||||
label_text = alias.decode("utf8")
|
||||
li.Init( label_text )
|
||||
fp.close()
|
||||
else:
|
||||
li.Init( os.path.basename(v) )
|
||||
li._Flag = v
|
||||
##li.SetSmallText( v )
|
||||
|
||||
self._MyList.append(li)
|
||||
counter += 1
|
||||
|
||||
def Init(self):
|
||||
if self._Screen != None:
|
||||
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
self._PosX = self._Index*self._Screen._Width
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
ps = InfoPageSelector()
|
||||
ps._PosX = 11
|
||||
ps._Parent = self
|
||||
ps._Width = self._Width-10
|
||||
self._Ps = ps
|
||||
self._PsIndex = 0
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
self._Scroller._Parent = self
|
||||
self._Scroller._PosX = 2
|
||||
self._Scroller._PosY = 2
|
||||
self._Scroller.Init()
|
||||
|
||||
self._ConfirmBox = DeleteCoreConfirmPage()
|
||||
self._ConfirmBox._Screen = self._Screen
|
||||
self._ConfirmBox._Name = "Confirm to Delete?"
|
||||
self._ConfirmBox._Parent = self
|
||||
self._ConfirmBox.Init()
|
||||
|
||||
def ReScan(self):
|
||||
self.GenList()
|
||||
self.RefreshPsIndex()
|
||||
|
||||
def ConfirmBoxCallbackA(self):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
|
||||
os.system("rm %s" % CmdClean(cur_li._Flag))
|
||||
self.GenList()
|
||||
self.RefreshPsIndex()
|
||||
|
||||
def OnLoadCb(self):
|
||||
self._Scrolled = 0
|
||||
self._PosY = 0
|
||||
self._DrawOnce = False
|
||||
self.GenList()
|
||||
|
||||
def OnReturnBackCb(self):
|
||||
pass
|
||||
|
||||
def KeyDown(self,event):
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["X"]: #Scan current
|
||||
self.ReScan()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Y"]: #del
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
self._ConfirmBox.CallbackA = self.ConfirmBoxCallbackA
|
||||
|
||||
self._Screen.PushPage(self._ConfirmBox)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
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()
|
||||
|
||||
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
if len(self._MyList) > 0:
|
||||
self._Ps.Draw()
|
||||
for i in self._MyList:
|
||||
i.Draw()
|
||||
|
||||
self._Scroller.UpdateSize( len(self._MyList)*InfoPageListItem._Height,
|
||||
self._PsIndex*InfoPageListItem._Height)
|
||||
self._Scroller.Draw()
|
||||
|
||||
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
self._Page = CoresPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Retroarch cores manager"
|
||||
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)
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class GateWayPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@@ -318,7 +318,7 @@ class GateWayPage(Page):
|
||||
i.Draw()
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ class LanguagesPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@@ -278,7 +278,7 @@ class LanguagesPage(Page):
|
||||
i.Draw()
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
|
||||
@@ -3,13 +3,33 @@ import os
|
||||
import pygame
|
||||
#import math
|
||||
#mport subprocess
|
||||
import platform
|
||||
#from beeprint import pp
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.util_funcs import ArmSystem
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.confirm_page import ConfirmPage
|
||||
|
||||
class SwitchToLauncherGoConfirmPage(ConfirmPage):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
ArmSystem("sudo reboot")
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
@@ -17,16 +37,16 @@ class APIOBJ(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
pass
|
||||
self._Page = SwitchToLauncherGoConfirmPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Switch To LauncherGo"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
main_screen._MsgBox.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
if "arm" in platform.machine():
|
||||
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
os.system("sudo reboot")
|
||||
main_screen.PushPage(self._Page)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
|
||||
@@ -11,7 +11,7 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.util_funcs import midRect,FileExists,ArmSystem
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
from UI.icon_pool import MyIconPool
|
||||
@@ -76,7 +76,7 @@ class PageListItem(InfoPageListItem):
|
||||
class GPUDriverPage(Page):
|
||||
_FootMsg = ["Nav","","","Back","Select"]
|
||||
_MyList = []
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk12")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@@ -101,8 +101,8 @@ class GPUDriverPage(Page):
|
||||
start_y = 0
|
||||
last_height = 0
|
||||
|
||||
drivers = [["fbturbo","Fbturbo"],
|
||||
["modesetting","Lima"]]
|
||||
drivers = [["fbturbo","FBTURBO driver (Software Rendering)"],
|
||||
["modesetting","LIMA driver (Experimental GPU Rendering)"]]
|
||||
|
||||
|
||||
for i,u in enumerate( drivers ):
|
||||
@@ -132,7 +132,7 @@ class GPUDriverPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@@ -152,7 +152,7 @@ class GPUDriverPage(Page):
|
||||
self._Scroller.SetCanvasHWND(self._HWND)
|
||||
|
||||
def Click(self):
|
||||
if len(self._MyList) == 0:
|
||||
if self._PsIndex > len(self._MyList) -1:
|
||||
return
|
||||
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
@@ -170,10 +170,16 @@ class GPUDriverPage(Page):
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if "modesetting" in cur_li._Value:
|
||||
if "modesetting" in cur_li._Value: ## enable lima
|
||||
os.system("touch %s/.lima" % os.path.expanduser('~') )
|
||||
else:
|
||||
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima /usr/lib/xorg/modules/drivers/modesetting_drv.so")
|
||||
ArmSystem("sudo sed -i '/^#.*lima/s/^#//' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
|
||||
ArmSystem("sudo ldconfig")
|
||||
else: #disable lima
|
||||
os.system("rm %s/.lima" % os.path.expanduser('~') )
|
||||
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima")
|
||||
ArmSystem("sudo sed -i 's/^[^#]*lima/#&/' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
|
||||
ArmSystem("sudo ldconfig")
|
||||
|
||||
pygame.time.delay(800)
|
||||
os.system("sudo reboot")
|
||||
@@ -265,7 +271,7 @@ class GPUDriverPage(Page):
|
||||
i.Draw()
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
@@ -278,7 +284,7 @@ class APIOBJ(object):
|
||||
def Init(self,main_screen):
|
||||
self._Page = GPUDriverPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="GPU driver switch"
|
||||
self._Page._Name ="GPU Driver Switch"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
|
||||
@@ -44,7 +44,7 @@ class NotifyJobListItem(InfoPageListItem):
|
||||
self._Labels["Text"] = l
|
||||
|
||||
done_icon = IconItem()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ from UI.constants import RUNSYS
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
import config
|
||||
|
||||
class PowerOffConfirmPage(ConfirmPage):
|
||||
@@ -48,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self.CheckBattery() < 20:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||
else:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||
|
||||
cmdpath += "sleep 3;"
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ class PowerOptionsPage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
done = IconItem()
|
||||
done._ImgSurf = MyIconPool._Icons["done"]
|
||||
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done._MyType = ICON_TYPES["STAT"]
|
||||
done._Parent = self
|
||||
self._Icons["done"] = done
|
||||
@@ -521,7 +521,7 @@ class PowerOptionsPage(Page):
|
||||
i.Draw()
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import myvars
|
||||
def InitSoundPage(main_screen):
|
||||
|
||||
myvars.SoundPage = SoundPage()
|
||||
|
||||
|
||||
myvars.SoundPage._Screen = main_screen
|
||||
myvars.SoundPage._Name = "Sound volume"
|
||||
myvars.SoundPage._Name = "Sound Volume"
|
||||
myvars.SoundPage.Init()
|
||||
|
||||
@@ -43,7 +43,7 @@ class SoundSlider(Slider):
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["vol"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("vol")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@@ -53,7 +53,7 @@ class SoundSlider(Slider):
|
||||
self._Scale = MultiIconItem()
|
||||
self._Scale._MyType = ICON_TYPES["STAT"]
|
||||
self._Scale._Parent = self
|
||||
self._Scale._ImgSurf = MyIconPool._Icons["scale"]
|
||||
self._Scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||
self._Scale._IconWidth = 82
|
||||
self._Scale._IconHeight = 63
|
||||
self._Scale.Adjust(0,0,82,63,0)
|
||||
|
||||
@@ -54,7 +54,7 @@ class StoragePage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["icon_sd"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("icon_sd")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ class TimezoneListPage(Page):
|
||||
self.SyncList("/usr/share/zoneinfo/posix")
|
||||
|
||||
icon_for_list = MultiIconItem()
|
||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
||||
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
|
||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||
icon_for_list._Parent = self
|
||||
|
||||
@@ -185,7 +185,7 @@ class TimezoneListPage(Page):
|
||||
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("No timezones found on system!", MyLangManager.TrFont("varela22"))
|
||||
|
||||
@@ -314,7 +314,7 @@ class APIOBJ(object):
|
||||
self._UpdatePage = UpdatePage()
|
||||
|
||||
self._UpdatePage._Screen = main_screen
|
||||
self._UpdatePage._Name = "Update"
|
||||
self._UpdatePage._Name = "Update Launcher"
|
||||
self._UpdatePage.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
|
||||
@@ -137,13 +137,13 @@ class NetItem(Widget):
|
||||
|
||||
|
||||
lock_icon = NetItemIcon()
|
||||
lock_icon._ImgSurf = MyIconPool._Icons["lock"]
|
||||
lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
|
||||
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
lock_icon._Parent = self
|
||||
self._Icons["lock"] = lock_icon
|
||||
|
||||
done_icon = NetItemIcon()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from wicd import misc
|
||||
from UI.constants import Width,Height
|
||||
from UI.page import Page,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.util_funcs import midRect,SwapAndShow
|
||||
from UI.util_funcs import midRect,SwapAndShow,FileExists,ReadTheFileContent
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.scroller import ListScroller
|
||||
from UI.confirm_page import ConfirmPage
|
||||
@@ -82,7 +82,11 @@ class WifiInfoPage(Page):
|
||||
self._AList["ip"]["value"] = ip
|
||||
|
||||
self._AList["bssid"]["value"] = self._Wireless.GetWirelessProperty(self._NetworkId,"bssid")
|
||||
|
||||
if FileExists("/sys/class/net/wlan0/address"):
|
||||
self._AList["mac_addr"]["value"] = ReadTheFileContent("/sys/class/net/wlan0/address").strip().upper()
|
||||
else:
|
||||
self._AList["mac_addr"]["value"] = ""
|
||||
|
||||
start_x = 0
|
||||
start_y = 0
|
||||
|
||||
@@ -130,10 +134,16 @@ class WifiInfoPage(Page):
|
||||
bssid["key"] = "bssid"
|
||||
bssid["label"] = "BSSID"
|
||||
bssid["value"] = ""
|
||||
|
||||
|
||||
mac_addr = {}
|
||||
mac_addr["key"] = "mac_addr"
|
||||
mac_addr["label"] = "MAC ADDR"
|
||||
mac_addr["value"] = ""
|
||||
|
||||
self._AList["ip"] = ip
|
||||
self._AList["bssid"] = bssid
|
||||
|
||||
self._AList["mac_addr"] = mac_addr
|
||||
|
||||
self.GenList()
|
||||
|
||||
self._DisconnectConfirmPage = WifiDisconnectConfirmPage()
|
||||
@@ -568,7 +578,23 @@ class WifiList(Page):
|
||||
password_inputed = "".join(myvars.PasswordPage._Textarea._MyWords)
|
||||
if is_wifi_connected_now() == False:
|
||||
self.ConfigWireless(password_inputed)
|
||||
|
||||
else:
|
||||
for i in range(0,10):
|
||||
if is_wifi_connected_now() == True:
|
||||
self.ShowBox(MyLangManager.Tr("Launching"))
|
||||
self._Daemon.Disconnect()
|
||||
self._Daemon.SetForcedDisconnect(True)
|
||||
self._Connecting = False
|
||||
else:
|
||||
break
|
||||
|
||||
pygame.time.delay(100)
|
||||
|
||||
if is_wifi_connected_now() == False:
|
||||
self.ConfigWireless(password_inputed)
|
||||
else:
|
||||
self.ShowBox(MyLangManager.Tr("Disconnect first"))
|
||||
|
||||
def OnReturnBackCb(self):
|
||||
pass
|
||||
|
||||
@@ -621,8 +647,8 @@ class WifiList(Page):
|
||||
for i in wicd_wirelss_encrypt_pwd:
|
||||
if "preshared_key" in i:
|
||||
if i["preshared_key"] != None:
|
||||
if len(i["preshared_key"]) > 0:
|
||||
thepass = i["preshared_key"]
|
||||
if len(str(i["preshared_key"])) > 0:
|
||||
thepass = str(i["preshared_key"])
|
||||
break
|
||||
|
||||
myvars.PasswordPage.SetPassword(thepass)
|
||||
|
||||
@@ -49,24 +49,26 @@ class ListPage(Page):
|
||||
ps._PosX = 2
|
||||
self._Ps = ps
|
||||
self._PsIndex = 0
|
||||
|
||||
|
||||
# "" pkgname, label
|
||||
alist = [["","Airplane","Airplane Mode"],
|
||||
["","PowerOptions","Power Options"],
|
||||
["","Wifi","Wi-Fi"],
|
||||
["","Bluetooth","Bluetooth"],
|
||||
["","Sound","Sound Volume"],
|
||||
["","Sound","Sound Volume"],
|
||||
["","Brightness","BackLight Brightness"],
|
||||
["","Storage",""],
|
||||
["","Time","Timezone"],
|
||||
["","Languages","Languages"],
|
||||
["","Notification","Notification"],
|
||||
["","Update", ""],
|
||||
["","Update", "Update Launcher"],
|
||||
["","Cores", "Retroarch cores manager"],
|
||||
["","About", "About"],
|
||||
["","PowerOFF","Power off"],
|
||||
["","PowerOFF","Power OFF"],
|
||||
["","ButtonsLayout","Buttons Layout"],
|
||||
["","Skins","Theme Manager"],
|
||||
["","LauncherGo","Switch to LauncherGo"],
|
||||
["","Lima","GPU driver switch"],
|
||||
["","Lima","GPU Driver Switch"],
|
||||
["","GateWay","Network gateway switch"]]
|
||||
|
||||
start_x = 0
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
ROM=/home/cpi/games/MAME
|
||||
ROM_SO=/home/cpi/apps/emulators/mame2003_plus_libretro.so
|
||||
EXT=zip
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=MAME Roms
|
||||
EXCLUDE=neogeo.zip
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mame2003_plus_libretro.so.zip
|
||||
@@ -1,6 +0,0 @@
|
||||
ROM=/home/cpi/games/MGBA
|
||||
ROM_SO=/home/cpi/apps/emulators/mgba_libretro.so
|
||||
EXT=gb,gbc,gba,gbx
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=MGBA Roms
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mgba_libretro.so.zip
|
||||
@@ -1,7 +0,0 @@
|
||||
ROM=/home/cpi/games/NESTOPIA
|
||||
ROM_SO=/home/cpi/apps/emulators/nestopia_libretro.so
|
||||
EXT=zip,nes
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=NESTOPIA Roms
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/nestopia_libretro.so.zip
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
retroarch
|
||||
#!/bin/bash
|
||||
retroarch
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
#!/bin/bash
|
||||
retroarch -L /home/cpi/apps/emulators/nxengine_libretro.so /home/cpi/games/nxengine/cavestory/data
|
||||
|
||||
@@ -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
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
#SDL_VIDEODRIVER=x11 DISPLAY=:0 ./pico-8/pico8_dyn -splore -draw_rect 32,0,256,240
|
||||
cd /home/cpi/games/PICO-8/pico-8
|
||||
cd /home/cpi/games/PICO-8/pico-8 || exit
|
||||
SDL_VIDEODRIVER=x11 DISPLAY=:0 ./pico8_dyn -splore -draw_rect 32,0,256,240
|
||||
|
||||
@@ -4,5 +4,8 @@ mkdir ~/.lexaloffle
|
||||
|
||||
cp -rf pico-8 ~/.lexaloffle
|
||||
|
||||
touch .done
|
||||
mkdir ~/.lexaloffle/pico-8/carts
|
||||
|
||||
ln -s ~/.lexaloffle/pico-8/carts/ ~/games/PICO-8/carts
|
||||
|
||||
touch .done
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
{
|
||||
"GameDir":"/home/cpi/games/PICO-8/",
|
||||
"InstallDir":"pico-8",
|
||||
"NotFoundMsg":["Please purchase the PICO-8 \n|None|varela16",
|
||||
"and copy it to the \"~/games/PICO-8\"|None|varela16"],
|
||||
|
||||
"MD5":{"pico-8_0.1.11g_raspi.zip":"a3f2995cf117499f880bd964d6a0e1f2","pico-8_0.1.11g_amd64.zip":"6726141c784afd4a41be6b7414c1b932","pico-8_0.1.12_raspi.zip":"08eda95570e63089a2b9f5531503431e","pico-8_0.1.12c_raspi.zip":"1a62b0d7d4e4be65f89f23ec9757cb66"},
|
||||
"Post-Up":"bash Post-Up.sh"
|
||||
"GameDir": "/home/cpi/games/PICO-8/",
|
||||
"InstallDir": "pico-8",
|
||||
"NotFoundMsg": [
|
||||
"Please purchase the PICO-8 \n|None|varela16",
|
||||
"and copy it to the \"~/games/PICO-8\"|None|varela16"
|
||||
],
|
||||
"MD5": {
|
||||
"pico-8_0.2.2_raspi.zip": "e2dba152bf507d337459e9316061411d",
|
||||
"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_0.1.12c2_raspi.zip": "7a878795472fa39304e9a10128c1f712",
|
||||
"pico-8_0.2.0e_raspi.zip": "085edfecd111c2b195b878b2197afe7a",
|
||||
"pico-8.zip": "whatever it takes"
|
||||
},
|
||||
"Post-Up": "bash Post-Up.sh"
|
||||
}
|
||||
|
||||
@@ -136,26 +136,26 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
"""
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["sheep_bg"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("sheep_bg")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
self._SheepHead = IconItem()
|
||||
self._SheepHead._ImgSurf = MyIconPool._Icons["sheep_head"]
|
||||
self._SheepHead._ImgSurf = MyIconPool.GiveIconSurface("sheep_head")
|
||||
self._SheepHead._MyType = ICON_TYPES["STAT"]
|
||||
self._SheepHead._Parent = self
|
||||
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
|
||||
|
||||
self._SheepBody = IconItem()
|
||||
self._SheepBody._ImgSurf = MyIconPool._Icons["sheep_body"]
|
||||
self._SheepBody._ImgSurf = MyIconPool.GiveIconSurface("sheep_body")
|
||||
self._SheepBody._MyType = ICON_TYPES["STAT"]
|
||||
self._SheepBody._Parent = self
|
||||
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
|
||||
"""
|
||||
|
||||
self._cwp_png = IconItem()
|
||||
self._cwp_png._ImgSurf = MyIconPool._Icons["tape"]
|
||||
self._cwp_png._ImgSurf = MyIconPool.GiveIconSurface("tape")
|
||||
self._cwp_png._MyType = ICON_TYPES["STAT"]
|
||||
self._cwp_png._Parent = self
|
||||
self._cwp_png.Adjust(0,0,79,79,0)
|
||||
|
||||
@@ -172,7 +172,7 @@ class MusicLibListPage(Page):
|
||||
self.SyncList("/")
|
||||
|
||||
icon_for_list = MultiIconItem()
|
||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
||||
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
|
||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||
icon_for_list._Parent = self
|
||||
|
||||
@@ -181,7 +181,7 @@ class MusicLibListPage(Page):
|
||||
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
||||
@@ -196,6 +196,7 @@ class MusicLibListPage(Page):
|
||||
self._Scroller.Init()
|
||||
|
||||
def Click(self):
|
||||
self.RefreshPsIndex()
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class PlayListPage(Page):
|
||||
gobject.timeout_add(850,self.GObjectInterval)
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("heart")
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"), MyLangManager.TrFont("varela18"))
|
||||
@@ -235,9 +235,10 @@ class PlayListPage(Page):
|
||||
self._MyList[i]._PosY += self._Scrolled * self._MyList[i]._Height
|
||||
|
||||
def Click(self):
|
||||
self.RefreshPsIndex()
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
play_pos_id = myvars.Poller.play(self._PsIndex)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pygame
|
||||
import validators
|
||||
import commands
|
||||
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.simple_name_space import SimpleNamespace
|
||||
@@ -116,6 +117,10 @@ class TinyCloudPage(Page):
|
||||
else:
|
||||
self._IP = "xxx.xxx.xxx.xxx"
|
||||
|
||||
hostname = commands.getstatusoutput("hostname")[1]
|
||||
if hostname == "":
|
||||
hostname = "clockworkpi"
|
||||
|
||||
labels = \
|
||||
[["forssh","For ssh and scp:",self._ListFontObj,self._TextColor],
|
||||
["ssh_addr","ssh cpi@%s" % self._IP, self._ListFontObj,self._URLColor],
|
||||
@@ -126,7 +131,7 @@ class TinyCloudPage(Page):
|
||||
["forKey", "Key:", self._ListFontObj, self._TextColor],
|
||||
["key_and_pass", "cpi", self._ListFontObj, self._URLColor],
|
||||
["for_airplay", "Airplay:", self._ListFontObj, self._TextColor],
|
||||
["airplay_name","clockworkpi", self._ListFontObj, self._URLColor],
|
||||
["airplay_name",hostname, self._ListFontObj, self._URLColor],
|
||||
["for-usb-eth","USB-Ethernet:", self._ListFontObj, self._TextColor],
|
||||
["usb-eth-addr","192.168.10.1", self._ListFontObj, self._URLColor]]
|
||||
|
||||
@@ -155,7 +160,7 @@ class TinyCloudPage(Page):
|
||||
self._PngSize["online"] = (75,122)
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||
@@ -163,7 +168,7 @@ class TinyCloudPage(Page):
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
onlinepng = IconItem()
|
||||
onlinepng._ImgSurf = MyIconPool._Icons["online"]
|
||||
onlinepng._ImgSurf = MyIconPool.GiveIconSurface("online")
|
||||
onlinepng._MyType = ICON_TYPES["STAT"]
|
||||
onlinepng._Parent = self
|
||||
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
|
||||
|
||||
@@ -7,6 +7,7 @@ from UI.constants import RUNSYS
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
import config
|
||||
|
||||
@@ -49,9 +50,9 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self.CheckBattery() < 20:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||
else:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||
|
||||
cmdpath += "sleep 3;"
|
||||
|
||||
@@ -61,7 +62,7 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||
|
||||
if event.key == CurKeys["X"]:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||
cmdpath += "sleep 3;"
|
||||
cmdpath += "sudo reboot"
|
||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||
|
||||
@@ -46,7 +46,14 @@ sudo apt-get -y install mpd ncmpcpp git libuser
|
||||
sudo apt-get -y install python-wicd wicd wicd-curses python-pycurl python-alsaaudio python-pygame python-gobject python-xlib
|
||||
|
||||
sudo apt-get -y install python-pip
|
||||
sudo pip install validators numpy requests python-mpd2
|
||||
sudo pip install validators numpy requests python-mpd2 beeprint
|
||||
```
|
||||
|
||||
### With pip install and virtualenv
|
||||
|
||||
```
|
||||
mkvirtualenv launcher
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
# Create “.mpd_cpi.conf” config
|
||||
@@ -83,3 +90,5 @@ audio_output {
|
||||
|
||||
filesystem_charset "UTF-8"
|
||||
```
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
max-connection-per-server=5
|
||||
enable-rpc=true
|
||||
rpc-allow-origin-all=true
|
||||
rpc-listen-all=true
|
||||
log-level=error
|
||||
log=/tmp/aria.log
|
||||
dir=/home/cpi/aria2download
|
||||
daemon=true
|
||||
allow-overwrite=true
|
||||
split=1
|
||||
max-concurrent-downloads=100
|
||||
disk-cache=15M
|
||||
timeout=600
|
||||
retry-wait=30
|
||||
max-tries=50
|
||||
save-session-interval=10
|
||||
disable-ipv6=true
|
||||
save-session=/home/cpi/aria2download/aria.session.txt
|
||||
@@ -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
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": ".",
|
||||
"name": "GameShell launcher"
|
||||
}
|
||||
],
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASENAME=`dirname "$0"`
|
||||
BASENAME=$(dirname "$0")
|
||||
|
||||
cd $BASENAME/sys.py
|
||||
cd "$BASENAME"/sys.py || exit
|
||||
|
||||
python run.py
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
pycurl
|
||||
pygame
|
||||
#gobject
|
||||
xlib
|
||||
pyalsaaudio
|
||||
dbus-python
|
||||
#wicd - not pip installable yet
|
||||
#beeprint - causes bugs
|
||||
validators
|
||||
python-mpd
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
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 |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
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 |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 379 B |
|
After Width: | Height: | Size: 499 B |
|
After Width: | Height: | Size: 606 B |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 5.8 KiB |
@@ -29,7 +29,7 @@ from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.keys_def import CurKeys,IsKeyMenuOrB,IsKeyStartOrA
|
||||
from UI.skin_manager import MySkinManager
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.text_bulletinboard import Textbulletinboard,Text
|
||||
@@ -49,7 +49,7 @@ class NotFoundPage(Page):
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons[self._BG]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
#print( MyIconPool.Width(self._BG),MyIconPool.Height(self._BG) )
|
||||
@@ -143,7 +143,7 @@ class HashErrPage(Page):
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons[self._BG]
|
||||
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface(self._BG)
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.Adjust(0,0,MyIconPool.Width(self._BG),MyIconPool.Height(self._BG),0)
|
||||
@@ -208,13 +208,13 @@ class HashErrPage(Page):
|
||||
self._Board.SetAndBlitText(a.Words()+b.Words())
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
return
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self._Leader.InstallPackage(self._Screen)
|
||||
return
|
||||
|
||||
@@ -272,7 +272,8 @@ class MyCommercialSoftwarePackage(object):
|
||||
|
||||
os.chdir(json_config["GameDir"])
|
||||
for i,v in enumerate(json_config["MD5"]):
|
||||
os.system("unzip -o %s" %v) ## auto overwrite
|
||||
if FileExists(v):
|
||||
os.system("unzip -o %s" %v) ## auto overwrite
|
||||
|
||||
if "Post-Up" in json_config:
|
||||
if FileExists(self._InvokeDir):
|
||||
@@ -339,6 +340,12 @@ class MyCommercialSoftwarePackage(object):
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
if self._Done != "":
|
||||
#try to check if the installed package still there, if not ,remove the done flag file
|
||||
if FileExists(os.path.join(self._ComPkgInfo["GameDir"],self._ComPkgInfo["InstallDir"] )) == False:
|
||||
done_file = os.path.join( os.path.dirname(self._Done),".done")
|
||||
if FileExists(done_file):
|
||||
os.remove(done_file)
|
||||
|
||||
main_screen._MsgBox.SetText("Starting")
|
||||
main_screen._MsgBox.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
@@ -70,7 +70,7 @@ class MyEmulator(object):
|
||||
keyname = i.split(".")[0]
|
||||
self._Icons[keyname] = pygame.image.load(basepath+"/"+i).convert_alpha()
|
||||
"""
|
||||
self._Icons["sys"] = MyIconPool._Icons["sys"]
|
||||
self._Icons["sys"] = MyIconPool.GiveIconSurface("sys")
|
||||
|
||||
|
||||
def InitDeleteConfirmPage(self,main_screen):
|
||||
|
||||
@@ -129,8 +129,11 @@ class FavListPage(Page):
|
||||
stats = os.stat(v)
|
||||
if stats.st_gid != self._Parent._FavGID: ## only favs
|
||||
continue
|
||||
try:
|
||||
dirmap["gamedir"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["gamedir"] = v.decode("ascii","ignore")
|
||||
|
||||
dirmap["gamedir"] = v.decode("utf8")
|
||||
ret.append(dirmap)
|
||||
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
||||
stats = os.stat(v)
|
||||
@@ -141,7 +144,11 @@ class FavListPage(Page):
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v.decode("utf8")
|
||||
try:
|
||||
dirmap["file"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["file"] = v.decode("ascii","ignore")
|
||||
|
||||
ret.append(dirmap)
|
||||
|
||||
# else:
|
||||
@@ -227,7 +234,7 @@ class FavListPage(Page):
|
||||
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["star"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("star")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.AddLabel(MyLangManager.Tr("MyFavGames"), MyLangManager.TrFont("varela18"))
|
||||
@@ -335,7 +342,7 @@ class FavListPage(Page):
|
||||
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
if FileExists(self._Emulator["ROM_SO"]):
|
||||
if FileExists(self._Emulator["ROM_SO"].split(" ")[0]):
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
||||
|
||||
@@ -73,8 +73,8 @@ class ListItem(object):
|
||||
|
||||
label_text = os.path.basename(text)
|
||||
alias_file = os.path.splitext(text)[0] + ".alias"
|
||||
if os.path.isfile(alias_file):
|
||||
fp = open(alias_file, "r")
|
||||
if os.path.isfile(alias_file.encode("utf8")):
|
||||
fp = open(alias_file.encode("utf8"), "r")
|
||||
alias = fp.read()
|
||||
fp.close()
|
||||
label_text = alias.decode("utf8")
|
||||
|
||||
@@ -100,7 +100,7 @@ class RomListPage(Page):
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","Del","Scan","Back","Run","AddFav"]
|
||||
_MyList = []
|
||||
_ListFont = MyLangManager.Tr("notosanscjk15")
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
_Emulator = None
|
||||
_Parent = None
|
||||
@@ -143,7 +143,11 @@ class RomListPage(Page):
|
||||
continue
|
||||
|
||||
if FileExists(v+"/"+gameshell_bat):
|
||||
dirmap["gamedir"] = v.decode("utf8")
|
||||
try:
|
||||
dirmap["gamedir"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["gamedir"] = v.decode("ascii","ignore")
|
||||
|
||||
ret.append(dirmap)
|
||||
if os.path.isfile(v) and self._Emulator["FILETYPE"] == "file":
|
||||
stats = os.stat(v)
|
||||
@@ -162,7 +166,11 @@ class RomListPage(Page):
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v.decode("utf8")
|
||||
try:
|
||||
dirmap["file"] = v.decode("utf8","ignore")
|
||||
except:
|
||||
dirmap["file"] = v.decode("ascii","ignore")
|
||||
|
||||
ret.append(dirmap)
|
||||
# else:
|
||||
# print("not file or dir")
|
||||
@@ -261,7 +269,7 @@ class RomListPage(Page):
|
||||
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
||||
@@ -376,7 +384,7 @@ class RomListPage(Page):
|
||||
if self._Emulator["ROM_SO"] =="": #empty means No needs for rom so
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
if FileExists(self._Emulator["ROM_SO"]):
|
||||
if FileExists(self._Emulator["ROM_SO"].split(" ")[0]):
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
else:
|
||||
self._Screen.PushPage(self._RomSoConfirmDownloadPage)
|
||||
|
||||
@@ -12,7 +12,7 @@ from icon_item import IconItem
|
||||
from page import Page,PageStack
|
||||
from title_bar import TitleBar
|
||||
from foot_bar import FootBar
|
||||
from constants import Width,Height,bg_color
|
||||
from constants import Width,Height
|
||||
from util_funcs import midRect
|
||||
from keys_def import CurKeys
|
||||
from label import Label
|
||||
|
||||
@@ -62,13 +62,13 @@ class ConfirmPage(Page):
|
||||
_BGWidth = 0
|
||||
_BGHeight = 0
|
||||
_Parent = None
|
||||
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._Icons = {}
|
||||
self._CanvasHWND = None
|
||||
self._MyList = []
|
||||
|
||||
|
||||
def Reset(self):
|
||||
self._MyList[0].SetText(self._ConfirmText)
|
||||
self._MyList[0]._PosX = (self._Width - self._MyList[0]._Width)/2
|
||||
|
||||
@@ -12,12 +12,10 @@ from pygame.locals import *
|
||||
#from beeprint import pp
|
||||
|
||||
#UI lib
|
||||
from skin_manager import MySkinManager
|
||||
|
||||
|
||||
Width = 320
|
||||
Height = 240
|
||||
bg_color = MySkinManager.GiveColor('White')
|
||||
|
||||
icon_width = 80
|
||||
icon_height = 80
|
||||
|
||||
@@ -6,6 +6,7 @@ import urllib2
|
||||
import hashlib
|
||||
|
||||
from threading import Thread
|
||||
from StringIO import StringIO
|
||||
|
||||
class Download(Thread):
|
||||
_dst_path = ""
|
||||
@@ -24,7 +25,7 @@ class Download(Thread):
|
||||
self.downloaded = 0
|
||||
|
||||
self.progress = { 'downloaded': 0, 'total': 0, 'percent': 0,'stopped':False }
|
||||
self.stop = False
|
||||
self._stop = False
|
||||
self.filename = ""
|
||||
|
||||
def isFinished(self):
|
||||
@@ -40,14 +41,15 @@ class Download(Thread):
|
||||
return self._errors
|
||||
|
||||
def run(self):
|
||||
|
||||
c = pycurl.Curl()
|
||||
c.setopt(pycurl.URL, self.url)
|
||||
c.setopt(pycurl.FOLLOWLOCATION, 1)
|
||||
c.setopt(pycurl.MAXREDIRS, 5)
|
||||
c.setopt(pycurl.NOBODY, 1)
|
||||
c.setopt(pycurl.FOLLOWLOCATION, True)
|
||||
c.setopt(pycurl.MAXREDIRS, 4)
|
||||
#c.setopt(pycurl.NOBODY, 1)
|
||||
|
||||
c.setopt(pycurl.CONNECTTIMEOUT, 10)
|
||||
c.setopt(c.VERBOSE, True)
|
||||
|
||||
#c.setopt(pycurl.CONNECTTIMEOUT, 20)
|
||||
|
||||
if self.useragent:
|
||||
c.setopt(pycurl.USERAGENT, self.useragent)
|
||||
@@ -55,39 +57,39 @@ class Download(Thread):
|
||||
# add cookies, if available
|
||||
if self.cookies:
|
||||
c.setopt(pycurl.COOKIE, self.cookies)
|
||||
c.perform()
|
||||
realurl = c.getinfo(pycurl.EFFECTIVE_URL)
|
||||
|
||||
#realurl = c.getinfo(pycurl.EFFECTIVE_URL)
|
||||
realurl = self.url
|
||||
print("realurl",realurl)
|
||||
self.filename = realurl.split("/")[-1].strip()
|
||||
|
||||
c = pycurl.Curl()
|
||||
c.setopt(pycurl.CONNECTTIMEOUT, 10)
|
||||
c.setopt(pycurl.URL, realurl)
|
||||
c.setopt(pycurl.FOLLOWLOCATION, 0)
|
||||
c.setopt(pycurl.FOLLOWLOCATION, True)
|
||||
c.setopt(pycurl.NOPROGRESS, False)
|
||||
c.setopt(pycurl.XFERINFOFUNCTION, self.getProgress)
|
||||
if self.useragent:
|
||||
c.setopt(pycurl.USERAGENT, self.useragent)
|
||||
|
||||
c.setopt(pycurl.SSL_VERIFYPEER, False)
|
||||
c.setopt(pycurl.SSL_VERIFYHOST, False)
|
||||
|
||||
# configure pycurl output file
|
||||
if self.path == False:
|
||||
self.path = os.getcwd()
|
||||
filepath = os.path.join(self.path, self.filename)
|
||||
|
||||
|
||||
|
||||
if os.path.exists(filepath):## remove old file,restart download
|
||||
os.system("rm -rf " + filepath)
|
||||
f = open(filepath, "wb")
|
||||
else:
|
||||
f = open(filepath, "wb")
|
||||
|
||||
c.setopt(pycurl.WRITEDATA, f)
|
||||
buffer = StringIO()
|
||||
c.setopt(pycurl.WRITEDATA, buffer)
|
||||
|
||||
self._dst_path = filepath
|
||||
|
||||
# add cookies, if available
|
||||
if self.cookies:
|
||||
c.setopt(pycurl.COOKIE, self.cookies)
|
||||
|
||||
|
||||
self._stop = False
|
||||
self.progress["stopped"] = False
|
||||
# download file
|
||||
try:
|
||||
c.perform()
|
||||
@@ -95,14 +97,18 @@ class Download(Thread):
|
||||
errno,errstr = error
|
||||
print("curl error: %s" % errstr)
|
||||
self._errors.append(errstr)
|
||||
self.stop = True
|
||||
self._stop = True
|
||||
self.progress["stopped"] = True
|
||||
self.stop()
|
||||
finally:
|
||||
|
||||
code = c.getinfo( c.RESPONSE_CODE )
|
||||
c.close()
|
||||
self._is_finished = True
|
||||
|
||||
|
||||
with open(filepath, mode='w') as f:
|
||||
f.write(buffer.getvalue())
|
||||
|
||||
if self.progress["percent"] < 100:
|
||||
self._is_successful = False
|
||||
else:
|
||||
@@ -127,7 +133,7 @@ class Download(Thread):
|
||||
self.progress['total'] = download_t + self.downloaded
|
||||
self.progress['percent'] = ( float(self.progress['downloaded']) / float(self.progress['total'])) * 100.0
|
||||
self.progress["stopped"] = False
|
||||
if self.stop:
|
||||
if self._stop:
|
||||
self.progress["stopped"] = True
|
||||
return 1
|
||||
|
||||
@@ -151,11 +157,11 @@ class Download(Thread):
|
||||
return self.progress["percent"]
|
||||
|
||||
def stop(self):
|
||||
self.stop = True
|
||||
self._stop = True
|
||||
|
||||
def cancel(self):
|
||||
# sets the boolean to stop the thread.
|
||||
self.stop = True
|
||||
self._stop = True
|
||||
|
||||
def main():
|
||||
from optparse import OptionParser
|
||||
|
||||
@@ -58,14 +58,14 @@ class DownloadProcessPage(Page):
|
||||
self._PngSize["needwifi_bg"] = (253,132)
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["rom_download"]
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("rom_download")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
needwifi_bg = IconItem()
|
||||
needwifi_bg._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
||||
needwifi_bg._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||
needwifi_bg._MyType = ICON_TYPES["STAT"]
|
||||
needwifi_bg._Parent = self
|
||||
needwifi_bg.Adjust(0,0,self._PngSize["needwifi_bg"][0],self._PngSize["needwifi_bg"][1],0)
|
||||
@@ -75,16 +75,16 @@ class DownloadProcessPage(Page):
|
||||
|
||||
self._FileNameLabel = Label()
|
||||
self._FileNameLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._FileNameLabel.Init("", fonts["varela12"])
|
||||
self._FileNameLabel.Init("", MyLangManager.TrFont("varela12"))
|
||||
|
||||
self._SizeLabel = Label()
|
||||
self._SizeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._SizeLabel.Init("0/0Kb",fonts["varela12"])
|
||||
self._SizeLabel.Init("0/0Kb",MyLangManager.TrFont("varela12"))
|
||||
self._SizeLabel.SetColor( self._URLColor )
|
||||
|
||||
|
||||
def OnExitCb(self,event):
|
||||
print("DownloadProcessPage OnExitCb")
|
||||
#print("DownloadProcessPage OnExitCb")
|
||||
if self._Downloader == None:
|
||||
return
|
||||
try:
|
||||
@@ -97,14 +97,14 @@ class DownloadProcessPage(Page):
|
||||
if self._Screen.CurPage() == self:
|
||||
if self._Downloader.isFinished():
|
||||
if self._Downloader.isSuccessful():
|
||||
print("Success!")
|
||||
print("Download Success!")
|
||||
# Do something with obj.get_dest()
|
||||
filename = os.path.basename(self._Downloader.get_dest())
|
||||
cur_dir = os.getcwd()
|
||||
|
||||
if filename.endswith(".zip"):
|
||||
os.chdir(self._DST_DIR)
|
||||
os.system( "unzip " + filename )
|
||||
os.system( "unzip -o " + filename )
|
||||
|
||||
elif filename.endswith(".zsync"):
|
||||
os.chdir(self._DST_DIR)
|
||||
@@ -115,7 +115,8 @@ class DownloadProcessPage(Page):
|
||||
os.system( "tar xf " + filename)
|
||||
os.system( "rm -rf " + filename)
|
||||
|
||||
os.chdir(cur_dir)
|
||||
os.chdir(cur_dir)
|
||||
self.DownloadPostJob()
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -155,6 +156,20 @@ class DownloadProcessPage(Page):
|
||||
else:
|
||||
return False
|
||||
|
||||
def DownloadPostJob(self):
|
||||
cur_dir = os.getcwd()
|
||||
|
||||
arr = self._URL.rsplit('/', 1)
|
||||
if len(arr) > 1:
|
||||
downloaded_filename = arr[1]
|
||||
try:
|
||||
os.chdir(os.path.join(cur_dir,"patches",downloaded_filename))
|
||||
os.system("/bin/sh Run.sh")
|
||||
except:
|
||||
pass
|
||||
|
||||
os.chdir(cur_dir)
|
||||
|
||||
def StartDownload(self,url,dst_dir):
|
||||
if is_wifi_connected_now() == False:
|
||||
return
|
||||
@@ -172,7 +187,7 @@ class DownloadProcessPage(Page):
|
||||
self._Downloader = Download(url,dst_dir,None)
|
||||
self._Downloader.start()
|
||||
|
||||
self._DownloaderTimer = gobject.timeout_add(100, self.GObjectUpdateProcessInterval)
|
||||
self._DownloaderTimer = gobject.timeout_add(200, self.GObjectUpdateProcessInterval)
|
||||
|
||||
def KeyDown(self,event):
|
||||
if IsKeyMenuOrB(event.key):
|
||||
|
||||
@@ -15,6 +15,8 @@ from lang_manager import MyLangManager
|
||||
from widget import Widget
|
||||
from skin_manager import MySkinManager
|
||||
|
||||
import config
|
||||
|
||||
icon_base_path = MySkinManager.GiveIcon("gameshell/footbar_icons/")
|
||||
|
||||
class FootBarIcon(MultiIconItem):
|
||||
@@ -94,7 +96,7 @@ class FootBar(Widget):
|
||||
|
||||
round_corners._MyType = ICON_TYPES["STAT"]
|
||||
round_corners._Parent = self
|
||||
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
|
||||
round_corners._ImgSurf = MyIconPool.GiveIconSurface("roundcorners")
|
||||
round_corners.Adjust(0,0,10,10,0)
|
||||
|
||||
self._Icons["round_corners"] = round_corners
|
||||
|
||||
@@ -33,7 +33,20 @@ class IconPool(object):
|
||||
def Height(self,keyname):
|
||||
if keyname in self._Sizes:
|
||||
return self._Sizes[keyname][1]
|
||||
|
||||
|
||||
def GiveIconSurface(self,imgname): ## imgname is the png file name without .png
|
||||
if imgname in self._Icons:
|
||||
return self._Icons[imgname]
|
||||
else:
|
||||
icon_file = MySkinManager.GiveIcon("gameshell/icons/"+imgname+".png")
|
||||
if os.path.isfile(icon_file):
|
||||
keyname = imgname
|
||||
self._Icons[keyname] = pygame.image.load(icon_file).convert_alpha()
|
||||
self._Sizes[keyname] = self._Icons[keyname].get_size()
|
||||
return self._Icons[keyname]
|
||||
|
||||
return None # this will cause panic,if not found both in theme and default skin folder
|
||||
|
||||
##global Handler
|
||||
MyIconPool = None
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class InfoPageSelector(PageSelector):
|
||||
|
||||
def Draw(self):
|
||||
idx = self._Parent._PsIndex
|
||||
if idx < len(self._Parent._MyList):
|
||||
if idx >= 0 and idx < len(self._Parent._MyList):
|
||||
y = self._Parent._MyList[idx]._PosY+1
|
||||
h = self._Parent._MyList[idx]._Height -3
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ class Keyboard(Page):
|
||||
|
||||
if val == "_L" or val == "_R":
|
||||
it = KeyboardIcon()
|
||||
it._ImgSurf = MyIconPool._Icons[val]
|
||||
it._ImgSurf = MyIconPool.GiveIconSurface(val)
|
||||
it._Parent = self
|
||||
it._Str = val
|
||||
it.Init(start_x+it._ImgSurf.get_width()/2 ,start_y,it._ImgSurf.get_width(),it._ImgSurf.get_height(),0)
|
||||
|
||||
@@ -6,9 +6,8 @@ from sys import exit
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
from config import CurKeySet
|
||||
|
||||
import config
|
||||
from config import CurKeySet ## read only
|
||||
|
||||
def GetButtonsLayoutMode():
|
||||
lm = "xbox"
|
||||
@@ -25,6 +24,7 @@ def SetButtonsLayoutMode(mode):
|
||||
SetXYABButtons(mode)
|
||||
with open(".buttonslayout", "w") as f:
|
||||
f.write(mode)
|
||||
config.ButtonsLayout = mode
|
||||
|
||||
def SetXYABButtons(mode):
|
||||
if mode == "snes":
|
||||
|
||||