mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2024-11-14 11:27:42 +08:00
文件函数变更,新功能回增
This commit is contained in:
parent
b6a63a794e
commit
c04b622297
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
1
.idea/.name
Normal file
1
.idea/.name
Normal file
@ -0,0 +1 @@
|
|||||||
|
Musicreater.py
|
12
.idea/Musicreater.iml
Normal file
12
.idea/Musicreater.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="PyDocumentationSettings">
|
||||||
|
<option name="format" value="PLAIN" />
|
||||||
|
<option name="myDocStringFormat" value="Plain" />
|
||||||
|
</component>
|
||||||
|
</module>
|
46
.idea/inspectionProfiles/Project_Default.xml
Normal file
46
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="LongLine" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyArgumentEqualDefaultInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyAugmentAssignmentInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyClassicStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyCompatibilityInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="ourVersions">
|
||||||
|
<value>
|
||||||
|
<list size="1">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="3.10" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyMandatoryEncodingInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyMissingTypeHintsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredErrors">
|
||||||
|
<list>
|
||||||
|
<option value="E501" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredErrors">
|
||||||
|
<list>
|
||||||
|
<option value="N802" />
|
||||||
|
<option value="N803" />
|
||||||
|
<option value="N806" />
|
||||||
|
<option value="N813" />
|
||||||
|
<option value="N801" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredIdentifiers">
|
||||||
|
<list>
|
||||||
|
<option value="list.__getitem__" />
|
||||||
|
<option value="list.split" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Musicreater.iml" filepath="$PROJECT_DIR$/.idea/Musicreater.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
458
Musicreater.py
458
Musicreater.py
@ -280,109 +280,107 @@ def __main__():
|
|||||||
print('退出命令加载完成!')
|
print('退出命令加载完成!')
|
||||||
|
|
||||||
def SaveProject():
|
def SaveProject():
|
||||||
|
global is_save
|
||||||
if is_new_file:
|
if is_new_file:
|
||||||
# 新的项目相等于另存为
|
# 新的项目相等于另存为
|
||||||
SaveAsProject()
|
SaveAsProject()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
try:
|
if dataset[0].get('mainset').get('ReadMethod') == "old":
|
||||||
# 旧项目旧存着吧
|
# 旧项目旧存着吧
|
||||||
log('存储已有文件:{}'.format(ProjectName))
|
log('存储已有文件:{}'.format(ProjectName))
|
||||||
with open(ProjectName, 'w', encoding='utf-8') as f:
|
with open(ProjectName, 'w', encoding='utf-8') as f:
|
||||||
json.dump(dataset[0], f)
|
json.dump(dataset[0], f)
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(ProjectName))
|
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(ProjectName))
|
||||||
global is_save
|
|
||||||
is_save = True
|
is_save = True
|
||||||
except TypeError:
|
elif dataset[0].get('mainset').get('ReadMethod') == "class": # 这部分相当SaveClassProject()函数
|
||||||
SaveClassProject()
|
# if is_new_file:
|
||||||
|
# # 新的项目相等于另存为
|
||||||
|
# SaveAsClassProject()
|
||||||
|
# return
|
||||||
|
# else:
|
||||||
|
with open(ProjectName, 'wb') as f:
|
||||||
|
pickle.dump(dataset, f)
|
||||||
|
tkinter.messagebox.showinfo(title=READABLETEXT[4],
|
||||||
|
message=READABLETEXT[107].format(ProjectName))
|
||||||
|
is_save = True
|
||||||
|
# return
|
||||||
|
elif dataset[0].get('mainset').get('ReadMethod') == "new": # 这部分相当于SaveNewProject()函数
|
||||||
|
# if is_new_file: # 这部分相当于SaveAsNewProject()函数
|
||||||
|
# # 新的项目相等于另存为
|
||||||
|
# SaveAsNewProject()
|
||||||
|
# return
|
||||||
|
# else:
|
||||||
|
save_list = [dataset]
|
||||||
|
try:
|
||||||
|
with open("1.pkl", 'rb') as r:
|
||||||
|
save_list.append(pickle.load(r))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
with open(ProjectName, 'wb') as f:
|
||||||
|
pickle.dump(save_list, f)
|
||||||
|
tkinter.messagebox.showinfo(title=READABLETEXT[4],
|
||||||
|
message=READABLETEXT[107].format(ProjectName))
|
||||||
|
is_save = True
|
||||||
return
|
return
|
||||||
|
|
||||||
def SaveNewProject():
|
print('保存项目命令加载完成!')
|
||||||
if is_new_file:
|
|
||||||
# 新的项目相等于另存为
|
def SaveAsProject():
|
||||||
SaveAsClassProject() # SaveAsNewProject()
|
global is_save
|
||||||
return
|
if dataset[0].get('mainset').get('ReadMethod') == "old":
|
||||||
else:
|
# 另存为项目
|
||||||
|
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./',
|
||||||
|
filetypes=[(READABLETEXT[108][0], '.msct'),
|
||||||
|
(READABLETEXT[109], '*')],
|
||||||
|
defaultextension='Noname.msct')
|
||||||
|
if fn is None or fn == '':
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
Project_Name = fn
|
||||||
|
with open(Project_Name, 'w', encoding='utf-8') as f:
|
||||||
|
json.dump(dataset[0], f)
|
||||||
|
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
||||||
|
is_save = True
|
||||||
|
except TypeError:
|
||||||
|
Project_Name = fn
|
||||||
|
with open(Project_Name, 'wb') as f:
|
||||||
|
pickle.dump(dataset[0], f)
|
||||||
|
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
||||||
|
is_save = True
|
||||||
|
elif dataset[0].get('mainset').get('ReadMethod') == "class": # 等于SaveAsNewProject()函数
|
||||||
|
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./',
|
||||||
|
filetypes=[(READABLETEXT[108][1], '.msctn'),
|
||||||
|
(READABLETEXT[109], '*')],
|
||||||
|
defaultextension='Noname.msctn')
|
||||||
|
if fn is None or fn == '':
|
||||||
|
return
|
||||||
|
Project_Name = fn
|
||||||
|
with open(Project_Name, 'wb') as f:
|
||||||
|
pickle.dump(dataset, f)
|
||||||
|
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
||||||
|
|
||||||
|
is_save = True
|
||||||
|
elif dataset[0].get('mainset').get('ReadMethod') == "new": # 等于SaveAsClassProject()函数
|
||||||
|
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./',
|
||||||
|
filetypes=[(READABLETEXT[108][2], '.msctx'),
|
||||||
|
(READABLETEXT[109], '*')],
|
||||||
|
defaultextension='Noname.msctx')
|
||||||
|
if fn is None or fn == '':
|
||||||
|
return
|
||||||
|
Project_Name = fn
|
||||||
save_list = [dataset]
|
save_list = [dataset]
|
||||||
try:
|
try:
|
||||||
with open("1.pkl", 'rb') as r:
|
with open("1.pkl", 'rb') as r:
|
||||||
save_list.append(pickle.load(r))
|
save_list.append(pickle.load(r))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
with open(ProjectName, 'wb') as f:
|
print(save_list)
|
||||||
pickle.dump(save_list, f)
|
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(ProjectName))
|
|
||||||
global is_save
|
|
||||||
is_save = True
|
|
||||||
|
|
||||||
def SaveClassProject():
|
|
||||||
if is_new_file:
|
|
||||||
# 新的项目相等于另存为
|
|
||||||
SaveAsClassProject()
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
with open(ProjectName, 'wb') as f:
|
|
||||||
pickle.dump(dataset, f)
|
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(ProjectName))
|
|
||||||
global is_save
|
|
||||||
is_save = True
|
|
||||||
|
|
||||||
print('保存项目命令加载完成!')
|
|
||||||
|
|
||||||
def SaveAsProject():
|
|
||||||
# 另存为项目
|
|
||||||
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./',
|
|
||||||
filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[109], '*')],
|
|
||||||
defaultextension='Noname.msct')
|
|
||||||
if fn is None or fn == '':
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
Project_Name = fn
|
|
||||||
with open(Project_Name, 'w', encoding='utf-8') as f:
|
|
||||||
json.dump(dataset[0], f)
|
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
|
||||||
global is_save
|
|
||||||
is_save = True
|
|
||||||
except TypeError:
|
|
||||||
Project_Name = fn
|
|
||||||
with open(Project_Name, 'wb') as f:
|
with open(Project_Name, 'wb') as f:
|
||||||
pickle.dump(dataset[0], f)
|
pickle.dump(save_list, f)
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
||||||
is_save = True
|
is_save = True
|
||||||
|
|
||||||
def SaveAsNewProject():
|
|
||||||
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./',
|
|
||||||
filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[109], '*')],
|
|
||||||
defaultextension='Noname.msct')
|
|
||||||
if fn is None or fn == '':
|
|
||||||
return
|
|
||||||
Project_Name = fn
|
|
||||||
save_list = [dataset]
|
|
||||||
try:
|
|
||||||
with open("1.pkl", 'rb') as r:
|
|
||||||
save_list.append(pickle.load(r))
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
print(save_list)
|
|
||||||
with open(Project_Name, 'wb') as f:
|
|
||||||
pickle.dump(save_list, f)
|
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
|
||||||
global is_save
|
|
||||||
is_save = True
|
|
||||||
|
|
||||||
def SaveAsClassProject():
|
|
||||||
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./',
|
|
||||||
filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[109], '*')],
|
|
||||||
defaultextension='Noname.msct')
|
|
||||||
if fn is None or fn == '':
|
|
||||||
return
|
|
||||||
Project_Name = fn
|
|
||||||
with open(Project_Name, 'wb') as f:
|
|
||||||
pickle.dump(dataset, f)
|
|
||||||
tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(Project_Name))
|
|
||||||
global is_save
|
|
||||||
is_save = True
|
|
||||||
|
|
||||||
print('另存项目命令加载完成!')
|
print('另存项目命令加载完成!')
|
||||||
|
|
||||||
def openOldProject():
|
def openOldProject():
|
||||||
@ -404,73 +402,81 @@ def __main__():
|
|||||||
|
|
||||||
def openProject():
|
def openProject():
|
||||||
global is_save
|
global is_save
|
||||||
|
global dataset
|
||||||
if is_save is not True:
|
if is_save is not True:
|
||||||
result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
|
result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
|
||||||
if result:
|
if result:
|
||||||
SaveProject()
|
SaveProject()
|
||||||
fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./',
|
fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./',
|
||||||
filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[112], '*')],
|
filetypes=[(READABLETEXT[108][0], '.msct'),
|
||||||
|
(READABLETEXT[108][1], '.msctn'), # msctn: 音创新文件(用类方法解析)
|
||||||
|
(READABLETEXT[108][2], '.msctx'), # msctx: 音创测试文件(用来支持多乐器解析)
|
||||||
|
(READABLETEXT[112], '*')],
|
||||||
multiple=True)
|
multiple=True)
|
||||||
if fn is None or fn == '':
|
if fn is None or fn == '':
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
fn = fn[0]
|
fn = fn[0]
|
||||||
try:
|
|
||||||
with open(fn, 'r', encoding='UTF-8') as C:
|
|
||||||
dataset[0] = json.load(C)
|
|
||||||
|
|
||||||
except json.decoder.JSONDecodeError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
|
||||||
# json.decoder.JSONDecodeError
|
|
||||||
print(READABLETEXT[8].format(fn))
|
|
||||||
log('无法打开{}'.format(fn))
|
|
||||||
return
|
|
||||||
global is_new_file
|
|
||||||
global ProjectName
|
|
||||||
is_new_file = False
|
|
||||||
ProjectName = fn
|
|
||||||
del fn
|
|
||||||
global NowMusic
|
|
||||||
RefreshMain()
|
|
||||||
RefreshMusic(NowMusic)
|
|
||||||
|
|
||||||
def openNewProject():
|
|
||||||
global is_save
|
|
||||||
if is_save is not True:
|
|
||||||
result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
|
|
||||||
if result:
|
|
||||||
SaveProject()
|
|
||||||
fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./',
|
|
||||||
filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[112], '*')],
|
|
||||||
multiple=True)
|
|
||||||
if fn is None or fn == '':
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
# print(fn)
|
|
||||||
fn = fn[0]
|
|
||||||
# print(fn)
|
|
||||||
log("尝试打开:" + fn)
|
log("尝试打开:" + fn)
|
||||||
try:
|
if str(fn)[str(fn).rfind("."):] == ".msct": # str(fn)[str(fn).rfind("."):] ->文件格式返回".xxx"
|
||||||
try:
|
try:
|
||||||
with open(fn, 'rb') as C:
|
try:
|
||||||
global dataset
|
with open(fn, 'r', encoding='UTF-8') as C:
|
||||||
# print(pickle.load(C))
|
dataset[0] = json.load(C)
|
||||||
read = pickle.load(C) # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
log("读取工程文件成功")
|
||||||
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
except UnicodeDecodeError:
|
||||||
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
print(READABLETEXT[8].format(fn))
|
||||||
# print(read)
|
log('无法打开{}'.format(fn))
|
||||||
dataset = read[0]
|
return
|
||||||
pkl1 = read[1]
|
except json.decoder.JSONDecodeError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
||||||
|
# json.decoder.JSONDecodeError
|
||||||
|
print(READABLETEXT[8].format(fn))
|
||||||
|
log('无法打开{}'.format(fn))
|
||||||
|
return
|
||||||
|
elif str(fn)[str(fn).rfind("."):] == ".msctx":
|
||||||
|
try:
|
||||||
|
try:
|
||||||
|
with open(fn, 'rb') as C:
|
||||||
|
# print(pickle.load(C))
|
||||||
|
read = pickle.load(C) # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# print(read)
|
||||||
|
dataset = read[0]
|
||||||
|
pkl1 = read[1]
|
||||||
|
log("读取新文件成功")
|
||||||
|
with open("1.pkl", 'wb') as w:
|
||||||
|
pickle.dump(pkl1, w)
|
||||||
|
except KeyError:
|
||||||
|
with open(fn, 'rb') as C:
|
||||||
|
dataset[0] = pickle.load(C)
|
||||||
log("读取新文件成功")
|
log("读取新文件成功")
|
||||||
with open("1.pkl", 'wb') as w:
|
except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
||||||
pickle.dump(pkl1, w)
|
# pickle.UnpicklingError
|
||||||
except KeyError:
|
print(READABLETEXT[8].format(fn))
|
||||||
with open(fn, 'rb') as C:
|
log('无法打开{}'.format(fn))
|
||||||
dataset[0] = pickle.load(C)
|
return
|
||||||
log("读取新文件成功")
|
elif str(fn)[str(fn).rfind("."):] == ".msctn":
|
||||||
except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
try:
|
||||||
# pickle.UnpicklingError
|
try:
|
||||||
print(READABLETEXT[8].format(fn))
|
with open(fn, 'rb') as C:
|
||||||
log('无法打开{}'.format(fn))
|
# print(pickle.load(C))
|
||||||
|
read = pickle.load(C) # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# print(read)
|
||||||
|
dataset = read
|
||||||
|
log("读取新文件成功")
|
||||||
|
except KeyError:
|
||||||
|
with open(fn, 'rb') as C:
|
||||||
|
dataset[0] = pickle.load(C)
|
||||||
|
log("读取新文件成功")
|
||||||
|
except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
||||||
|
# pickle.UnpicklingError
|
||||||
|
print(READABLETEXT[8].format(fn))
|
||||||
|
log('无法打开{}'.format(fn))
|
||||||
|
return
|
||||||
|
else:
|
||||||
return
|
return
|
||||||
global is_new_file
|
global is_new_file
|
||||||
global ProjectName
|
global ProjectName
|
||||||
@ -481,50 +487,98 @@ def __main__():
|
|||||||
RefreshMain()
|
RefreshMain()
|
||||||
RefreshMusic(NowMusic)
|
RefreshMusic(NowMusic)
|
||||||
|
|
||||||
def openClassProject():
|
# def openNewProject():
|
||||||
global is_save
|
# global is_save
|
||||||
if is_save is not True:
|
# if is_save is not True:
|
||||||
result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
|
# result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
|
||||||
if result:
|
# if result:
|
||||||
SaveProject()
|
# SaveProject()
|
||||||
fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./',
|
# fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./',
|
||||||
filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[112], '*')],
|
# filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[112], '*')],
|
||||||
multiple=True)
|
# multiple=True)
|
||||||
if fn is None or fn == '':
|
# if fn is None or fn == '':
|
||||||
return
|
# return
|
||||||
else:
|
# else:
|
||||||
# print(fn)
|
# # print(fn)
|
||||||
fn = fn[0]
|
# fn = fn[0]
|
||||||
# print(fn)
|
# # print(fn)
|
||||||
log("尝试打开:" + fn)
|
# log("尝试打开:" + fn)
|
||||||
try:
|
# try:
|
||||||
try:
|
# try:
|
||||||
with open(fn, 'rb') as C:
|
# with open(fn, 'rb') as C:
|
||||||
global dataset
|
# global dataset
|
||||||
# print(pickle.load(C))
|
# # print(pickle.load(C))
|
||||||
read = pickle.load(C) # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
# read = pickle.load(C) # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
# # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
# 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
# # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
# print(read)
|
# # print(read)
|
||||||
dataset = read
|
# dataset = read[0]
|
||||||
log("读取新文件成功")
|
# pkl1 = read[1]
|
||||||
except KeyError:
|
# log("读取新文件成功")
|
||||||
with open(fn, 'rb') as C:
|
# with open("1.pkl", 'wb') as w:
|
||||||
dataset[0] = pickle.load(C)
|
# pickle.dump(pkl1, w)
|
||||||
log("读取新文件成功")
|
# except KeyError:
|
||||||
except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
# with open(fn, 'rb') as C:
|
||||||
# pickle.UnpicklingError
|
# dataset[0] = pickle.load(C)
|
||||||
print(READABLETEXT[8].format(fn))
|
# log("读取新文件成功")
|
||||||
log('无法打开{}'.format(fn))
|
# except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
||||||
return
|
# # pickle.UnpicklingError
|
||||||
global is_new_file
|
# print(READABLETEXT[8].format(fn))
|
||||||
global ProjectName
|
# log('无法打开{}'.format(fn))
|
||||||
is_new_file = False
|
# return
|
||||||
ProjectName = fn
|
# global is_new_file
|
||||||
del fn
|
# global ProjectName
|
||||||
global NowMusic
|
# is_new_file = False
|
||||||
RefreshMain()
|
# ProjectName = fn
|
||||||
RefreshMusic(NowMusic)
|
# del fn
|
||||||
|
# global NowMusic
|
||||||
|
# RefreshMain()
|
||||||
|
# RefreshMusic(NowMusic)
|
||||||
|
|
||||||
|
# def openClassProject():
|
||||||
|
# global is_save
|
||||||
|
# if is_save is not True:
|
||||||
|
# result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
|
||||||
|
# if result:
|
||||||
|
# SaveProject()
|
||||||
|
# fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./',
|
||||||
|
# filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[112], '*')],
|
||||||
|
# multiple=True)
|
||||||
|
# if fn is None or fn == '':
|
||||||
|
# return
|
||||||
|
# else:
|
||||||
|
# # print(fn)
|
||||||
|
# fn = fn[0]
|
||||||
|
# # print(fn)
|
||||||
|
# log("尝试打开:" + fn)
|
||||||
|
# try:
|
||||||
|
# try:
|
||||||
|
# with open(fn, 'rb') as C:
|
||||||
|
# global dataset
|
||||||
|
# # print(pickle.load(C))
|
||||||
|
# read = pickle.load(C) # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# # 重要的事情说三遍!!!pickle.load只能load一次,所以多load几次就有bug,要一次读完!
|
||||||
|
# # print(read)
|
||||||
|
# dataset = read
|
||||||
|
# log("读取新文件成功")
|
||||||
|
# except KeyError:
|
||||||
|
# with open(fn, 'rb') as C:
|
||||||
|
# dataset[0] = pickle.load(C)
|
||||||
|
# log("读取新文件成功")
|
||||||
|
# except pickle.UnpicklingError: # 程序规范修改:根据新的语法标准:except后面不能没有错误类型,测试后改为:
|
||||||
|
# # pickle.UnpicklingError
|
||||||
|
# print(READABLETEXT[8].format(fn))
|
||||||
|
# log('无法打开{}'.format(fn))
|
||||||
|
# return
|
||||||
|
# global is_new_file
|
||||||
|
# global ProjectName
|
||||||
|
# is_new_file = False
|
||||||
|
# ProjectName = fn
|
||||||
|
# del fn
|
||||||
|
# global NowMusic
|
||||||
|
# RefreshMain()
|
||||||
|
# RefreshMusic(NowMusic)
|
||||||
|
|
||||||
print('打开项目命令加载完成!')
|
print('打开项目命令加载完成!')
|
||||||
|
|
||||||
@ -562,10 +616,32 @@ def __main__():
|
|||||||
print('关于命令加载完成!')
|
print('关于命令加载完成!')
|
||||||
|
|
||||||
def apphelp():
|
def apphelp():
|
||||||
|
def funcHelp():
|
||||||
|
funTK = tk.Tk()
|
||||||
|
funTK.title("函数功能查询")
|
||||||
|
funTK.geometry('1200x1000')
|
||||||
|
thingLabel = tk.Label(funTK, text="函数功能查询", font=('', 20))
|
||||||
|
thingLabel.pack()
|
||||||
|
aLabel = tk.Label(funTK, text="""文件:\n
|
||||||
|
打开音·创项目...: 打开三种类型的音创文件(.msct, .msctn, .msctx)\n
|
||||||
|
打开旧项目...: 打开两种类型的音创文件(.ry.nfc, .ry.mfm)\n
|
||||||
|
保存项目: 自动选择保存类型,并保存为音创文件(.msct, .msctn, .msctx)\n
|
||||||
|
另存为...: 自动选择另存为类型,并保存为音创文件(.msct, .msctn, .msctx)\n
|
||||||
|
退出 : 退出程序\n\n
|
||||||
|
编辑:\n
|
||||||
|
从midi导入音轨: 以旧方法(列表方法)解析midi,如果你使用这个方法解析,意味着你选择.msct文件\n
|
||||||
|
从midi导入音轨且用新方法解析: 以新方法(类方法)解析midi,并解析乐器信息,如果你使用这个方法解析,意味着你选择.msctx文件\n
|
||||||
|
注意!!!这个功能暂时只用于支持雪莹乐器资源包,如果你不是为了这个,最好别用!\n
|
||||||
|
从midi导入音轨且用类方法解析: 以类方法解析midi,如果你使用这个方法解析,意味着你选择.msctn文件\n
|
||||||
|
注意!!!这个功能暂时在开发中!!!别用!\n
|
||||||
|
""", font=('宋体', 12))
|
||||||
|
aLabel.pack()
|
||||||
|
|
||||||
ahpw = tk.Tk()
|
ahpw = tk.Tk()
|
||||||
ahpw.title(READABLETEXT[19])
|
ahpw.title(READABLETEXT[19])
|
||||||
ahpw.geometry('400x600') # 像素
|
ahpw.geometry('400x600') # 像素
|
||||||
|
tk.Label(ahpw, text="帮助", font=('楷体', 32)).grid(row=0, column=2)
|
||||||
|
tk.Button(ahpw, text="函数功能查询", command=funcHelp, font=('楷体', 20)).grid(row=1, column=1)
|
||||||
ahpw.mainloop()
|
ahpw.mainloop()
|
||||||
|
|
||||||
print('帮助命令加载完成!')
|
print('帮助命令加载完成!')
|
||||||
@ -1503,9 +1579,7 @@ def __main__():
|
|||||||
from nmcsup.vers import resetver
|
from nmcsup.vers import resetver
|
||||||
|
|
||||||
print('按钮点击命令加载完成!')
|
print('按钮点击命令加载完成!')
|
||||||
|
|
||||||
print('完成!')
|
print('完成!')
|
||||||
|
|
||||||
print('加载菜单与页面...')
|
print('加载菜单与页面...')
|
||||||
|
|
||||||
# 创建一个菜单
|
# 创建一个菜单
|
||||||
@ -1525,11 +1599,11 @@ def __main__():
|
|||||||
# filemenu.add_command(label=READABLETEXT[150], command=SaveNewProject)
|
# filemenu.add_command(label=READABLETEXT[150], command=SaveNewProject)
|
||||||
# filemenu.add_command(label=READABLETEXT[151], command=SaveAsNewProject)
|
# filemenu.add_command(label=READABLETEXT[151], command=SaveAsNewProject)
|
||||||
|
|
||||||
filemenu.add_separator()
|
# filemenu.add_separator()
|
||||||
|
#
|
||||||
filemenu.add_command(label=READABLETEXT[161], command=openClassProject)
|
# filemenu.add_command(label=READABLETEXT[161], command=openClassProject)
|
||||||
filemenu.add_command(label=READABLETEXT[162], command=SaveClassProject)
|
# filemenu.add_command(label=READABLETEXT[162], command=SaveClassProject)
|
||||||
filemenu.add_command(label=READABLETEXT[163], command=SaveAsClassProject)
|
# filemenu.add_command(label=READABLETEXT[163], command=SaveAsClassProject)
|
||||||
|
|
||||||
filemenu.add_separator() # 分隔符
|
filemenu.add_separator() # 分隔符
|
||||||
|
|
||||||
@ -1555,11 +1629,11 @@ def __main__():
|
|||||||
funcmenu.add_command(label=READABLETEXT[64], command=MakeCMD)
|
funcmenu.add_command(label=READABLETEXT[64], command=MakeCMD)
|
||||||
funcmenu.add_command(label=READABLETEXT[65], command=MakeCMDdir)
|
funcmenu.add_command(label=READABLETEXT[65], command=MakeCMDdir)
|
||||||
funcmenu.add_command(label=READABLETEXT[66], command=MakePackFile)
|
funcmenu.add_command(label=READABLETEXT[66], command=MakePackFile)
|
||||||
# funcmenu.add_separator()
|
funcmenu.add_separator()
|
||||||
# funcmenu.add_command(label=READABLETEXT[147], command=MakeNewCMD)
|
funcmenu.add_command(label=READABLETEXT[147], command=MakeNewCMD)
|
||||||
# funcmenu.add_command(label=READABLETEXT[153], command=MakeNewCMDdir)
|
funcmenu.add_command(label=READABLETEXT[153], command=MakeNewCMDdir)
|
||||||
# funcmenu.add_command(label=READABLETEXT[154], command=MakeNewFunctionPackFile)
|
funcmenu.add_command(label=READABLETEXT[154], command=MakeNewFunctionPackFile)
|
||||||
# funcmenu.add_command(label=READABLETEXT[155], command=MakeNewFunctionPack_ResourcesPacks_File)
|
funcmenu.add_command(label=READABLETEXT[155], command=MakeNewFunctionPack_ResourcesPacks_File)
|
||||||
|
|
||||||
# 将子菜单加入到菜单条中
|
# 将子菜单加入到菜单条中
|
||||||
main_menu_bar.add_cascade(label=READABLETEXT[67], menu=funcmenu)
|
main_menu_bar.add_cascade(label=READABLETEXT[67], menu=funcmenu)
|
||||||
@ -1602,7 +1676,7 @@ def __main__():
|
|||||||
helpmenu.add_command(label=READABLETEXT[85], command=ClearLog)
|
helpmenu.add_command(label=READABLETEXT[85], command=ClearLog)
|
||||||
helpmenu.add_command(label=READABLETEXT[86], command=resetver)
|
helpmenu.add_command(label=READABLETEXT[86], command=resetver)
|
||||||
helpmenu.add_command(label=READABLETEXT[152], command=end)
|
helpmenu.add_command(label=READABLETEXT[152], command=end)
|
||||||
# helpmenu.add_command(label=READABLETEXT[156], command=changeResourcesPath)
|
helpmenu.add_command(label=READABLETEXT[156], command=changeResourcesPath)
|
||||||
|
|
||||||
helpmenu.add_separator() # 分隔符
|
helpmenu.add_separator() # 分隔符
|
||||||
|
|
||||||
|
22
README.md
22
README.md
@ -64,13 +64,33 @@ python3 Musicreater.py
|
|||||||
2. 看得懂简体中文字的不一定全会用
|
2. 看得懂简体中文字的不一定全会用
|
||||||
3. 最好要懂一点点英文
|
3. 最好要懂一点点英文
|
||||||
|
|
||||||
|
|
||||||
|
### 诸葛亮与八卦阵的说明(不必要)
|
||||||
|
|
||||||
|
1. 首先!这里的提示是给想使用多音色资源包的人的,如果你想请下载 神羽资源包(神羽自己的链接):https://pan.baidu.com/s/11uoq5zwN7c3rX-98DqVpJg
|
||||||
|
提取码:ek3t
|
||||||
|
2. 下载到你自己电脑上某个位置,注意并不需要放置于本项目下。音色资源包较大,可以选取只下载:
|
||||||
|
`神羽资源包_乐器、音源的资源包\羽音缭绕-midiout_25.0` 这个文件夹。
|
||||||
|
3. 也可以只下载其中的:
|
||||||
|
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\mcpack(国际版推荐)格式_25.0` 或者:
|
||||||
|
`神羽资源包_乐器\音源的资源包\羽音缭绕-midiout_25.0\zip格式_25.0`
|
||||||
|
4. 接下来就是关键了:在音创中绑定资源包
|
||||||
|
5. 首先,先打开音创->帮助与疑问->[神羽资源包位置选择]:选择文件夹... 这时候,
|
||||||
|
会跳出选择框,关键来了,选择:***你的mcpack(国际版推荐)_25.0文件夹或zip格式_25.0文件夹,外面的!文件夹!注意是外面的文件夹!!***
|
||||||
|
举个例子:我的文件路径是这样的:
|
||||||
|
`L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0`这里面有:`神羽资源包_25.0_使用方法.xls`、
|
||||||
|
`mcpack(国际版推荐)格式_25.0`、`zip格式_25.0`两个文件夹和一个.xls文件,而你在音创中
|
||||||
|
也应该选择这个文件夹:**L:\shenyu\音源的资源包\羽音缭绕-midiout_25.0**
|
||||||
|
6. 如果你想使用音色资源包函数,那么解析时你应该用音创->编辑->从midi导入音轨且用新方法解析,然后在使用
|
||||||
|
音创->函数(包)->下面的四个新函数
|
||||||
|
|
||||||
### 致谢
|
### 致谢
|
||||||
|
|
||||||
1. 感谢由 [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”等 带来的我的世界websocket服务器功能
|
1. 感谢由 [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”等 带来的我的世界websocket服务器功能
|
||||||
2. 感谢 昀梦\<QQ1515399885\> 找出指令生成错误bug并指正
|
2. 感谢 昀梦\<QQ1515399885\> 找出指令生成错误bug并指正
|
||||||
3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能
|
3. 感谢由 Charlie_Ping “查理平” 带来的bdx转换功能
|
||||||
4. 感谢由 CMA_2401PT 带来的 BDXWorkShop 供本程序对于bdx操作的指导
|
4. 感谢由 CMA_2401PT 带来的 BDXWorkShop 供本程序对于bdx操作的指导
|
||||||
5.
|
5. 感谢由 Miracle Plume “神羽” \<QQshenyu40403\>带来的基岩版音色资源包
|
||||||
6. 感谢广大群友为此程序提供的测试等支持
|
6. 感谢广大群友为此程序提供的测试等支持
|
||||||
7. 若您对我们有所贡献但您的名字没有显示在此列表中,请联系我!
|
7. 若您对我们有所贡献但您的名字没有显示在此列表中,请联系我!
|
||||||
|
|
||||||
|
Binary file not shown.
@ -119,7 +119,7 @@ READABLETEXT = {
|
|||||||
105: "找不到或无法读取文件😢:{}",
|
105: "找不到或无法读取文件😢:{}",
|
||||||
106: "您当前的项目已修改但未存储,是否先保存当前项目?",
|
106: "您当前的项目已修改但未存储,是否先保存当前项目?",
|
||||||
107: "项目已经存储至:{}",
|
107: "项目已经存储至:{}",
|
||||||
108: "音·创工程文件",
|
108: ["音·创工程文件", "新:音·创工程文件", "音·创测试文件"],
|
||||||
109: "任意类型",
|
109: "任意类型",
|
||||||
110: "函数音创工程文件",
|
110: "函数音创工程文件",
|
||||||
111: "MMFM0.0.6版本工程文件",
|
111: "MMFM0.0.6版本工程文件",
|
||||||
|
BIN
测试用/1.msct
Normal file
BIN
测试用/1.msct
Normal file
Binary file not shown.
BIN
测试用/hz.msctn
Normal file
BIN
测试用/hz.msctn
Normal file
Binary file not shown.
1
测试用/tdst.msct
Normal file
1
测试用/tdst.msct
Normal file
File diff suppressed because one or more lines are too long
BIN
测试用/同道殊途.msctx
Normal file
BIN
测试用/同道殊途.msctx
Normal file
Binary file not shown.
BIN
测试用/国歌.msctn
Normal file
BIN
测试用/国歌.msctn
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user