格式化了一下代码

This commit is contained in:
EillesWan 2024-02-02 18:10:12 +08:00
parent 0139d0f130
commit 28ec743b86
3 changed files with 63 additions and 30 deletions

View File

@ -19,7 +19,7 @@ __version__ = "0.0.6"
import datetime import datetime
import os import os
import random import random
import sys # import sys
import Musicreater import Musicreater
from Musicreater.constants import DEFAULT_PROGRESSBAR_STYLE from Musicreater.constants import DEFAULT_PROGRESSBAR_STYLE
@ -30,7 +30,7 @@ from Musicreater.plugin.addonpack import (
to_addon_pack_in_score, to_addon_pack_in_score,
) )
from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score
from utils.io import * from utils.io import MainConsole, prt, ipt, myWords, isin, bool_str, float_str
# from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure # from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure
@ -41,19 +41,19 @@ MainConsole.print(
justify="center", justify="center",
) )
osc.project_name = "伶伦转换器" # osc.project_name = "伶伦转换器"
osc.version = __version__ # osc.version = __version__
if len(sys.argv) > 0: # if len(sys.argv) > 0:
def go_for_args(debugMode: str = "False", logfile: str = "True"): # def go_for_args(debugMode: str = "False", logfile: str = "True"):
global logger # global logger
osc.isRelease = False if debugMode.lower() in ("true", "1") else True # osc.isRelease = False if debugMode.lower() in ("true", "1") else True
logger.printing = not osc.isRelease # logger.printing = not osc.isRelease
logger.writing = True if logfile.lower() in ("true", "1") else False # logger.writing = True if logfile.lower() in ("true", "1") else False
go_for_args(*sys.argv) # go_for_args(*sys.argv)
# 显示大标题 # 显示大标题

View File

@ -180,7 +180,11 @@ class LingLunMainFrame(wx.Frame):
self.FileMenu = wx.Menu() self.FileMenu = wx.Menu()
self.m_ClearSetting_menuItem2 = wx.MenuItem( self.m_ClearSetting_menuItem2 = wx.MenuItem(
self.FileMenu, wx.ID_ANY, "重置设置", "将全部数据设置重置为默认值(下次启动时生效)", wx.ITEM_CHECK self.FileMenu,
wx.ID_ANY,
"重置设置",
"将全部数据设置重置为默认值(下次启动时生效)",
wx.ITEM_CHECK,
) )
self.FileMenu.Append(self.m_ClearSetting_menuItem2) self.FileMenu.Append(self.m_ClearSetting_menuItem2)
@ -344,7 +348,12 @@ class ConvertPagePanel(wx.Panel):
s_midiChooseSizer = wx.BoxSizer(wx.HORIZONTAL) s_midiChooseSizer = wx.BoxSizer(wx.HORIZONTAL)
self.m_ChooseMidiTips_staticText3 = wx.StaticText( self.m_ChooseMidiTips_staticText3 = wx.StaticText(
self, wx.ID_ANY, "选择MIDI文件\n(双击移除)", wx.DefaultPosition, wx.DefaultSize, 0 self,
wx.ID_ANY,
"选择MIDI文件\n(双击移除)",
wx.DefaultPosition,
wx.DefaultSize,
0,
) )
self.m_ChooseMidiTips_staticText3.Wrap(-1) self.m_ChooseMidiTips_staticText3.Wrap(-1)
@ -424,7 +433,8 @@ class ConvertPagePanel(wx.Panel):
ss_regularPromoptsEnteringSizer1 = wx.BoxSizer(wx.HORIZONTAL) ss_regularPromoptsEnteringSizer1 = wx.BoxSizer(wx.HORIZONTAL)
sss_VolumnPersentageEnteringSizer = wx.StaticBoxSizer( sss_VolumnPersentageEnteringSizer = wx.StaticBoxSizer(
wx.StaticBox(s_promptSizer.GetStaticBox(), wx.ID_ANY, "音量大小"), wx.HORIZONTAL wx.StaticBox(s_promptSizer.GetStaticBox(), wx.ID_ANY, "音量大小"),
wx.HORIZONTAL,
) )
self.m_volumn_slider = wx.Slider( self.m_volumn_slider = wx.Slider(
@ -464,7 +474,8 @@ class ConvertPagePanel(wx.Panel):
) )
sss_SpeedEnteringSizer = wx.StaticBoxSizer( sss_SpeedEnteringSizer = wx.StaticBoxSizer(
wx.StaticBox(s_promptSizer.GetStaticBox(), wx.ID_ANY, "播放倍速"), wx.HORIZONTAL wx.StaticBox(s_promptSizer.GetStaticBox(), wx.ID_ANY, "播放倍速"),
wx.HORIZONTAL,
) )
self.m_speed_slider = wx.Slider( self.m_speed_slider = wx.Slider(
@ -504,7 +515,8 @@ class ConvertPagePanel(wx.Panel):
s_promptSizer.Add(ss_regularPromoptsEnteringSizer1, 0, wx.EXPAND, 5) s_promptSizer.Add(ss_regularPromoptsEnteringSizer1, 0, wx.EXPAND, 5)
ss_commandCheckingSizer = wx.StaticBoxSizer( ss_commandCheckingSizer = wx.StaticBoxSizer(
wx.StaticBox(s_promptSizer.GetStaticBox(), wx.ID_ANY, "指令设置"), wx.HORIZONTAL wx.StaticBox(s_promptSizer.GetStaticBox(), wx.ID_ANY, "指令设置"),
wx.HORIZONTAL,
) )
self.m_progressBarEnablingCheckBox1 = wx.CheckBox( self.m_progressBarEnablingCheckBox1 = wx.CheckBox(
@ -1005,7 +1017,10 @@ class ConvertPagePanel(wx.Panel):
) )
else: else:
wx.MessageDialog( wx.MessageDialog(
None, "你输入的播放器有误!", "错误", wx.YES_DEFAULT | wx.ICON_ERROR None,
"你输入的播放器有误!",
"错误",
wx.YES_DEFAULT | wx.ICON_ERROR,
).ShowModal() ).ShowModal()
return return
wx.MessageDialog( wx.MessageDialog(
@ -1034,7 +1049,10 @@ class ConvertPagePanel(wx.Panel):
) )
else: else:
wx.MessageDialog( wx.MessageDialog(
None, "你输入的播放器有误!", "错误", wx.YES_DEFAULT | wx.ICON_ERROR None,
"你输入的播放器有误!",
"错误",
wx.YES_DEFAULT | wx.ICON_ERROR,
).ShowModal() ).ShowModal()
return return
wx.MessageDialog( wx.MessageDialog(
@ -1047,7 +1065,10 @@ class ConvertPagePanel(wx.Panel):
).ShowModal() ).ShowModal()
else: else:
wx.MessageDialog( wx.MessageDialog(
None, "你输入的输出格式有误!", "错误", wx.YES_DEFAULT | wx.ICON_ERROR None,
"你输入的输出格式有误!",
"错误",
wx.YES_DEFAULT | wx.ICON_ERROR,
).ShowModal() ).ShowModal()
return return
@ -1147,7 +1168,9 @@ class SettingPagePannel(wx.Panel):
ssss_UnplayedPartProgressbarPattle_sbSizer10 = wx.StaticBoxSizer( ssss_UnplayedPartProgressbarPattle_sbSizer10 = wx.StaticBoxSizer(
wx.StaticBox( wx.StaticBox(
setting_page1_progressbar_style.GetStaticBox(), wx.ID_ANY, "未播放之样式" setting_page1_progressbar_style.GetStaticBox(),
wx.ID_ANY,
"未播放之样式",
), ),
wx.VERTICAL, wx.VERTICAL,
) )
@ -1170,7 +1193,9 @@ class SettingPagePannel(wx.Panel):
ssss_PlayedPartProgressbarPattle_sbSizer11 = wx.StaticBoxSizer( ssss_PlayedPartProgressbarPattle_sbSizer11 = wx.StaticBoxSizer(
wx.StaticBox( wx.StaticBox(
setting_page1_progressbar_style.GetStaticBox(), wx.ID_ANY, "已播放之样式" setting_page1_progressbar_style.GetStaticBox(),
wx.ID_ANY,
"已播放之样式",
), ),
wx.VERTICAL, wx.VERTICAL,
) )
@ -1522,9 +1547,9 @@ class SettingPagePannel(wx.Panel):
def onPitchedInstListChanging(self, event): def onPitchedInstListChanging(self, event):
global convert_table_selection global convert_table_selection
convert_table_selection[ convert_table_selection["PITCHED"] = (
"PITCHED" self.m_pitched_instrument_table_choice.GetStringSelection()
] = self.m_pitched_instrument_table_choice.GetStringSelection() )
self.m_pitched_notes_table_propertyGrid1.SetPropertyValues( self.m_pitched_notes_table_propertyGrid1.SetPropertyValues(
dict( dict(
[ [
@ -1556,7 +1581,11 @@ class SettingPagePannel(wx.Panel):
), ),
) )
convert_tables["PITCHED"]["自定义对照表"][to_change_id] = to_change_value convert_tables["PITCHED"]["自定义对照表"][to_change_id] = to_change_value
logger.info("自定义乐音乐器对照表第 {} 项已更新为:{}".format(to_change_id, to_change_value)) logger.info(
"自定义乐音乐器对照表第 {} 项已更新为:{}".format(
to_change_id, to_change_value
)
)
if "自定义对照表" not in self.m_pitched_instrument_table_choice.Items: if "自定义对照表" not in self.m_pitched_instrument_table_choice.Items:
self.m_pitched_instrument_table_choice.Append("自定义对照表") self.m_pitched_instrument_table_choice.Append("自定义对照表")
self.m_pitched_instrument_table_choice.SetSelection(2) self.m_pitched_instrument_table_choice.SetSelection(2)
@ -1568,9 +1597,9 @@ class SettingPagePannel(wx.Panel):
def onPercussionInstListChanging(self, event): def onPercussionInstListChanging(self, event):
global convert_table_selection global convert_table_selection
convert_table_selection[ convert_table_selection["PERCUSSION"] = (
"PERCUSSION" self.m_percussion_instrument_table_choice1.GetStringSelection()
] = self.m_percussion_instrument_table_choice1.GetStringSelection() )
self.m_percussion_notes_table_propertyGrid11.SetPropertyValues( self.m_percussion_notes_table_propertyGrid11.SetPropertyValues(
dict( dict(
[ [
@ -1601,7 +1630,11 @@ class SettingPagePannel(wx.Panel):
), ),
) )
convert_tables["PERCUSSION"]["自定义对照表"][to_change_id] = to_change_value convert_tables["PERCUSSION"]["自定义对照表"][to_change_id] = to_change_value
logger.info("自定义打击乐器对照表第 {} 项已更新为:{}".format(to_change_id, to_change_value)) logger.info(
"自定义打击乐器对照表第 {} 项已更新为:{}".format(
to_change_id, to_change_value
)
)
if "自定义对照表" not in self.m_percussion_instrument_table_choice1.Items: if "自定义对照表" not in self.m_percussion_instrument_table_choice1.Items:
self.m_percussion_instrument_table_choice1.Append("自定义对照表") self.m_percussion_instrument_table_choice1.Append("自定义对照表")
self.m_percussion_instrument_table_choice1.SetSelection(2) self.m_percussion_instrument_table_choice1.SetSelection(2)

View File

@ -1,2 +1,2 @@
Musicreater>=1.7.1 Musicreater>=1.7.2
TrimLog>=0.8.3 TrimLog>=0.8.3