思来想去还是改个版本号吧,顺便优化一下更新能力

This commit is contained in:
EillesWan 2024-08-19 03:05:22 +08:00
parent 0d7a91904d
commit 59f5615a80
2 changed files with 20 additions and 16 deletions

View File

@ -74,7 +74,7 @@ BLACK = (18, 17, 16) # 121110
__appname__ = "伶伦转换器" __appname__ = "伶伦转换器"
__version__ = "WXGUI 1.2.0.1" __version__ = "WXGUI 1.2.0.2"
__zhver__ = "WX图形界面 初代次版" __zhver__ = "WX图形界面 初代次版"
@ -1782,9 +1782,7 @@ class SettingPagePannel(wx.Panel):
wx.ID_ANY, wx.ID_ANY,
wx.DefaultPosition, wx.DefaultPosition,
wx.DefaultSize, wx.DefaultSize,
pg.PG_BOLD_MODIFIED pg.PG_BOLD_MODIFIED | pg.PG_HIDE_MARGIN | pg.PG_SPLITTER_AUTO_CENTER,
| pg.PG_HIDE_MARGIN
| pg.PG_SPLITTER_AUTO_CENTER,
) )
self.m_pitched_notes_table_propertyGrid1.SetFont( self.m_pitched_notes_table_propertyGrid1.SetFont(
@ -1867,9 +1865,7 @@ class SettingPagePannel(wx.Panel):
wx.ID_ANY, wx.ID_ANY,
wx.DefaultPosition, wx.DefaultPosition,
wx.DefaultSize, wx.DefaultSize,
pg.PG_BOLD_MODIFIED pg.PG_BOLD_MODIFIED | pg.PG_HIDE_MARGIN | pg.PG_SPLITTER_AUTO_CENTER,
| pg.PG_HIDE_MARGIN
| pg.PG_SPLITTER_AUTO_CENTER,
) )
self.m_percussion_notes_table_propertyGrid11.SetFont( self.m_percussion_notes_table_propertyGrid11.SetFont(

View File

@ -17,7 +17,7 @@ from .io import TrimLog, Sequence, Iterable, Callable, Optional, Dict, Union
def is_ver_char(text: str) -> bool: def is_ver_char(text: str) -> bool:
return text.isnumeric() or text == "." return text.isnumeric() or text in ".-"
def cut_ver_str(text: str) -> str: def cut_ver_str(text: str) -> str:
@ -30,8 +30,12 @@ def cut_ver_str(text: str) -> str:
while is_ver_char(text[j]) and j < len_of_text: while is_ver_char(text[j]) and j < len_of_text:
j += 1 j += 1
temp_str = text[i:j].strip() temp_str = text[i:j].strip()
if ("." in temp_str) and (temp_str[0] != ".") and (temp_str[-1] != "."): if (
return temp_str ("." in temp_str or "-" in temp_str)
and (temp_str[0] not in ".-")
and (temp_str[-1] not in ".-")
):
return temp_str.replace("-", ".")
i = j i = j
i += 1 i += 1
return "" return ""
@ -48,8 +52,12 @@ def get_ver_str(text: str) -> Iterable[str]:
while is_ver_char(text[j]) and j < len_of_text: while is_ver_char(text[j]) and j < len_of_text:
j += 1 j += 1
temp_str = text[i:j].strip() temp_str = text[i:j].strip()
if ("." in temp_str) and (temp_str[0] != ".") and (temp_str[-1] != "."): if (
all_ver_str.append(temp_str) ("." in temp_str or "-" in temp_str)
and (temp_str[0] not in ".-")
and (temp_str[-1] not in ".-")
):
all_ver_str.append(temp_str.replace("-", "."))
i = j i = j
i += 1 i += 1
return all_ver_str return all_ver_str
@ -78,7 +86,7 @@ def check_update_repo(
if not version_disp: if not version_disp:
version_disp = version_now version_disp = version_now
logger.info("当前 {} 版本:{}".format(appname,version_now)) logger.info("当前 {} 版本:{}".format(appname, version_now))
try: try:
code_content: str = requests.get(get_text_url).text code_content: str = requests.get(get_text_url).text
except Exception as E: # noinspection PyBroadException except Exception as E: # noinspection PyBroadException
@ -89,7 +97,7 @@ def check_update_repo(
code_content = code_content[code_content.find('"') + 1 :] code_content = code_content[code_content.find('"') + 1 :]
version_content = code_content[: code_content.find('"')] version_content = code_content[: code_content.find('"')]
logger.info("已获取 {} 新版本信息:{}".format(appname,version_content)) logger.info("已获取 {} 新版本信息:{}".format(appname, version_content))
if is_ver_bigger( if is_ver_bigger(
[int(v) for v in cut_ver_str(version_content).split(".")], [int(v) for v in cut_ver_str(version_content).split(".")],
@ -130,7 +138,7 @@ def check_update_release(
version_renew_tip: str = "!有新版本!\n最新的 {app} 已经是 {latest} 版本,当前您正在使用的仍是 {current} 版本,是否更新?", version_renew_tip: str = "!有新版本!\n最新的 {app} 已经是 {latest} 版本,当前您正在使用的仍是 {current} 版本,是否更新?",
) -> Union[None, Dict[str, str]]: ) -> Union[None, Dict[str, str]]:
logger.info("当前 {} 版本:{}".format(appname,version_now)) logger.info("当前 {} 版本:{}".format(appname, version_now))
try: try:
code_content: Dict = requests.get(get_release_url).json() code_content: Dict = requests.get(get_release_url).json()
except Exception as E: # noinspection PyBroadException except Exception as E: # noinspection PyBroadException
@ -139,7 +147,7 @@ def check_update_release(
version_content = code_content["release"]["tag"]["name"] version_content = code_content["release"]["tag"]["name"]
logger.info("已获取 {} 新版本信息:{}".format(appname,version_content)) logger.info("已获取 {} 新版本信息:{}".format(appname, version_content))
if is_ver_bigger( if is_ver_bigger(
[int(v) for v in cut_ver_str(version_content).split(".")], [int(v) for v in cut_ver_str(version_content).split(".")],