mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-02-07 19:36:46 +08:00
小改动
This commit is contained in:
parent
80fab8ced0
commit
8502a02880
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
# mystuff
|
||||
|
||||
.vscode
|
||||
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
|
BIN
AutoInstaller/MSCT Auto Installer
Normal file
BIN
AutoInstaller/MSCT Auto Installer
Normal file
Binary file not shown.
@ -1,219 +1,219 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# 音·创 开发交流群 861684859
|
||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
||||
|
||||
|
||||
"""
|
||||
音·创自动安装器 (Musicreater Auto Installer)
|
||||
对音·创的自动安装提供支持的独立软件
|
||||
Musicreater Auto Installer (音·创自动安装器)
|
||||
A software that used for installing Musicreater automatically
|
||||
|
||||
Copyright 2022 all the developers of Musicreater
|
||||
|
||||
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 sys import platform
|
||||
from platform import architecture
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from os import system as srun
|
||||
from os import walk, rename, remove, path, chdir, listdir
|
||||
from shutil import rmtree, move
|
||||
|
||||
|
||||
if platform == "win32":
|
||||
|
||||
nowpath = __file__[: len(__file__) - __file__[len(__file__) :: -1].index('\\')]
|
||||
|
||||
if srun('python -V'):
|
||||
|
||||
print('\033[7m{}\033[0m'.format("正在下载python\nDownloading Python"))
|
||||
|
||||
try:
|
||||
urllib.request.urlretrieve(
|
||||
"https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"
|
||||
if architecture()[0] == "32bit"
|
||||
else "https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe",
|
||||
"./pythonInstaller.exe",
|
||||
)
|
||||
# urllib.request.urlretrieve("https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe","./pythonInstaller.exe")
|
||||
except Exception as E:
|
||||
input(str(E) + "\n自动下载失败,按下回车取消")
|
||||
exit()
|
||||
|
||||
print('正在安装python\nInstalling Python')
|
||||
|
||||
# open('install.bat','w').write(f'.\\pythonInstaller.exe /passive InstallAllUsers=0 TargetDir="{nowpath}python38" DefaultJustForMeTargetDir="{nowpath}python38" AssociateFiles=0 CompileAll=1 PrependPath=0 Shortcuts=0 Include_doc=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_test=0 Include_tools=0')
|
||||
|
||||
srun(
|
||||
f'.\\pythonInstaller.exe /passive InstallAllUsers=1 AssociateFiles=1 CompileAll=1 PrependPath=1 Shortcuts=1 Include_doc=0 Include_exe=1 Include_pip=1 Include_lib=1 Include_tcltk=1 Include_launcher=1 InstallLauncherAllUsers=1 Include_test=0 Include_tools=0'
|
||||
)
|
||||
|
||||
remove('./pythonInstaller.exe')
|
||||
|
||||
# print('\033[7m{}\033[0m'.format("正在下载pip安装工具\nDownloading get-pip tool"))
|
||||
|
||||
# try:
|
||||
# urllib.request.urlretrieve(
|
||||
# "https://bootstrap.pypa.io/get-pip.py", "./python38/get-pip.py"
|
||||
# )
|
||||
# except Exception as E:
|
||||
# input(str(E) + "\n自动下载失败,按下回车取消")
|
||||
# exit()
|
||||
|
||||
# print('\033[7m{}\033[0m'.format("正在下载pip\nDownloading pip"))
|
||||
|
||||
# chdir('./python38')
|
||||
# srun(r'".\python.exe get-pip.py')
|
||||
|
||||
# print('\033[7m{}\033[0m'.format('正在安装pip\nInstalling pip'))
|
||||
|
||||
# for dire in listdir('./Lib/site-packages/'):
|
||||
# move('./Lib/site-packages/'+dire,'./'+dire)
|
||||
|
||||
# print('\033[7m{}\033[0m'.format("完成!"))
|
||||
|
||||
# chdir('../')
|
||||
|
||||
try:
|
||||
choseurl = int(
|
||||
input(
|
||||
'\033[7m{}\033[0m'.format(
|
||||
"""请选择 音·创 下载源,默认为0
|
||||
Please choose a download source of Musicreater(default 0)
|
||||
[0] 私有服务器<暂无> | Private Server<Haven't been built>
|
||||
[1] Gitee
|
||||
[2] Github\n:"""
|
||||
)
|
||||
)
|
||||
)
|
||||
except Exception as E:
|
||||
print('\033[7m{}\033[0m'.format(str(E) + "\n将使用默认源\nUsing default source"))
|
||||
choseurl = 0
|
||||
|
||||
myurl = ""
|
||||
Giteeurl = "https://gitee.com/EillesWan/Musicreater/repository/blazearchive/master.zip?Expires=1647771436&Signature=%2BkqLHwmvzScCd4cPQDP0LHLpqeZUxOrOv17QpRy%2FTzs%3D"
|
||||
Githuburl = (
|
||||
"https://codeload.github.com/EillesWan/Musicreater/zip/refs/heads/master"
|
||||
)
|
||||
|
||||
url = (
|
||||
myurl
|
||||
if choseurl == 0
|
||||
else Giteeurl
|
||||
if choseurl == 1
|
||||
else Githuburl
|
||||
if choseurl == 2
|
||||
else myurl
|
||||
)
|
||||
|
||||
print('\033[7m{}\033[0m'.format("正在下载音·创\nDownloading Musicreater"))
|
||||
|
||||
try:
|
||||
urllib.request.urlretrieve(url, "./master.zip")
|
||||
except Exception as E:
|
||||
input('\033[0{}\033[0m'.format(str(E) + "\n自动下载失败,按下回车取消"))
|
||||
exit()
|
||||
|
||||
print('\033[7m{}\033[0m'.format("安装音·创\nInstalling Musicreater"))
|
||||
|
||||
zipfile.ZipFile("./master.zip", "r").extractall()
|
||||
|
||||
remove("./master.zip")
|
||||
|
||||
try:
|
||||
rmtree("./Musicreater")
|
||||
except:
|
||||
pass
|
||||
|
||||
rename("./Musicreater-master/", "./Musicreater/")
|
||||
|
||||
elif platform == 'linux':
|
||||
srun("sudo apt-get install python3")
|
||||
srun("sudo apt-get install python3-pip")
|
||||
srun("sudo apt-get install git")
|
||||
try:
|
||||
choseurl = int(
|
||||
input(
|
||||
'\033[0{}\033[0m'.format(
|
||||
"""请选择 音·创 下载源,默认为1
|
||||
Please choose a download source of Musicreater(default 1)
|
||||
[1] Gitee
|
||||
[2] Github\n:"""
|
||||
)
|
||||
)
|
||||
)
|
||||
except Exception as E:
|
||||
print(str(E) + "\n将使用默认源\nUsing default source")
|
||||
choseurl = 1
|
||||
|
||||
url = (
|
||||
"https://gitee.com/EillesWan/Musicreater.git"
|
||||
if choseurl == 1
|
||||
else "https://github.com/EillesWan/Musicreater.git"
|
||||
if choseurl == 2
|
||||
else "https://gitee.com/EillesWan/Musicreater.git"
|
||||
)
|
||||
srun(f"sudo git clone {url}")
|
||||
|
||||
|
||||
print('\033[7m{}\033[0m'.format("编译音·创\nCompiling Musicreater"))
|
||||
|
||||
if platform == "linux":
|
||||
srun("python3 -O -m compileall -b ./Musicreater/")
|
||||
elif platform == "win32":
|
||||
srun("python -O -m compileall -b ./Musicreater/")
|
||||
|
||||
for parent, dirnames, filenames in walk("./Musicreater"):
|
||||
for filename in filenames:
|
||||
if filename[-3:] == ".py":
|
||||
fn = path.join(parent, filename)
|
||||
remove(fn)
|
||||
print(f"删除文件 {fn}")
|
||||
for dirname in dirnames:
|
||||
if dirname == "__pycache__":
|
||||
pn = path.join(parent, dirname)
|
||||
rmtree(pn)
|
||||
print(f"删除目录 {pn}")
|
||||
|
||||
|
||||
print(
|
||||
'\033[7m{}\033[0m'.format(
|
||||
"""您可以开始使用音·创了
|
||||
我们将在后台为您安装各项支持库
|
||||
您可以运行Musicreater文件夹中的Musicreater.pyc文件来运行音·创
|
||||
|
||||
You can use Musicreater now,
|
||||
We will setup the libraries ineed for you in background,
|
||||
You can now open Musicreater.PYC in the directory of ./Musicreater to run Musicreater
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if platform == "linux":
|
||||
srun("python3 -m pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
elif platform == "win32":
|
||||
srun("pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# 音·创 开发交流群 861684859
|
||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
||||
|
||||
|
||||
"""
|
||||
音·创自动安装器 (Musicreater Auto Installer)
|
||||
对音·创的自动安装提供支持的独立软件
|
||||
Musicreater Auto Installer (音·创自动安装器)
|
||||
A software that used for installing Musicreater automatically
|
||||
|
||||
Copyright 2022 all the developers of Musicreater
|
||||
|
||||
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 sys import platform
|
||||
from platform import architecture
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from os import system as srun
|
||||
from os import walk, rename, remove, path, chdir, listdir
|
||||
from shutil import rmtree, move
|
||||
|
||||
|
||||
if platform == "win32":
|
||||
|
||||
nowpath = __file__[: len(__file__) - __file__[len(__file__) :: -1].index('\\')]
|
||||
|
||||
if srun('python -V'):
|
||||
|
||||
print('\033[7m{}\033[0m'.format("正在下载python\nDownloading Python"))
|
||||
|
||||
try:
|
||||
urllib.request.urlretrieve(
|
||||
"https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"
|
||||
if architecture()[0] == "32bit"
|
||||
else "https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe",
|
||||
"./pythonInstaller.exe",
|
||||
)
|
||||
# urllib.request.urlretrieve("https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe","./pythonInstaller.exe")
|
||||
except Exception as E:
|
||||
input(str(E) + "\n自动下载失败,按下回车取消")
|
||||
exit()
|
||||
|
||||
print('正在安装python\nInstalling Python')
|
||||
|
||||
# open('install.bat','w').write(f'.\\pythonInstaller.exe /passive InstallAllUsers=0 TargetDir="{nowpath}python38" DefaultJustForMeTargetDir="{nowpath}python38" AssociateFiles=0 CompileAll=1 PrependPath=0 Shortcuts=0 Include_doc=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_test=0 Include_tools=0')
|
||||
|
||||
srun(
|
||||
f'.\\pythonInstaller.exe /passive InstallAllUsers=1 AssociateFiles=1 CompileAll=1 PrependPath=1 Shortcuts=1 Include_doc=0 Include_exe=1 Include_pip=1 Include_lib=1 Include_tcltk=1 Include_launcher=1 InstallLauncherAllUsers=1 Include_test=0 Include_tools=0'
|
||||
)
|
||||
|
||||
remove('./pythonInstaller.exe')
|
||||
|
||||
# print('\033[7m{}\033[0m'.format("正在下载pip安装工具\nDownloading get-pip tool"))
|
||||
|
||||
# try:
|
||||
# urllib.request.urlretrieve(
|
||||
# "https://bootstrap.pypa.io/get-pip.py", "./python38/get-pip.py"
|
||||
# )
|
||||
# except Exception as E:
|
||||
# input(str(E) + "\n自动下载失败,按下回车取消")
|
||||
# exit()
|
||||
|
||||
# print('\033[7m{}\033[0m'.format("正在下载pip\nDownloading pip"))
|
||||
|
||||
# chdir('./python38')
|
||||
# srun(r'".\python.exe get-pip.py')
|
||||
|
||||
# print('\033[7m{}\033[0m'.format('正在安装pip\nInstalling pip'))
|
||||
|
||||
# for dire in listdir('./Lib/site-packages/'):
|
||||
# move('./Lib/site-packages/'+dire,'./'+dire)
|
||||
|
||||
# print('\033[7m{}\033[0m'.format("完成!"))
|
||||
|
||||
# chdir('../')
|
||||
|
||||
try:
|
||||
choseurl = int(
|
||||
input(
|
||||
'\033[7m{}\033[0m'.format(
|
||||
"""请选择 音·创 下载源,默认为0
|
||||
Please choose a download source of Musicreater(default 0)
|
||||
[0] 私有服务器<暂无> | Private Server<Haven't been built>
|
||||
[1] Gitee
|
||||
[2] Github\n:"""
|
||||
)
|
||||
)
|
||||
)
|
||||
except Exception as E:
|
||||
print('\033[7m{}\033[0m'.format(str(E) + "\n将使用默认源\nUsing default source"))
|
||||
choseurl = 0
|
||||
|
||||
myurl = ""
|
||||
Giteeurl = "https://gitee.com/EillesWan/Musicreater/repository/blazearchive/master.zip?Expires=1647771436&Signature=%2BkqLHwmvzScCd4cPQDP0LHLpqeZUxOrOv17QpRy%2FTzs%3D"
|
||||
Githuburl = (
|
||||
"https://codeload.github.com/EillesWan/Musicreater/zip/refs/heads/master"
|
||||
)
|
||||
|
||||
url = (
|
||||
myurl
|
||||
if choseurl == 0
|
||||
else Giteeurl
|
||||
if choseurl == 1
|
||||
else Githuburl
|
||||
if choseurl == 2
|
||||
else myurl
|
||||
)
|
||||
|
||||
print('\033[7m{}\033[0m'.format("正在下载音·创\nDownloading Musicreater"))
|
||||
|
||||
try:
|
||||
urllib.request.urlretrieve(url, "./master.zip")
|
||||
except Exception as E:
|
||||
input('\033[0{}\033[0m'.format(str(E) + "\n自动下载失败,按下回车取消"))
|
||||
exit()
|
||||
|
||||
print('\033[7m{}\033[0m'.format("安装音·创\nInstalling Musicreater"))
|
||||
|
||||
zipfile.ZipFile("./master.zip", "r").extractall()
|
||||
|
||||
remove("./master.zip")
|
||||
|
||||
try:
|
||||
rmtree("./Musicreater")
|
||||
except:
|
||||
pass
|
||||
|
||||
rename("./Musicreater-master/", "./Musicreater/")
|
||||
|
||||
elif platform == 'linux':
|
||||
srun("sudo apt-get install python3")
|
||||
srun("sudo apt-get install python3-pip")
|
||||
srun("sudo apt-get install git")
|
||||
try:
|
||||
choseurl = int(
|
||||
input(
|
||||
'\033[0{}\033[0m'.format(
|
||||
"""请选择 音·创 下载源,默认为1
|
||||
Please choose a download source of Musicreater(default 1)
|
||||
[1] Gitee
|
||||
[2] Github\n:"""
|
||||
)
|
||||
)
|
||||
)
|
||||
except Exception as E:
|
||||
print(str(E) + "\n将使用默认源\nUsing default source")
|
||||
choseurl = 1
|
||||
|
||||
url = (
|
||||
"https://gitee.com/EillesWan/Musicreater.git"
|
||||
if choseurl == 1
|
||||
else "https://github.com/EillesWan/Musicreater.git"
|
||||
if choseurl == 2
|
||||
else "https://gitee.com/EillesWan/Musicreater.git"
|
||||
)
|
||||
srun(f"sudo git clone {url}")
|
||||
|
||||
|
||||
print('\033[7m{}\033[0m'.format("编译音·创\nCompiling Musicreater"))
|
||||
|
||||
if platform == "linux":
|
||||
srun("python3 -O -m compileall -b ./Musicreater/")
|
||||
elif platform == "win32":
|
||||
srun("python -O -m compileall -b ./Musicreater/")
|
||||
|
||||
for parent, dirnames, filenames in walk("./Musicreater"):
|
||||
for filename in filenames:
|
||||
if filename[-3:] == ".py":
|
||||
fn = path.join(parent, filename)
|
||||
remove(fn)
|
||||
print(f"删除文件 {fn}")
|
||||
for dirname in dirnames:
|
||||
if dirname == "__pycache__":
|
||||
pn = path.join(parent, dirname)
|
||||
rmtree(pn)
|
||||
print(f"删除目录 {pn}")
|
||||
|
||||
|
||||
print(
|
||||
'\033[7m{}\033[0m'.format(
|
||||
"""您可以开始使用音·创了
|
||||
我们将在后台为您安装各项支持库
|
||||
您可以运行Musicreater文件夹中的Musicreater.pyc文件来运行音·创
|
||||
|
||||
You can use Musicreater now,
|
||||
We will setup the libraries ineed for you in background,
|
||||
You can now open Musicreater.PYC in the directory of ./Musicreater to run Musicreater
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if platform == "linux":
|
||||
srun("python3 -m pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
elif platform == "win32":
|
||||
srun("pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
|
@ -1,183 +1,183 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# 音·创 开发交流群 861684859
|
||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
||||
|
||||
|
||||
"""
|
||||
音·创 (Musicreater)
|
||||
一款免费开源的 《我的世界:基岩版》 音乐制作软件
|
||||
注意!除了此源文件以外,任何属于此仓库以及此项目的文件均依照Apache许可证进行许可
|
||||
Musicreater (音·创)
|
||||
A free opensource software which is used for creating all kinds of musics in Minecraft
|
||||
Note! Except for this source file, all the files in this repository and this project are licensed under Apache License 2.0
|
||||
|
||||
Copyright 2022 all the developers of Musicreater
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
# 下面为正文
|
||||
|
||||
# 音·创 为梦而创,为爱远航
|
||||
|
||||
|
||||
|
||||
from msctLib.buildIN import version
|
||||
from languages.lang import _
|
||||
from msctLib.log import log
|
||||
import wx # 引入wxPython库
|
||||
|
||||
__ver__ = f'{version.version[1]} {version.version[0]}'
|
||||
__author__ = '金羿Eilles'
|
||||
|
||||
|
||||
|
||||
|
||||
class MainWindow(wx.Frame):
|
||||
"""We simply derive a new class of Frame."""
|
||||
def __init__(self, *args, **kargs):
|
||||
super(MainWindow, self).__init__(*args, **kargs)
|
||||
|
||||
|
||||
#创建位于窗口的底部的状态栏
|
||||
self.CreateStatusBar()
|
||||
|
||||
# 设置菜单
|
||||
filemenu = wx.Menu()
|
||||
|
||||
#wx.ID_ABOUT和wx.ID_EXIT是wxWidgets提供的标准ID
|
||||
filemenu.Append(wx.ID_ABOUT, _(u"关于"), _(u"h关于"))
|
||||
filemenu.AppendSeparator()
|
||||
filemenu.Append(wx.ID_EXIT, item=_(u"退出"), helpString=_(r'h退出') )
|
||||
|
||||
# 创建菜单栏
|
||||
menuBar = wx.MenuBar()
|
||||
menuBar.Append(filemenu, u"文件")
|
||||
self.SetMenuBar(menuBar)
|
||||
|
||||
# 创建图标
|
||||
icon = wx.Icon(name="./resources/msctIcon.png")
|
||||
self.SetIcon(icon)
|
||||
|
||||
self.Show(True)
|
||||
|
||||
def initArgs(
|
||||
self,
|
||||
debug: bool = False,
|
||||
menuWidget: dict = {},
|
||||
wordView: str = '音·创 Musicreater',
|
||||
buttons: list = [],
|
||||
settingBox: list = [],
|
||||
notemap: list = [],
|
||||
infobar: str = '就绪',
|
||||
) -> None:
|
||||
'''使用参数初始化一些基本的音·创窗口组件
|
||||
:param debug 是否将日志输出到控制台
|
||||
wordview: str #言论部分显示的字样
|
||||
button: list = [ # 操作按钮部分
|
||||
dict = {
|
||||
按钮名称 : tuple(按钮图标,执行函数)
|
||||
},
|
||||
],
|
||||
settingbox: list = [ # 设置部分显示的字样及其对应的设置函数
|
||||
(
|
||||
设置名称:str,
|
||||
值类型:tuple,
|
||||
显示内容:str,
|
||||
设置操作函数:<function>,
|
||||
)
|
||||
],
|
||||
map: list = [ # 一首曲目的音符数据
|
||||
音符数据
|
||||
]
|
||||
:param infobar str 显示信息用
|
||||
'''
|
||||
|
||||
if debug:
|
||||
log('载入参数')
|
||||
|
||||
# 载入参量 注意!图标将不被载入参数
|
||||
|
||||
|
||||
|
||||
self.menuWidgets = menuWidget
|
||||
'''菜单设定项'''
|
||||
|
||||
self.wordView = wordView
|
||||
'''言·论 所显示的文字'''
|
||||
|
||||
self.buttons = buttons
|
||||
'''快捷功能按钮'''
|
||||
|
||||
self.settingBox = settingBox
|
||||
'''设置框'''
|
||||
|
||||
self.notemap = notemap
|
||||
'''音符列表'''
|
||||
|
||||
self.infoBar = infobar
|
||||
'''信息显示版所显示的文字'''
|
||||
|
||||
self.debug = debug
|
||||
'''是否打开调试模式'''
|
||||
|
||||
|
||||
def setMenu(self) -> 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(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)
|
||||
log('菜单项 -- ' + cmdName)
|
||||
else:
|
||||
menu.add_separator()
|
||||
log('分隔符 -- 分隔符')
|
||||
self._mainMenuBar.add_cascade(label=menuName, menu=menu)
|
||||
self._RootMenu[menuName] = menu
|
||||
log('计入一个菜单 -- ' + menuName)
|
||||
self.__root.config(menu=self._mainMenuBar)
|
||||
log('菜单设置完毕')
|
||||
|
||||
|
||||
|
||||
def __main__():
|
||||
app = wx.App(False)
|
||||
frame = MainWindow(None, id=wx.ID_ANY, title=f"{_('F音创')} {__ver__}", size=(1600, 900))
|
||||
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
__main__()
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
# 音·创 开发交流群 861684859
|
||||
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
|
||||
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
|
||||
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
|
||||
|
||||
|
||||
"""
|
||||
音·创 (Musicreater)
|
||||
一款免费开源的 《我的世界:基岩版》 音乐制作软件
|
||||
注意!除了此源文件以外,任何属于此仓库以及此项目的文件均依照Apache许可证进行许可
|
||||
Musicreater (音·创)
|
||||
A free opensource software which is used for creating all kinds of musics in Minecraft
|
||||
Note! Except for this source file, all the files in this repository and this project are licensed under Apache License 2.0
|
||||
|
||||
Copyright 2022 all the developers of Musicreater
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
# 下面为正文
|
||||
|
||||
# 音·创 为梦而创,为爱远航
|
||||
|
||||
|
||||
|
||||
from msctLib.buildIN import version
|
||||
from languages.lang import _
|
||||
from msctLib.log import log
|
||||
import wx # 引入wxPython库
|
||||
|
||||
__ver__ = f'{version.version[1]} {version.version[0]}'
|
||||
__author__ = '金羿Eilles'
|
||||
|
||||
|
||||
|
||||
|
||||
class MainWindow(wx.Frame):
|
||||
"""We simply derive a new class of Frame."""
|
||||
def __init__(self, *args, **kargs):
|
||||
super(MainWindow, self).__init__(*args, **kargs)
|
||||
|
||||
|
||||
#创建位于窗口的底部的状态栏
|
||||
self.CreateStatusBar()
|
||||
|
||||
# 设置菜单
|
||||
filemenu = wx.Menu()
|
||||
|
||||
#wx.ID_ABOUT和wx.ID_EXIT是wxWidgets提供的标准ID
|
||||
filemenu.Append(wx.ID_ABOUT, _(u"关于"), _(u"h关于"))
|
||||
filemenu.AppendSeparator()
|
||||
filemenu.Append(wx.ID_EXIT, item=_(u"退出"), helpString=_(r'h退出') )
|
||||
|
||||
# 创建菜单栏
|
||||
menuBar = wx.MenuBar()
|
||||
menuBar.Append(filemenu, u"文件")
|
||||
self.SetMenuBar(menuBar)
|
||||
|
||||
# 创建图标
|
||||
icon = wx.Icon(name="./resources/msctIcon.png")
|
||||
self.SetIcon(icon)
|
||||
|
||||
self.Show(True)
|
||||
|
||||
def initArgs(
|
||||
self,
|
||||
debug: bool = False,
|
||||
menuWidget: dict = {},
|
||||
wordView: str = '音·创 Musicreater',
|
||||
buttons: list = [],
|
||||
settingBox: list = [],
|
||||
notemap: list = [],
|
||||
infobar: str = '就绪',
|
||||
) -> None:
|
||||
'''使用参数初始化一些基本的音·创窗口组件
|
||||
:param debug 是否将日志输出到控制台
|
||||
wordview: str #言论部分显示的字样
|
||||
button: list = [ # 操作按钮部分
|
||||
dict = {
|
||||
按钮名称 : tuple(按钮图标,执行函数)
|
||||
},
|
||||
],
|
||||
settingbox: list = [ # 设置部分显示的字样及其对应的设置函数
|
||||
(
|
||||
设置名称:str,
|
||||
值类型:tuple,
|
||||
显示内容:str,
|
||||
设置操作函数:<function>,
|
||||
)
|
||||
],
|
||||
map: list = [ # 一首曲目的音符数据
|
||||
音符数据
|
||||
]
|
||||
:param infobar str 显示信息用
|
||||
'''
|
||||
|
||||
if debug:
|
||||
log('载入参数')
|
||||
|
||||
# 载入参量 注意!图标将不被载入参数
|
||||
|
||||
|
||||
|
||||
self.menuWidgets = menuWidget
|
||||
'''菜单设定项'''
|
||||
|
||||
self.wordView = wordView
|
||||
'''言·论 所显示的文字'''
|
||||
|
||||
self.buttons = buttons
|
||||
'''快捷功能按钮'''
|
||||
|
||||
self.settingBox = settingBox
|
||||
'''设置框'''
|
||||
|
||||
self.notemap = notemap
|
||||
'''音符列表'''
|
||||
|
||||
self.infoBar = infobar
|
||||
'''信息显示版所显示的文字'''
|
||||
|
||||
self.debug = debug
|
||||
'''是否打开调试模式'''
|
||||
|
||||
|
||||
def setMenu(self) -> 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(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)
|
||||
log('菜单项 -- ' + cmdName)
|
||||
else:
|
||||
menu.add_separator()
|
||||
log('分隔符 -- 分隔符')
|
||||
self._mainMenuBar.add_cascade(label=menuName, menu=menu)
|
||||
self._RootMenu[menuName] = menu
|
||||
log('计入一个菜单 -- ' + menuName)
|
||||
self.__root.config(menu=self._mainMenuBar)
|
||||
log('菜单设置完毕')
|
||||
|
||||
|
||||
|
||||
def __main__():
|
||||
app = wx.App(False)
|
||||
frame = MainWindow(None, id=wx.ID_ANY, title=f"{_('F音创')} {__ver__}", size=(1600, 900))
|
||||
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
__main__()
|
||||
|
@ -1,76 +1,76 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
"""音·创的核心内置组件功能集合"""
|
||||
|
||||
def author_reader(path:str = './resources/msctDevAuthors.txt'):
|
||||
'''读入作者数据,格式需要按照署名文件中的指定格式,详见/resources/msctDevAuthors.txt
|
||||
:param path: 作者署名文件所在路径
|
||||
:return 指定的作者格式
|
||||
{
|
||||
'作者常用名':{
|
||||
'语言码' : '对应语言的名字',
|
||||
},
|
||||
}'''
|
||||
allAuthors = open(path,'r',encoding='utf-8').readlines()
|
||||
result = {}
|
||||
indexName = ''
|
||||
for line in allAuthors:
|
||||
line = line.replace('\n', '')
|
||||
if (not line.startswith('#')) and line:
|
||||
if line.startswith('启'):
|
||||
if indexName:
|
||||
result[indexName] = authorList
|
||||
indexName = line[line.index('启')+1:]
|
||||
authorList = {}
|
||||
continue
|
||||
line_c = ''
|
||||
for char in line:
|
||||
if not char == '#':
|
||||
line_c += char
|
||||
else:
|
||||
break
|
||||
authorList[line_c.split(' ', 1)[0]] = line_c.split(' ', 1)[1]
|
||||
result[indexName] = authorList
|
||||
return result
|
||||
|
||||
|
||||
|
||||
class version:
|
||||
libraries = (
|
||||
'wxPython', 'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
|
||||
'pyinstaller', 'py7zr','websockets', 'zhdate', 'requests',
|
||||
)
|
||||
"""当前所需库"""
|
||||
|
||||
version = ('0.3.0', '丁',)
|
||||
"""当前版本"""
|
||||
|
||||
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':
|
||||
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
|
||||
# -*- coding: UTF-8 -*-
|
||||
"""音·创的核心内置组件功能集合"""
|
||||
|
||||
def author_reader(path:str = './resources/msctDevAuthors.txt'):
|
||||
'''读入作者数据,格式需要按照署名文件中的指定格式,详见/resources/msctDevAuthors.txt
|
||||
:param path: 作者署名文件所在路径
|
||||
:return 指定的作者格式
|
||||
{
|
||||
'作者常用名':{
|
||||
'语言码' : '对应语言的名字',
|
||||
},
|
||||
}'''
|
||||
allAuthors = open(path,'r',encoding='utf-8').readlines()
|
||||
result = {}
|
||||
indexName = ''
|
||||
for line in allAuthors:
|
||||
line = line.replace('\n', '')
|
||||
if (not line.startswith('#')) and line:
|
||||
if line.startswith('启'):
|
||||
if indexName:
|
||||
result[indexName] = authorList
|
||||
indexName = line[line.index('启')+1:]
|
||||
authorList = {}
|
||||
continue
|
||||
line_c = ''
|
||||
for char in line:
|
||||
if not char == '#':
|
||||
line_c += char
|
||||
else:
|
||||
break
|
||||
authorList[line_c.split(' ', 1)[0]] = line_c.split(' ', 1)[1]
|
||||
result[indexName] = authorList
|
||||
return result
|
||||
|
||||
|
||||
|
||||
class version:
|
||||
libraries = (
|
||||
'wxPython', 'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
|
||||
'pyinstaller', 'py7zr','websockets', 'zhdate', 'requests',
|
||||
)
|
||||
"""当前所需库"""
|
||||
|
||||
version = ('0.3.0', '丁',)
|
||||
"""当前版本"""
|
||||
|
||||
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':
|
||||
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
|
||||
|
16
作者的自我修养.py
16
作者的自我修养.py
@ -1,8 +1,8 @@
|
||||
|
||||
from os import system
|
||||
from sys import platform
|
||||
|
||||
if platform == "linux":
|
||||
system("python3 -m pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
elif platform == "win32":
|
||||
system("pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
|
||||
from os import system
|
||||
from sys import platform
|
||||
|
||||
if platform == "linux":
|
||||
system("python3 -m pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
elif platform == "win32":
|
||||
system("pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
from msctLib.buildIN import author_reader
|
||||
|
||||
|
||||
from msctLib.buildIN import author_reader
|
||||
|
||||
input(author_reader())
|
Loading…
x
Reference in New Issue
Block a user