mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
warehouse bug fix
This commit is contained in:
parent
0af791192f
commit
7e6d172512
@ -306,18 +306,27 @@ class GameStorePage(Page):
|
|||||||
self._Icons = {}
|
self._Icons = {}
|
||||||
self._MyStack = RPCStack()
|
self._MyStack = RPCStack()
|
||||||
#title path type
|
#title path type
|
||||||
|
|
||||||
|
repos = [
|
||||||
|
{"title":"github.com/cuu/gamestore","file":"https://raw.githubusercontent.com/cuu/gamestore/master/index.json","type":"source"}
|
||||||
|
]
|
||||||
|
self._MyStack.Push(repos)
|
||||||
|
|
||||||
|
|
||||||
|
def SyncWarehouse(self):
|
||||||
try:
|
try:
|
||||||
conn = sqlite3.connect(self._warehouse_db)
|
conn = sqlite3.connect(self._warehouse_db)
|
||||||
conn.row_factory = dict_factory
|
conn.row_factory = dict_factory
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
repos = c.execute("SELECT * FROM warehouse").fetchall()
|
ret = c.execute("SELECT * FROM warehouse").fetchall()
|
||||||
conn.close()
|
conn.close()
|
||||||
self._MyStack.Push(repos)
|
return ret
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(ex)
|
print(ex)
|
||||||
|
return None
|
||||||
|
return None
|
||||||
|
|
||||||
|
def SyncTasks(self):
|
||||||
def SyncSqlite(self):
|
|
||||||
try:
|
try:
|
||||||
conn = sqlite3.connect(self._aria2_db)
|
conn = sqlite3.connect(self._aria2_db)
|
||||||
conn.row_factory = dict_factory
|
conn.row_factory = dict_factory
|
||||||
@ -347,12 +356,17 @@ class GameStorePage(Page):
|
|||||||
]
|
]
|
||||||
|
|
||||||
if stk_lev == 1: # on top
|
if stk_lev == 1: # on top
|
||||||
sqlite3_menu= self.SyncSqlite()
|
ware_menu= self.SyncWarehouse()
|
||||||
if sqlite3_menu != None and len(sqlite3_menu) > 0:
|
if ware_menu != None and len(ware_menu) > 0:
|
||||||
#print(sqlite3_menu)
|
#print(ware_menu)
|
||||||
repos.extend(sqlite3_menu )
|
repos.extend(ware_menu )
|
||||||
|
|
||||||
#print(repos)
|
tasks_menu= self.SyncTasks()
|
||||||
|
if tasks_menu != None and len(tasks_menu) > 0:
|
||||||
|
#print(tasks_menu)
|
||||||
|
repos.extend(tasks_menu )
|
||||||
|
|
||||||
|
#print(repos)
|
||||||
repos.extend(add_new_house)
|
repos.extend(add_new_house)
|
||||||
|
|
||||||
for i,u in enumerate( repos ):
|
for i,u in enumerate( repos ):
|
||||||
@ -439,7 +453,18 @@ class GameStorePage(Page):
|
|||||||
# return
|
# return
|
||||||
print("Remove cur_li._Value",cur_li._Value)
|
print("Remove cur_li._Value",cur_li._Value)
|
||||||
|
|
||||||
if "gid" in cur_li._Value:
|
if cur_li._Value["type"] == "source":
|
||||||
|
print("remove a source")
|
||||||
|
try:
|
||||||
|
conn = sqlite3.connect(self._warehouse_db)
|
||||||
|
conn.row_factory = dict_factory
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute("DELETE FROM warehouse WHERE file = '%s'" % cur_li._Value["file"] )
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
except Exception as ex:
|
||||||
|
print(ex)
|
||||||
|
elif "gid" in cur_li._Value:
|
||||||
try:
|
try:
|
||||||
gid = cur_li._Value["gid"]
|
gid = cur_li._Value["gid"]
|
||||||
conn = sqlite3.connect(self._aria2_db)
|
conn = sqlite3.connect(self._aria2_db)
|
||||||
@ -718,7 +743,6 @@ class GameStorePage(Page):
|
|||||||
if len(self._MyList) * self._MyList[0]._Height > self._Height:
|
if len(self._MyList) * self._MyList[0]._Height > self._Height:
|
||||||
self._Ps._Width = self._Width - 11
|
self._Ps._Width = self._Width - 11
|
||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
print("len self._MyList", len(self._MyList))
|
|
||||||
for i in self._MyList:
|
for i in self._MyList:
|
||||||
if i._PosY > self._Height + self._Height/2:
|
if i._PosY > self._Height + self._Height/2:
|
||||||
break
|
break
|
||||||
@ -731,7 +755,6 @@ class GameStorePage(Page):
|
|||||||
else:
|
else:
|
||||||
self._Ps._Width = self._Width
|
self._Ps._Width = self._Width
|
||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
print("len self._MyList", len(self._MyList))
|
|
||||||
for i in self._MyList:
|
for i in self._MyList:
|
||||||
if i._PosY > self._Height + self._Height/2:
|
if i._PosY > self._Height + self._Height/2:
|
||||||
break
|
break
|
||||||
|
|||||||
@ -163,18 +163,6 @@ def init_sqlite3():
|
|||||||
|
|
||||||
if conn is not None:
|
if conn is not None:
|
||||||
create_table(conn, sql_create_warehouse_table)
|
create_table(conn, sql_create_warehouse_table)
|
||||||
c = conn.cursor()
|
|
||||||
|
|
||||||
ret = c.execute("SELECT count() FROM warehouse;" ).fetchone()
|
|
||||||
|
|
||||||
if int(ret[0]) == 0:
|
|
||||||
insert_bootrap = """ INSERT INTO warehouse(title,file,type) VALUES(
|
|
||||||
'github.com/cuu/gamestore',
|
|
||||||
'https://raw.githubusercontent.com/cuu/gamestore/master/index.json',
|
|
||||||
'source');"""
|
|
||||||
c.execute(insert_bootrap)
|
|
||||||
conn.commit()
|
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
else:
|
else:
|
||||||
print("Error! cannot create the database connection.")
|
print("Error! cannot create the database connection.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user