diff --git a/Dockerfile b/Dockerfile index adb95ec..cdfcbbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ - +# 从镜像站点拷贝基础系统 FROM docker.1ms.run/library/python:3.10-slim-bullseye ENV TZ Asia/Taipei +# 工作目录 WORKDIR /app -# RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak +# 省的说我给人删了不备份 RUN touch /etc/apt/sources.list +RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak +# 换源!! RUN echo "deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" > /etc/apt/sources.list && \ echo "deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" >> /etc/apt/sources.list && \ echo "deb https://mirrors.aliyun.com/debian-security/ bullseye-security main" >> /etc/apt/sources.list && \ @@ -18,21 +21,22 @@ RUN echo "deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" echo "deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" >> /etc/apt/sources.list +# 下个 Git RUN apt-get update && apt-get install -y git && \ # 清理 apt 缓存 rm -rf /var/lib/apt/lists/* -# 克隆指定的 git 仓库 +# 克隆伶伦仓库 RUN git clone https://gitee.com/TriM-Organization/Linglun-Converter.git # 创建 Python 虚拟环境 RUN python3 -m venv /app/venv - +# 处理依赖 RUN . /app/venv/bin/activate && \ pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \ /app/venv/bin/python3 -m pip install --upgrade pip && \ - pip install --no-cache-dir --upgrade "Musicreater[full]" TrimLog requests zhDateTime + pip install --no-cache-dir --upgrade "Musicreater[full]" TrimLog requests zhDateTime "setuptools<80" # 切换到克隆下来的仓库目录 WORKDIR /app/Linglun-Converter diff --git a/llc_cli.py b/llc_cli.py index 2586bcb..7eba9b5 100644 --- a/llc_cli.py +++ b/llc_cli.py @@ -19,7 +19,7 @@ The Licensor of _Linglun Converter CLI_("this project") is Eilles Wan. 详细的准许和限制条款请见原协议文本。 """ -__version__ = "0.0.9" +__version__ = "0.0.9.1" import os @@ -45,7 +45,6 @@ from utils.yanlun import solar_date, yanlun_texts # import sys - # from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure @@ -379,7 +378,7 @@ for singleMidi in midis: else to_BDX_file_in_delay(cvt_mid, out_path, style, *prompts[3:]) ) if output_file_format == 1 - else (cvt_method(cvt_mid, out_path, *prompts[2:])) + else (cvt_method(cvt_mid, out_path, *prompts[2:])) # type: ignore ) ) diff --git a/llc_win_wxPython.py b/llc_win_wxPython.py index 6fdbeda..76c64a0 100644 --- a/llc_win_wxPython.py +++ b/llc_win_wxPython.py @@ -60,12 +60,12 @@ from utils.io import TrimLog, log__init__, logger, object_constants from utils.packdata import enpack_llc_pack, load_msct_packed_data, unpack_llc_pack from utils.update_check import check_update_release from utils.webview import go_update_tip -from utils.yanlun import yanlun_bg_colour, yanlun_fg_colour, yanlun_texts +from utils.yanlun import STANDARD_WHITE, STANDART_BLACK, yanlun_texts -WHITE = (242, 244, 246) # F2F4F6 +WHITE = wx.Colour(242, 244, 246) # F2F4F6 # WHITE2 = (248, 252, 255) # WHITE3 = (233, 236, 240) -BLACK = (18, 17, 16) # 121110 +BLACK = wx.Colour(18, 17, 16) # 121110 # BLACK2 = (9, 12, 14) # BLACK3 = (0, 2, 6) @@ -74,10 +74,12 @@ BLACK = (18, 17, 16) # 121110 # BLACK = (242, 244, 246) # 121110 # BLACK2 = (248, 252, 255) +yanlun_fg_colour = wx.Colour(*STANDARD_WHITE) +yanlun_bg_colour = wx.Colour(*STANDART_BLACK) __appname__ = "伶伦转换器" -__version__ = "WXGUI 1.2.1.1" -__zhver__ = "WX图形界面 初代次版一编" +__version__ = "WXGUI 1.2.2" +__zhver__ = "WX图形界面 初代次版二编" logger.info("检查更新") @@ -343,6 +345,10 @@ logger.printing = not osc.is_release yanlun_length = len(yanlun_texts) + +logger.info("音·创内核版本:{}".format(Musicreater.__version__), mandatory_use=True) + + logger.info("加载窗口布局……") @@ -1354,13 +1360,13 @@ class ConvertPagePanel(wx.Panel): ) def onSpeedSpinChanged(self, event): - if self.m_speed_spinCtrlDouble.Value > 1: + if self.m_speed_spinCtrlDouble.GetValue() > 1: self.m_speed_slider.SetValue( - int((self.m_speed_spinCtrlDouble.Value + 8) * 50 / 9) + int((self.m_speed_spinCtrlDouble.GetValue() + 8) * 50 / 9) ) else: self.m_speed_slider.SetValue( - int((self.m_speed_spinCtrlDouble.Value - 0.01) * 5000 / 99) + int((self.m_speed_spinCtrlDouble.GetValue() - 0.01) * 5000 / 99) ) def onProgressbarChecked(self, event): @@ -1430,6 +1436,7 @@ class ConvertPagePanel(wx.Panel): mid_cvt = ConvertClass[0].from_midi_file( midi_file_path=file_name, mismatch_error_ignorance=ignore_midi_mismatch_error, + play_speed=self.m_speed_spinCtrlDouble.GetValue(), pitched_note_table=convert_tables["PITCHED"][ convert_table_selection["PITCHED"] ], @@ -1437,6 +1444,8 @@ class ConvertPagePanel(wx.Panel): convert_table_selection["PERCUSSION"] ], old_exe_format=self.m_oldExeFormatChecker_checkBox3.GetValue(), + min_volume=self.m_volumn_spinCtrlDouble1.GetValue() / 100, + music_pitch_deviation=0, ) cvt_dist = ( @@ -2169,7 +2178,12 @@ if __name__ == "__main__": app = LinglunConverterApp() - app.MainLoop() + try: + app.MainLoop() + except Exception as e: + logger.error(f"程序异常退出:{e}") + + logger.info("关闭窗口,收尾任务") if on_exit_saving: enpack_llc_pack( diff --git a/pyinstaller_build.bat b/pyinstaller_build.bat index 7a37f4b..4ef12f9 100644 --- a/pyinstaller_build.bat +++ b/pyinstaller_build.bat @@ -1 +1,3 @@ -pyinstaller -D ./llc_win_wxPython.py -i ./resources/LLC_LOGO_OK_PLAIN_BANNER.ico --hide-console minimize-late --clean -n 伶伦转换器 \ No newline at end of file +pyinstaller -D ./llc_win_wxPython.py -i ./resources/LLC_LOGO_OK_PLAIN_BANNER.ico --hide-console minimize-late --clean -n 伶伦转换器 +pause +python ./clean_pycache.py \ No newline at end of file diff --git a/utils/authorp.py b/utils/authorp.py index 3301b67..b99dc1b 100644 --- a/utils/authorp.py +++ b/utils/authorp.py @@ -130,7 +130,7 @@ class LingLunAuthorPageFrame(wx.Frame): self.m_bitmap1 = wx.StaticBitmap( self.eilles_pannel, wx.ID_ANY, - wx.Bitmap(eilles_pic, wx.BITMAP_TYPE_ANY), + wx.BitmapBundle(wx.Image(eilles_pic, wx.BITMAP_TYPE_ANY)), wx.DefaultPosition, wx.DefaultSize, 0, @@ -183,7 +183,7 @@ class LingLunAuthorPageFrame(wx.Frame): bSizer41 = wx.BoxSizer(wx.VERTICAL) - bSizer41.Add((0, 0), 1, wx.EXPAND, 5) + bSizer41.Add(wx.Size(0, 0), 1, wx.EXPAND, 5) self.m_staticText211 = wx.StaticText( self.bgarray_pannel, diff --git a/utils/update_check.py b/utils/update_check.py index ba3be84..1eeaff9 100644 --- a/utils/update_check.py +++ b/utils/update_check.py @@ -158,7 +158,7 @@ def check_update_release( version_renew_tip.format( app=appname, latest=version_content, current=version_now ), - code_content["release"]["release"]["description"], + code_content["release"]["release"]["description"].replace("\r\n", "\n"), ): return dict( [ diff --git a/utils/webview.py b/utils/webview.py index 99f166c..a882aa4 100644 --- a/utils/webview.py +++ b/utils/webview.py @@ -25,7 +25,7 @@ class HTMLFrame(wx.Frame): tip_text, web_text, window_title: str = "新版本已发布", - bg_colour: tuple = (0, 0, 0), + bg_colour: tuple | wx.Colour = (0, 0, 0), window_size: tuple = (800, 480), ): """构造函数""" @@ -36,12 +36,12 @@ class HTMLFrame(wx.Frame): id=wx.ID_ANY, title=window_title, pos=wx.DefaultPosition, - size=window_size, + size=wx.Size(*window_size), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL, ) # self.SetIcon(wx.Icon('', wx.BITMAP_TYPE_ICO)) - self.SetBackgroundColour(bg_colour) + self.SetBackgroundColour(wx.Colour(bg_colour)) self.Center() self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) diff --git a/utils/yanlun.py b/utils/yanlun.py index 4c117f4..97d054f 100644 --- a/utils/yanlun.py +++ b/utils/yanlun.py @@ -19,8 +19,6 @@ from .io import logger, prt STANDARD_WHITE = (242, 244, 246) STANDART_BLACK = (18, 17, 16) -yanlun_fg_colour = STANDARD_WHITE -yanlun_bg_colour = STANDART_BLACK logger.info("获取 言·论 信息……") @@ -55,3 +53,5 @@ else: except BaseException as E: logger.warning(f"读取言·论信息发生 未知 错误:\n{E}") yanlun_texts = ["灵光焕发 深艺献心"] + +logger.info("已获取言·论 {} 条".format(len(yanlun_texts)))