Skip to content

Commit 173b5d3

Browse files
committed
improve & codes
1 parent ac9cbd0 commit 173b5d3

2 files changed

Lines changed: 37 additions & 15 deletions

File tree

oclp_r/wx_gui/gui_main_menu.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,27 @@ def __init__(self, parent: wx.Frame, title: str, global_constants: constants.Con
5454

5555
self.Centre()
5656
self.Show()
57-
self.api_link()
57+
threading.Thread(target=self.api_link,daemon=True).start()
5858

5959
self._preflight_checks()
6060
def api_link(self):
61-
if self.constants.github_proxy_link!="SimpleHac":
62-
self.constants.kdk_api_link="https://dortania.github.io/KdkSupportPkg/manifest.json"
63-
self.constants.metallib_api_link="https://dortania.github.io/MetallibSupportPkg/manifest.json"
64-
print(f"- User Select kdk link: {self.constants.kdk_api_link}")
65-
print(f"- User Select metallib link: {self.constants.metallib_api_link}")
66-
67-
if self.constants.github_proxy_link=="SimpleHac":
68-
69-
self.constants.kdk_api_link="https://next.oclpapi.simplehac.cn/KdkSupportPkg/manifest.json"
70-
self.constants.metallib_api_link="https://next.oclpapi.simplehac.cn/MetallibSupportPkg/manifest.json"
71-
72-
print(f"- User Select kdk link: {self.constants.kdk_api_link}")
73-
print(f"- User Select metallib link: {self.constants.metallib_api_link}")
61+
def func():
62+
if self.constants.github_proxy_link!="SimpleHac":
63+
self.constants.kdk_api_link="https://dortania.github.io/KdkSupportPkg/manifest.json"
64+
self.constants.metallib_api_link="https://dortania.github.io/MetallibSupportPkg/manifest.json"
65+
66+
67+
if self.constants.github_proxy_link=="SimpleHac":
68+
69+
self.constants.kdk_api_link="https://next.oclpapi.simplehac.cn/KdkSupportPkg/manifest.json"
70+
self.constants.metallib_api_link="https://next.oclpapi.simplehac.cn/MetallibSupportPkg/manifest.json"
71+
while True:
72+
hookd=threading.Thread(target=func,daemon=True)
73+
hookd.start()
74+
hookd.join()
75+
76+
77+
7478
def _generate_elements(self) -> None:
7579
"""
7680
Generate UI elements for the main menu

oclp_r/wx_gui/gui_settings.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ def __init__(self, parent: wx.Frame, title: str, global_constants: constants.Con
5858

5959
self._generate_elements(self.frame_modal)
6060
self.frame_modal.ShowWindowModal()
61+
62+
def api_link(self):
63+
if self.constants.github_proxy_link!="SimpleHac":
64+
self.constants.kdk_api_link="https://dortania.github.io/KdkSupportPkg/manifest.json"
65+
self.constants.metallib_api_link="https://dortania.github.io/MetallibSupportPkg/manifest.json"
66+
print(f"- User Select kdk link: {self.constants.kdk_api_link}")
67+
print(f"- User Select metallib link: {self.constants.metallib_api_link}")
68+
69+
if self.constants.github_proxy_link=="SimpleHac":
70+
71+
self.constants.kdk_api_link="https://next.oclpapi.simplehac.cn/KdkSupportPkg/manifest.json"
72+
self.constants.metallib_api_link="https://next.oclpapi.simplehac.cn/MetallibSupportPkg/manifest.json"
73+
74+
print(f"- User Select kdk link: {self.constants.kdk_api_link}")
75+
print(f"- User Select metallib link: {self.constants.metallib_api_link}")
6176
def condition_exp(self,key:str):
6277
import json
6378
try:
@@ -82,7 +97,7 @@ def _generate_elements(self, frame: wx.Frame = None) -> None:
8297
Uses wx.Notebook to implement a tabbed interface
8398
and relies on 'self._settings()' for populating
8499
"""
85-
100+
86101
notebook = wx.Notebook(frame, style=wx.NB_MULTILINE)
87102
notebook.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
88103
notebook.SetMinSize((-1, 300))
@@ -901,6 +916,7 @@ def _settings(self) -> dict:
901916
},
902917
self.trans["Github Proxy"]: {
903918
"type": "choice",
919+
"function":self.api_link(),
904920
"choices": [
905921
"Default",
906922
"SimpleHac",
@@ -918,6 +934,7 @@ def _settings(self) -> dict:
918934
self.trans["ghfast : https://ghfast.top/"],
919935
self.trans["ghllkk : https://gh.llkk.cc/"],
920936
],
937+
921938
},
922939

923940
"wrap_around 1": {
@@ -1306,6 +1323,7 @@ def on_spinctrl(self, event: wx.Event, label: str) -> None:
13061323

13071324

13081325
def _update_setting(self, variable, value):
1326+
self.api_link()
13091327
logging.info(self.trans["Updating Local Setting: {variable} = {value}"].format(variable=variable, value=value))
13101328
setattr(self.constants, variable, value)
13111329
tmp_value = value

0 commit comments

Comments
 (0)