Compare commits
3 Commits
TkinterWin
...
oldUI
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79f99dd7ed | ||
|
|
af21b75b70 | ||
|
|
75df9dc167 |
@@ -1,120 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# W-YI 金羿
|
||||
# QQ 2647547478
|
||||
# 音·创 开发交流群 861684859
|
||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||
# 版权所有 Team-Ryoun 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray")
|
||||
# 若需转载或借鉴 请附作者
|
||||
|
||||
|
||||
"""
|
||||
音·创 (Musicreater)
|
||||
一款免费开源的 《我的世界:基岩版》 音乐制作软件
|
||||
Musicreater (音·创)
|
||||
A free opensource software which is used for creating all kinds of musics in Minecraft
|
||||
|
||||
Copyright 2022 Team-Ryoun
|
||||
|
||||
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软件协议公开
|
||||
|
||||
|
||||
# 下面为正文
|
||||
|
||||
# 一定会好起来的
|
||||
|
||||
|
||||
from msctLib.buildIN import version
|
||||
|
||||
__ver__ = f'{version.version[1]} {version.version[0]}'
|
||||
__author__ = '金羿Eilles'
|
||||
|
||||
import msctLib.display as disp
|
||||
|
||||
from msctLib.function import *
|
||||
|
||||
from msctLib.data import uniteIO
|
||||
|
||||
|
||||
hb = r''' __ __
|
||||
/\ \/\ \
|
||||
\ \ \_\ \ __ _____ _____ __ __
|
||||
\ \ _ \ /'__`\ /\ '__`\ /\ '__`\ /\ \/\ \
|
||||
\ \ \ \ \ /\ \L\.\_\ \ \L\ \\ \ \L\ \\ \ \_\ \
|
||||
\ \_\ \_\\ \__/.\_\\ \ ,__/ \ \ ,__/ \/`____ \
|
||||
\/_/\/_/ \/__/\/_/ \ \ \/ \ \ \/ `/___/> \
|
||||
\ \_\ \ \_\ /\___/
|
||||
\/_/ \/_/ \/__/
|
||||
____ __ __ __
|
||||
/\ _`\ __ /\ \__ /\ \ /\ \
|
||||
\ \ \L\ \ /\_\ _ __ \ \ ,_\\ \ \___ \_\ \ __ __ __
|
||||
\ \ _ <'\/\ \ /\`'__\\ \ \/ \ \ _ `\ /'_` \ /'__`\ /\ \/\ \
|
||||
\ \ \L\ \\ \ \\ \ \/ \ \ \_ \ \ \ \ \ /\ \L\ \ /\ \L\.\_\ \ \_\ \
|
||||
\ \____/ \ \_\\ \_\ \ \__\ \ \_\ \_\\ \___,_\\ \__/.\_\\/`____ \
|
||||
\/___/ \/_/ \/_/ \/__/ \/_/\/_/ \/__,_ / \/__/\/_/ `/___/> \
|
||||
/\___/
|
||||
\/__/ '''
|
||||
|
||||
|
||||
def __main__():
|
||||
import datetime, time, random, os, sys, zhdate
|
||||
|
||||
if datetime.date.today().month == 4 and datetime.date.today().day == 3:
|
||||
if sys.platform == 'win32':
|
||||
os.system('color 4e')
|
||||
os.system('cls')
|
||||
for i in range(len(hb)):
|
||||
print(hb[i], end='', flush=True)
|
||||
time.sleep(random.random() * 0.001)
|
||||
input("金羿 生日快乐!")
|
||||
elif '三月初五' in zhdate.ZhDate.today().chinese():
|
||||
input('缅怀先祖 祭祀忠勇 勿忘国耻 振兴中华')
|
||||
|
||||
else:
|
||||
|
||||
def test():
|
||||
print('!!!', end=' ')
|
||||
|
||||
def test2():
|
||||
print('???', end=' ')
|
||||
|
||||
window = disp.disp(
|
||||
disp.root,
|
||||
geometry='1200x800',
|
||||
menuWidget={
|
||||
'文件': {'新建': test, '打开': test},
|
||||
'编辑': {'撤销': test, '重做': test},
|
||||
'视图': {'缩放': test},
|
||||
'帮助': {'关于': disp.authorWindowStarter},
|
||||
},
|
||||
title='音·创 0.2 测试中',
|
||||
buttons=[
|
||||
{
|
||||
'新建': ('', test2),
|
||||
'打开': ('', test2)
|
||||
},
|
||||
{
|
||||
'测试': ('', test2)
|
||||
}
|
||||
],
|
||||
debug=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
__main__()
|
||||
@@ -1,425 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''音·创的Tkinter GUI窗口界面显示主程序
|
||||
:若要使用其他界面显示,请详见:
|
||||
:开发说明|指南'''
|
||||
|
||||
|
||||
import tkinter as tk
|
||||
import tkinter.simpledialog as sdialog
|
||||
import tkinter.filedialog as fdialog
|
||||
from msctLib.log import log
|
||||
|
||||
|
||||
DEFAULTBLUE = (0, 137, 242)
|
||||
# 0089F2
|
||||
|
||||
WEAKBLUE = (0, 161, 231)
|
||||
LIGHTBLUE = (38, 226, 255)
|
||||
# 26E2FF
|
||||
|
||||
RED = (255, 52, 50)
|
||||
# FF3432
|
||||
|
||||
PURPLE = (171, 112, 255)
|
||||
# AB70FF
|
||||
|
||||
GREEN = (0, 255, 33)
|
||||
# 00FF21
|
||||
|
||||
WHITE = (242, 244, 246)
|
||||
# F2F4F6
|
||||
|
||||
BLACK = (18, 17, 16)
|
||||
# 121110
|
||||
|
||||
|
||||
backgroundColor = WHITE
|
||||
frontgroundColor = BLACK
|
||||
loadingColor = DEFAULTBLUE
|
||||
errorColor = RED
|
||||
okColor = GREEN
|
||||
tipsColor = PURPLE
|
||||
|
||||
# 注:UI界面字体、代码字体
|
||||
fontPattern = ('DengXian Light', 'Fira Code')
|
||||
|
||||
|
||||
|
||||
# =========================================================
|
||||
# 设定函数部分
|
||||
# =========================================================
|
||||
|
||||
def setTitle(__root, title_: str = '') -> None:
|
||||
'''设置窗口标题
|
||||
:param title: str 窗口标题'''
|
||||
|
||||
if title:
|
||||
self.title = title_
|
||||
__root.title(self.title)
|
||||
if self.debug:
|
||||
log(f"设置窗口标题 {self.title}")
|
||||
|
||||
def setGeometry(__root, geometry: str = '0x0') -> None:
|
||||
'''设置窗口大小
|
||||
:param geometry: str 窗口大小'''
|
||||
__root.geometry(geometry)
|
||||
if self.debug:
|
||||
log(f"设置窗口大小{geometry}")
|
||||
|
||||
def setIcon(__root, bitmap: str = './musicreater.ico', default: str = '') -> bool:
|
||||
'''设置窗口图标
|
||||
:param bitmap: str 图标路径
|
||||
:param default: str 设置对于全局的默认图标路径
|
||||
注意,default参数仅在Windows下有效,其意为将所有没有图标的窗口设置默认图标。如果在非Windows环境使用default参数,将会引发一个错误
|
||||
:retuen bool 是否成功设置图标'''
|
||||
|
||||
try:
|
||||
if default:
|
||||
__root.iconbitmap(bitmap, default)
|
||||
log(f'设置图标为{bitmap},默认为{default}')
|
||||
else:
|
||||
__root.iconbitmap(bitmap)
|
||||
log(f'设置图标为{bitmap}')
|
||||
return True
|
||||
except Exception as e:
|
||||
log(str(e), 'ERROR')
|
||||
if self.debug:
|
||||
raise e
|
||||
return False
|
||||
|
||||
def setMenu(__root) -> None:
|
||||
'''设置根菜单'''
|
||||
if not self.menuWidgets:
|
||||
# 如果传入空参数则返回当前菜单
|
||||
try:
|
||||
return self._RootMenu
|
||||
except Exception as E:
|
||||
if self.debug:
|
||||
raise E
|
||||
log('无法读取菜单信息', 'WARRING')
|
||||
# 如果不是空参数则新建菜单
|
||||
log('新建一个菜单')
|
||||
|
||||
self._RootMenu = {}
|
||||
self._mainMenuBar = tk.Menu(__root)
|
||||
for menuName, menuCmd in self.menuWidgets.items():
|
||||
# 取得一个菜单名和一堆菜单函数及其显示名称
|
||||
menu = tk.Menu(self._mainMenuBar, tearoff=0)
|
||||
for cmdName, cmdFunc in menuCmd.items():
|
||||
if cmdName:
|
||||
menu.add_command(label=cmdName, command=cmdFunc)
|
||||
log('菜单项 -- ' + cmdName)
|
||||
else:
|
||||
menu.add_separator()
|
||||
log('分隔符 -- 分隔符')
|
||||
self._mainMenuBar.add_cascade(label=menuName, menu=menu)
|
||||
self._RootMenu[menuName] = menu
|
||||
log('计入一个菜单 -- ' + menuName)
|
||||
__root.config(menu=self._mainMenuBar)
|
||||
log('菜单设置完毕')
|
||||
|
||||
def addMenu(menuRoot: str = '', menuLabel: str = '', menuCommand=None):
|
||||
'''增加一个菜单项
|
||||
:param menuRoot : str
|
||||
菜单的根菜单,即所属的菜单上的文字
|
||||
:param menuLabel : str
|
||||
所需要增加的项目显示的文字
|
||||
:param menuCommand : <function>
|
||||
'''
|
||||
if menuRoot in self._RootMenu.keys:
|
||||
# 如果已经有父菜单
|
||||
if menuLabel:
|
||||
# 增加菜单指令
|
||||
self._RootMenu[menuRoot].add_command(
|
||||
label=menuLabel, command=menuCommand
|
||||
)
|
||||
else:
|
||||
# 增加分隔栏
|
||||
self._RootMenu[menuRoot].add_separator()
|
||||
else:
|
||||
# 没有父菜单则新增一个父菜单
|
||||
menu = tk.Menu(self._mainMenuBar, tearoff=False)
|
||||
if menuLabel:
|
||||
menu.add_command(label=menuLabel, command=menuCommand)
|
||||
else:
|
||||
menu.add_separator()
|
||||
self._mainMenuBar.add_cascade(label=menuRoot, menu=menu)
|
||||
self._RootMenu[menuRoot] = menu
|
||||
|
||||
def initWidget(__root) -> None:
|
||||
'''设置窗口小部件,分为:
|
||||
:言·论 WordView
|
||||
:快捷按钮面板 ButtonBar
|
||||
:设置框 SettingBar
|
||||
:音轨框 TrackBar
|
||||
:各个音轨的显示框 TrackFrame
|
||||
:信息显示版 InfoBar
|
||||
'''
|
||||
self._wordviewBar = tk.Label(
|
||||
__root,
|
||||
bg='black',
|
||||
fg='white',
|
||||
text=self.wordView,
|
||||
font=(fontPattern[0], 30),
|
||||
)
|
||||
# 定义 言·论 版面
|
||||
log('言·论版面设置完成')
|
||||
|
||||
self._infoBar = tk.Label(
|
||||
__root,
|
||||
bg='white',
|
||||
fg='black',
|
||||
text=self.infoBar,
|
||||
font=(fontPattern[0], 10),
|
||||
)
|
||||
# 定义 信息显示版
|
||||
log('信息显示版设置完成')
|
||||
|
||||
self._buttonBar = tk.Frame(
|
||||
__root,
|
||||
bd=2,
|
||||
)
|
||||
# 定义 快捷按钮面板. 注意!这里是以一个Frame为容器,而不是一个Button列表,后面的版面也以Frame容器居多
|
||||
|
||||
self.setButtonBar(self.buttons)
|
||||
|
||||
self._wordviewBar.pack(side='top', fill='x')
|
||||
self._buttonBar.pack(side='top', fill='x')
|
||||
|
||||
self._infoBar.pack(side='bottom', fill='x')
|
||||
|
||||
def setButtonBar(
|
||||
self,
|
||||
buttonList: list = [],
|
||||
defaultMissingTexturePath: str = './resources/uimage/missing_texture.png',
|
||||
separatorButtonTexturePath: str = './resources/uimage/separator_line.png',
|
||||
) -> None:
|
||||
'''设置快捷按钮面板
|
||||
:param buttonList : list
|
||||
快捷按钮列表,每个元素为一个字典,字典的键为按钮名称,值为一个元组,元组中第一项为按钮的图标,第二项为按钮的回调函数
|
||||
'''
|
||||
|
||||
# 图标应该如下
|
||||
# 新建 打开 保存 |
|
||||
|
||||
self._buttonBarList = []
|
||||
'''按钮对象列表,注意软件调用的时候千万别动!'''
|
||||
|
||||
separatorimg = tk.PhotoImage(file=separatorButtonTexturePath)
|
||||
|
||||
for buttons in buttonList:
|
||||
# 循环每个按钮组
|
||||
for name, args in buttons.items():
|
||||
# 循环每个按钮
|
||||
try:
|
||||
img = tk.PhotoImage(file=args[0])
|
||||
except:
|
||||
log('载入图片失败,使用默认图片','WARNING')
|
||||
if self.debug:
|
||||
raise FileNotFoundError(f'图片{args[0]}不存在')
|
||||
img = tk.PhotoImage(file=defaultMissingTexturePath)
|
||||
button = tk.Button(
|
||||
self._buttonBar,
|
||||
text=name,
|
||||
command=args[1],
|
||||
image=img,
|
||||
bd=2,
|
||||
compound='center',
|
||||
font=(fontPattern[0], 10),
|
||||
)
|
||||
button.pack(side='left', padx=5, pady=5)
|
||||
self._buttonBarList.append(button)
|
||||
# 添加按钮
|
||||
tk.Label(self._buttonBar, image=separatorimg).pack(
|
||||
side='left', padx=5, pady=5
|
||||
)
|
||||
|
||||
def setWordView(self, text: str) -> None:
|
||||
'''重新设置言·论版的文字'''
|
||||
self._wordviewBar['text'] = text
|
||||
|
||||
def setInfoBar(self, text: str) -> None:
|
||||
'''重新设置信息显示版的文字'''
|
||||
self._infoBar['text'] = text
|
||||
|
||||
# =========================================================
|
||||
# 预置函数部分
|
||||
# =========================================================
|
||||
|
||||
def authorWindowStarter(
|
||||
authors: tuple = (
|
||||
('金羿', 'Email EillesWan@outlook.com', 'QQ 2647547478'),
|
||||
('诸葛亮与八卦阵', 'QQ 474037765'),
|
||||
)
|
||||
):
|
||||
'''自定义作者界面'''
|
||||
from languages.lang import _
|
||||
from languages.lang import DEFAULTLANGUAGE
|
||||
from msctLib.buildIN import version
|
||||
|
||||
authorWindow = tk.Tk()
|
||||
authorWindow.title(_('关于'))
|
||||
authorWindow.geometry('550x600') # 像素
|
||||
tk.Label(authorWindow, text='', font=('', 15)).pack()
|
||||
tk.Label(authorWindow, text=_('F音创'), font=('', 35)).pack()
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
text='{} {}'.format(version.version[1] , version.version[0]),
|
||||
font=('', 15),
|
||||
).pack()
|
||||
# pack 的side可以赋值为LEFT RTGHT TOP BOTTOM
|
||||
# grid 的row 是列数、column是行排,注意,这是针对空间控件本身大小来的,即是指向当前控件的第几个。
|
||||
# place的 x、y是(x,y)坐标
|
||||
rylogo = tk.PhotoImage(file='./resources/RyounLogo.png')
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
image=rylogo,
|
||||
width=200,
|
||||
height=200,
|
||||
).pack()
|
||||
tk.Label(authorWindow, text=_('凌云pairs'), font=('', 20)).pack()
|
||||
tk.Label(authorWindow, text='', font=('', 15)).pack()
|
||||
tk.Label(authorWindow, text=_('开发者'), font=('', 15)).pack()
|
||||
for i in authors:
|
||||
for j in i:
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
text=j,
|
||||
font=(
|
||||
'',
|
||||
17 if i.index(j) == 0 else 15,
|
||||
'bold' if i.index(j) == 0 else '',
|
||||
),
|
||||
).pack()
|
||||
tk.Label(authorWindow, text='', font=('', 5)).pack()
|
||||
if DEFAULTLANGUAGE != 'zh-CN':
|
||||
tk.Label(authorWindow, text=_('译者'), font=('', 15)).pack()
|
||||
for i in _('TRANSLATERS').split(';'):
|
||||
for j in i.split(','):
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
text=j,
|
||||
font=(
|
||||
'',
|
||||
17 if i.split(',').index(j) == 0 else 15,
|
||||
'bold' if i.split(',').index(j) == 0 else '',
|
||||
),
|
||||
).pack()
|
||||
|
||||
def exitAboutWindow():
|
||||
authorWindow.destroy()
|
||||
|
||||
tk.Button(authorWindow, text=_('确定'), command=exitAboutWindow).pack()
|
||||
|
||||
authorWindow.mainloop()
|
||||
|
||||
|
||||
class ProgressBar:
|
||||
def __init__(
|
||||
self,
|
||||
root: tk.Tk = tk.Tk(),
|
||||
style: tuple = (DEFAULTBLUE, BLACK, WHITE),
|
||||
type: bool = False,
|
||||
info: str = '',
|
||||
debug: bool = False,
|
||||
) -> None:
|
||||
'''建立一个进度条或者加载等待界面
|
||||
:param root : tk.Tk
|
||||
建立进度条的根窗口
|
||||
:param style : tuple
|
||||
设置主题颜色,第一个参数为进度条或者等待转圈圈的颜色,第二个参数为前景色,第三个是背景色
|
||||
:param type : bool
|
||||
类型,为 False 时为进度条,为 True 时为等待板
|
||||
:param info : str
|
||||
显示的附加信息
|
||||
:param debug : bool
|
||||
是否输出日志到控制台'''
|
||||
self.root = root
|
||||
|
||||
|
||||
# TODO
|
||||
# 单选框与复选框
|
||||
|
||||
|
||||
if __name__ == '__mian__':
|
||||
|
||||
# __root,
|
||||
# debug: bool = False,
|
||||
# title: str = '音·创',
|
||||
# geometry: str = '0x0',
|
||||
# iconbitmap: tuple = ('./resources/musicreater.ico', './resources/musicreater.ico'),
|
||||
# menuWidget: dict = {},
|
||||
# wordView: str = '音·创 Musicreater',
|
||||
# buttons: list = [],
|
||||
# settingBox: list = [],
|
||||
# notemap: list = [],
|
||||
# infobar: str = '就绪',
|
||||
|
||||
'''使用参数建立基本的 音·创 窗口
|
||||
:param root 根窗口
|
||||
:param debug 是否将日志输出到控制台
|
||||
:param title 窗口标题
|
||||
wordview: str #言论部分显示的字样
|
||||
button: list = [ # 操作按钮部分
|
||||
dict = {
|
||||
按钮名称 : tuple(按钮图标,执行函数)
|
||||
},
|
||||
],
|
||||
settingbox: list = [ # 设置部分显示的字样及其对应的设置函数
|
||||
(
|
||||
设置名称:str,
|
||||
值类型:tuple,
|
||||
显示内容:str,
|
||||
设置操作函数:<function>,
|
||||
)
|
||||
],
|
||||
map: list = [ # 一首曲目的音符数据
|
||||
音符数据
|
||||
]
|
||||
:param infobar str 显示信息用
|
||||
'''
|
||||
|
||||
if debug:
|
||||
log('载入参数')
|
||||
|
||||
# 载入参量 注意!图标将不被载入参数
|
||||
|
||||
|
||||
self.title = title
|
||||
'''窗口标题'''
|
||||
|
||||
self.menuWidgets = menuWidget
|
||||
'''菜单设定项'''
|
||||
|
||||
self.wordView = wordView
|
||||
'''言·论 所显示的文字'''
|
||||
|
||||
self.buttons = buttons
|
||||
'''快捷功能按钮'''
|
||||
|
||||
self.settingBox = settingBox
|
||||
'''设置框'''
|
||||
|
||||
self.notemap = notemap
|
||||
'''音符列表'''
|
||||
|
||||
self.infoBar = infobar
|
||||
'''信息显示版所显示的文字'''
|
||||
|
||||
self.debug = debug
|
||||
'''是否打开调试模式'''
|
||||
|
||||
self.setTitle(__root,)
|
||||
|
||||
self.setGeometry(__root, geometry)
|
||||
self.setIcon(__root, *iconbitmap)
|
||||
|
||||
self.setMenu(__root)
|
||||
|
||||
self.initWidget(__root)
|
||||
|
||||
self.start(__root)
|
||||
|
||||
def start(self, __root) -> None:
|
||||
# 启动主消息循环
|
||||
__root.mainloop()
|
||||
30
README.md
@@ -1,11 +1,9 @@
|
||||
<h1 align="center">音·创 Musicreater</h1>
|
||||
|
||||
<p align="center">
|
||||
<img width="128" height="128" src="https://s1.ax1x.com/2022/05/06/Ouhghj.md.png" >
|
||||
<img width="128" height="128" src="https://s1.ax1x.com/2022/04/01/qhfOPA.png" >
|
||||
</p>
|
||||
|
||||
<h3 align="center">一个免费开源的《我的世界:基岩版》音乐编辑制作软件</h3>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://forthebadge.com/images/badges/built-with-love.svg">
|
||||
<p>
|
||||
@@ -19,31 +17,6 @@
|
||||
|
||||
简体中文🇨🇳 | [English🇬🇧](README_EN.md)
|
||||
|
||||
|
||||
> 是谁把科技的领域布满政治的火药
|
||||
>
|
||||
> 是谁把纯净的蓝天染上暗淡的沉灰
|
||||
>
|
||||
> 中国人民无不热爱自己伟大的祖国
|
||||
>
|
||||
> 我们不会忘记屈辱历史留下的惨痛
|
||||
>
|
||||
> 我们希望世界和平
|
||||
>
|
||||
> 我们希望获得世界的尊重
|
||||
>
|
||||
> 愿世上再也没有战争
|
||||
>
|
||||
> 无论是热还是冷
|
||||
>
|
||||
> 无论是经济还是政治
|
||||
>
|
||||
> 让美妙的和平的优雅的音乐响彻世界
|
||||
>
|
||||
> ——金羿
|
||||
> 2022 5 7
|
||||
|
||||
|
||||
## 软件介绍🚀
|
||||
|
||||
音·创 Musicreater 是一款免费开源的 **《我的世界:基岩版》** 音乐制作软件
|
||||
@@ -180,7 +153,6 @@ python3 Musicreater.py
|
||||
* - [ ] 20.以小节为单位做音符播放时间对标
|
||||
|
||||
|
||||
|
||||
[Bilibili: 凌云金羿]: https://img.shields.io/badge/Bilibili-%E5%87%8C%E4%BA%91%E9%87%91%E7%BE%BF-00A1E7?style=for-the-badge
|
||||
[Bilibili: 诸葛亮与八卦阵]: https://img.shields.io/badge/Bilibili-%E8%AF%B8%E8%91%9B%E4%BA%AE%E4%B8%8E%E5%85%AB%E5%8D%A6%E9%98%B5-00A1E7?style=for-the-badge
|
||||
[CodeStyle: black]: https://img.shields.io/badge/code%20style-black-121110.svg?style=for-the-badge
|
||||
|
||||
30
README_EN.md
@@ -1,11 +1,9 @@
|
||||
<h1 align="center">音·创 Musicreater</h1>
|
||||
|
||||
<p align="center">
|
||||
<img width="128" height="128" src="https://s1.ax1x.com/2022/05/06/Ouhghj.md.png" >
|
||||
<img width="128" height="128" src="https://s1.ax1x.com/2022/04/01/qhfOPA.png" >
|
||||
</p>
|
||||
|
||||
<h3 align="center">An open source and free software of making music in Minecraft</h3>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://forthebadge.com/images/badges/built-with-love.svg">
|
||||
<p>
|
||||
@@ -19,31 +17,6 @@
|
||||
|
||||
[简体中文🇨🇳](README.md) | English🇬🇧
|
||||
|
||||
|
||||
> Who has dropped political gunpowder into the technology
|
||||
>
|
||||
> Who has dyed clear blue sky into the dark grey
|
||||
>
|
||||
> All Chinese people love our great homeland
|
||||
>
|
||||
> We *WILL* remember the remain pain of the humiliating history
|
||||
>
|
||||
> We love the whole world but in peace
|
||||
>
|
||||
> We love everyone but under respect
|
||||
>
|
||||
> It is to be hoped that the war ends forever
|
||||
>
|
||||
> Whatever it is cold or hot
|
||||
>
|
||||
> Whatever it is economical or political
|
||||
>
|
||||
> Just let the wonderful music of peace surround the world
|
||||
>
|
||||
> ---- Eilles Wan
|
||||
> 7/5 2022
|
||||
|
||||
|
||||
**Notice that the language support of *README* may be a little SLOW.**
|
||||
|
||||
## Introduction🚀
|
||||
@@ -158,6 +131,7 @@ Musicreater - > function (package) - > the following four new functions
|
||||
|
||||
|
||||
|
||||
|
||||
[Bilibili: Eilles]: https://img.shields.io/badge/Bilibili-%E5%87%8C%E4%BA%91%E9%87%91%E7%BE%BF-00A1E7?style=for-the-badge
|
||||
[Bilibili: bgArray]: https://img.shields.io/badge/Bilibili-%E8%AF%B8%E8%91%9B%E4%BA%AE%E4%B8%8E%E5%85%AB%E5%8D%A6%E9%98%B5-00A1E7?style=for-the-badge
|
||||
[CodeStyle: black]: https://img.shields.io/badge/code%20style-black-121110.svg?style=for-the-badge
|
||||
|
||||
@@ -88,12 +88,11 @@ def __loadLanguage(languageFilename: str):
|
||||
return _text
|
||||
|
||||
|
||||
|
||||
if DEFAULTLANGUAGE in LANGUAGELIST.keys():
|
||||
_TEXT = __loadLanguage('./languages/' + DEFAULTLANGUAGE + '.lang')
|
||||
else:
|
||||
log(f"无法打开当前本地化文本{DEFAULTLANGUAGE}", level='ERROR')
|
||||
raise KeyError(f'无法打开默认语言{DEFAULTLANGUAGE}')
|
||||
if not DEFAULTLANGUAGE == 'zh-CN':
|
||||
if DEFAULTLANGUAGE in LANGUAGELIST.keys():
|
||||
_TEXT = __loadLanguage('./languages/' + DEFAULTLANGUAGE + '.lang')
|
||||
else:
|
||||
raise KeyError(f'无法打开默认语言{DEFAULTLANGUAGE}')
|
||||
|
||||
|
||||
def wordTranslate(singleWord: str, debug: bool = False):
|
||||
@@ -114,7 +113,7 @@ def _(text: str, debug: bool = False):
|
||||
if debug:
|
||||
raise KeyError(f'无法找到翻译文本{text}')
|
||||
else:
|
||||
log(f'无法找到本地化文本{text}','WARRING')
|
||||
log(f'无法找到本地化文本{text}','ERROR')
|
||||
return ''
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# 也切勿在正文结尾放!
|
||||
LANGKEY zh-CN
|
||||
LANGCHINESENAME 简体中文 中国大陆
|
||||
LANGENGLISHNAME Simplified Chinese, Chinese Mainland
|
||||
LANGENGLIFHNAME Simplified Chinese, Chinese Mainland
|
||||
LANGLOCALNAME 简体中文 中国大陆
|
||||
MSCT 音·创
|
||||
F音创 音·创 Musicreater
|
||||
|
||||
BIN
msctLib/UI设计图.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
msctLib/bugExecution.exe
Normal file
@@ -6,7 +6,7 @@
|
||||
class version:
|
||||
libraries = (
|
||||
'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
|
||||
'pyinstaller', 'py7zr','websockets', 'zhdate', 'requests'
|
||||
'pyinstaller', 'py7zr','websockets', 'torch', 'requests'
|
||||
)
|
||||
"""当前所需库"""
|
||||
|
||||
|
||||
326
msctLib/display.py
Normal file
@@ -0,0 +1,326 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''音·创的GUI窗口界面显示库
|
||||
:若要使用其他界面显示,请详见:
|
||||
:开发说明|指南'''
|
||||
|
||||
|
||||
import tkinter as tk
|
||||
import tkinter.simpledialog as sdialog
|
||||
import tkinter.filedialog as fdialog
|
||||
from msctLib.log import log
|
||||
|
||||
|
||||
DEFAULTBLUE = (0, 137, 242)
|
||||
# 0089F2
|
||||
|
||||
WEAKBLUE = (0, 161, 231)
|
||||
LIGHTBLUE = (38, 226, 255)
|
||||
# 26E2FF
|
||||
|
||||
RED = (255, 52, 50)
|
||||
PURPLE = (171, 112, 255)
|
||||
GREEN = (0, 255, 33)
|
||||
WHITE = (242, 244, 246)
|
||||
BLACK = (18, 17, 16)
|
||||
|
||||
|
||||
backgroundColor = WHITE
|
||||
frontgroundColor = BLACK
|
||||
loadingColor = DEFAULTBLUE
|
||||
errorColor = RED
|
||||
okColor = GREEN
|
||||
tipsColor = PURPLE
|
||||
|
||||
# 注:UI界面字体、代码字体
|
||||
fontPattern = ('DengXian Light', 'Fira Code')
|
||||
|
||||
|
||||
class disp:
|
||||
'''音·创 的基本Tk窗口显示库'''
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
root: tk.Tk = tk.Tk(),
|
||||
debug: bool = False,
|
||||
title: str = '音·创',
|
||||
geometry: str = '0x0',
|
||||
iconbitmap: tuple = ('', ''),
|
||||
menuWidget: dict = {},
|
||||
wordView: str = '音·创 Musicreater',
|
||||
buttons: list = [],
|
||||
settingBox: list = [],
|
||||
notemap: list = [],
|
||||
infobar:str = '就绪',
|
||||
) -> None:
|
||||
'''使用参数建立基本的 音·创 窗口
|
||||
:param root 根窗口
|
||||
:param debug 是否将日志输出到控制台
|
||||
:param title 窗口标题
|
||||
wordview: str #言论部分显示的字样
|
||||
button: list = [ # 操作按钮部分
|
||||
dict = {
|
||||
按钮名称 : tuple(按钮图标,执行函数)
|
||||
},
|
||||
],
|
||||
settingbox: list = [ # 设置部分显示的字样及其对应的设置函数
|
||||
(
|
||||
设置名称:str,
|
||||
值类型:tuple,
|
||||
显示内容:str,
|
||||
设置操作函数:<function>,
|
||||
)
|
||||
],
|
||||
map: list = [ # 一首曲目的音符数据
|
||||
音符数据
|
||||
]
|
||||
:param infobar 显示信息用
|
||||
'''
|
||||
|
||||
# 载入参量 注意!图标将不被载入参数
|
||||
self.__root = root
|
||||
'''窗口根'''
|
||||
|
||||
self.title = title
|
||||
'''窗口标题'''
|
||||
|
||||
self.menuWidgets = menuWidget
|
||||
'''菜单设定项'''
|
||||
|
||||
self.wordView = wordView
|
||||
'''言·论'''
|
||||
|
||||
self.buttons = buttons
|
||||
'''快捷功能按钮'''
|
||||
|
||||
self.settingBox = settingBox
|
||||
'''设置框'''
|
||||
|
||||
self.notemap = notemap
|
||||
'''音符列表'''
|
||||
|
||||
self.infoBar = infobar
|
||||
'''信息显示版'''
|
||||
|
||||
|
||||
|
||||
self.debug = debug
|
||||
'''是否打开调试模式'''
|
||||
|
||||
self.setTitle()
|
||||
self.setGeometry(geometry)
|
||||
self.setIcon(*iconbitmap)
|
||||
|
||||
self.setMenu()
|
||||
|
||||
self.initWidget()
|
||||
|
||||
# =========================================================
|
||||
# 设定函数部分
|
||||
# =========================================================
|
||||
|
||||
def setTitle(self) -> None:
|
||||
'''设置窗口标题'''
|
||||
self.__root.title = self.title
|
||||
if self.debug:
|
||||
log(f"设置窗口标题{self.title}")
|
||||
|
||||
def setGeometry(self,geometry:str = '0x0') -> None:
|
||||
'''设置窗口大小'''
|
||||
self.__root.geometry(geometry)
|
||||
if self.debug:
|
||||
log(f"设置窗口大小{geometry}")
|
||||
|
||||
def setIcon(
|
||||
self, bitmap: str = './musicreater.ico', default: str = ''
|
||||
) -> None:
|
||||
'''设置窗口图标
|
||||
注意,default参数仅在Windows下有效,其意为将所有没有图标的窗口设置默认图标
|
||||
如果在非Windows环境使用default参数,一个Error将被升起'''
|
||||
if not self.debug:
|
||||
try:
|
||||
if default:
|
||||
self.__root.iconbitmap(bitmap, default)
|
||||
log(f'设置图标为{bitmap},默认为{default}')
|
||||
else:
|
||||
self.__root.iconbitmap(bitmap)
|
||||
log(f'设置图标为{bitmap}')
|
||||
return True
|
||||
except Exception as e:
|
||||
log(str(e), 'ERROR')
|
||||
return False
|
||||
else:
|
||||
self.__root.iconbitmap(bitmap, default)
|
||||
return
|
||||
|
||||
def setMenu(self) -> None:
|
||||
'''设置根菜单'''
|
||||
if not self.menuWidgets:
|
||||
# 如果传入空参数则返回当前菜单
|
||||
try:
|
||||
return self.RootMenu
|
||||
except Exception as E:
|
||||
if self.debug:
|
||||
raise E
|
||||
else:
|
||||
log('无法读取菜单信息', 'WARRING')
|
||||
# 如果不是空参数则新建菜单
|
||||
self.RootMenu = {}
|
||||
self.mainMenuBar = tk.Menu(self.__root)
|
||||
for menuName, menuCmd in self.menuWidgets.items():
|
||||
# 取得一个菜单名和一堆菜单函数及其显示名称
|
||||
menu = tk.Menu(self.mainMenuBar, tearoff=0)
|
||||
for cmdName, cmdFunc in menuCmd.items():
|
||||
if cmdName:
|
||||
menu.add_command(label=cmdName, command=cmdFunc)
|
||||
else:
|
||||
menu.add_separator()
|
||||
self.mainMenuBar.add_cascade(label=menuName, menu=menu)
|
||||
self.RootMenu[menuName] = menu
|
||||
self.__root.config(menu=self.mainMenuBar)
|
||||
|
||||
def addMenu(self, menuRoot: str = '', menuLabel: str = '', menuCommand=None):
|
||||
'''增加一个菜单项
|
||||
:param menuRoot : str
|
||||
菜单的根菜单,即所属的菜单上的文字
|
||||
:param menuLabel : str
|
||||
所需要增加的项目显示的文字
|
||||
:param menuCommand : <function>
|
||||
'''
|
||||
if menuRoot in self.RootMenu.keys:
|
||||
# 如果已经有父菜单
|
||||
if menuLabel:
|
||||
# 增加菜单指令
|
||||
self.RootMenu[menuRoot].add_command(
|
||||
label=menuLabel, command=menuCommand
|
||||
)
|
||||
else:
|
||||
# 增加分隔栏
|
||||
self.RootMenu[menuRoot].add_separator()
|
||||
else:
|
||||
# 没有父菜单则新增一个父菜单
|
||||
menu = tk.Menu(self.mainMenuBar, tearoff=False)
|
||||
if menuLabel:
|
||||
menu.add_command(label=menuLabel, command=menuCommand)
|
||||
else:
|
||||
menu.add_separator()
|
||||
self.mainMenuBar.add_cascade(label=menuRoot, menu=menu)
|
||||
self.RootMenu[menuRoot] = menu
|
||||
|
||||
def initWidget(self,) -> None:
|
||||
'''设置窗口小部件,分为:
|
||||
:言·论 WordView
|
||||
:快捷按钮面板 ButtonBar
|
||||
:设置框 SettingBar
|
||||
:音轨框 TrackBar
|
||||
:各个音轨的显示框 TrackFrame
|
||||
:信息显示版 InfoBar
|
||||
'''
|
||||
self._wordviewBar = tk.Label(
|
||||
self.__root, bg='white', fg='black', text=self.wordView, font=(fontPattern[0], 30)
|
||||
)
|
||||
|
||||
self.setWordView(self.wordView)
|
||||
|
||||
def setWordView(self, text: str) -> None:
|
||||
self._wordviewBar['text'] = text
|
||||
|
||||
|
||||
# =========================================================
|
||||
# 预置函数部分
|
||||
# =========================================================
|
||||
|
||||
def authorWindowStarter(
|
||||
authors: tuple = (
|
||||
('金羿', 'Email EillesWan@outlook.com', 'QQ 2647547478'),
|
||||
('诸葛亮与八卦阵', 'QQ 474037765'),
|
||||
)
|
||||
):
|
||||
'''自定义作者界面'''
|
||||
from languages.lang import _
|
||||
from languages.lang import DEFAULTLANGUAGE
|
||||
from msctLib.buildIN import version
|
||||
|
||||
authorWindow = tk.Tk()
|
||||
authorWindow.title(_('关于'))
|
||||
authorWindow.geometry('550x600') # 像素
|
||||
tk.Label(authorWindow, text='', font=('', 15)).pack()
|
||||
tk.Label(authorWindow, text=_('F音创'), font=('', 35)).pack()
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
text='{} {}'.format(version.version[1] + version.version[0]),
|
||||
font=('', 15),
|
||||
).pack()
|
||||
# pack 的side可以赋值为LEFT RTGHT TOP BOTTOM
|
||||
# grid 的row 是列数、column是行排,注意,这是针对空间控件本身大小来的,即是指向当前控件的第几个。
|
||||
# place的 x、y是(x,y)坐标
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
image=tk.PhotoImage(file='./resources/RyounLogo.png'),
|
||||
width=200,
|
||||
height=200,
|
||||
).pack()
|
||||
tk.Label(authorWindow, text=_('凌云pairs'), font=('', 20)).pack()
|
||||
tk.Label(authorWindow, text='', font=('', 15)).pack()
|
||||
tk.Label(authorWindow, text=_('开发者'), font=('', 15)).pack()
|
||||
for i in authors:
|
||||
for j in i:
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
text=j,
|
||||
font=(
|
||||
'',
|
||||
17 if i.index(j) == 0 else 15,
|
||||
'bold' if i.index(j) == 0 else '',
|
||||
),
|
||||
).pack()
|
||||
tk.Label(authorWindow, text='', font=('', 5)).pack()
|
||||
if DEFAULTLANGUAGE != 'zh-CN':
|
||||
tk.Label(authorWindow, text=_('译者'), font=('', 15)).pack()
|
||||
for i in _('TRANSLATERS').split(';'):
|
||||
for j in i.split(','):
|
||||
tk.Label(
|
||||
authorWindow,
|
||||
text=j,
|
||||
font=(
|
||||
'',
|
||||
17 if i.split(',').index(j) == 0 else 15,
|
||||
'bold' if i.split(',').index(j) == 0 else '',
|
||||
),
|
||||
).pack()
|
||||
|
||||
def exitAboutWindow():
|
||||
authorWindow.destroy()
|
||||
|
||||
tk.Button(authorWindow, text=_('确定'), command=exitAboutWindow).pack()
|
||||
|
||||
authorWindow.mainloop()
|
||||
|
||||
|
||||
class ProgressBar:
|
||||
def __init__(
|
||||
self,
|
||||
root: tk.Tk = tk.Tk(),
|
||||
style: tuple = (DEFAULTBLUE, BLACK, WHITE),
|
||||
type: bool = False,
|
||||
info: str = '',
|
||||
debug: bool = False,
|
||||
) -> None:
|
||||
'''建立一个进度条或者加载等待界面
|
||||
:param root : tk.Tk
|
||||
建立进度条的根窗口
|
||||
:param style : tuple
|
||||
设置主题颜色,第一个参数为进度条或者等待转圈圈的颜色,第二个参数为前景色,第三个是背景色
|
||||
:param type : bool
|
||||
类型,为 False 时为进度条,为 True 时为等待板
|
||||
:param info : str
|
||||
显示的附加信息
|
||||
:param debug : bool
|
||||
是否输出日志到控制台'''
|
||||
self.root = root
|
||||
|
||||
|
||||
if __name__ == '__mian__':
|
||||
import os
|
||||
|
||||
os.chdir('../')
|
||||
disp.authorMenu()
|
||||
@@ -75,7 +75,7 @@ def log(info:str = '',level : str = 'INFO', isPrinted:bool = True):
|
||||
f.write(outputinfo+'\n')
|
||||
|
||||
if isPrinted:
|
||||
input(outputinfo)
|
||||
print(outputinfo)
|
||||
|
||||
return True
|
||||
except:
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
开发说明\|指南
|
||||
==============
|
||||
|
||||
***不要看了,这玩意没啥意义了。***
|
||||
|
||||
此文件旨在使后期欲参与开发之人员减轻其开发负担,同时也为了我们正在开发的人员详细说明功能与用法
|
||||
掌握开发指南之后,在调用函数等的过程中将会更加方便
|
||||
|
||||
@@ -91,24 +89,19 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
||||
5. `buttons`
|
||||
|
||||
快捷功能按钮的列表,列表的元素为字典,字典的键是按钮的名称,值为一个元组,元组中含有两个元素,其中元组的第1个元素为按钮图标,是一个图片的路径;第2个元素为执行的函数,其值应当是一个函数对象。
|
||||
值得注意的是,每个字典中包含的按钮组件会分到一个组之中,两个组之间会使用分隔符分割
|
||||
|
||||
```python
|
||||
button: list = [
|
||||
dict{ # 操作按钮部分
|
||||
button: list = [ # 操作按钮部分
|
||||
dict{
|
||||
str"按钮名称" : tuple(
|
||||
按钮图标,
|
||||
执行函数
|
||||
),
|
||||
...
|
||||
)
|
||||
},
|
||||
...
|
||||
],
|
||||
```
|
||||
|
||||
其中,如果执行图标找不到了或者无法读取了,就会使用“材质丢失”图标作为图标,当然也可以通过函数`setButtonBar`中的参数`defaultMissingTexturePath`来设置默认的在职丢失图标路径,同理,使用`separatorButtonTexturePath`可以设置默认的分割线路径……
|
||||
但是啊!但是!我虽然建议用不同的display库来达到不同的显示效果……但我没说你们都带一套自己的图标包撒!想要绘制图标包也很简单,我们之后应该会出图标包的加载工具(吧?)
|
||||
|
||||
|
||||
6. `settingBox`
|
||||
|
||||
@@ -138,7 +131,6 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
||||
7. `notemap`
|
||||
|
||||
音符数据表,用于存储曲谱信息,存储格式如下
|
||||
|
||||
```python
|
||||
notemap: list = [ # 音轨列表
|
||||
dict{ # 单个音轨
|
||||
@@ -173,37 +165,21 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
||||
|
||||
- 函数
|
||||
|
||||
1. `setTitle`设置窗口标题
|
||||
1. `setMenu`对菜单的基础设定
|
||||
|
||||
```python
|
||||
:param title: str 窗口标题
|
||||
{
|
||||
菜单名 : {
|
||||
选项名 : 选项函数
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
修改了变量`self.title`之后需要执行此函数以切换标题,或者通过此函数修改窗口标题信息。
|
||||
|
||||
2. `setGeometry`设置窗口大小
|
||||
|
||||
```python
|
||||
:param geometry: str 窗口大小
|
||||
```
|
||||
|
||||
由于不希望您经常修改窗口大小,我就没有把窗口大小的变量放在类里面。只能通过这个函数来修改窗口大小。
|
||||
|
||||
3. `setIcon`设置窗口图标
|
||||
|
||||
```python
|
||||
:param bitmap: str 图标路径
|
||||
:param default: str 设置对于全局的默认图标路径
|
||||
:retuen bool 是否成功设置图标
|
||||
```
|
||||
|
||||
同上,我们不希望您经常修改窗口图标,所以没有把图标路径作为变量放在类里面。所以你只能通过这个函数修改窗口的图标。
|
||||
|
||||
值得注意的是,default参数仅在Windows下有效,如果在非Windows环境使用default参数,将会引发一个错误
|
||||
|
||||
4. `setMenu`设置窗口菜单
|
||||
|
||||
实例化此类之后会运行这个函数进行窗口根菜单配置,如果当前对象中没有菜单,则会对其依照类中的响应参数进行配置,如果有则返回菜单中的内容(一个字典,键为菜单名称)
|
||||
注:
|
||||
`菜单名` : `str` 显示在菜单上的字符串
|
||||
`选项名` : `str` 显示在菜单选项上的字符串
|
||||
`选项函数` : `function` 菜单调取的函数(无返回值,无入参)
|
||||
当 `选项名` 的布尔值判定为 `False` 的时候,无论 `选项函数` 为何,皆插入一段分割线,但 `选项函数` 不得为空
|
||||
|
||||
2. `setWidget`对窗口部件的放置
|
||||
```python
|
||||
@@ -216,7 +192,12 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
||||
按钮名称 : tuple(按钮图标,执行函数)
|
||||
},
|
||||
],
|
||||
settingbox: list = [ #设置部分显示的字样及其对应的设置函数置操作函数:<function>,
|
||||
settingbox: list = [ #设置部分显示的字样及其对应的设置函数
|
||||
(
|
||||
设置名称:str,
|
||||
值类型:tuple,
|
||||
显示内容:str,
|
||||
设置操作函数:<function>,
|
||||
)
|
||||
],
|
||||
map: list = [
|
||||
@@ -225,6 +206,11 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
||||
```
|
||||
注:
|
||||
|
||||
上文中,值类型可以是如下几个项
|
||||
1. `('str',)` 字符串类型,使用文本框输入数据
|
||||
2. `('bool',)` 布尔类型,使用复选框输入数据
|
||||
3. `('num',最小值:int,最大值:int,步长:int = 1)` 数值类型,使用数值滑动条输入数据
|
||||
4. `('list',列表项:list)` 单选类型,即列表中多选一,使用单选框输入数据
|
||||
|
||||
值得注意的是,在kwgs中修改的部件设置,可以在其变量中读取或热修改,对应的变量如下
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''此文件为音·创的插件加载程序,为了满足各平台需求,使用的是CLI界面'''
|
||||
|
||||
# W-YI 金羿
|
||||
# QQ 2647547478
|
||||
# 音·创 开发交流群 861684859
|
||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||
# 版权所有 Team-Ryoun 金羿
|
||||
# 若需转载或借鉴 请附作者
|
||||
|
||||
|
||||
"""
|
||||
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软件协议公开
|
||||
|
||||
|
||||
# 下面为正文
|
||||
|
||||
|
||||
print("""
|
||||
音·创 插件管理
|
||||
Musicreater PLUGINS Management
|
||||
""")
|
||||
|
||||
# 准备启用
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import brotli
|
||||
class BdxConverter:
|
||||
__header = "BD@"
|
||||
__bin_header = b"BDX"
|
||||
__generator_author = b"& Musicreater"
|
||||
__generator_author = b"&Musicreater"
|
||||
|
||||
keys = {
|
||||
# x--, x++, addSmallX(-128~127), addX(-32768~32767), addBigX(-2147483648~2147483647)
|
||||
@@ -16,7 +16,7 @@ class BdxConverter:
|
||||
"z": [b"\x13", b"\x12", b"\x1e", b"\x18", b"\x19"],
|
||||
"end": b"\x58",
|
||||
"isSigned": b"\x5a",
|
||||
"placeCommandBlockWithData": b"\x1b",#用不上
|
||||
"placeCommandBlockWithData": b"\x1b",
|
||||
"placeBlock": b"\x07"
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ class BdxConverter:
|
||||
:return:
|
||||
"""
|
||||
_types = b""
|
||||
|
||||
|
||||
for block in self.blocks:
|
||||
# print(f"当前方块:{block['block_name']}, 位置: {block['direction']}]")
|
||||
diff = self.move_pointer(self.direction, block["direction"])
|
||||
@@ -180,7 +182,7 @@ class BdxConverter:
|
||||
:return: bytes of command_block
|
||||
"""
|
||||
|
||||
block_id = b"\x24"
|
||||
block_id = b"\x1b" + self.block_type.index(block["block_name"]).to_bytes(2, byteorder="big", signed=False)
|
||||
particular_value = block["particular_value"].to_bytes(2, byteorder="big", signed=False)
|
||||
block_header = block_id + particular_value
|
||||
for i in [
|
||||
|
||||
@@ -90,4 +90,48 @@ class report:
|
||||
os.remove("./Temps&Logs.zip")
|
||||
|
||||
|
||||
from msctLib.buildIN import version
|
||||
class version:
|
||||
libraries = (
|
||||
'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
|
||||
'pyinstaller', 'py7zr','websockets', 'torch', 'requests', 'zhdate'
|
||||
)
|
||||
"""当前所需库"""
|
||||
|
||||
version = ('0.1.6', 'Delta',)
|
||||
"""当前版本"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
self.libraries = version.libraries
|
||||
"""当前所需库"""
|
||||
|
||||
self.version = version.version
|
||||
"""当前版本"""
|
||||
|
||||
|
||||
def installLibraries(self,index:str = 'https://pypi.tuna.tsinghua.edu.cn/simple'):
|
||||
"""安装全部开发用库"""
|
||||
from sys import platform
|
||||
import os
|
||||
if platform == 'win32':
|
||||
import shutil
|
||||
try:
|
||||
shutil.rmtree(os.getenv('APPDATA') + '\\Musicreater\\')
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
for i in self.libraries:
|
||||
print("安装库:" + i)
|
||||
os.system(f"python -m pip install {i} -i {index}")
|
||||
elif platform == 'linux':
|
||||
os.system("sudo apt-get install python3-pip")
|
||||
os.system("sudo apt-get install python3-tk")
|
||||
os.system("sudo apt-get install python3-tkinter")
|
||||
for i in self.libraries:
|
||||
print("安装库:" + i)
|
||||
os.system(f"sudo python3 -m pip install {i} -i {index}")
|
||||
|
||||
|
||||
def __call__(self):
|
||||
'''直接安装库,顺便返回一下当前版本'''
|
||||
self.installLibraries()
|
||||
return self.version
|
||||
|
||||
@@ -188,14 +188,6 @@ def formCmdBlock(direction: Iterable, command: str, particularValue: int, implus
|
||||
"needRedstone": int #是否需要红石 1 bytes
|
||||
}
|
||||
'''
|
||||
# for particularValue, is like this
|
||||
# :0 下 无条件
|
||||
# :1 上 无条件
|
||||
# :2 z轴负方向 无条件
|
||||
# :3 z轴正方向 无条件
|
||||
# :4 x轴负方向 无条件
|
||||
# :5 x轴正方向 无条件
|
||||
print(f"==[DEBUG]=={direction}: {command} {'下' if particularValue == 0 else '上' if particularValue ==1 else 'z-' if particularValue ==2 else 'z+' if particularValue==3 else 'x-' if particularValue==4 else 'x+'} {'脉冲' if impluse==0 else '循环' if impluse ==1 else '连锁'} {'有条件' if condition else '无条件'} {'需要红石' if needRedstone else '不需要红石'}")
|
||||
return {"direction": direction,
|
||||
"block_name": "command_block",
|
||||
"particular_value": particularValue,
|
||||
@@ -280,7 +272,7 @@ def music2cmdBlocks(direction: Iterable, music: dict, isProsess: bool = False, h
|
||||
direction = list(direction)
|
||||
|
||||
def trackDealing(direction,track):
|
||||
# print('=========DEBUG=========音轨起方块:', direction)
|
||||
print('=========DEBUG=========音轨起方块:', direction)
|
||||
blocks = []
|
||||
cmdList = classList_conversion_SinglePlayer(track['notes'], track['set']['ScoreboardName'],
|
||||
music['mainset']['PlayerSelect'], isProsess)
|
||||
@@ -306,7 +298,7 @@ def music2cmdBlocks(direction: Iterable, music: dict, isProsess: bool = False, h
|
||||
# :4 x轴负方向 无条件
|
||||
# :5 x轴正方向 无条件
|
||||
for cmd in cmdList:
|
||||
# print('=========DEBUG=========方块:', dire)
|
||||
print('=========DEBUG=========方块:', dire)
|
||||
blocks.append(formCmdBlock(dire, cmd, 5 if (down is False and dire[1] == height + direction[1]) or (
|
||||
down and dire[1] == direction[1] + 1) else 0 if down else 1, 2, needRedstone=False))
|
||||
if down:
|
||||
@@ -330,7 +322,6 @@ def music2cmdBlocks(direction: Iterable, music: dict, isProsess: bool = False, h
|
||||
for th in threads:
|
||||
allblocks += th.getResult()
|
||||
|
||||
print(allblocks)
|
||||
return allblocks
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 7.6 MiB After Width: | Height: | Size: 123 KiB |
BIN
resources/msctIcon_256px.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
resources/msctIcon_512px.png
Normal file
|
After Width: | Height: | Size: 123 KiB |
BIN
resources/musicreater.ico
Normal file
|
After Width: | Height: | Size: 38 KiB |
@@ -8,23 +8,23 @@
|
||||
那个曾与我相伴的人 依稀在我的心头留恋
|
||||
你是我灵魂中绽放出最艳丽的花朵
|
||||
心之所向 意之所属
|
||||
一个蛋从外面被敲开,注定被吃掉,但从里面啄开,没准是只鹰 ——长津湖
|
||||
一个蛋从外面被敲开,注定被吃掉\n但从里面啄开,没准是只鹰 ——长津湖
|
||||
音·创
|
||||
辉煌的、璀璨的、无边无际、铺天盖地的晚霞——洒下斑驳的金光,染红了整片山河
|
||||
辉煌的、璀璨的、无边无际、铺天盖地的晚霞\n洒下斑驳的金光,染红了整片山河
|
||||
《赫兰圣殿》
|
||||
风,摇曳着,轻抚着他的脸颊,半壁残阳正留恋着人世最后一抹温暖
|
||||
风,摇曳着,轻抚着他的脸颊\n半壁残阳正留恋着人世最后一抹温暖
|
||||
清晨的阳光将吹散人间的雾霭 照亮每一寸土壤
|
||||
远方的山川 总会踏着白雾前来
|
||||
梦中的世界 总被现实相依存
|
||||
敌人都是自己树立的,生存的道路上想要披荆斩棘,那就得学会化敌为友
|
||||
敌人都是自己树立的\n生存的道路上想要披荆斩棘,那就得学会化敌为友
|
||||
有光之处必有影 有影之处必有光
|
||||
一生所恋 相伴相随
|
||||
你的眼眸是剔透的晶灯 散发着醉人心扉的清光
|
||||
海波激出透人心脾的欢呼
|
||||
英雄何必要站在光中?深入黑暗,我自发光。
|
||||
英雄何必要站在光中?\n深入黑暗,我自发光。
|
||||
如果我们有三生三世的时间\n那我们将渡过三百乘以三百六十个潮涨潮落
|
||||
善善不能用 恶恶不能去
|
||||
知行合一,格物致知;远沂博索,夕惕若厉;蕙心执质,嘉言懿行;怀瑾握瑜,心若芷萱。
|
||||
知行合一,格物致知;远沂博索,夕惕若厉;\n蕙心执质,嘉言懿行;怀瑾握瑜,心若芷萱。
|
||||
纪念 追忆 那段不平凡的青春
|
||||
守望黑夜的人,切莫忘记黎明的光彩 ——原神
|
||||
与邪佞战斗的人,切莫失掉正直的心 ——原神
|
||||
@@ -42,7 +42,7 @@
|
||||
给大家带来笑容 这就是我存在的使命
|
||||
不忘本源 牢记故地
|
||||
一厢情愿即是真 心海浮沉即为灵
|
||||
听戏时要点最红的名伶,遛鸟时要买最名贵的画眉——此即人生 ——原神
|
||||
听戏时要点最红的名伶,\n遛鸟时要买最名贵的画眉\n——此即人生 ——原神
|
||||
「精巧」是千年的积淀,而其背后皆存于「意义」
|
||||
世事无常,悲喜难料 ——原神
|
||||
金钱在死亡面前毫不重要
|
||||
@@ -54,7 +54,7 @@ There is NO heroes, only honors.
|
||||
A man achieve with challenges.
|
||||
种果得果,等的就是这份收获的喜悦 ——原神
|
||||
事了拂衣去,深藏功与名
|
||||
万事开头虽难,倾注的情感也多;而欲永恒,仍需重新审视自身;不小心处理,灵魂便留下裂纹无法挽回。
|
||||
万事开头虽难,倾注的情感也多;\n而欲永恒,仍需重新审视自身\n不小心处理,灵魂便留下裂纹无法挽回。
|
||||
历经历史的沉淀,留下希望的继承
|
||||
身为凡民,血脉脆弱,却也坚强
|
||||
民为本,社稷次之,君为轻 ——孟子
|
||||
@@ -79,7 +79,7 @@ A man achieve with challenges.
|
||||
除了路途中的花与枫叶,还有心中的「道」 ——原神
|
||||
只有败北,才能感悟差距,才有机会成长 ——原神
|
||||
命运的邂逅,必定有其意义 ——原神
|
||||
万商云来,千船继至。百货迭出,诸海历览。 ——原神
|
||||
万商云来,千船继至。\n百货迭出,诸海历览。\n ——原神
|
||||
现状越是难以置信,我们越是不能停下脚步。 ——原神
|
||||
古老的文明孕育着最美丽的传说 ——原神
|
||||
百川奔流 雨露不休
|
||||
@@ -138,6 +138,3 @@ To be or not to be is a question. ——莎士比亚
|
||||
如果我们要再会,就在夕阳与海面相遇的地方再会吧。 ——原神
|
||||
到那时,再让我看看你如同钻石一般明净而璀璨的灵魂,是否蒙上了一缕尘埃吧。 ——原神
|
||||
水过时迁
|
||||
Waterrun Timepass
|
||||
人们都害怕生离死别,怕的是痛苦与遗憾 ——原神
|
||||
俗话说「旧的不去新的不来」,一个圆满的句号标志着一段新的旅途的开始 ——原神
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 272 B |