增强多语言支持

This commit is contained in:
EillesWan 2022-01-15 00:40:17 +08:00
parent ce441e4905
commit 32ae868c34
18 changed files with 601 additions and 1842 deletions

12
LICENSE
View File

@ -92,16 +92,16 @@
meet the following conditions: meet the following conditions:
(a) You must give any other recipients of the Work or (a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and Derivative Works a copy of this License and
(b) You must cause any modified files to carry prominent notices (b) You must cause any modified files to carry prominent notices
stating that You changed the files; and stating that You changed the files and
(c) You must retain, in the Source form of any Derivative Works (c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work, attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of excluding those notices that do not pertain to any part of
the Derivative Works; and the Derivative Works and
(d) If the Work includes a "NOTICE" text file as part of its (d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must distribution, then any Derivative Works that You distribute must
@ -109,8 +109,8 @@
within such NOTICE file, excluding those notices that do not within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or as part of the Derivative Works within the Source form or
documentation, if provided along with the Derivative Works; or, documentation, if provided along with the Derivative Works or,
within a display generated by the Derivative Works, if and within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and of the NOTICE file are for informational purposes only and
@ -178,7 +178,7 @@
Copyright 2022 Eilles Wan (金羿) Copyright 2022 Eilles Wan (金羿)
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#! python3 #! python3
# W-YI 金羿 # W-YI 金羿
# QQ 2647547478 # QQ 2647547478
# 音·创 开发交流群 861684859 # 音·创 开发交流群 861684859
@ -8,24 +9,27 @@
# 版权所有 Team-Ryoun 金羿 # 版权所有 Team-Ryoun 金羿
# 若需转载或借鉴 请附作者 # 若需转载或借鉴 请附作者
''' '''
Copyright 2022 Eilles Wan (金羿) Copyright 2022 Eilles Wan (金羿)
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the 'License')
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
''' '''
# 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开 # 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开
import json import json
import os import os
import shutil import shutil
@ -36,6 +40,7 @@ import tkinter.filedialog
import tkinter.messagebox import tkinter.messagebox
import tkinter.simpledialog import tkinter.simpledialog
from languages.lang import *
from msctspt.threadOpera import NewThread from msctspt.threadOpera import NewThread
from nmcsup.vers import VER from nmcsup.vers import VER
@ -48,7 +53,6 @@ __author__ = 'W-YI (金羿)'
from languages.lang import READABLETEXT
@ -127,7 +131,7 @@ dataset = [
is_new_file = True is_new_file = True
is_save = True is_save = True
ProjectName = '' ProjectName = ''
clearLog = False; clearLog = False
NowMusic = 0 NowMusic = 0
root = tk.Tk() root = tk.Tk()
@ -204,7 +208,7 @@ def __main__():
from nmcsup.nmcreader import ReadFile as fileRead from nmcsup.nmcreader import ReadFile as fileRead
k = fileRead(fn) k = fileRead(fn)
if k == False : if k == False :
tk.messagebox.showerror(title=READABLETEXT[0], message="找不到文件😢:{}".format(fn)) tk.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[105].format(fn))
return return
else: else:
return k return k
@ -214,7 +218,7 @@ def __main__():
from nmcsup.nmcreader import ReadMidi as midiRead from nmcsup.nmcreader import ReadMidi as midiRead
k = midiRead(midfile) k = midiRead(midfile)
if k == False : if k == False :
tk.messagebox.showerror(title=READABLETEXT[0], message="找不到文件或无法读取文件😢:{}".format(midfile)) tk.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[105].format(midfile))
return return
else: else:
return k return k
@ -226,12 +230,12 @@ def __main__():
# 菜单命令 # 菜单命令
print('加载菜单命令...'); print('加载菜单命令...')
def exitapp(): def exitapp():
global is_save global is_save
if is_save != True: if is_save != True:
if tkinter.messagebox.askyesno(title=READABLETEXT[1], message="您当前的项目已修改但未存储,是否先保存当前项目?"): if tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106]):
SaveProject() SaveProject()
log('程序正常退出') log('程序正常退出')
@ -279,7 +283,7 @@ def __main__():
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="项目已经存储至:{}".format(ProjectName)) tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(ProjectName))
global is_save global is_save
is_save = True is_save = True
@ -289,13 +293,13 @@ def __main__():
def SaveAsProject(): def SaveAsProject():
# 另存为项目 # 另存为项目
fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./', filetypes=[("音·创工程文件", '.msct'), ("任意类型", '*')], defaultextension='Noname.msct') fn = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[5], initialdir=r'./', filetypes=[(READABLETEXT[108], '.msct'), (READABLETEXT[109], '*')], defaultextension='Noname.msct')
if fn == None or fn =='': if fn == None or fn =='':
return return
ProjectName = fn ProjectName = fn
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="项目已经存储至:{}".format(ProjectName)) tkinter.messagebox.showinfo(title=READABLETEXT[4], message=READABLETEXT[107].format(ProjectName))
global is_save global is_save
is_save = True is_save = True
@ -306,10 +310,10 @@ def __main__():
def openOldProject(): def openOldProject():
global is_save global is_save
if is_save != True: if is_save != True:
result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message="您当前的项目已修改但未存储,是否先保存当前项目?") result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[106])
if result: if result:
SaveProject() SaveProject()
fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[6], initialdir=r'./', filetypes=[("函数音创工程文件", '.ry.nfc'), ("MMFM0.0.6版本工程文件", '.ry.mfm'), ("全部类型", '*')], multiple=True) fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[6], initialdir=r'./', filetypes=[(READABLETEXT[110], '.ry.nfc'), (READABLETEXT[111], '.ry.mfm'), (READABLETEXT[112], '*')], multiple=True)
if fn == None or fn == '': if fn == None or fn == '':
return return
else: else:
@ -322,10 +326,10 @@ def __main__():
def openProject(): def openProject():
global is_save global is_save
if is_save != True: if is_save != True:
result = tkinter.messagebox.askyesno(title=READABLETEXT[1], message="您当前的项目已修改但未存储,是否先保存当前项目?") 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'./', filetypes=[("音·创工程文件", '.msct'),("全部类型", '*')], multiple=True) fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[7], initialdir=r'./', filetypes=[(READABLETEXT[108], '.msct'),(READABLETEXT[112], '*')], multiple=True)
if fn == None or fn == '': if fn == None or fn == '':
return return
else: else:
@ -353,7 +357,7 @@ def __main__():
def appabout(): def appabout():
aabw = tk.Tk() aabw = tk.Tk()
aabw.title(READABLETEXT[9]) aabw.title(READABLETEXT[9])
aabw.geometry('400x600') # 像素 aabw.geometry('550x600') # 像素
tk.Label(aabw, text='', font=('', 15)).pack() tk.Label(aabw, text='', font=('', 15)).pack()
tk.Label(aabw, text=READABLETEXT[10], font=('', 35)).pack() tk.Label(aabw, text=READABLETEXT[10], font=('', 35)).pack()
tk.Label(aabw, text=READABLETEXT[11].format(VER[1]+VER[0]), font=('', 15)).pack() tk.Label(aabw, text=READABLETEXT[11].format(VER[1]+VER[0]), font=('', 15)).pack()
@ -365,13 +369,18 @@ def __main__():
#del pic #del pic
tk.Label(aabw, text='', font=('', 5)).pack() tk.Label(aabw, text='', font=('', 5)).pack()
tk.Label(aabw, text=READABLETEXT[12], font=('', 20)).pack() tk.Label(aabw, text=READABLETEXT[12], font=('', 20)).pack()
tk.Label(aabw, text=READABLETEXT[13], font=('', 20)).pack()
tk.Label(aabw, text=READABLETEXT[14], font=('', 20)).pack()
tk.Label(aabw, text='', font=('', 15)).pack() tk.Label(aabw, text='', font=('', 15)).pack()
tk.Label(aabw, text=READABLETEXT[15], font=('', 15)).pack() for i in READABLETEXT[15]:
tk.Label(aabw, text=i[0], font=('', 17 if i[1] else 15,'bold' if i[1] else '')).pack()
tk.Label(aabw, text='', font=('', 5)).pack()
if DEFAULTLANGUAGE != 'zh-CN':
tk.Label(aabw, text=READABLETEXT[16], font=('', 15)).pack() tk.Label(aabw, text=READABLETEXT[16], font=('', 15)).pack()
tk.Label(aabw, text=READABLETEXT[17], font=('', 15)).pack() for i in READABLETEXT['Translator']:
tk.Label(aabw, text=READABLETEXT[18], font=('', 15)).pack() tk.Label(aabw, text=i[0], font=('', 17 if i[1] else 15,'bold' if i[1] else '')).pack()
def exitAboutWindow():
aabw.destroy()
tk.Button(aabw,text=READABLETEXT[13],command=exitAboutWindow).pack()
aabw.mainloop() aabw.mainloop()
@ -392,7 +401,7 @@ def __main__():
def FromMP3(): def FromMP3():
log('从MP3导入音乐') log('从MP3导入音乐')
mp3file = tkinter.filedialog.askopenfilename(title=READABLETEXT[20], initialdir=r'./', filetypes=[("钢琴声音的音频文件", '.mp3 .m4a'), ("全部类型", '*')], multiple=True) mp3file = tkinter.filedialog.askopenfilename(title=READABLETEXT[20], initialdir=r'./', filetypes=[(READABLETEXT[113], '.mp3 .m4a'), (READABLETEXT[112], '*')], multiple=True)
if mp3file == None or mp3file == '': if mp3file == None or mp3file == '':
log('取消') log('取消')
return return
@ -426,7 +435,7 @@ def __main__():
def FromMidi(): def FromMidi():
log('从midi导入音乐') log('从midi导入音乐')
midfile = tkinter.filedialog.askopenfilename(title=READABLETEXT[21], initialdir=r'./', filetypes=[("Midi文件", '.mid .midi'), ("全部类型", '*')], multiple=True) midfile = tkinter.filedialog.askopenfilename(title=READABLETEXT[21], initialdir=r'./', filetypes=[(READABLETEXT[114], '.mid .midi'), (READABLETEXT[112], '*')], multiple=True)
if midfile == None or midfile == '': if midfile == None or midfile == '':
log('取消') log('取消')
return return
@ -455,7 +464,7 @@ def __main__():
def FromForm(): def FromForm():
log('从文本读入音轨') log('从文本读入音轨')
fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[22], initialdir=r'./', filetypes=[("文本文件", '.txt'), ("全部类型", '*')], multiple=True) fn = tkinter.filedialog.askopenfilename(title=READABLETEXT[22], initialdir=r'./', filetypes=[(READABLETEXT[115], '.txt'), (READABLETEXT[112], '*')], multiple=True)
if fn == None or fn =='': if fn == None or fn =='':
log('取消') log('取消')
return return
@ -482,7 +491,7 @@ def __main__():
def FromText(): def FromText():
log('写入音符至音轨') log('写入音符至音轨')
dat = tkinter.simpledialog.askstring(title=READABLETEXT[23], prompt="请输入音符:", initialvalue='`1 .2 C') dat = tkinter.simpledialog.askstring(title=READABLETEXT[23], prompt=READABLETEXT[14], initialvalue='`1 .2 C')
if dat == None: if dat == None:
return return
datas = [] datas = []
@ -571,12 +580,12 @@ def __main__():
from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])] dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!") tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./') Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
@ -604,12 +613,12 @@ def __main__():
from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player from nmcsup.trans import Cmd2World, Datas2BlkWorld, Notes2Player
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])] dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!") tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./') Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
@ -634,17 +643,17 @@ def __main__():
def MakeFuncPlayer(): def MakeFuncPlayer():
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])] dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[30], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[30], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
return; return
else: else:
Outdire = '{}/{}/'.format(Outdire,dataset[0]['mainset']['PackName']) Outdire = '{}/{}/'.format(Outdire,dataset[0]['mainset']['PackName'])
from nmcsup.trans import Notes2Player from nmcsup.trans import Notes2Player
@ -662,21 +671,21 @@ def __main__():
from nmcsup.trans import Cmd2World, Note2Cmd from nmcsup.trans import Cmd2World, Note2Cmd
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16'); dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]; dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue; continue
break; break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
return; return
else: else:
Outdire+='/'+dataset[0]['mainset']['PackName']+'/'; Outdire+='/'+dataset[0]['mainset']['PackName']+'/'
with zipfile.ZipFile('./nmcsup/EptWorld.zip', 'r') as zipobj: with zipfile.ZipFile('./nmcsup/EptWorld.zip', 'r') as zipobj:
zipobj.extractall(Outdire); zipobj.extractall(Outdire)
for i in range(len(dataset[0]['musics'])): for i in range(len(dataset[0]['musics'])):
Cmd2World(Note2Cmd(dataset[0]['musics'][i]['notes'],dataset[0]['musics'][i]['set']['ScoreboardName'],dataset[0]['musics'][i]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect'],True),Outdire,[dire[0],dire[1],dire[2]+i]) Cmd2World(Note2Cmd(dataset[0]['musics'][i]['notes'],dataset[0]['musics'][i]['set']['ScoreboardName'],dataset[0]['musics'][i]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect'],True),Outdire,[dire[0],dire[1],dire[2]+i])
del dire,Outdire del dire,Outdire
@ -688,15 +697,15 @@ def __main__():
from nmcsup.trans import Cmd2World, Note2Cmd from nmcsup.trans import Cmd2World, Note2Cmd
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])] dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
return return
else: else:
@ -714,20 +723,20 @@ def __main__():
from nmcsup.trans import Cmd2World from nmcsup.trans import Cmd2World
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])] dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
return; return
else: else:
Outdire+='/'; Outdire+='/'
Cmd2World(open(tkinter.filedialog.askopenfilename(title=READABLETEXT[31], initialdir=r'./', filetypes=[("我的世界指令函数文件", '.mcfunction'), ("全部类型", '*')], multiple=True)[0],'r',encoding='utf-8').readlines(),Outdire,dire) Cmd2World(open(tkinter.filedialog.askopenfilename(title=READABLETEXT[31], initialdir=r'./', filetypes=[(READABLETEXT[118], '.mcfunction'), (READABLETEXT[112], '*')], multiple=True)[0],'r',encoding='utf-8').readlines(),Outdire,dire)
@ -742,38 +751,38 @@ def __main__():
from nmcsup.trans import Cmd2World from nmcsup.trans import Cmd2World
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入执行链生成坐标:",initialvalue = '16 4 16'); dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[119],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]; dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入。"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[120])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
log('取消') log('取消')
return return
else: else:
Outdire+='/'; Outdire+='/'
log('获得地图地址:'+Outdire) log('获得地图地址:'+Outdire)
fileName = tkinter.filedialog.askopenfilename(title=READABLETEXT[31], initialdir=r'./', filetypes=[("我的世界指令函数文件", '.mcfunction'), ("全部类型", '*')], multiple=True) fileName = tkinter.filedialog.askopenfilename(title=READABLETEXT[31], initialdir=r'./', filetypes=[(READABLETEXT[118], '.mcfunction'), (READABLETEXT[112], '*')], multiple=True)
if fileName == None or fileName == '': if fileName == None or fileName == '':
log('取消') log('取消')
return; return
else: else:
fileName = fileName[0] fileName = fileName[0]
log('获得文件名:'+fileName) log('获得文件名:'+fileName)
bigFile = open(fileName,'r',encoding='utf-8') bigFile = open(fileName,'r',encoding='utf-8')
parts = funSplit(bigFile) parts = funSplit(bigFile)
if parts == -1: if parts == -1:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您的函数文件不大于一万条指令,无需进行分割操作。"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[121])
return; return
log('创建函数文件夹') log('创建函数文件夹')
packName = fileName[len(fileName)-fileName[::-1].index('/'):fileName.index('.')] packName = fileName[len(fileName)-fileName[::-1].index('/'):fileName.index('.')]
packDire = hans2pinyin(packName) packDire = hans2pinyin(packName)
try: try:
os.makedirs(Outdire+'behavior_packs/'+packDire+'/functions/'); os.makedirs(Outdire+'behavior_packs/'+packDire+'/functions/')
except: except:
log('已存在文件夹') log('已存在文件夹')
log('创建manifest.json以及world_behavior_packs.json') log('创建manifest.json以及world_behavior_packs.json')
@ -792,7 +801,7 @@ def __main__():
f.write('{\n \'format_version\': 1,\n \'header\': {\n \'description\': \''+packName+' Pack : behavior pack\',\n \'version\': [ 0, 0, 1 ],\n \'name\': \''+packName+'Pack\',\n \'uuid\': \'' + str(behaviorUuid) + '\'\n },\n \'modules\': [\n {\n \'description\': \''+packName+' Pack : behavior pack\',\n \'type\': \'data\',\n \'version\': [ 0, 0, 1 ],\n \'uuid\': \'' + str(uuid.uuid4()) + '\'\n }\n ]\n}') f.write('{\n \'format_version\': 1,\n \'header\': {\n \'description\': \''+packName+' Pack : behavior pack\',\n \'version\': [ 0, 0, 1 ],\n \'name\': \''+packName+'Pack\',\n \'uuid\': \'' + str(behaviorUuid) + '\'\n },\n \'modules\': [\n {\n \'description\': \''+packName+' Pack : behavior pack\',\n \'type\': \'data\',\n \'version\': [ 0, 0, 1 ],\n \'uuid\': \'' + str(uuid.uuid4()) + '\'\n }\n ]\n}')
cmdlist = [] cmdlist = []
for i in parts : for i in parts :
open(Outdire+'behavior_packs/'+packDire+'/functions/'+packDire+str(parts.index(i)+1)+'.mcfunction','w',encoding='utf-8').writelines(i); open(Outdire+'behavior_packs/'+packDire+'/functions/'+packDire+str(parts.index(i)+1)+'.mcfunction','w',encoding='utf-8').writelines(i)
cmdlist.append('function '+packDire+str(parts.index(i)+1)) cmdlist.append('function '+packDire+str(parts.index(i)+1))
Cmd2World(cmdlist,Outdire,dire) Cmd2World(cmdlist,Outdire,dire)
del cmdlist,behaviorUuid,Outdire,fileName,bigFile,parts,dire,packName,packDire del cmdlist,behaviorUuid,Outdire,fileName,bigFile,parts,dire,packName,packDire
@ -804,33 +813,33 @@ def __main__():
from msctspt.transfer import note2bdx from msctspt.transfer import note2bdx
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入执行链生成相对坐标:",initialvalue = '0 0 0'); dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[122],initialvalue = '0 0 0')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]; dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入。"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[120])
continue continue
break break
fileName = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[32], initialdir=r'./', filetypes=[("FastBuilder结构文件", '.bdx'), ("全部类型", '*')], defaultextension=dataset[0]['mainset']['PackName']+'.bdx',initialfile=dataset[0]['mainset']['PackName']+'.bdx') fileName = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[32], initialdir=r'./', filetypes=[(READABLETEXT[123], '.bdx'), (READABLETEXT[112], '*')], defaultextension=dataset[0]['mainset']['PackName']+'.bdx',initialfile=dataset[0]['mainset']['PackName']+'.bdx')
if fileName == None or fileName == '': if fileName == None or fileName == '':
log('取消') log('取消')
return; return
log('获得文件名:'+fileName) log('获得文件名:'+fileName)
res = note2bdx(fileName,dire,dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['ScoreboardName'],dataset[0]['musics'][NowMusic]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect']) res = note2bdx(fileName,dire,dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['ScoreboardName'],dataset[0]['musics'][NowMusic]['set']['Instrument'],dataset[0]['mainset']['PlayerSelect'])
log('转换结束!\n'+str(res)) log('转换结束!\n'+str(res))
tkinter.messagebox.showinfo(READABLETEXT[33],"转换结束!\n{}".format(str(res))) tkinter.messagebox.showinfo(READABLETEXT[33],READABLETEXT[124].format(str(res)))
def wsPlay(): def wsPlay():
from msctspt.transfer import note2webs from msctspt.transfer import note2webs
spd = tkinter.simpledialog.askfloat(READABLETEXT[34],prompt="一秒,音乐走几拍?",initialvalue = '5.0') spd = tkinter.simpledialog.askfloat(READABLETEXT[34],prompt=READABLETEXT[125],initialvalue = '5.0')
tkinter.messagebox.showinfo(title=READABLETEXT[35], message="按下确认后在游戏中使用connect指令连接localhost:8080即可播放") tkinter.messagebox.showinfo(title=READABLETEXT[35], message=READABLETEXT[126])
note2webs(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['Instrument'],spd,dataset[0]['mainset']['PlayerSelect']) note2webs(dataset[0]['musics'][NowMusic]['notes'],dataset[0]['musics'][NowMusic]['set']['Instrument'],spd,dataset[0]['mainset']['PlayerSelect'])
@ -843,25 +852,25 @@ def __main__():
from msctspt.transfer import note2RSworld from msctspt.transfer import note2RSworld
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16'); dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]; dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue; continue
break; break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
return; return
else: else:
Outdire+='/'+dataset[0]['mainset']['PackName']+'/'; Outdire+='/'+dataset[0]['mainset']['PackName']+'/'
with zipfile.ZipFile('./nmcsup/EptWorld.zip', 'r') as zipobj: with zipfile.ZipFile('./nmcsup/EptWorld.zip', 'r') as zipobj:
zipobj.extractall(Outdire); zipobj.extractall(Outdire)
for i in range(len(dataset[0]['musics'])): for i in range(len(dataset[0]['musics'])):
note2RSworld(Outdire,dire,dataset[0]['musics'][i]['notes'],dataset[0]['musics'][i]['set']['Instrument']) note2RSworld(Outdire,dire,dataset[0]['musics'][i]['notes'],dataset[0]['musics'][i]['set']['Instrument'])
del dire,Outdire; del dire,Outdire
@ -869,54 +878,54 @@ def __main__():
from msctspt.transfer import note2RSworld from msctspt.transfer import note2RSworld
while True: while True:
try: try:
dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入坐标:",initialvalue = '16 4 16') dire = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[116],initialvalue = '16 4 16')
if dire == None or dire == '': if dire == None or dire == '':
return; return
dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])] dire = [int(dire.split(' ')[0]), int(dire.split(' ')[1]), int(dire.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./'); Outdire = tkinter.filedialog.askdirectory(title=READABLETEXT[29], initialdir=r'./')
if Outdire == None or Outdire == '': if Outdire == None or Outdire == '':
return; return
else: else:
Outdire+='/'; Outdire+='/'
for i in range(len(dataset[0]['musics'])): for i in range(len(dataset[0]['musics'])):
note2RSworld(Outdire,dire,dataset[0]['musics'][i]['notes'],dataset[0]['musics'][i]['set']['Instrument']) note2RSworld(Outdire,dire,dataset[0]['musics'][i]['notes'],dataset[0]['musics'][i]['set']['Instrument'])
del dire,Outdire; del dire,Outdire
def world2RyStruct(): def world2RyStruct():
outdir = tkinter.filedialog.askdirectory(title=READABLETEXT[36], initialdir=r'./'); outdir = tkinter.filedialog.askdirectory(title=READABLETEXT[36], initialdir=r'./')
if outdir == None or outdir == '': if outdir == None or outdir == '':
return; return
else: else:
outdir+='/'; outdir+='/'
while True: while True:
try: try:
begp = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入区域选择的开始坐标:",initialvalue = '16 4 16') begp = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[127],initialvalue = '16 4 16')
if begp == None or begp == '': if begp == None or begp == '':
return; return
begp = [int(begp.split(' ')[0]), int(begp.split(' ')[1]), int(begp.split(' ')[2])] begp = [int(begp.split(' ')[0]), int(begp.split(' ')[1]), int(begp.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
while True: while True:
try: try:
endp = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt="请输入区域选择的结束坐标:",initialvalue = '16 4 16') endp = tkinter.simpledialog.askstring(title = READABLETEXT[28],prompt=READABLETEXT[128],initialvalue = '16 4 16')
if endp == None or endp == '': if endp == None or endp == '':
return; return
endp = [int(endp.split(' ')[0]), int(endp.split(' ')[1]), int(endp.split(' ')[2])] endp = [int(endp.split(' ')[0]), int(endp.split(' ')[1]), int(endp.split(' ')[2])]
except: except:
tkinter.messagebox.showerror(title=READABLETEXT[0], message="您输入的格式有误,请重新输入!"); tkinter.messagebox.showerror(title=READABLETEXT[0], message=READABLETEXT[117])
continue continue
break break
isAir = tkinter.messagebox.askyesno(READABLETEXT[37],"所选区块导出时是否需要保留空气方块?") isAir = tkinter.messagebox.askyesno(READABLETEXT[37],READABLETEXT[129])
fileName = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[38], initialdir=r'./', filetypes=[("音·创结构文件", '.RyStruct'), ("全部类型", '*')], defaultextension='*.RyStruct',initialfile='*.RyStruct') fileName = tkinter.filedialog.asksaveasfilename(title=READABLETEXT[38], initialdir=r'./', filetypes=[(READABLETEXT[130], '.RyStruct'), (READABLETEXT[112], '*')], defaultextension='*.RyStruct',initialfile='*.RyStruct')
if fileName == None or fileName == '': if fileName == None or fileName == '':
log('取消') log('取消')
return return
@ -926,15 +935,15 @@ def __main__():
try: try:
with open(fileName,'w',encoding='utf-8') as f: with open(fileName,'w',encoding='utf-8') as f:
json.dump(rys.RyStruct,f,sort_keys=True, indent=4, separators=(', ', ': '), ensure_ascii=False) json.dump(rys.RyStruct,f,sort_keys=True, indent=4, separators=(', ', ': '), ensure_ascii=False)
tkinter.messagebox.showinfo(READABLETEXT[33],"文件已生成\n{}".format(fileName)) tkinter.messagebox.showinfo(READABLETEXT[33],READABLETEXT[131].format(fileName))
except: except:
tkinter.messagebox.showerror(READABLETEXT[39],"文件无法生成\n{}\n{}".format(fileName,str(rys.RyStruct))) tkinter.messagebox.showerror(READABLETEXT[39],READABLETEXT[132].format(fileName,str(rys.RyStruct)))
rys.closeLevel() rys.closeLevel()
def world2BDX(): def world2BDX():
tkinter.messagebox.showerror(READABLETEXT[0],"本功能尚未开发。") tkinter.messagebox.showerror(READABLETEXT[0],READABLETEXT[133])
@ -952,9 +961,9 @@ def __main__():
#使用邮件反馈bug #使用邮件反馈bug
def sendBugReport(): def sendBugReport():
from msctspt.bugReporter import report from msctspt.bugReporter import report
name = tkinter.simpledialog.askstring(title = READABLETEXT[40],prompt="您的称呼") name = tkinter.simpledialog.askstring(title = READABLETEXT[40],prompt=READABLETEXT[134])
contact = tkinter.simpledialog.askstring(title = READABLETEXT[40],prompt="您的联系方式") contact = tkinter.simpledialog.askstring(title = READABLETEXT[40],prompt=READABLETEXT[135])
describetion = tkinter.simpledialog.askstring(title = READABLETEXT[40],prompt="您对问题的描述") describetion = tkinter.simpledialog.askstring(title = READABLETEXT[40],prompt=READABLETEXT[136])
report(name,contact,describetion).emailReport() report(name,contact,describetion).emailReport()
del name,contact,describetion del name,contact,describetion
@ -969,12 +978,12 @@ def __main__():
def ClearLog(): def ClearLog():
global clearLog; global clearLog
clearLog = not clearLog; clearLog = not clearLog
if clearLog: if clearLog:
tkinter.messagebox.showinfo(READABLETEXT[33],"在程序结束后将清除日志及临时文件信息。") tkinter.messagebox.showinfo(READABLETEXT[33],READABLETEXT[137])
else: else:
tkinter.messagebox.showinfo(READABLETEXT[33],"在程序结束后将不会清除日志及临时文件信息。") tkinter.messagebox.showinfo(READABLETEXT[33],READABLETEXT[138])
@ -1052,7 +1061,7 @@ def __main__():
def changePackName(event): def changePackName(event):
a = tkinter.simpledialog.askstring(title=READABLETEXT[50], prompt="修改包名", initialvalue='Ryoun') a = tkinter.simpledialog.askstring(title=READABLETEXT[50], prompt=READABLETEXT[139], initialvalue='Ryoun')
if a == None: if a == None:
return return
dataset[0]['mainset']['PackName'] = a dataset[0]['mainset']['PackName'] = a
@ -1061,7 +1070,7 @@ def __main__():
def changeMusicTitle(event): def changeMusicTitle(event):
a = tkinter.simpledialog.askstring(title=READABLETEXT[50], prompt="修改音乐标题", initialvalue='Noname') a = tkinter.simpledialog.askstring(title=READABLETEXT[50], prompt=READABLETEXT[140], initialvalue='Noname')
if a == None: if a == None:
return return
dataset[0]['mainset']['MusicTitle'] = a dataset[0]['mainset']['MusicTitle'] = a
@ -1074,7 +1083,7 @@ def __main__():
def changePlayerSelect(event): def changePlayerSelect(event):
dataset[0]['mainset']['PlayerSelect'] = tkinter.simpledialog.askstring(title=READABLETEXT[50], prompt="修改玩家选择器\n注意!要加上中括号“[]”", initialvalue='') dataset[0]['mainset']['PlayerSelect'] = tkinter.simpledialog.askstring(title=READABLETEXT[50], prompt=READABLETEXT[141], initialvalue='')
if dataset[0]['mainset']['PlayerSelect'] == None: if dataset[0]['mainset']['PlayerSelect'] == None:
dataset[0]['mainset']['PlayerSelect'] = '' dataset[0]['mainset']['PlayerSelect'] = ''
RefreshMain() RefreshMain()
@ -1082,7 +1091,7 @@ def __main__():
def changeEntityName(event): def changeEntityName(event):
global NowMusic global NowMusic
a = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt="修改本音轨的执行实体名", initialvalue='musicSupport') a = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt=READABLETEXT[142], initialvalue='musicSupport')
if a == None: if a == None:
return return
dataset[0]['musics'][NowMusic]['set']['EntityName'] = a dataset[0]['musics'][NowMusic]['set']['EntityName'] = a
@ -1091,7 +1100,7 @@ def __main__():
def changeScoreboardName(event): def changeScoreboardName(event):
global NowMusic global NowMusic
a = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt="修改本音轨所用的积分板", initialvalue='musicSupport') a = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt=READABLETEXT[143], initialvalue='musicSupport')
if a == None: if a == None:
return return
dataset[0]['musics'][NowMusic]['set']['ScoreboardName'] = a dataset[0]['musics'][NowMusic]['set']['ScoreboardName'] = a
@ -1102,9 +1111,9 @@ def __main__():
from nmcsup.const import Instuments as inst from nmcsup.const import Instuments as inst
global NowMusic global NowMusic
while(True): while(True):
instemp = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt="修改本音轨所用乐器", initialvalue='note.harp') instemp = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt=READABLETEXT[144], initialvalue='note.harp')
if not instemp in inst.keys(): if not instemp in inst.keys():
if tkinter.messagebox.askyesno(title=READABLETEXT[1], message="您输入的乐器并非游戏内置乐器,是否继续用您输入的字符作为乐器?"): if tkinter.messagebox.askyesno(title=READABLETEXT[1], message=READABLETEXT[145]):
dataset[0]['musics'][NowMusic]['set']['Instrument'] = instemp dataset[0]['musics'][NowMusic]['set']['Instrument'] = instemp
del instemp del instemp
break break
@ -1123,7 +1132,7 @@ def __main__():
def changeFileName(event): def changeFileName(event):
global NowMusic global NowMusic
a = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt="修改本音轨生成的文件名", initialvalue='Music') a = tkinter.simpledialog.askstring(title=READABLETEXT[51], prompt=READABLETEXT[146], initialvalue='Music')
if a == None: if a == None:
return return
dataset[0]['musics'][NowMusic]['set']['FileName'] = a dataset[0]['musics'][NowMusic]['set']['FileName'] = a
@ -1199,31 +1208,31 @@ def __main__():
#创建世界菜单 #创建世界菜单
worldmenu = tk.Menu(main_menu_bar, tearoff=0); worldmenu = tk.Menu(main_menu_bar, tearoff=0)
worldmenu.add_command(label=READABLETEXT[68], command=ToBlockWorldEpt); worldmenu.add_command(label=READABLETEXT[68], command=ToBlockWorldEpt)
worldmenu.add_command(label=READABLETEXT[69], command=ToBlockWorld); worldmenu.add_command(label=READABLETEXT[69], command=ToBlockWorld)
worldmenu.add_separator() worldmenu.add_separator()
worldmenu.add_command(label=READABLETEXT[70], command=ToCmdWorldEpt); worldmenu.add_command(label=READABLETEXT[70], command=ToCmdWorldEpt)
worldmenu.add_command(label=READABLETEXT[71], command=ToCmdWorld); worldmenu.add_command(label=READABLETEXT[71], command=ToCmdWorld)
worldmenu.add_separator() worldmenu.add_separator()
worldmenu.add_command(label=READABLETEXT[72], command=toRSworldEPT); worldmenu.add_command(label=READABLETEXT[72], command=toRSworldEPT)
worldmenu.add_command(label=READABLETEXT[73], command=toRSworld); worldmenu.add_command(label=READABLETEXT[73], command=toRSworld)
# 将子菜单加入到菜单条中 # 将子菜单加入到菜单条中
main_menu_bar.add_cascade(label=READABLETEXT[74], menu=worldmenu); main_menu_bar.add_cascade(label=READABLETEXT[74], menu=worldmenu)
# 创建其他功能菜单 # 创建其他功能菜单
otherMenu = tk.Menu(main_menu_bar, tearoff=0) otherMenu = tk.Menu(main_menu_bar, tearoff=0)
otherMenu.add_command(label=READABLETEXT[75], command=MakeFuncPlayer) otherMenu.add_command(label=READABLETEXT[75], command=MakeFuncPlayer)
otherMenu.add_separator(); otherMenu.add_separator()
otherMenu.add_command(label=READABLETEXT[76], command=toScbBDXfile) otherMenu.add_command(label=READABLETEXT[76], command=toScbBDXfile)
otherMenu.add_command(label=READABLETEXT[77], command=world2BDX) otherMenu.add_command(label=READABLETEXT[77], command=world2BDX)
otherMenu.add_command(label=READABLETEXT[78], command=world2RyStruct) otherMenu.add_command(label=READABLETEXT[78], command=world2RyStruct)
otherMenu.add_separator(); otherMenu.add_separator()
otherMenu.add_command(label=READABLETEXT[79], command=func2World); otherMenu.add_command(label=READABLETEXT[79], command=func2World)
otherMenu.add_command(label=READABLETEXT[80], command=bigFunc2World); otherMenu.add_command(label=READABLETEXT[80], command=bigFunc2World)
main_menu_bar.add_cascade(label=READABLETEXT[81], menu=otherMenu); main_menu_bar.add_cascade(label=READABLETEXT[81], menu=otherMenu)
# 创建实验功能菜单 # 创建实验功能菜单
@ -1265,10 +1274,10 @@ def __main__():
# 大标题 # 大标题
tk.Label(UpLeftFrame, text=READABLETEXT[91], font=('', 20)).pack() tk.Label(UpLeftFrame, text=READABLETEXT[91], font=('', 20)).pack()
# 按钮式文本 # 按钮式文本
LabelPackName = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[92], font=('', 15)) LabelPackName = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[46], font=('', 15))
LabelMusicTitle = tk.Label(UpLeftFrame, bg='white',text=READABLETEXT[93], font=('', 15)) LabelMusicTitle = tk.Label(UpLeftFrame, bg='white',text=READABLETEXT[47], font=('', 15))
LabelIsRepeat = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[94], font=('', 15)) LabelIsRepeat = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[48], font=('', 15))
LabelPlayerSelect = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[95], font=('', 15)) LabelPlayerSelect = tk.Label(UpLeftFrame, bg='white', text=READABLETEXT[49], font=('', 15))
# 绑定按钮 # 绑定按钮
LabelPackName.bind('<Button-1>', changePackName) LabelPackName.bind('<Button-1>', changePackName)
LabelMusicTitle.bind('<Button-1>', changeMusicTitle) LabelMusicTitle.bind('<Button-1>', changeMusicTitle)
@ -1306,10 +1315,10 @@ def __main__():
# 大标题 # 大标题
tk.Label(UpRightFrame, text=READABLETEXT[97], font=('', 20)).pack() tk.Label(UpRightFrame, text=READABLETEXT[97], font=('', 20)).pack()
# 按钮式文本 # 按钮式文本
LabelEntityName = tk.Label(UpRightFrame, bg='white',text=READABLETEXT[98], font=('', 15)) LabelEntityName = tk.Label(UpRightFrame, bg='white',text=READABLETEXT[42], font=('', 15))
LabelScoreboardName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[99], font=('', 15)) LabelScoreboardName = tk.Label(UpRightFrame, bg='white', text=READABLETEXT[43], font=('', 15))
LabelInstrument = tk.Label(UpRightFrame, bg='white',text=READABLETEXT[100], font=('', 15)) LabelInstrument = tk.Label(UpRightFrame, bg='white',text=READABLETEXT[44], font=('', 15))
LabelFileName = tk.Label(UpRightFrame, bg='white',text=READABLETEXT[101], font=('', 15)) LabelFileName = tk.Label(UpRightFrame, bg='white',text=READABLETEXT[45], font=('', 15))
# 绑定按钮 # 绑定按钮
LabelEntityName.bind('<Button-1>', changeEntityName) LabelEntityName.bind('<Button-1>', changeEntityName)
LabelScoreboardName.bind('<Button-1>', changeScoreboardName) LabelScoreboardName.bind('<Button-1>', changeScoreboardName)
@ -1399,6 +1408,6 @@ def __main__():
if __name__ == '__main__': if __name__ == '__main__':
__main__(); __main__()

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,8 @@
支持 Windows7+ 以及各个支持 Python3.8 的 Linux 支持 Windows7+ 以及各个支持 Python3.8 的 Linux
***各位开发人员注意多语言支持请使用READABLETEXT常量输出文字如需补充请在相应的语言文件中补充***
### 安装教程 ### 安装教程

Binary file not shown.

Binary file not shown.

View File

@ -9,6 +9,23 @@
# 若需转载或借鉴 请附作者 # 若需转载或借鉴 请附作者
'''
Copyright 2022 Eilles Wan (金羿)
Licensed under the Apache License, Version 2.0 (the 'License')
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
# 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开 # 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开
''' '''
@ -17,6 +34,9 @@
方便进行语言翻译支持 方便进行语言翻译支持
''' '''
startWith = 0
import sys import sys
@ -26,24 +46,23 @@ def __main__():
print('读取文件: {}'.format(fileName)) print('读取文件: {}'.format(fileName))
fileText = [] fileText = []
for line in open(fileName, 'r', encoding='utf-8'): for line in open(fileName, 'r', encoding='utf-8'):
if line.count('"') >=2: while line.count('"') >=2:
# 只有上帝看得懂我在写什么。 # 只有上帝看得懂我在写什么。
if line[line.index('"'):2+line[line.index('"')+1:].index('"')+len(line[:line.index('"')])] in textList: if line[line.index('"'):2+line[line.index('"')+1:].index('"')+len(line[:line.index('"')])] in textList:
thisText = textList.index(line[line.index('"'):2+line[line.index('"')+1:].index('"')+len(line[:line.index('"')])]) thisText = textList.index(line[line.index('"'):2+line[line.index('"')+1:].index('"')+len(line[:line.index('"')])])
else: else:
thisText = len(textList) thisText = len(textList)
textList.append(line[line.index('"'):2+line[line.index('"')+1:].index('"')+len(line[:line.index('"')])]) textList.append(line[line.index('"'):2+line[line.index('"')+1:].index('"')+len(line[:line.index('"')])])
fileText.append(line.replace( line = line.replace(
line[line.index('"'):2+line[line.index('"') + 1:].index('"')+len(line[:line.index('"')])], line[line.index('"'):2+line[line.index('"') + 1:].index('"')+len(line[:line.index('"')])],
'READABLETEXT[{}]'.format(thisText) 'READABLETEXT[{}]'.format(thisText+startWith)
)) )
else:
fileText.append(line) fileText.append(line)
open(fileName+'_C','w',encoding='utf-8').writelines(fileText) open(fileName+'_C','w',encoding='utf-8').writelines(fileText)
outFile = open('lang.py','w',encoding='utf-8') outFile = open('lang__.py','w',encoding='utf-8')
outFile.write('''# -*- coding:utf-8 -*- outFile.write('''# -*- coding:utf-8 -*-
# 由金羿翻译工具生成字符串列表 # 由金羿翻译工具生成字符串列表
@ -54,7 +73,7 @@ def __main__():
READABLETEXT = { READABLETEXT = {
''') ''')
for i in range(len(textList)): for i in range(len(textList)):
outFile.write(" {}:{},\n".format(i,textList[i])) outFile.write(" {}:{},\n".format(i+startWith,textList[i]))
outFile.write('}') outFile.write('}')
outFile.close() outFile.close()

161
languages/enGB.py Normal file
View File

@ -0,0 +1,161 @@
# -*- coding:utf-8 -*-
# 由金羿翻译工具生成字符串列表
# 请在所需翻译的文件前from 此文件 import READABLETEXT
READABLETEXT = {
'Translator':(("Eilles Wan (金羿)",True),),
# 此处是语言翻译者列表,其中每个元组第一项为显示文本,第二项为此文本是否为开发者名字
0:"ERROR❌",
1:"TIPS❗",
2:"Clearing log(this wont be in the file)",
3:"Could not clear the temporary files or logs",
4:"saved",
5:"New Musicreater Project",
6:"Select old-type project",
7:"Select Musicreater Project",
8:"Cant open:{}, please check if youve entered the right name",
9:"Musicreat - Aboit",
10:"Musicreater",
11:"Ver. {}",
12:"""Team-Ryoun for Minecraft\n×\nTeam-Ryoun for Software Development""",
13:"OK",
14:"Inpute Notes",
15:(("- Developer(s) -",False),("Eilles Wan (金羿)",True),("EillesWan@outlook.com",False),("QQ 2647547478",False)),
# 此处是开发者列表,其中每个元组第一项为显示文本,第二项为此文本是否为开发者名字
16:"- Translators -",
# 17:"",
18:"QQ Group: 861684859",
19:"Musicreater - Help",
20:"Select sound file",
21:"Select MIDI file",
22:"Select NoteText file",
23:"Get Note info",
24:"Write in Note info: {}",
25:"Select generating file",
26:"Select generating folder",
27:"Select generating .mcpack file",
28:"Input position info",
29:"Select generating world folder",
30:"Select generating Function Pack",
31:"Select .mcfunction file ",
32:"Select .bdx file ",
33:"DONE✔",
34:"Input playing rate",
35:"Generating",
36:"Select a world folder",
37:"Make sure",
38:"Generate .RyStruct file",
39:"FAILED❌",
40:"Report message inpution",
41:"Musicreater - Eilles - {}",
42:"ExecutingEntityName: {}",
43:"ScoreboardName: {}",
44:"Instrument: {}",
45:"TrackName: {}",
46:"PackName: {}",
47:"MusicTitle: {}",
48:"IsRepeat?: {}",
49:"Player'sTargetSelector: {}",
50:"Modify Main Option",
51:"Modify Track Option",
52:"Default Instrument: Enter English\n",
53:"Open...",
54:"Open Old Project...",
55:"Save",
56:"Save as...",
57:"Exit",
58:"File",
59:"Load tracks from sound",
60:"Load tracks from Midi",
61:"Load tracks from Text",
62:"Input notes to track",
63:"Edit",
64:"Generate file...",
65:"Generate function pack...",
66:"Generate .mcpack file...",
67:"Functions(Pack)",
68:"Save music as blocks into a map",
69:"Save music as blocks into a exist map...",
70:"Save music as commands into a map",
71:"Save music as commands into a exist map...",
72:"Save music as notebox into a map",
73:"Save music as notebox into a exist map...",
74:"World",
75:"Generate a function that fits current music...",
76:"Save selected track as commands in .bdx file...",
77:"Export .bdx file from map...",
78:"Export .RyStruct file from map...",
79:"Load functions into a world...",
80:"Separate long .mcfunction file into small ones and set them into a world as a chain...",
81:"Additional Functions",
82:"Show generating result",
83:"Set a websocket server on localhost:8080 and play the selected track",
84:"Experimental Functions",
85:"Clear log file",
86:"Clear save file(obsolete)",
87:"Help",
88:"About",
89:"Send a bug report",
90:"Q&A",
91:"Main Options",
# 92:"",
# 93:"",
# 94:"",
# 95:"",
96:"Reset Main Options",
97:"Track Options",
# 98:"",
# 99:"",
# 100:"",
# 101:"",
102:"Delete Selected Track",
# 103:"",
# 104:"",
105:"找不到或无法读取文件😢:{}",
106:"您当前的项目已修改但未存储,是否先保存当前项目?",
107:"项目已经存储至:{}",
108:"音·创工程文件",
109:"任意类型",
110:"函数音创工程文件",
111:"MMFM0.0.6版本工程文件",
112:"全部类型",
113:"钢琴声音的音频文件",
114:"Midi文件",
115:"文本文件",
116:"请输入坐标:",
117:"您输入的格式有误,请重新输入!",
118:"我的世界指令函数文件",
119:"请输入执行链生成坐标:",
120:"您输入的格式有误,请重新输入。",
121:"您的函数文件不大于一万条指令,无需进行分割操作。",
122:"请输入执行链生成相对坐标:",
123:"FastBuilder结构文件",
124:"转换结束!\n{}",
125:"一秒,音乐走几拍?",
126:"按下确认后在游戏中使用connect指令连接localhost:8080即可播放",
127:"请输入区域选择的开始坐标:",
128:"请输入区域选择的结束坐标:",
129:"所选区块导出时是否需要保留空气方块?",
130:"音·创结构文件",
131:"文件已生成\n{}",
132:"文件无法生成\n{}\n{}",
133:"本功能尚未开发。",
134:"您的称呼",
135:"您的联系方式",
136:"您对问题的描述",
137:"在程序结束后将清除日志及临时文件信息。",
138:"在程序结束后将不会清除日志及临时文件信息。",
139:"修改包名",
140:"修改音乐标题",
141:"修改玩家选择器\n注意!要加上中括号“[]”",
142:"修改本音轨的执行实体名",
143:"修改本音轨所用的积分板",
144:"修改本音轨所用乐器",
145:"您输入的乐器并非游戏内置乐器,是否继续用您输入的字符作为乐器?",
146:"修改本音轨生成的文件名",
}

View File

@ -1,113 +1,23 @@
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
# 由金羿翻译工具生成字符串列表
# 请在所需翻译文件前from 此文件 import READABLETEXT DEFAULTLANGUAGE = 'en-GB'
LANGUAGELIST = {
READABLETEXT = { 'zh-CN':(
0:"错误❌", "简体中文 中国大陆",
1:"提示❗", "Simplified Chinese, China Mainland",
2:"清除log此句不载入日志", ),
3:"无法清除日志及临时文件", 'en-GB':(
4:"已存储", "英式英语 大不列颠",
5:"新建 音·创 项目", "British English, Great Britain",
6:"请选择旧类型的项目", ),
7:"请选择 音·创 项目",
8:"无法打开文件:{},请查看您是否输入正确",
9:"音·创 - 关于",
10:"我的世界音·创",
11:"当前版本:{}",
12:"凌云我的世界开发团队",
13:"×",
14:"凌云软件开发团队",
15:"唯一开发者金羿W-YI",
16:"Email: EillesWan@outlook.com",
17:"QQ: 2647547478",
18:"讨论群: 861684859",
19:"音·创 - 帮助",
20:"请选择钢琴声音的音乐文件",
21:"请选择 MIDI 文件",
22:"请选择 音符文本 文件",
23:"获取音符信息",
24:"音符数据写入{}",
25:"请选择文件生成的位置",
26:"请选择文件夹生成的位置",
27:"请选择.mcpack文件生成的位置",
28:"坐标信息输入",
29:"请选择世界文件夹生成的位置",
30:"请选择函数包生成的位置",
31:"请选择 .mcfunction 文件",
32:"请选择需要生成的.bdx文件",
33:"完成✔",
34:"输入播放速度",
35:"创建中",
36:"请选择世界文件夹所在的位置",
37:"请确认",
38:"生成.RyStruct文件",
39:"失败❌",
40:"邮件反馈信息输入",
41:"音·创 - 金羿 - {}",
42:"执行实体名:{}",
43:"使用计分板:{}",
44:"所用的乐器:{}",
45:"当前音轨名:{}",
46:"包名:{}",
47:"音乐标题:{}",
48:"是否重复:{}",
49:"玩家选择器:{}",
50:"修改主设置",
51:"修改节设置",
52:"游戏内置乐器如下:请输入英文\n",
53:"打开音·创项目...",
54:"打开旧项目...",
55:"保存项目",
56:"另存为...",
57:"退出",
58:"文件",
59:"从钢琴MP3导入音轨",
60:"从midi导入音轨",
61:"从文本文件导入音轨",
62:"输入音符至音轨",
63:"编辑",
64:"生成文件至...",
65:"生成函数包至...",
66:"生成附加包文件至...",
67:"函数(包)",
68:"将音乐以方块存储生成地图",
69:"将音乐以方块存储载入地图…",
70:"将音乐以指令存储生成地图",
71:"将音乐以指令存储载入地图…",
72:"将音乐以音符盒存储生成地图",
73:"将音乐以音符盒存储载入地图…",
74:"世界",
75:"生成符合当前音乐的函数播放器…",
76:"将选中音轨以指令存储生成.bdx文件…",
77:"由地图导出至.bdx文件…",
78:"由地图导出至.RyStruct文件…",
79:"将函数载入世界…",
80:"将大函数分割并建立执行链…",
81:"辅助功能",
82:"展示生成结果",
83:"建立位于localhost:8080上的websocket服务器播放选中音轨",
84:"实验功能",
85:"清除临时文件",
86:"清除存在文件",
87:"帮助",
88:"关于",
89:"发送错误日志反馈",
90:"帮助与疑问",
91:"音乐总设置(项目设置)",
92:"地图/函数包名:",
93:"音乐标题:",
94:"是否重复:",
95:"玩家选择器:",
96:"重置项目设置",
97:"当前音轨设置(段落设置)",
98:"执行实体名:",
99:"使用计分板:",
100:"所用的乐器:",
101:"当前音轨名:",
102:"删除选中音轨",
} }
if DEFAULTLANGUAGE == 'zh-CN':
from languages.zhCN import READABLETEXT
elif DEFAULTLANGUAGE == 'en-GB':
from languages.enGB import READABLETEXT

View File

@ -1,113 +0,0 @@
# -*- coding:utf-8 -*-
# 由金羿翻译工具generate字符串列表
# 请在所需翻译 file 前from 此 file import READABLETEXT
READABLETEXT = {
0:"ERROR❌",
1:"TIPS❗",
2:"Clearing log(this wont be in the file)",
3:"Could not clear the temporary files or logs",
4:"saved",
5:"New Musicreater Project",
6:"Select old-type project",
7:"Select Musicreater Project",
8:"Cant open:{}, please check if youve entered the right name",
9:"Musicreat - Aboit",
10:"Musicreater",
11:"Ver. {}",
12:"RYOUN",
13:"凌云团队",
14:"Team-Ryoun",
15:"Developer: Eilles(W-YI)",
16:"Email: EillesWan@outlook.com",
17:"QQ: 2647547478",
18:"QQ group: 861684859",
19:"Musicreater - Help",
20:"Select sound file",
21:"Select MIDI file",
22:"Select NoteText file",
23:"Get Note info",
24:"Write in Note info: {}",
25:"Select generating file",
26:"Select generating folder",
27:"Select generating .mcpack file",
28:"Input position info",
29:"Select generating world folder",
30:"Select generating Function Pack",
31:"Select .mcfunction file ",
32:"Select .bdx file ",
33:"DONE✔",
34:"Input playing rate",
35:"Generating",
36:"Select a world folder",
37:"Make sure",
38:"Generate .RyStruct file",
39:"FAILED❌",
40:"邮件反馈信息输入",
41:"Musicreater - Eilles - {}",
42:"执行实体名: {}",
43:"使用计分板: {}",
44:"所用的乐器: {}",
45:"当前音轨名: {}",
46:"Pack Name: {}",
47:"MusicTitle: {}",
48:"IsRepeat?: {}",
49:"玩家选择器: {}",
50:"修改主设置",
51:"修改节设置",
52:"游戏内置乐器如下: 请输入英文\n",
53:"Open...",
54:"Open Old Project...",
55:"Save",
56:"Save as...",
57:"Exit",
58:"File",
59:"Load tracks from sound",
60:"Load tracks from Midi",
61:"Load tracks from Text",
62:"Input notes to track",
63:"Edit",
64:"Generate file...",
65:"Generate function pack...",
66:"Generate .mcpack file...",
67:"Functions(Pack)",
68:"Save music as blocks into a map",
69:"Save music as blocks into a exist map...",
70:"Save music as commands into a map",
71:"Save music as commands into a exist map...",
72:"Save music as notebox into a map",
73:"Save music as notebox into a exist map...",
74:"World",
75:"generate符合当前音乐的函数播放器...",
76:"Save selected track as commands in .bdx file...",
77:"由 map导出至.bdx file...",
78:"由 map导出至.RyStruct file...",
79:"将函数载入 world...",
80:"将大函数分割并建立执行链...",
81:"辅助功能",
82:"Show generating result",
83:"建立位于localhost:8080上的websocket服务器播放选中音轨",
84:"实验功能",
85:"清除临时 file ",
86:"清除存在 file ",
87:"帮助",
88:"关于",
89:"发送错误日志反馈",
90:"帮助与疑问",
91:"音乐总设置(项目设置)",
92:" map/函数包名: ",
93:"音乐标题: ",
94:"是否重复: ",
95:"玩家选择器: ",
96:"重置项目设置",
97:"当前音轨设置(段落设置)",
98:"执行实体名: ",
99:"使用计分板: ",
100:"所用的乐器: ",
101:"当前音轨名: ",
102:"删除选中音轨",
}

161
languages/zhCN.py Normal file
View File

@ -0,0 +1,161 @@
# -*- coding:utf-8 -*-
# 由金羿翻译工具生成字符串列表
# 请在所需翻译文件前from 此文件 import READABLETEXT
READABLETEXT = {
'Translator':(("金羿 Eilles 原稿",True),),
# 此处是语言翻译者列表,其中每个元组第一项为显示文本,第二项为此文本是否为开发者名字
0:"错误❌",
1:"提示❗",
2:"清除log此句不载入日志",
3:"无法清除日志及临时文件",
4:"已存储",
5:"新建 音·创 项目",
6:"请选择旧类型的项目",
7:"请选择 音·创 项目",
8:"无法打开文件:{},请查看您是否输入正确",
9:"音·创 - 关于",
10:"音·创 Musicreater",
11:"当前版本:{}",
12:"""凌云我的世界开发团队\n×\n凌云计算机应用软件开发团队""",
13:"确定",
14:"请输入音符",
15:(("- 开发者 -",False),("金羿 Eilles",True),("EillesWan@outlook.com",False),("QQ 2647547478",False)),
# 此处是开发者列表,其中每个元组第一项为显示文本,第二项为此文本是否为开发者名字
16:"- 翻译者 -",
# 17:"",
18:"讨论群: 861684859",
19:"音·创 - 帮助",
20:"请选择钢琴声音的音乐文件",
21:"请选择 MIDI 文件",
22:"请选择 音符文本 文件",
23:"获取音符信息",
24:"音符数据写入{}",
25:"请选择文件生成的位置",
26:"请选择文件夹生成的位置",
27:"请选择.mcpack文件生成的位置",
28:"坐标信息输入",
29:"请选择世界文件夹生成的位置",
30:"请选择函数包生成的位置",
31:"请选择 .mcfunction 文件",
32:"请选择需要生成的.bdx文件",
33:"完成✔",
34:"输入播放速度",
35:"创建中",
36:"请选择世界文件夹所在的位置",
37:"请确认",
38:"生成.RyStruct文件",
39:"失败❌",
40:"邮件反馈信息输入",
41:"音·创 - 金羿 - {}",
42:"执行实体名:{}",
43:"使用计分板:{}",
44:"所用的乐器:{}",
45:"当前音轨名:{}",
46:"包名:{}",
47:"音乐标题:{}",
48:"是否重复:{}",
49:"玩家选择器:{}",
50:"修改主设置",
51:"修改节设置",
52:"游戏内置乐器如下:请输入英文\n",
53:"打开音·创项目...",
54:"打开旧项目...",
55:"保存项目",
56:"另存为...",
57:"退出",
58:"文件",
59:"从钢琴MP3导入音轨",
60:"从midi导入音轨",
61:"从文本文件导入音轨",
62:"输入音符至音轨",
63:"编辑",
64:"生成文件至...",
65:"生成函数包至...",
66:"生成附加包文件至...",
67:"函数(包)",
68:"将音乐以方块存储生成地图",
69:"将音乐以方块存储载入地图…",
70:"将音乐以指令存储生成地图",
71:"将音乐以指令存储载入地图…",
72:"将音乐以音符盒存储生成地图",
73:"将音乐以音符盒存储载入地图…",
74:"世界",
75:"生成符合当前音乐的函数播放器…",
76:"将选中音轨以指令存储生成.bdx文件…",
77:"由地图导出至.bdx文件…",
78:"由地图导出至.RyStruct文件…",
79:"将函数载入世界…",
80:"将大函数分割并建立执行链…",
81:"辅助功能",
82:"展示生成结果",
83:"建立位于localhost:8080上的websocket服务器播放选中音轨",
84:"实验性功能",
85:"清除日志文件",
86:"清除早期版本的存储文件",
87:"帮助",
88:"关于",
89:"发送错误日志反馈",
90:"帮助与疑问",
91:"音乐总设置(项目设置)",
# 92:"",
# 93:"",
# 94:"",
# 95:"",
96:"重置项目设置",
97:"当前音轨设置(段落设置)",
# 98:"",
# 99:"",
# 100:"",
# 101:"",
102:"删除选中音轨",
# 103:"",
# 104:"",
105:"找不到或无法读取文件😢:{}",
106:"您当前的项目已修改但未存储,是否先保存当前项目?",
107:"项目已经存储至:{}",
108:"音·创工程文件",
109:"任意类型",
110:"函数音创工程文件",
111:"MMFM0.0.6版本工程文件",
112:"全部类型",
113:"钢琴声音的音频文件",
114:"Midi文件",
115:"文本文件",
116:"请输入坐标:",
117:"您输入的格式有误,请重新输入!",
118:"我的世界指令函数文件",
119:"请输入执行链生成坐标:",
120:"您输入的格式有误,请重新输入。",
121:"您的函数文件不大于一万条指令,无需进行分割操作。",
122:"请输入执行链生成相对坐标:",
123:"FastBuilder结构文件",
124:"转换结束!\n{}",
125:"一秒,音乐走几拍?",
126:"按下确认后在游戏中使用connect指令连接localhost:8080即可播放",
127:"请输入区域选择的开始坐标:",
128:"请输入区域选择的结束坐标:",
129:"所选区块导出时是否需要保留空气方块?",
130:"音·创结构文件",
131:"文件已生成\n{}",
132:"文件无法生成\n{}\n{}",
133:"本功能尚未开发。",
134:"您的称呼",
135:"您的联系方式",
136:"您对问题的描述",
137:"在程序结束后将清除日志及临时文件信息。",
138:"在程序结束后将不会清除日志及临时文件信息。",
139:"修改包名",
140:"修改音乐标题",
141:"修改玩家选择器\n注意!要加上中括号“[]”",
142:"修改本音轨的执行实体名",
143:"修改本音轨所用的积分板",
144:"修改本音轨所用乐器",
145:"您输入的乐器并非游戏内置乐器,是否继续用您输入的字符作为乐器?",
146:"修改本音轨生成的文件名",
}

View File

@ -21,7 +21,7 @@ def makeZip(sourceDir, outFilename,compression = 8,exceptFile = None):
for parent, dirnames, filenames in os.walk(sourceDir): for parent, dirnames, filenames in os.walk(sourceDir):
for filename in filenames: for filename in filenames:
if filename == exceptFile: if filename == exceptFile:
continue; continue
print(filename) print(filename)
pathfile = os.path.join(parent, filename) pathfile = os.path.join(parent, filename)
arcname = pathfile[pre_len:].strip(os.path.sep) #相对路径 arcname = pathfile[pre_len:].strip(os.path.sep) #相对路径
@ -43,51 +43,51 @@ class report():
''':param senderName 发送者名称 ''':param senderName 发送者名称
:param senderContact 发送者联系方式 :param senderContact 发送者联系方式
:param describetion 问题描述''' :param describetion 问题描述'''
self.senderName = senderName; self.senderName = senderName
self.senderContact = senderContact; self.senderContact = senderContact
self.describetion = describetion; self.describetion = describetion
if not self.senderName : if not self.senderName :
self.senderName = 'Unknown'; self.senderName = 'Unknown'
if not self.senderContact : if not self.senderContact :
self.senderContact = 'None'; self.senderContact = 'None'
def emailReport(self): def emailReport(self):
'''使用E-mail方法发送当前的日志和临时文件等''' '''使用E-mail方法发送当前的日志和临时文件等'''
import smtplib import smtplib
from email.mime.text import MIMEText; from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart; from email.mime.multipart import MIMEMultipart
from email.header import Header; from email.header import Header
from nmcsup.log import log from nmcsup.log import log
log("发送错误报告") log("发送错误报告")
import os; import os
log("添加标题与正文") log("添加标题与正文")
msg = MIMEMultipart(); msg = MIMEMultipart()
#发送者与接收者显示名称 #发送者与接收者显示名称
msg["From"] = Header(self.senderName,'utf-8'); msg["From"] = Header(self.senderName,'utf-8')
msg["To"] = Header("W-YI (QQ2647547478)",'utf-8'); msg["To"] = Header("W-YI (QQ2647547478)",'utf-8')
#标题 #标题
msg["Subject"] = '音·创 - 来自 '+self.senderName+' 的错误报告'; msg["Subject"] = '音·创 - 来自 '+self.senderName+' 的错误报告'
#正文 #正文
msg.attach(MIMEText("来自"+self.senderName+"( "+self.senderContact+" )的错误描述:\n"+self.describetion,'plain','utf-8')); msg.attach(MIMEText("来自"+self.senderName+"( "+self.senderContact+" )的错误描述:\n"+self.describetion,'plain','utf-8'))
log("添加完毕,正在生成压缩包...") log("添加完毕,正在生成压缩包...")
makeZip("./","Temps&Logs.zip",exceptFile="Temps&Logs.zip"); makeZip("./","Temps&Logs.zip",exceptFile="Temps&Logs.zip")
attafile=MIMEText(open("Temps&Logs.zip",'rb').read(),"base64",'gb2312'); attafile=MIMEText(open("Temps&Logs.zip",'rb').read(),"base64",'gb2312')
attafile["Content-Type"] = 'application/octet-stream'; attafile["Content-Type"] = 'application/octet-stream'
attafile["Content-Disposition"] = 'attachment;filename="BugReport_from_'+self.senderName+'.zip"'; attafile["Content-Disposition"] = 'attachmentfilename="BugReport_from_'+self.senderName+'.zip"'
msg.attach(attafile); msg.attach(attafile)
log("完毕,准备发送") log("完毕,准备发送")
try: try:
smtp = smtplib.SMTP() smtp = smtplib.SMTP()
smtp.connect("smtp.163.com"); smtp.connect("smtp.163.com")
#smtp.login("RyounDevTeam@163.com","RyounDaiYi99"); #smtp.login("RyounDevTeam@163.com","RyounDaiYi99")
#SIQQKQQYCZRVIDFJ是授权密码 #SIQQKQQYCZRVIDFJ是授权密码
smtp.login("RyounDevTeam@163.com","SIQQKQQYCZRVIDFJ"); smtp.login("RyounDevTeam@163.com","SIQQKQQYCZRVIDFJ")
smtp.sendmail("RyounDevTeam@163.com",["RyounDevTeam@163.com",],msg.as_string()) smtp.sendmail("RyounDevTeam@163.com",["RyounDevTeam@163.com",],msg.as_string())
log("错误汇报邮件已发送") log("错误汇报邮件已发送")
except smtplib.SMTPException as e: except smtplib.SMTPException as e:
log("错误汇报邮件发送失败:\n"+str(e)); log("错误汇报邮件发送失败:\n"+str(e))
log("清空内存和临时文件") log("清空内存和临时文件")
del msg,attafile del msg,attafile
os.remove("./Temps&Logs.zip") os.remove("./Temps&Logs.zip")
@ -102,7 +102,7 @@ class version:
libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','pyinstaller','py7zr','websockets','torch') libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','pyinstaller','py7zr','websockets','torch')
'''当前所需库,有一些是开发用的,用户不需要安装''' '''当前所需库,有一些是开发用的,用户不需要安装'''
version = ('0.0.0','Delta',) version = ('0.0.1','Delta',)
'''当前版本''' '''当前版本'''
def __init__(self) -> None: def __init__(self) -> None:
@ -122,12 +122,13 @@ class version:
try: try:
shutil.rmtree(os.getenv('APPDATA')+'\\Musicreater\\') shutil.rmtree(os.getenv('APPDATA')+'\\Musicreater\\')
except: except:
pass; pass
for i in self.libraries: for i in self.libraries:
print("安装库:"+i) print("安装库:"+i)
os.system("python -m pip install "+i+" -i https://pypi.tuna.tsinghua.edu.cn/simple") os.system("python -m pip install "+i+" -i https://pypi.tuna.tsinghua.edu.cn/simple")
elif platform == 'linux': elif platform == 'linux':
os.system("sudo apt-get install python3-pip") os.system("sudo apt-get install python3-pip")
os.system("sudo apt-get install python3-tk")
os.system("sudo apt-get install python3-tkinter") os.system("sudo apt-get install python3-tkinter")
for i in self.libraries: for i in self.libraries:
print("安装库:"+i) print("安装库:"+i)

View File

@ -12,21 +12,21 @@ def delPart(Data,starter,ender,includeStart :bool= True,includend :bool= True):
starter与ender若为None则默认从首或尾开始''' starter与ender若为None则默认从首或尾开始'''
try: try:
if starter == None: if starter == None:
includeStart = True; includeStart = True
starter = Data[0]; starter = Data[0]
if ender == None: if ender == None:
includend = True; includend = True
ender = Data[len(Data)-1]; ender = Data[len(Data)-1]
if includend: if includend:
if includeStart: if includeStart:
return Data[Data.index(starter):len(Data)-Data[len(Data)::-1].index(ender)]; return Data[Data.index(starter):len(Data)-Data[len(Data)::-1].index(ender)]
else: else:
return Data[Data.index(starter)+1:len(Data)-Data[len(Data)::-1].index(ender)]; return Data[Data.index(starter)+1:len(Data)-Data[len(Data)::-1].index(ender)]
else: else:
if includeStart: if includeStart:
return Data[Data.index(starter):len(Data)-Data[len(Data)::-1].index(ender)-1]; return Data[Data.index(starter):len(Data)-Data[len(Data)::-1].index(ender)-1]
else: else:
return Data[Data.index(starter)+1:len(Data)-Data[len(Data)::-1].index(ender)-1]; return Data[Data.index(starter)+1:len(Data)-Data[len(Data)::-1].index(ender)-1]
except: except:
return 0 return 0
@ -37,21 +37,21 @@ def keepart(Data,starter,ender,includeStart :bool= True,includend :bool= True):
starter与ender若为None则默认从首或尾开始''' starter与ender若为None则默认从首或尾开始'''
try: try:
if starter == None: if starter == None:
includeStart = True; includeStart = True
starter = Data[0]; starter = Data[0]
if ender == None: if ender == None:
includend = True; includend = True
ender = Data[len(Data)-1]; ender = Data[len(Data)-1]
if includend: if includend:
if includeStart: if includeStart:
return Data[Data.index(starter):Data.index(ender)+1]; return Data[Data.index(starter):Data.index(ender)+1]
else: else:
return Data[Data.index(starter)+1:Data.index(ender)+1]; return Data[Data.index(starter)+1:Data.index(ender)+1]
else: else:
if includeStart: if includeStart:
return Data[Data.index(starter):Data.index(ender)]; return Data[Data.index(starter):Data.index(ender)]
else: else:
return Data[Data.index(starter)+1:Data.index(ender)]; return Data[Data.index(starter)+1:Data.index(ender)]
except: except:
return 0 return 0
@ -66,13 +66,13 @@ def keepart(Data,starter,ender,includeStart :bool= True,includend :bool= True):
def lenFunction(fun) -> int: def lenFunction(fun) -> int:
'''取得函数指令部分长度,即忽略#开头的注释''' '''取得函数指令部分长度,即忽略#开头的注释'''
try: try:
l = 0; l = 0
for i in fun: for i in fun:
if i.replace(" ",'')[0] == '#': if i.replace(" ",'')[0] == '#':
l += 1; l += 1
return len(fun)-l; return len(fun)-l
except: except:
return -1; return -1
@ -82,21 +82,21 @@ def funSplit(bigFile,maxCmdLen : int = 10000 ):
返回-1为大小低于maxCmdLen最长函数指令长度''' 返回-1为大小低于maxCmdLen最长函数指令长度'''
bigFile = bigFile.readlines() bigFile = bigFile.readlines()
if lenFunction(bigFile) < maxCmdLen: if lenFunction(bigFile) < maxCmdLen:
return -1; return -1
part = []; part = []
parts = []; parts = []
l = 0; l = 0
for i in bigFile: for i in bigFile:
if i.replace(" ",'')[0] == '#': if i.replace(" ",'')[0] == '#':
part.append(i+'\n'); part.append(i+'\n')
else: else:
part.append(i+'\n'); part.append(i+'\n')
l += 1; l += 1
if l >= 10000: if l >= 10000:
parts.append(part) parts.append(part)
part = []; part = []
l = 0; l = 0
return parts; return parts

View File

@ -13,7 +13,7 @@ def hans2pinyin(hans,style=3):
result = lazy_pinyin(hans=hans,style=style) result = lazy_pinyin(hans=hans,style=style)
final = '' final = ''
for i in result: for i in result:
final += i; final += i
return final return final
@ -83,7 +83,7 @@ def note2bdx(filePath:str,dire:list,Notes : list,ScoreboardName:str,Instrument:s
i = 0 i = 0
down = False down = False
blocks = [formCmdBlock(dire,cdl.pop(0),1,1)] blocks = [formCmdBlock(dire,cdl.pop(0),1,1)]
dire[1]+=1; dire[1]+=1
for j in cdl: for j in cdl:
if dire[1]+i > height: if dire[1]+i > height:
dire[0]+=1 dire[0]+=1
@ -124,12 +124,12 @@ def note2webs(Notes : list,Instrument:str, speed:float = 5.0, PlayerSelect:str='
await fcwslib.tellraw(websocket, '已连接服务器——音·创'+VER[1]+VER[0]+' 作者:金羿(W-YI)') await fcwslib.tellraw(websocket, '已连接服务器——音·创'+VER[1]+VER[0]+' 作者:金羿(W-YI)')
if isProsess: if isProsess:
length = len(Notes) length = len(Notes)
j = 1; j = 1
for i in range(len(Notes)): for i in range(len(Notes)):
await fcwslib.send_command(websocket,'execute @a'+PlayerSelect+' ~ ~ ~ playsound '+Instrument+' @s ~ ~ ~ 1000 '+str(Notes[i][0])+' 1000') await fcwslib.send_command(websocket,'execute @a'+PlayerSelect+' ~ ~ ~ playsound '+Instrument+' @s ~ ~ ~ 1000 '+str(Notes[i][0])+' 1000')
if isProsess: if isProsess:
fcwslib.send_command(websocket,'execute @a'+PlayerSelect+' ~ ~ ~ title @s actionbar §e▶ 播放中: §a'+str(j)+'/'+str(length)+' || '+str(int(j/length*1000)/10)) fcwslib.send_command(websocket,'execute @a'+PlayerSelect+' ~ ~ ~ title @s actionbar §e▶ 播放中: §a'+str(j)+'/'+str(length)+' || '+str(int(j/length*1000)/10))
j+=1; j+=1
time.sleep(Notes[i][1]/speed) time.sleep(Notes[i][1]/speed)
fcwslib.run_server(run_server) fcwslib.run_server(run_server)
@ -170,19 +170,19 @@ def note2RSworld(world:str,startpos:list,notes:list,instrument:str,speed:float =
:param note: 0~24 :param note: 0~24
:return Block()''' :return Block()'''
if powered: if powered:
powered = 'true'; powered = 'true'
else: else:
powered = 'false'; powered = 'false'
return Block('universal_minecraft','noteblock',{"instrument":ts(instrument.replace("note.",'')),'note':ts(str(note)),'powered':ts(powered)}) return Block('universal_minecraft','noteblock',{"instrument":ts(instrument.replace("note.",'')),'note':ts(str(note)),'powered':ts(powered)})
def formRepeater(delay:int,facing:str,locked:bool=False,powered:bool=False): def formRepeater(delay:int,facing:str,locked:bool=False,powered:bool=False):
'''生成中继器方块 '''生成中继器方块
:param delay: 1~4 :param delay: 1~4
:return Block()''' :return Block()'''
if powered:powered = 'true'; if powered:powered = 'true'
else:powered = 'false'; else:powered = 'false'
if locked:locked = 'true'; if locked:locked = 'true'
else:locked = 'false'; else:locked = 'false'
return Block('universal_minecraft','repeater',{"delay":ts(str(delay)),'facing':ts(facing),'locked':ts(locked),'powered':ts(powered)}) return Block('universal_minecraft','repeater',{"delay":ts(str(delay)),'facing':ts(facing),'locked':ts(locked),'powered':ts(powered)})

View File

@ -147,7 +147,7 @@ def Cmd2World(cmd:list,world:str,dire:list):
chunk.block_entities[(dire[0], dire[1], dire[2])] = universal_block_entity chunk.block_entities[(dire[0], dire[1], dire[2])] = universal_block_entity
chunk.changed = True chunk.changed = True
#集体上移 #集体上移
dire[1]+=1; dire[1]+=1
#真正开始 #真正开始
down = False down = False
for j in cdl: for j in cdl:

View File

@ -16,12 +16,12 @@ for path,dir_list,file_list in os.walk(r"./") :
try: try:
code -= code[code.index('#'):] code -= code[code.index('#'):]
except: except:
pass; pass
if code: if code:
print("\t"+code) print("\t"+code)
l+=1 l+=1
else: else:
pass; pass
input("\n最终代码行数为:"+str(l)) input("\n最终代码行数为:"+str(l))