mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
gamestore bug fix
This commit is contained in:
parent
85d67dc218
commit
3371393733
@ -187,8 +187,9 @@ def dict_factory(cursor, row):
|
|||||||
class GameStorePage(Page):
|
class GameStorePage(Page):
|
||||||
_FootMsg = ["Nav","","Up","Back","Select"]
|
_FootMsg = ["Nav","","Up","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = MyLangManager.TrFont("notosanscjk12")
|
_ListFont12 = MyLangManager.TrFont("notosanscjk12")
|
||||||
|
_ListFont15 = MyLangManager.TrFont("varela15")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
_Scrolled = 0
|
_Scrolled = 0
|
||||||
@ -238,7 +239,7 @@ class GameStorePage(Page):
|
|||||||
if self._MyStack.Length() == 1: # on top
|
if self._MyStack.Length() == 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)
|
||||||
repos.extend(sqlite3_menu )
|
repos.extend(sqlite3_menu )
|
||||||
|
|
||||||
print(repos)
|
print(repos)
|
||||||
@ -250,7 +251,7 @@ class GameStorePage(Page):
|
|||||||
li._PosX = start_x
|
li._PosX = start_x
|
||||||
li._PosY = start_y + last_height
|
li._PosY = start_y + last_height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFont
|
li._Fonts["normal"] = self._ListFont15
|
||||||
li._Active = False
|
li._Active = False
|
||||||
li._Value = u
|
li._Value = u
|
||||||
li.Init( u["title"] )
|
li.Init( u["title"] )
|
||||||
@ -259,7 +260,6 @@ class GameStorePage(Page):
|
|||||||
|
|
||||||
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:
|
||||||
@ -296,10 +296,10 @@ class GameStorePage(Page):
|
|||||||
return
|
return
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
if cur_li._Active == True:
|
#if cur_li._Active == True:
|
||||||
return
|
# return
|
||||||
|
|
||||||
print(cur_li._Value)
|
print("cur_li._Value",cur_li._Value)
|
||||||
|
|
||||||
if cur_li._Value["type"] == "dir":
|
if cur_li._Value["type"] == "dir":
|
||||||
remote_file_url = cur_li._Value["file"]
|
remote_file_url = cur_li._Value["file"]
|
||||||
@ -345,15 +345,19 @@ class GameStorePage(Page):
|
|||||||
if ret == False:
|
if ret == False:
|
||||||
gid = config.RPC.addUri( remote_file_url, options={"out": menu_file})
|
gid = config.RPC.addUri( remote_file_url, options={"out": menu_file})
|
||||||
self._Downloading = remote_file_url
|
self._Downloading = remote_file_url
|
||||||
try:
|
print("stack length ",self._MyStack.Length())
|
||||||
conn = sqlite3.connect("aria2tasks.db")
|
if self._MyStack.Length() > 1:## not on the top list page
|
||||||
c = conn.cursor()
|
try:
|
||||||
c.execute("INSERT INTO tasks(gid,title,file,type,status,fav) VALUES ('"+gid+"','"+cur_li._Value["title"]+"','"+cur_li._Value["file"]+"','"+cur_li._Value["type"]+"','active','0')")
|
conn = sqlite3.connect("aria2tasks.db")
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute("INSERT INTO tasks(gid,title,file,type,status,fav) VALUES ('"+gid+"','"+cur_li._Value["title"]+"','"+cur_li._Value["file"]+"','"+cur_li._Value["type"]+"','active','0')")
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("SQLITE3 ",ex)
|
print("SQLITE3 ",ex)
|
||||||
|
else:
|
||||||
|
print(config.RPC.tellStatus(gid,["status","totalLength","completedLength"]))
|
||||||
|
|
||||||
self._Screen._MsgBox.SetText("Getting the game now")
|
self._Screen._MsgBox.SetText("Getting the game now")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
@ -367,7 +371,8 @@ class GameStorePage(Page):
|
|||||||
self._Scrolled = 0
|
self._Scrolled = 0
|
||||||
self._PosY = 0
|
self._PosY = 0
|
||||||
self._DrawOnce = False
|
self._DrawOnce = False
|
||||||
#sync
|
#sync
|
||||||
|
print("OnLoadCb")
|
||||||
self.SyncList()
|
self.SyncList()
|
||||||
|
|
||||||
def OnReturnBackCb(self):
|
def OnReturnBackCb(self):
|
||||||
@ -387,6 +392,7 @@ class GameStorePage(Page):
|
|||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
if event.key == CurKeys["X"]:
|
if event.key == CurKeys["X"]:
|
||||||
|
print(self._MyStack.Length() )
|
||||||
if self._MyStack.Length() > 1:
|
if self._MyStack.Length() > 1:
|
||||||
self._MyStack.Pop()
|
self._MyStack.Pop()
|
||||||
self.SyncList()
|
self.SyncList()
|
||||||
|
|||||||
@ -2,25 +2,37 @@ import sqlite3
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from wicd import misc
|
from wicd import misc
|
||||||
|
from pyaria2_rpc.pyaria2 import Wsrpc
|
||||||
|
|
||||||
import libs.websocket as websocket
|
import libs.websocket as websocket
|
||||||
|
|
||||||
aria2_ws = "ws://localhost:6800/jsonrpc"
|
aria2_ws = "ws://localhost:6800/jsonrpc"
|
||||||
aria2_db = "aria2tasks.db"
|
aria2_db = "aria2tasks.db"
|
||||||
|
|
||||||
|
rpc = Wsrpc('localhost',6800)
|
||||||
|
|
||||||
@misc.threaded
|
@misc.threaded
|
||||||
def game_install_thread():
|
def game_install_thread():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_message(ws, message):
|
def on_message(ws, message):
|
||||||
|
global rpc
|
||||||
print("got message")
|
print("got message")
|
||||||
print(message)
|
print(message)
|
||||||
#decode json
|
#decode json
|
||||||
#lookup in the sqlite db ,update the status[error,complete],
|
#lookup in the sqlite db ,update the status[error,complete],
|
||||||
#uncompress the game into destnation folder in the game_install_thread
|
#uncompress the game into destnation folder in the game_install_thread
|
||||||
aria2_noti = json.loads(message)
|
aria2_noti = json.loads(message)
|
||||||
|
if "method" in aria2_noti and aria2_noti["method"] == "aria2.onDownloadError":
|
||||||
|
gid = aria2_noti["params"][0]["gid"]
|
||||||
|
msg = rpc.tellStatus(gid)
|
||||||
|
ws.send(msg)
|
||||||
|
|
||||||
|
if "method" in aria2_noti and aria2_noti["method"] == "aria2.onDownloadComplete":
|
||||||
|
gid = aria2_noti["params"][0]["gid"]
|
||||||
|
msg = rpc.tellStatus(gid)
|
||||||
|
ws.send(msg)
|
||||||
|
|
||||||
|
|
||||||
def on_error(ws, error):
|
def on_error(ws, error):
|
||||||
print(error)
|
print(error)
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit d5b7c364d6baa93cd1d85b16cd115fd70c3898e2
|
Subproject commit 864bea5ca1252bc105cac47f640f47e95c81f6fa
|
||||||
Loading…
x
Reference in New Issue
Block a user