mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 09:48:50 +01:00
...
This commit is contained in:
parent
ac0df61352
commit
1aac399de6
@ -22,8 +22,34 @@ from UI.lang_manager import MyLangManager
|
|||||||
from UI.info_page_list_item import InfoPageListItem
|
from UI.info_page_list_item import InfoPageListItem
|
||||||
from UI.info_page_selector import InfoPageSelector
|
from UI.info_page_selector import InfoPageSelector
|
||||||
|
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
|
class RPCStack:
|
||||||
|
def __init__(self):
|
||||||
|
self.stack = list()
|
||||||
|
|
||||||
|
def Push(self,data):
|
||||||
|
if data not in self.stack:
|
||||||
|
self.stack.append(data)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def Pop(self):
|
||||||
|
if len(self.stack)<=0:
|
||||||
|
return None,False
|
||||||
|
return self.stack.pop(),True
|
||||||
|
|
||||||
|
def Last(self):
|
||||||
|
idx = len(self.stack) -1
|
||||||
|
if idx < 0:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
return self.stack[ idx ]
|
||||||
|
|
||||||
|
def Length(self):
|
||||||
|
return len(self.stack)
|
||||||
|
|
||||||
class GameStorePage(Page):
|
class GameStorePage(Page):
|
||||||
_FootMsg = ["Nav","","","Back","Select"]
|
_FootMsg = ["Nav","","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
@ -39,12 +65,19 @@ class GameStorePage(Page):
|
|||||||
_DrawOnce = False
|
_DrawOnce = False
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
_InfoPage = None
|
_InfoPage = None
|
||||||
|
_Downloading = None
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Page.__init__(self)
|
Page.__init__(self)
|
||||||
self._Icons = {}
|
self._Icons = {}
|
||||||
|
self._MyStack = RPCStack()
|
||||||
|
#title path type
|
||||||
|
repos = [
|
||||||
|
["github.com/cuu/gamestore","https://raw.githubusercontent.com/cuu/gamestore/master/index.json","dir"]
|
||||||
|
]
|
||||||
|
self._MyStack.Push(repos)
|
||||||
|
|
||||||
def GenList(self):
|
def SyncList(self):
|
||||||
|
|
||||||
self._MyList = []
|
self._MyList = []
|
||||||
|
|
||||||
@ -52,10 +85,8 @@ class GameStorePage(Page):
|
|||||||
start_y = 0
|
start_y = 0
|
||||||
last_height = 0
|
last_height = 0
|
||||||
|
|
||||||
repos = [
|
repos = self._MyStack.Last()
|
||||||
["https://raw.githubusercontent.com/cuu/gamestore/master/index.json","github.com/cuu/gamestore"]
|
|
||||||
]
|
|
||||||
|
|
||||||
for i,u in enumerate( repos ):
|
for i,u in enumerate( repos ):
|
||||||
#print(i,u)
|
#print(i,u)
|
||||||
li = InfoPageListItem()
|
li = InfoPageListItem()
|
||||||
@ -65,13 +96,16 @@ class GameStorePage(Page):
|
|||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFont
|
li._Fonts["normal"] = self._ListFont
|
||||||
li._Active = False
|
li._Active = False
|
||||||
li._Value = u[0]
|
li._Value = u[1]
|
||||||
li.Init( u[1] )
|
li._Type = u[2]
|
||||||
|
li.Init( u[0] )
|
||||||
|
|
||||||
last_height += li._Height
|
last_height += li._Height
|
||||||
|
|
||||||
self._MyList.append(li)
|
self._MyList.append(li)
|
||||||
|
|
||||||
|
self._MyStack.Push(repos)
|
||||||
|
|
||||||
def Init(self):
|
def Init(self):
|
||||||
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:
|
||||||
@ -93,7 +127,7 @@ class GameStorePage(Page):
|
|||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
self._PsIndex = 0
|
self._PsIndex = 0
|
||||||
|
|
||||||
self.GenList()
|
self.SyncList()
|
||||||
|
|
||||||
self._Scroller = ListScroller()
|
self._Scroller = ListScroller()
|
||||||
self._Scroller._Parent = self
|
self._Scroller._Parent = self
|
||||||
@ -111,12 +145,27 @@ class GameStorePage(Page):
|
|||||||
return
|
return
|
||||||
|
|
||||||
print(cur_li._Value)
|
print(cur_li._Value)
|
||||||
|
|
||||||
|
if cur_li._Type == "dir":
|
||||||
|
menu_file = cur_li._Value.split("master")[1]
|
||||||
|
local_menu_file = "%s/aria2Download%s" % (os.path.expanduser('~'),menu_file )
|
||||||
|
if FileExists( local_menu_file ) == False:
|
||||||
|
if config.RPC.urlDownloading(cur_li._Value) == False:
|
||||||
|
config.RPC.addUri(cur_li._Value, options={"out": menu_file})
|
||||||
|
self._Downloading = cur_li._Value
|
||||||
|
else:
|
||||||
|
#read the local_menu_file, push into stack,display menu
|
||||||
|
self._Downloading = None
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
#download the game probably
|
||||||
|
|
||||||
def OnLoadCb(self):
|
def OnLoadCb(self):
|
||||||
self._Scrolled = 0
|
self._Scrolled = 0
|
||||||
self._PosY = 0
|
self._PosY = 0
|
||||||
self._DrawOnce = False
|
self._DrawOnce = False
|
||||||
|
#sync
|
||||||
|
|
||||||
def OnReturnBackCb(self):
|
def OnReturnBackCb(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
from UI.util_funcs import FileExists,ArmSystem
|
from UI.util_funcs import FileExists,ArmSystem
|
||||||
|
from pyaria2 import Xmlrpc
|
||||||
|
|
||||||
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
CurKeySet = "GameShell" ## >>> PC or GameShell <<<
|
||||||
|
|
||||||
@ -10,7 +11,6 @@ DontLeave = False
|
|||||||
BackLight = "/proc/driver/backlight"
|
BackLight = "/proc/driver/backlight"
|
||||||
Battery = "/sys/class/power_supply/axp20x-battery/uevent"
|
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_ver0.4.json"
|
UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI/master/launcher_ver0.4.json"
|
||||||
@ -21,6 +21,7 @@ SKIN=None
|
|||||||
|
|
||||||
ButtonsLayout="xbox"
|
ButtonsLayout="xbox"
|
||||||
|
|
||||||
|
RPC = None
|
||||||
## three timer values in seconds: dim screen, close screen,PowerOff
|
## three timer values in seconds: dim screen, close screen,PowerOff
|
||||||
## zero means no action
|
## zero means no action
|
||||||
PowerLevels = {}
|
PowerLevels = {}
|
||||||
@ -71,7 +72,8 @@ def PreparationInAdv():
|
|||||||
ArmSystem("sudo iw wlan0 set power_save on > /dev/null")
|
ArmSystem("sudo iw wlan0 set power_save on > /dev/null")
|
||||||
else:
|
else:
|
||||||
ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
|
ArmSystem("sudo iw wlan0 set power_save off >/dev/null")
|
||||||
|
|
||||||
|
RPC = Xmlrpc('localhost', 6800)
|
||||||
PreparationInAdv()
|
PreparationInAdv()
|
||||||
##sys.py/.powerlevel
|
##sys.py/.powerlevel
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user