From 264d1ec11c1f0a9668d07159ebc16a56b8c23d74 Mon Sep 17 00:00:00 2001 From: EillesWan Date: Mon, 8 Jan 2024 00:10:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=86=E5=A4=87=E5=B0=9D=E8=AF=95=E6=96=B0?= =?UTF-8?q?=E4=BA=8B=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llc_win_wxPython.py | 42 ++++++++++++++++++++++++++++-------------- requirements.txt | 4 ++-- utils/io.py | 28 +++++++++++++++++++--------- utils/localize.py | 31 +++++++++++++++++++++++++++++++ 自我陶醉.py | 23 +++++++++++++++++++++++ 5 files changed, 103 insertions(+), 25 deletions(-) create mode 100644 utils/localize.py create mode 100644 自我陶醉.py diff --git a/llc_win_wxPython.py b/llc_win_wxPython.py index 001ac59..c8345d5 100644 --- a/llc_win_wxPython.py +++ b/llc_win_wxPython.py @@ -13,13 +13,17 @@ Terms & Conditions: ./Lisense.md # 导入所需库 -import datetime import os import random import sys -import urllib.error -import urllib.request +if sys.argv: + if "-l" in sys.argv: + pass # 更换语言 + elif "--edit-lang" in sys.argv: + from utils.localize import main + main() + exit() import Musicreater from Musicreater.constants import DEFAULT_PROGRESSBAR_STYLE @@ -33,7 +37,7 @@ from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_scor import wx -from utils.io import myWords, osc, logger, object_constants, TrimLog, is_logging +from utils.io import myWords, logger, object_constants # , TrimLog, is_logging from utils.update_check import check_update @@ -45,22 +49,20 @@ __appname__ = "伶伦转换器" __version__ = "WXGUI 0.0.3" __zhver__ = "WX图形界面 预代预版第三次修订" -osc.project_name = __appname__ -osc.version = __version__ - - -# osc = object_constants.ObjectStateConstant( -# logging_project_name=__appname__, -# logging_project_version=__version__, -# logging_exit_exec=lambda x: None, -# ) +osc = object_constants.ObjectStateConstant( + logging_project_name=__appname__, + logging_project_version=__version__, + logging_exit_exec=lambda x: None, +) +logger.printing = not osc.is_release yanlun_length = len(myWords) logger.info("加载窗口布局……") + # 创建应用程序类 class LinglunConverterApp(wx.App): def OnInit(self): @@ -959,7 +961,19 @@ logger.info("执行应用。") if __name__ == "__main__": app = LinglunConverterApp() - check_update(__appname__,"https://gitee.com/TriM-Organization/Linglun-Converter/raw/master/llc_win_wxPython.py",__version__,lambda text:wx.MessageDialog(None,text,"软件更新",wx.ICON_INFORMATION | wx.YES_DEFAULT,).ShowModal(),logger,__zhver__) + check_update( + __appname__, + "https://gitee.com/TriM-Organization/Linglun-Converter/raw/master/llc_win_wxPython.py", + __version__, + lambda text: wx.MessageDialog( + None, + text, + "软件更新", + wx.ICON_INFORMATION | wx.YES_DEFAULT, + ).ShowModal(), + logger, + __zhver__, + ) app.MainLoop() diff --git a/requirements.txt b/requirements.txt index 6075cdf..c07d2f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -Musicreater>=1.0.0 -TrimLog>=0.7.2 +Musicreater>=1.6.0 +TrimLog>=0.8.3 diff --git a/utils/io.py b/utils/io.py index 5853627..256b907 100644 --- a/utils/io.py +++ b/utils/io.py @@ -14,20 +14,30 @@ Terms & Conditions: ./Lisense.md import urllib.error import urllib.request -from typing import Any, Callable, Dict, List, Literal, Optional, Set, TextIO, Tuple, Iterable, Sequence +from typing import ( + Any, + Callable, + Dict, + List, + Literal, + Optional, + Set, + TextIO, + Tuple, + Iterable, + Sequence, +) import TrimLog -from TrimLog import Console, object_constants +from TrimLog import object_constants, logger is_logging: bool = True -MainConsole = Console() -osc = object_constants.ObjectStateConstant() -logger = TrimLog.Logger( - is_logging=is_logging, - # printing=not osc.is_release, - in_suffix=".llc", -) +MainConsole = logger.console + +logger.is_logging = True +logger.suffix = ".llc" +logger.is_tips = True try: diff --git a/utils/localize.py b/utils/localize.py new file mode 100644 index 0000000..05e0478 --- /dev/null +++ b/utils/localize.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +""" +伶伦转换器 本地化组件 +Linglun Converter Language Localization Component + +版权所有 © 2023 金羿 & 睿穆开发组 +Copyright © 2023 EillesWan & TriM Org. + +开源相关声明请见 ./License.md +Terms & Conditions: ./Lisense.md +""" + +from .io import TrimLog, urllib, Sequence, Iterable, Callable, Optional + +def unpack_language_pack(): + pass + +def enpack_language_pack(): + pass + +def _() -> str: + return "" + +def main(): + pass + +if __name__ == "__main__": + main() + + diff --git a/自我陶醉.py b/自我陶醉.py new file mode 100644 index 0000000..5add14e --- /dev/null +++ b/自我陶醉.py @@ -0,0 +1,23 @@ +# -*- conding: utf8 -*- + +import os + +m = 0 + +for path, dir_list, file_list in os.walk(r"./"): + for file_name in file_list: + if file_name.endswith('.py'): + file = os.path.join(path, file_name) + print("得到文件名:" + str(file)) + for i in open(file, 'r', encoding="utf-8"): + code = i.strip() + + if code.startswith('#'): + pass + elif code: + print("\t" + code) + m += 1 + else: + pass + +input("\n最终代码行数为:" + str(m))