From 59f5615a80e018360ed0bd8862b1da3f495e38da Mon Sep 17 00:00:00 2001 From: EillesWan Date: Mon, 19 Aug 2024 03:05:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=9D=E6=9D=A5=E6=83=B3=E5=8E=BB=E8=BF=98?= =?UTF-8?q?=E6=98=AF=E6=94=B9=E4=B8=AA=E7=89=88=E6=9C=AC=E5=8F=B7=E5=90=A7?= =?UTF-8?q?=EF=BC=8C=E9=A1=BA=E4=BE=BF=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llc_win_wxPython.py | 10 +++------- utils/update_check.py | 26 +++++++++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/llc_win_wxPython.py b/llc_win_wxPython.py index 38adc49..bbf0f10 100644 --- a/llc_win_wxPython.py +++ b/llc_win_wxPython.py @@ -74,7 +74,7 @@ BLACK = (18, 17, 16) # 121110 __appname__ = "伶伦转换器" -__version__ = "WXGUI 1.2.0.1" +__version__ = "WXGUI 1.2.0.2" __zhver__ = "WX图形界面 初代次版" @@ -1782,9 +1782,7 @@ class SettingPagePannel(wx.Panel): wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, - pg.PG_BOLD_MODIFIED - | pg.PG_HIDE_MARGIN - | pg.PG_SPLITTER_AUTO_CENTER, + pg.PG_BOLD_MODIFIED | pg.PG_HIDE_MARGIN | pg.PG_SPLITTER_AUTO_CENTER, ) self.m_pitched_notes_table_propertyGrid1.SetFont( @@ -1867,9 +1865,7 @@ class SettingPagePannel(wx.Panel): wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, - pg.PG_BOLD_MODIFIED - | pg.PG_HIDE_MARGIN - | pg.PG_SPLITTER_AUTO_CENTER, + pg.PG_BOLD_MODIFIED | pg.PG_HIDE_MARGIN | pg.PG_SPLITTER_AUTO_CENTER, ) self.m_percussion_notes_table_propertyGrid11.SetFont( diff --git a/utils/update_check.py b/utils/update_check.py index ddecc6b..b5b3737 100644 --- a/utils/update_check.py +++ b/utils/update_check.py @@ -17,7 +17,7 @@ from .io import TrimLog, Sequence, Iterable, Callable, Optional, Dict, Union 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: @@ -30,8 +30,12 @@ def cut_ver_str(text: str) -> str: while is_ver_char(text[j]) and j < len_of_text: j += 1 temp_str = text[i:j].strip() - if ("." in temp_str) and (temp_str[0] != ".") and (temp_str[-1] != "."): - return temp_str + if ( + ("." 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 += 1 return "" @@ -48,8 +52,12 @@ def get_ver_str(text: str) -> Iterable[str]: while is_ver_char(text[j]) and j < len_of_text: j += 1 temp_str = text[i:j].strip() - if ("." in temp_str) and (temp_str[0] != ".") and (temp_str[-1] != "."): - all_ver_str.append(temp_str) + if ( + ("." 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 += 1 return all_ver_str @@ -78,7 +86,7 @@ def check_update_repo( if not version_disp: version_disp = version_now - logger.info("当前 {} 版本:{}".format(appname,version_now)) + logger.info("当前 {} 版本:{}".format(appname, version_now)) try: code_content: str = requests.get(get_text_url).text except Exception as E: # noinspection PyBroadException @@ -89,7 +97,7 @@ def check_update_repo( code_content = code_content[code_content.find('"') + 1 :] version_content = code_content[: code_content.find('"')] - logger.info("已获取 {} 新版本信息:{}".format(appname,version_content)) + logger.info("已获取 {} 新版本信息:{}".format(appname, version_content)) if is_ver_bigger( [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} 版本,是否更新?", ) -> Union[None, Dict[str, str]]: - logger.info("当前 {} 版本:{}".format(appname,version_now)) + logger.info("当前 {} 版本:{}".format(appname, version_now)) try: code_content: Dict = requests.get(get_release_url).json() except Exception as E: # noinspection PyBroadException @@ -139,7 +147,7 @@ def check_update_release( version_content = code_content["release"]["tag"]["name"] - logger.info("已获取 {} 新版本信息:{}".format(appname,version_content)) + logger.info("已获取 {} 新版本信息:{}".format(appname, version_content)) if is_ver_bigger( [int(v) for v in cut_ver_str(version_content).split(".")],