Skip to content

Commit 67b1de1

Browse files
pyquickCopilot
andcommitted
update sort
Co-authored-by: Copilot <copilot@github.com>
1 parent 309b20a commit 67b1de1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

oclp_r/wx_gui/gui_KDK_download.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
utilities,
1818
network_handler,
1919
)
20+
import re
21+
from packaging import version
2022
from ..support.translate_language import TranslateLanguage
2123
class KDKDownloadFrame(wx.Frame):
2224
def __init__(self, parent: wx.Frame, title: str, global_constants: constants.Constants,screen_location: tuple = None):
@@ -74,13 +76,15 @@ def _fetch_installers():
7476
KDK_API_LINK=self.constants.kdk_api_link
7577
response = requests.get(KDK_API_LINK,verify=False)
7678
self.kdk_data = response.json()
77-
79+
self.kdk_data=sorted(self.kdk_data, key=lambda item: item['build'],reverse=True)
7880
self.kdk_data_latest = []
7981
kdk_data_number=[] #大版本number的合集
8082
kdk_data_build=[] #所有版本的合集
8183
maxnx=[]
8284
#处理kdk的 seen 和 url参数
8385
for i in range(len(self.kdk_data)):
86+
if not re.match(r'^[1-9][0-9].[0-9]',self.kdk_data[i]['version']):
87+
self.kdk_data[i]['version']+=".0"
8488
self.kdk_data[i]['seen']=((self.kdk_data[i]['seen']).split("T"))[0]
8589
if self.constants.github_proxy_link=="gh-proxy":
8690
self.kdk_data[i]['url']="https://gh-proxy.com/"+self.kdk_data[i]['url']

oclp_r/wx_gui/gui_metallib_download.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,25 @@ def _fetch_installers():
6565
self.kdk_data_latest = []
6666
kdk_data_number=[]
6767
kdk_data_build=[]
68+
self.kdk_data=sorted(self.kdk_data, key=lambda item: item['build'],reverse=True)
6869
maxnx=[]
6970
for i in range(len(self.kdk_data)):
7071
data=self.kdk_data[i]["build"][:2]
7172
data2=self.kdk_data[i]["build"]
72-
73+
import re
74+
if not re.match(r'^[1-9][0-9].[0-9]',self.kdk_data[i]['version']):
75+
self.kdk_data[i]['version']+=".0"
7376
if self.constants.github_proxy_link=="gh-proxy":
7477
self.kdk_data[i]['url']="https://gh-proxy.com/"+self.kdk_data[i]['url']
7578
if self.constants.github_proxy_link=="ghfast":
7679
self.kdk_data[i]['url']="https://ghfast.top/"+self.kdk_data[i]['url']
7780
if self.constants.github_proxy_link=="ghllkk":
7881
self.kdk_data[i]['url']="https://gh.llkk.cc/"+self.kdk_data[i]['url']
7982
kdk_data_number.append(data)
83+
kdk_data_number.sort(reverse=True)
84+
8085
kdk_data_build.append(data2)
86+
kdk_data_build.sort(reverse=True)
8187
for i in range(4):
8288
try:
8389
maxn=kdk_data_number[0]

0 commit comments

Comments
 (0)