1.重新采用Tk作为窗口库

2.优化界面布局
3.修改部分按钮无响应的bug
4.新增启动时的Saying
5.删除命令行模式
6.更新README文件,并增添英文README
This commit is contained in:
EillesWan 2022-01-02 21:43:34 +08:00
parent 1bc1c6485b
commit 17f9fa7ffc
11 changed files with 134 additions and 395 deletions

View File

@ -1,341 +0,0 @@
# -*- coding: utf-8 -*-
# W-YI 金羿
# QQ 2647547478
# 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com
# 版权所有 Team-Ryoun 金羿
# 若需转载或借鉴 请附作者
# 代码写的并非十分的漂亮还请大佬多多包涵本软件源代码依照Apache软件协议公开
import json
import os
import shutil
import threading
import sys
from msctspt.threadOpera import NewThread
from msctspt.bugReporter import version
from nmcsup.log import log
__version__ = version.version[1]+version.version[0]
__author__ = 'W-YI (金羿)'
log("系统工作————————加载变量及函数")
print("更新执行位置...")
if sys.platform == 'win32':
os.chdir(__file__[:len(__file__)-__file__[len(__file__)::-1].index('\\')])
log("更新执行位置,当前文件位置"+__file__)
else:
try:
os.chdir(__file__[:len(__file__) -
__file__[len(__file__)::-1].index('/')])
except:
pass
log("其他平台:"+sys.platform+"更新执行位置,当前文件位置"+__file__)
print('完成!')
def __main__():
print('建立变量,存入内存,载入字典常量函数')
# 主体部分
# 支持多文件同时操作
# dataset[{ 'mainset':{ 'x':'y' }, 'musics': [ { 'set' :{ 'A':'B' } , 'note' : [ [ 'a' , b ], ] }, ] }, ]
# 编辑:
# 修改主设置: dataset[第几个项目]['mainset']['什么设置'] = '设置啥'
# 修改音乐: dataset[第几个项目]['musics'][第几个音轨]['notes'][第几个音符][音符还是时间01] = 改成啥
# 修改音轨设置: dataset[第几个项目]['musics'][第几个音轨]['set']['什么设置'] = '设置啥'
#
# 新增音轨: dataset[第几个项目]['musics'].append(datasetmodelpart)
#
'''
dataset=[
{
'mainset':{
'PackName':"Ryoun",
'MusicTitle':'Noname',
'IsRepeat':False,
'PlayerSelect':''
},
'musics':[
{
'set':{
'EntityName':'music_support',
'ScoreboardName':'music_support',
'Instrument':'harp',
'FileName':"Music"
},
'notes':[
[0.0,1.0],
]
},
],
},
]
'''
global dataset
dataset = [
{
'mainset': {
'PackName': "Ryoun",
'MusicTitle': 'Noname',
'IsRepeat': False,
'PlayerSelect': ''
},
'musics': [
{
'set': {
'EntityName': 'MusicSupport',
'ScoreboardName': 'MusicSupport',
'Instrument': 'note.harp',
'FileName': "Music"
},
'notes': [
[0.0, 1.0],
]
},
],
},
]
global is_new_file
global is_save
global ProjectName
global NowMusic
is_new_file = True
is_save = True
ProjectName = ''
NowMusic = 0
def DMM(): # 反回字典用于编辑
datasetmodelpart = {
'set': {
'EntityName': 'MusicSupport',
'ScoreboardName': 'MusicSupport',
'Instrument': 'note.harp',
'FileName': "Music"
},
'notes': []
}
return datasetmodelpart
print("完成")
# 菜单命令
print('加载菜单命令...')
def exitapp(cmd):
log("程序正常退出", False)
global is_save
if is_save == False:
if '/s' in cmd:
saveProject()
else:
print("您尚未保存,请使用 /s 开关保存并退出")
return
try:
global dataset
del dataset
except:
pass
if '/c' in cmd:
print("清除log此句不载入日志")
try:
if os.path.exists("./log/"):
shutil.rmtree("./log/")
if os.path.exists("./logs/"):
shutil.rmtree("./logs/")
if os.path.exists("./cache/"):
shutil.rmtree("./cache/")
except:
print("无法清除日志及临时文件")
exit()
print('退出函数加载完成!')
print("载入文件读取函数")
def ReadFile(fn: str) -> list:
from nmcsup.nmcreader import ReadFile as fileRead
k = fileRead(fn)
if k == False:
log("找不到"+fn)
return
else:
return k
def ReadMidi(midfile: str) -> str:
from nmcsup.nmcreader import ReadMidi as midiRead
k = midiRead(midfile)
if k == False:
log("找不到"+midfile)
return
else:
return k
print('完成!')
print("载入命令函数")
def saveProject(cmd: list):
global is_new_file
if '/a' in cmd:
log("另存项目")
ProjectName = cmd[cmd.index('/a')+1]
else:
if is_new_file:
print("初次存储请使用 /a 开关规定存储文件名")
log("文件为未保存")
return
log("存储文件:"+ProjectName)
with open(ProjectName, 'w', encoding='utf-8') as f:
json.dump(dataset[0], f)
global is_save
is_save = True
print('保存项目函数加载完成!')
def loadMusic(cmd: list):
if '/mid' in cmd:
th = NewThread(ReadMidi, (cmd[cmd.index('/mid')+1],))
th.start()
def midiSPT(th):
for i in th.getResult():
datas = DMM()
datas['notes'] = i
dataset[0]['musics'].append(datas)
del th
global is_save
is_save = False
threading.Thread(target=midiSPT, args=(th,)).start()
del th
elif '/txt' in cmd:
th = NewThread(ReadFile, (cmd[cmd.index('/txt')+1],))
th.start()
def midiSPT(th):
for i in th.getResult():
datas = DMM()
datas['notes'] = i
dataset[0]['musics'].append(datas)
del th
global is_save
is_save = False
threading.Thread(target=midiSPT, args=(th,)).start()
elif '/input' in cmd:
datas = []
for i in cmd[cmd.index('/input')+1:]:
datas.append([str(i), 1.0])
from nmcsup.trans import note2list
datat = DMM()
datat['notes'] = note2list(datas)
dataset[0]['musics'].append(datat)
del datas, datat
global is_save
is_save = False
print('音轨载入函数加载完成!')
def funBuild(cmd: list):
if '/file' in cmd:
from msctspt.funcOpera import makeFuncFiles
makepath = cmd[cmd.index('/file')+1]
if makepath[-1] != '/':
makepath += '/'
makeFuncFiles(dataset[0], makepath)
elif '/directory' in cmd:
from msctspt.funcOpera import makeFunDir
makepath = cmd[cmd.index('/directory')+1]
if makepath[-1] != '/':
makepath += '/'
makeFunDir(dataset[0], makepath)
elif '/mcpack' in cmd:
import zipfile
from msctspt.funcOpera import makeFunDir
makepath = cmd[cmd.index('/mcpack')+1]
if makepath[-1] != '/':
makepath += '/'
if not os.path.exists('./temp/'):
os.makedirs('./temp/')
makeFunDir(dataset[0], './temp/')
shutil.move('./temp/'+dataset[0]['mainset']['PackName'] +
"Pack/behavior_packs/"+dataset[0]['mainset']['PackName']+"/functions", './')
shutil.move('./temp/'+dataset[0]['mainset']['PackName'] + "Pack/behavior_packs/" +
dataset[0]['mainset']['PackName']+"/manifest.json", './')
with zipfile.ZipFile(makepath+dataset[0]['mainset']['PackName']+'.mcpack', "w") as zipobj:
for i in os.listdir('./functions/'):
zipobj.write('./functions/'+i)
zipobj.write('./manifest.json')
shutil.move('./functions', './temp/')
shutil.move('./manifest.json', './temp/')
shutil.rmtree("./temp/")
print("函数建立函数加载完成")
if sys.platform == 'win32':
os.system("cls")
else:
os.system("clear")
if sys.platform in ('win32', 'linux'):
print("您当前的运行环境为标准桌面,您可以打开 Musicreater.py 运行窗口模式的 音·创")
print("您也可以输入 win 指令在不退出命令行模式的同时打开窗口模式\n")
print(__author__+" 音·创 —— 当前核心版本 "+__version__+'\n')
nowWorkPath = os.path.split(os.path.realpath(__file__))[0]
while True:
strcmd = input("MSCT "+nowWorkPath+">")
cmd = strcmd.lower().split(' ')
if cmd[0] == 'exit':
exitapp(cmd[1:])
elif cmd[0] == 'save':
saveProject(cmd[1:])
elif cmd[0] == 'load':
loadMusic(cmd[1:])
elif cmd[0] == 'win':
def run(cmd):
os.system(cmd)
if sys.platform == 'win32':
NewThread(run, ("python "+os.path.split(os.path.realpath(__file__))
[0]+"/Musicreater.py",)).start()
else:
NewThread(run, ("python3 "+os.path.split(os.path.realpath(__file__))
[0]+"/Musicreater.py",)).start()
elif cmd[0] == 'chdir':
nowWorkPath = os.path.realpath(cmd[1])
os.chdir(nowWorkPath)
elif cmd[0] == 'build':
funBuild(cmd[1:])
else:
os.system(strcmd)
if __name__ == '__main__':
__main__()

View File

@ -4,7 +4,7 @@
# W-YI 金羿 # W-YI 金羿
# QQ 2647547478 # QQ 2647547478
# 音·创 开发交流群 861684859 # 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com # Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
# 版权所有 Team-Ryoun 金羿 # 版权所有 Team-Ryoun 金羿
# 若需转载或借鉴 请附作者 # 若需转载或借鉴 请附作者
@ -1340,6 +1340,13 @@ def __main__():
# 下半部分框容器 # 下半部分框容器
DownFrame = tk.Frame(root, bg='blue') DownFrame = tk.Frame(root, bg='blue')
import random
texts = open('./resources/mySayings.txt','r',encoding='utf-8').readlines()
tk.Label(DownFrame,text=texts[random.randint(0,len(texts)-1)].replace('\n',''),fg='white',bg='black',font=('DengXian Light',20)).pack(fill='x')
del texts
# 音符列表菜单 # 音符列表菜单
NoteList_var = tk.StringVar() NoteList_var = tk.StringVar()

View File

@ -1,34 +1,37 @@
# Musicreater # 音·创 Musicreater
### 介绍 ### 介绍
音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件 音·创 Musicreater 是由金羿(*W-YI*)开发的一款 **《我的世界:基岩版》** 音乐生成辅助软件
欢迎加群861684859 欢迎加群861684859
### 软件架构 ### 软件架构
软件采用Python作为第一语言目前还没有使用其他语言辅助。现在的图形库是tkinter后期将使用BeeWare兼容安卓 软件采用 *Python* 作为第一语言,目前还没有使用其他语言辅助。使用 *Tkinter* 为图形库。
现阶段支持Windows7+Linux(版本嘛支持Python3.8就好) 支持 Windows7+ 以及各个支持 Python3.8 的 Linux
### 安装教程 ### 安装教程
正在到来。
### 从源代码运行教程
#### Windows7+ #### Windows7+
0. [Gitee下载需要登陆](https://gitee.com/EillesWan/Musicreater/repository/archive/master.zip) 0. [Gitee下载需要登陆](https://gitee.com/EillesWan/Musicreater/repository/archive/master.zip)
[Github下载](https://github.com/EillesWan/Musicreater/archive/refs/heads/master.zip)本程序 [Github下载](https://github.com/EillesWan/Musicreater/archive/refs/heads/master.zip)本程序源代码
1. 安装Python 3.8.10 1. 安装Python 3.8.10
[下载64位安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe) [下载64位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe)
[下载32位安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe) [下载32位Python安装包](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe)
2. 以管理员身份运行 补全库.py : 2. 以管理员身份运行 补全库.py :
- 按下 Ctrl+Shift+Esc 打开任务管理器 - 点击 “开始” 菜单,搜索 `命令提示符`
- 点击 "文件" 菜单中的 运行新任务 命令 - 右键点击 `命令提示符` 左键点击 “以管理员身份运行”
- 输入 `cmd` 并框选 "以管理员身份运行" 按下 "确定" - 将 “补全库.py” 拖拽入开启的窗口,按下回车
- 将 "补全库.py" 拖拽入开启的窗口,按下回车
3. 等待安装完成后,双击运行 Musicreater.py 3. 等待安装完成后,双击运行 Musicreater.py
#### Linux (测试版本Kali 2021.4) #### Linux
0. 若你没有足够优秀的环境,推荐先在终端敲: 0. 若你没有足够优秀的环境,推荐先在终端敲:
```bash ```bash
@ -56,13 +59,14 @@ python3 Musicreater.py
### 致谢 ### 致谢
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. 感谢广大群友为此程序提供的测试等支持 4. 感谢由 CMA_2401PT 带来的 BDXWorkShop 供本程序对于bdx操作的指导
5. 若您为我找出了错误但您的名字没有显示在此列表中,请联系我! 5. 感谢广大群友为此程序提供的测试等支持
6. 若您对我们有所贡献但您的名字没有显示在此列表中,请联系我!
### 作者<金羿>联系方式 ### 作者\<*金羿*\>(W-YI)联系方式
1. QQ 2647547478 1. QQ 2647547478
2. 电邮 EillesWan2006@163.com W-YI_DoctorYI@outlook.com 2. 电邮 EillesWan2006@163.com W-YI_DoctorYI@outlook.com

74
README_en.md Normal file
View File

@ -0,0 +1,74 @@
# Musicreater
### Introduction
Musicreater(音·创) is an Eilles(*W-YI*)'s app that is used for creating musics in **Minecraft: Bedrock Edition**.
Welcome to join our QQ group: 861684859
### Framework
Using *Python* to develop, using Tkinter as a graphics library.
Support Windows7+ && Linux (that supports Python3.8)
### Installation
Comming soon...
### Run with Source Code
#### Windows
0. First, download the source code pack of Musicreater.
[Download from Gitee (Need to Login)](https://gitee.com/EillesWan/Musicreater/repository/archive/master.zip)
[Download from Github](https://github.com/EillesWan/Musicreater/archive/refs/heads/master.zip)
1. Install Python 3.8.10
[Download the 64-bit Python Installer](https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe)
[Download the 32-bit Python Installer](https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe)
2. After completing installation, we need to install the libraries :
- Open "Start Menu" and find `cmd`
- Run `cmd` as Administrator
- Drag "补全库.py" into the opened window and press Enter
3. After completing installationdouble click Musicreater.py to run
#### Linux
0. If you 're not sure whether your environment is good enough, please run these commands on Terminal
```bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python3
sudo apt-get install python3-pip
sudo apt-get install git
```
1. Now if you are confident enough about your runtime environment, open Terminal on the place which you want to download Musicreater, and run these
```bash
sudo git clone https://gitee.com/EillesWan/Musicreater.git
cd Musicreater
python3 补全库.py
python3 Musicreater.py
```
### Instructions
1. Just make u understand the Chinese
2. If u dont understand, u can come to the QQ group or email me to ask questions
3. The English Edition is comming soon.
### Thanks
1. Thank [Fuckcraft](https://github.com/fuckcraft) “鸣凤鸽子”and so on for the function of Creating the Websocket Server for Minecraft: Bedrock Edition.
2. Thank 昀梦\<QQ1515399885\> for finding and correcting the bugs in the commands that *Musicreater* Created.
3. Thank Charlie_Ping “查理平” for bdx convert funtion.
4. Thank CMA_2401PT for BDXWorkShop as the .bdx structure's operation guide.
5. Thanks for a lot of groupmates who support me and help me to test the program.
6. If u have give me some help but u haven't been in the list, please contact me.
### Contact *Eilles(W-YI)*(金羿)
1. QQ 2647547478
2. E-mail EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
3. WeChat WYI_DoctorYI

View File

@ -99,10 +99,10 @@ class report():
class version: class version:
libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','briefcase','toga','pyinstaller','py7zr','websockets','torch') libraries = ('mido','amulet','amulet-core','amulet-nbt','piano_transcription_inference','pypinyin','pyinstaller','py7zr','websockets','torch')
'''当前所需库,有一些是开发用的,用户不需要安装''' '''当前所需库,有一些是开发用的,用户不需要安装'''
version = ('0.0.4.3','Beta',) version = ('0.0.0','Delta',)
'''当前版本''' '''当前版本'''
def __init__(self) -> None: def __init__(self) -> None:

View File

@ -1,7 +1,7 @@
音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件 音·创(Musicreater)是由金羿(W-YI)开发的一款《我的世界》基岩版音乐生成辅助软件
本软件源代码依照Apache软件协议公开。 本软件源代码依照Apache软件协议公开。
Copyright © W-YI 2021 Copyright © W-YI 2022
本软件是金羿前作函数音创和世界音创的集合版本,同时增加了大量功能更新。 本软件是金羿前作函数音创和世界音创的集合版本,同时增加了大量功能更新。
@ -31,6 +31,24 @@ Copyright © W-YI 2021
新更新日志 新更新日志
Delta 0.0.0
2022 1 2
1.重新采用Tk作为窗口库
2.优化界面布局
3.修改部分按钮无响应的bug
4.新增启动时的Saying
5.删除命令行模式
6.更新README文件并增添英文README
Gamma 0.0.0
2021 12 26~2021 12 31
1.使用BeeWare作为窗口库
2.兼容安卓,但是安卓上无法运行
3.兼容窗口化系统,但是无法实现正常功能
4.引申大量bug
Beta 0.0.4.3 Beta 0.0.4.3
2021 11 3~2021 12 26 2021 11 3~2021 12 26
1.不断改进包以及代码可读性 1.不断改进包以及代码可读性

BIN
resources/musicreater.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
resources/musicreater.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 KiB

11
resources/mySayings.txt Normal file
View File

@ -0,0 +1,11 @@
生命灵动 当用激情跃起奋发之力
奇偶数阵
学海无涯 应用爱意徜徉
在生命的起源寻找灵魂的慰藉
纪念那一段辉煌灿烂的青春年华
以梦想为驱使 创造属于自己的未来
集青春之力 绽放爱意之花
那个曾与我相伴的人 依稀在我的心头留恋
我爱你 我 爱 你
你是我灵魂中绽放出最艳丽的花朵
心之所向 意之所属

View File

@ -1,34 +0,0 @@
# Musicreater 音·创 命令行模式
为了对后期安卓的兼容,先支持命令行
## 命令列表
### exit \[/s\] \[/c\]
- ```/s``` 保存并退出
- ```/c``` 清除日志
### save \[/a \<fileName\>\]
- ```/a <文件名>``` 指定文件名保存
### load \[/\<loadMethod: input|txt|mid\> \<text|fileName\>\]
- ```/input <文本>``` 输入音符
- ```/txt <文件名>``` 从文本载入音符
- ```/mid <文件名>``` 解析midi文件载入音符
### win
- 开启窗口模式的 音·创(仅支持的系统下有效)
### chdir \<direction\>
- 切换当前工作目录
### build \[/\<buildMethod: file|directory|mcpack\> \<direction\>\]
- ```/file <目录位置>``` 在指定目录生成函数文件(散装)
- ```/directory <目录位置>``` 在指定目录生成一个附加包目录
- ```/mcpack <目录位置>``` 在指定目录生成一个.mcpack附加包