gamestore alpha

This commit is contained in:
cuu 2019-12-08 14:37:14 +00:00
parent 103838c531
commit 9c69b6a637
4 changed files with 68 additions and 16 deletions

View File

@ -2,18 +2,18 @@ session=${1:-gameshell}
case $session in case $session in
hdmi ) hdmi )
exec ~/launcher/aria2c --conf-path=~/launcher/aria2.conf exec ~/launcher/aria2c --conf-path=/home/cpi/launcher/aria2.conf &
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg
cd ~/launcher/sys.py/ ; python appinstaller.py& cd ~/ cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
exec ~/launcher/load.sh & exec ~/launcher/load.sh &
exec ~/launcher/sys.py/gsnotify/gsnotify-arm daemon & exec ~/launcher/sys.py/gsnotify/gsnotify-arm daemon &
#exec /usr/bin/twm -f ~/launcher/.twmrc #exec /usr/bin/twm -f ~/launcher/.twmrc
exec ~/launcher/dwm-mod exec ~/launcher/dwm-mod
;; ;;
gameshell ) gameshell )
exec ~/launcher/aria2c --conf-path=~/launcher/aria2.conf exec ~/launcher/aria2c --conf-path=/home/cpi/launcher/aria2.conf &
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png
cd ~/launcher/sys.py/ ; python appinstaller.py& cd ~/ cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
exec ~/launcher/load.sh & exec ~/launcher/load.sh &
exec ~/launcher/sys.py/gsnotify/gsnotify-arm & exec ~/launcher/sys.py/gsnotify/gsnotify-arm &
#exec awesome -c ~/launcher/awesome/rc.lua #exec awesome -c ~/launcher/awesome/rc.lua

View File

@ -14,7 +14,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.util_funcs import midRect,FileExists,ArmSystem from UI.util_funcs import midRect,FileExists,ArmSystem,reconstruct_broken_string
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
@ -185,7 +185,7 @@ def dict_factory(cursor, row):
return d return d
class GameStorePage(Page): class GameStorePage(Page):
_FootMsg = ["Nav","","Up","Back","Select"] _FootMsg = ["Nav","Update store","Up","Back","Select"]
_MyList = [] _MyList = []
_ListFont12 = MyLangManager.TrFont("notosanscjk12") _ListFont12 = MyLangManager.TrFont("notosanscjk12")
_ListFont15 = MyLangManager.TrFont("varela15") _ListFont15 = MyLangManager.TrFont("varela15")
@ -235,8 +235,9 @@ class GameStorePage(Page):
repos = [] repos = []
stk = self._MyStack.Last() stk = self._MyStack.Last()
stk_lev = self._MyStack.Length()
repos.extend(stk) repos.extend(stk)
if self._MyStack.Length() == 1: # on top if stk_lev == 1: # on top
sqlite3_menu= self.SyncSqlite() sqlite3_menu= self.SyncSqlite()
if sqlite3_menu != None and len(sqlite3_menu) > 0: if sqlite3_menu != None and len(sqlite3_menu) > 0:
#print(sqlite3_menu) #print(sqlite3_menu)
@ -253,9 +254,19 @@ class GameStorePage(Page):
li._Width = Width li._Width = Width
li._Fonts["normal"] = self._ListFont15 li._Fonts["normal"] = self._ListFont15
li._Active = False li._Active = False
li._ReadOnly = True
li._Value = u li._Value = u
li.Init( u["title"] ) li.Init( u["title"] )
if stk_lev >1:
li._ReadOnly = False
elif stk_lev == 1:
if "status" in u:
if u["status"] == "complete":
li._ReadOnly = False
if i == 0:
li._ReadOnly = False
last_height += li._Height last_height += li._Height
self._MyList.append(li) self._MyList.append(li)
@ -309,10 +320,25 @@ class GameStorePage(Page):
if "gid" in cur_li._Value: if "gid" in cur_li._Value:
try: try:
gid = cur_li._Value["gid"]
conn = sqlite3.connect(self._aria2_db) conn = sqlite3.connect(self._aria2_db)
conn.row_factory = dict_factory conn.row_factory = dict_factory
c = conn.cursor() c = conn.cursor()
c.execute("DELETE FROM tasks WHERE gid = '%s'" % cur_li._Value["gid"]) ret = c.execute("SELECT * FROM tasks WHERE gid='%s'" % gid ).fetchone()
if ret != None:
remote_file_url = ret["file"]
menu_file = remote_file_url.split("master")[1]
local_menu_file = "%s/aria2download%s" % (os.path.expanduser('~'),menu_file )
try:
if os.path.exists(local_menu_file):
os.remove(local_menu_file)
if os.path.exists(local_menu_file+".aria2"):
os.remove(local_menu_file+".aria2")
except Exception as ex:
print(ex)
c.execute("DELETE FROM tasks WHERE gid = '%s'" % gid )
conn.commit() conn.commit()
conn.close() conn.close()
except Exception as ex: except Exception as ex:
@ -398,7 +424,12 @@ class GameStorePage(Page):
else: else:
print("file downloaded")# maybe check it if is installed,then execute it print("file downloaded")# maybe check it if is installed,then execute it
if cur_li._Value["type"]=="launcher" and cur_li._ReadOnly == False:
game_sh = os.path.join( "%s/apps/Menu/21_Indie Games/" % os.path.expanduser('~'),cur_li._Value["title"],cur_li._Value["title"]+".sh")
#game_sh = reconstruct_broken_string( game_sh)
print("run game: ",game_sh, os.path.exists( game_sh))
self._Screen.RunEXE(game_sh)
def OnLoadCb(self): def OnLoadCb(self):
self._Scrolled = 0 self._Scrolled = 0
@ -408,8 +439,10 @@ class GameStorePage(Page):
print("OnLoadCb") print("OnLoadCb")
if self._MyStack.Length() == 1: if self._MyStack.Length() == 1:
self._FootMsg[2] = "Remove" self._FootMsg[2] = "Remove"
self._FootMsg[1] = "Update store"
else: else:
self._FootMsg[2] = "Up" self._FootMsg[2] = "Up"
self._FootMsg[1] = ""
self.SyncList() self.SyncList()
@ -417,8 +450,10 @@ class GameStorePage(Page):
if self._MyStack.Length() == 1: if self._MyStack.Length() == 1:
self._FootMsg[2] = "Remove" self._FootMsg[2] = "Remove"
self._FootMsg[1] = "Update store"
else: else:
self._FootMsg[2] = "Up" self._FootMsg[2] = "Up"
self._FootMsg[1] = ""
self.SyncList() self.SyncList()
self._Screen.Draw() self._Screen.Draw()
@ -440,8 +475,10 @@ class GameStorePage(Page):
if self._MyStack.Length() == 1: if self._MyStack.Length() == 1:
self._FootMsg[2] = "Remove" self._FootMsg[2] = "Remove"
self._FootMsg[1] = "Update store"
else: else:
self._FootMsg[2] = "Up" self._FootMsg[2] = "Up"
self._FootMsg[1] = ""
self._Screen.Draw() self._Screen.Draw()
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
@ -460,14 +497,22 @@ class GameStorePage(Page):
self._MyStack.Pop() self._MyStack.Pop()
if self._MyStack.Length() == 1: if self._MyStack.Length() == 1:
self._FootMsg[2] = "Remove" self._FootMsg[2] = "Remove"
self._FootMsg[1] = "Update store"
else: else:
self._FootMsg[2] = "Up" self._FootMsg[2] = "Up"
self._FootMsg[1] = ""
self.SyncList() self.SyncList()
self._Screen.Draw() self._Screen.Draw()
self._Screen.SwapAndShow() self._Screen.SwapAndShow()
if event.key == CurKeys["Y"]:
if self._MyStack.Length() == 1:
self._Screen._MsgBox.SetText("Done")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Up"]: if event.key == CurKeys["Up"]:
self.ScrollUp() self.ScrollUp()
self._Screen.Draw() self._Screen.Draw()

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -27,13 +27,18 @@ def game_install_thread(gid):
c = conn.cursor() c = conn.cursor()
ret = c.execute("SELECT * FROM tasks WHERE gid='%s'" % gid ).fetchone() ret = c.execute("SELECT * FROM tasks WHERE gid='%s'" % gid ).fetchone()
if ret == None: if ret == None:
conn.close()
return return
c.execute("UPDATE tasks SET status='complete' WHERE gid='%s'" % gid)
conn.commit()
conn.close()
remote_file_url = ret["file"] remote_file_url = ret["file"]
menu_file = remote_file_url.split("master")[1] menu_file = remote_file_url.split("master")[1]
local_menu_file = "%s/aria2download%s" % (os.path.expanduser('~'),menu_file ) local_menu_file = "%s/aria2download%s" % (os.path.expanduser('~'),menu_file )
if os.path.exists(local_menu_file) == True and "arm" not in platform.machine(): if os.path.exists(local_menu_file) == True and "arm" in platform.machine():
gametype = ret["type"] gametype = ret["type"]
if gametype == "launcher": if gametype == "launcher":
#tar zxvf #tar zxvf
@ -49,7 +54,6 @@ def game_install_thread(gid):
print(_cmd) print(_cmd)
os.system(_cmd) os.system(_cmd)
conn.close()
except Exception as ex: except Exception as ex:
print("Sqlite3 error: ",ex) print("Sqlite3 error: ",ex)
@ -81,8 +85,11 @@ def on_message(ws, message):
try: try:
print(aria2_noti["errorMessage"]) print(aria2_noti["errorMessage"])
for x in aria2_noti["files"]: for x in aria2_noti["files"]:
os.remove(x["path"]) if os.path.exists(x["path"]):
os.remove(x["path"]+".aria2") os.remove(x["path"])
if os.path.exists(x["path"]+".aria2"):
os.remove(x["path"]+".aria2")
except Exception as ex: except Exception as ex:
print(ex) print(ex)