From 9c69b6a63745d033a2c2fdb5a0b3463e46fd224d Mon Sep 17 00:00:00 2001 From: cuu Date: Sun, 8 Dec 2019 14:37:14 +0000 Subject: [PATCH] gamestore alpha --- .xinitrc | 8 +-- Menu/GameShell/21_GameStore/__init__.py | 59 +++++++++++++++--- .../gameshell/titlebar_icons/dlstatus18.png | Bin 0 -> 5942 bytes sys.py/appinstaller.py | 17 +++-- 4 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 skin/default/sys.py/gameshell/titlebar_icons/dlstatus18.png diff --git a/.xinitrc b/.xinitrc index e5c4856..ed27456 100644 --- a/.xinitrc +++ b/.xinitrc @@ -2,18 +2,18 @@ session=${1:-gameshell} case $session in 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 - 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/sys.py/gsnotify/gsnotify-arm daemon & #exec /usr/bin/twm -f ~/launcher/.twmrc exec ~/launcher/dwm-mod ;; 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 - 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/sys.py/gsnotify/gsnotify-arm & #exec awesome -c ~/launcher/awesome/rc.lua diff --git a/Menu/GameShell/21_GameStore/__init__.py b/Menu/GameShell/21_GameStore/__init__.py index a4ced91..00543fb 100644 --- a/Menu/GameShell/21_GameStore/__init__.py +++ b/Menu/GameShell/21_GameStore/__init__.py @@ -14,7 +14,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,ArmSystem +from UI.util_funcs import midRect,FileExists,ArmSystem,reconstruct_broken_string from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB from UI.scroller import ListScroller from UI.icon_pool import MyIconPool @@ -185,7 +185,7 @@ def dict_factory(cursor, row): return d class GameStorePage(Page): - _FootMsg = ["Nav","","Up","Back","Select"] + _FootMsg = ["Nav","Update store","Up","Back","Select"] _MyList = [] _ListFont12 = MyLangManager.TrFont("notosanscjk12") _ListFont15 = MyLangManager.TrFont("varela15") @@ -235,8 +235,9 @@ class GameStorePage(Page): repos = [] stk = self._MyStack.Last() + stk_lev = self._MyStack.Length() repos.extend(stk) - if self._MyStack.Length() == 1: # on top + if stk_lev == 1: # on top sqlite3_menu= self.SyncSqlite() if sqlite3_menu != None and len(sqlite3_menu) > 0: #print(sqlite3_menu) @@ -253,9 +254,19 @@ class GameStorePage(Page): li._Width = Width li._Fonts["normal"] = self._ListFont15 li._Active = False + li._ReadOnly = True li._Value = u 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 self._MyList.append(li) @@ -309,10 +320,25 @@ class GameStorePage(Page): if "gid" in cur_li._Value: try: + gid = cur_li._Value["gid"] conn = sqlite3.connect(self._aria2_db) conn.row_factory = dict_factory 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.close() except Exception as ex: @@ -398,7 +424,12 @@ class GameStorePage(Page): else: 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): self._Scrolled = 0 @@ -408,8 +439,10 @@ class GameStorePage(Page): print("OnLoadCb") if self._MyStack.Length() == 1: self._FootMsg[2] = "Remove" + self._FootMsg[1] = "Update store" else: self._FootMsg[2] = "Up" + self._FootMsg[1] = "" self.SyncList() @@ -417,8 +450,10 @@ class GameStorePage(Page): if self._MyStack.Length() == 1: self._FootMsg[2] = "Remove" + self._FootMsg[1] = "Update store" else: self._FootMsg[2] = "Up" + self._FootMsg[1] = "" self.SyncList() self._Screen.Draw() @@ -440,8 +475,10 @@ class GameStorePage(Page): if self._MyStack.Length() == 1: self._FootMsg[2] = "Remove" + self._FootMsg[1] = "Update store" else: self._FootMsg[2] = "Up" + self._FootMsg[1] = "" self._Screen.Draw() self._Screen.SwapAndShow() @@ -460,14 +497,22 @@ class GameStorePage(Page): self._MyStack.Pop() if self._MyStack.Length() == 1: self._FootMsg[2] = "Remove" + self._FootMsg[1] = "Update store" else: self._FootMsg[2] = "Up" - + self._FootMsg[1] = "" self.SyncList() self._Screen.Draw() 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"]: self.ScrollUp() self._Screen.Draw() diff --git a/skin/default/sys.py/gameshell/titlebar_icons/dlstatus18.png b/skin/default/sys.py/gameshell/titlebar_icons/dlstatus18.png new file mode 100644 index 0000000000000000000000000000000000000000..0b3eab4ed61a55c56058382b8806b690d4b4db2c GIT binary patch literal 5942 zcmeHLdt6gxA0HW@Bm|f@GMxhv-aMSM3)`3*28^3IE&~zF#Iv2Vi@UOO#)hm?yaXtw zh~)(pq)5seS`lI@Dqc`~qfm(thKUzm6H%#9v+Ow=AQZ2?zVF+AZlA%P=lTA=zx!{` z=j0{CMZ3HCxY1}d_t+S*6#VxFAMQ{W@VCC}q=iNs;<_L?m6W0uy3u4%sI@qq%rfG1 z+^Sa4Xx8SAl(51U`tbc-`9i1Ip?TNl4Vif_Z1WbEY+>6;|Cu#wBRm%Q9NM#L$-dQ- zf1J=7eRo+@;IUPW!uN`OXaA$ZSa-Osq24F3Jb3)`wgY7~!kEx>M4XehGWz2W-&{Ip z%ZuYfRW+v;Z!t8*N04LZO3JTQf0w>^N%8adgy&evan330Y{SgU&nLFKU3sAXVr5mc z&0|*%c0!uO_r4nB=T#QpnRDX(n7R{V%9(qGrTc>ek(pEv8TO?Nx~ zqtmX8^$SaOa;AEuwq>qsD%#vqxOA`BJwb9iz!~e{EPSE1iZRBU?#a%Rma9%jEfETC zRpb^=y6y68%wkhSQL&hHC}Z=1%Hyhk?YT2C>dLd8`5W~MUCgw3AG{w}CgTSrFV6R$ zd1n6g*`Fv*25P?i_Rf^rvquXna5nLB%Im`F1(`(mrB97s$tw3rqhFpoy<%jX=A+#+ zOVcMdS=T_ieOJzKTkBISUn%2jZe~?o=-zYwn8YVPRaKqVl`^}dG3J9Ra@6H(lgx$aSi1%rk$r^umbh)=Q&SUHIpvV-qHh_9x#OQjL^m zhuxgj68ehn4fN-wO&QOvPD+lc{b_M{cm3RJle=Ff?p{CkaM^D!-me<&K4;{E(&5vb zI*S&SaSk*sq0zjysXa z47wTKaDRDlDv|U_>xrHyf_TDK)Cefqb99pzheodjc&G ztCeaJ)h5|pqx|fXm1hR^MPH9w2)O~n2^e$W9igBmc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