From ad4a82bad548cf74c47d510a2aa32c34d2144289 Mon Sep 17 00:00:00 2001 From: cuu Date: Thu, 19 Dec 2019 05:13:07 +0000 Subject: [PATCH] run.py add CurrentPage.OnAria2CompleteCb 21_Warehouse/__init__.py text correspondence[_FootMsg] Warehouse beta now --- Menu/GameShell/21_Warehouse/__init__.py | 3 +++ sys.py/run.py | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Menu/GameShell/21_Warehouse/__init__.py b/Menu/GameShell/21_Warehouse/__init__.py index 75cd17d..956b89f 100644 --- a/Menu/GameShell/21_Warehouse/__init__.py +++ b/Menu/GameShell/21_Warehouse/__init__.py @@ -927,6 +927,9 @@ class GameStorePage(Page): def OnAria2CompleteCb(self,gid): print("OnAria2CompleteCb ", gid) + self.SyncList() + self._Screen.Draw() + self._Screen.SwapAndShow() def raw_github_com(self,_url):#eg: github.com/clockworkpi/warehouse if _url.startswith("github.com")== False: diff --git a/sys.py/run.py b/sys.py/run.py index 6e95933..0b5d9d9 100644 --- a/sys.py/run.py +++ b/sys.py/run.py @@ -23,6 +23,7 @@ import gobject import socket import pygame from sys import exit +import json #from beeprint import pp ######## @@ -481,7 +482,21 @@ def gobject_pygame_event_timer(main_screen): @misc.threaded def aria2_ws(main_screen): def on_message(ws, message): - print(message) + print("run.py aria2_ws on_message: ",message) + try: + aria2_noti = json.loads(message) + if "method" in aria2_noti and aria2_noti["method"] == "aria2.onDownloadError": + gid = aria2_noti["params"][0]["gid"] + + if "method" in aria2_noti and aria2_noti["method"] == "aria2.onDownloadComplete": + gid = aria2_noti["params"][0]["gid"] + on_comp_cb = getattr(main_screen._CurrentPage,"OnAria2CompleteCb",None) + if on_comp_cb != None: + if callable( on_comp_cb ): + main_screen._CurrentPage.OnAria2CompleteCb(gid) + #game_install_thread(gid) + except Exception as ex: + print(ex) def on_error(ws, error): print(error) @@ -490,7 +505,7 @@ def aria2_ws(main_screen): print("### closed ###") - websocket.enableTrace(True) + #websocket.enableTrace(True) try: ws = websocket.WebSocketApp("ws://localhost:6800/jsonrpc", on_message = on_message,