小改动

This commit is contained in:
EillesWan 2022-06-12 18:22:07 +08:00
parent 80fab8ced0
commit 8502a02880
7 changed files with 490 additions and 490 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
# mystuff # mystuff
.vscode
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

Binary file not shown.

View File

@ -1,219 +1,219 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# 音·创 开发交流群 861684859 # 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com # Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon") # 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可 # 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
""" """
·创自动安装器 (Musicreater Auto Installer) ·创自动安装器 (Musicreater Auto Installer)
对音·创的自动安装提供支持的独立软件 对音·创的自动安装提供支持的独立软件
Musicreater Auto Installer (·创自动安装器) Musicreater Auto Installer (·创自动安装器)
A software that used for installing Musicreater automatically A software that used for installing Musicreater automatically
Copyright 2022 all the developers of Musicreater Copyright 2022 all the developers of Musicreater
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软件协议公开
# 下面为正文 # 下面为正文
from sys import platform from sys import platform
from platform import architecture from platform import architecture
import urllib.request import urllib.request
import zipfile import zipfile
from os import system as srun from os import system as srun
from os import walk, rename, remove, path, chdir, listdir from os import walk, rename, remove, path, chdir, listdir
from shutil import rmtree, move from shutil import rmtree, move
if platform == "win32": if platform == "win32":
nowpath = __file__[: len(__file__) - __file__[len(__file__) :: -1].index('\\')] nowpath = __file__[: len(__file__) - __file__[len(__file__) :: -1].index('\\')]
if srun('python -V'): if srun('python -V'):
print('\033[7m{}\033[0m'.format("正在下载python\nDownloading Python")) print('\033[7m{}\033[0m'.format("正在下载python\nDownloading Python"))
try: try:
urllib.request.urlretrieve( urllib.request.urlretrieve(
"https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe" "https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"
if architecture()[0] == "32bit" if architecture()[0] == "32bit"
else "https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe", else "https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe",
"./pythonInstaller.exe", "./pythonInstaller.exe",
) )
# urllib.request.urlretrieve("https://www.python.org/ftp/python/3.8.10/python-3.8.10.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: except Exception as E:
input(str(E) + "\n自动下载失败,按下回车取消") input(str(E) + "\n自动下载失败,按下回车取消")
exit() exit()
print('正在安装python\nInstalling Python') 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') # 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( 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' 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') remove('./pythonInstaller.exe')
# print('\033[7m{}\033[0m'.format("正在下载pip安装工具\nDownloading get-pip tool")) # print('\033[7m{}\033[0m'.format("正在下载pip安装工具\nDownloading get-pip tool"))
# try: # try:
# urllib.request.urlretrieve( # urllib.request.urlretrieve(
# "https://bootstrap.pypa.io/get-pip.py", "./python38/get-pip.py" # "https://bootstrap.pypa.io/get-pip.py", "./python38/get-pip.py"
# ) # )
# except Exception as E: # except Exception as E:
# input(str(E) + "\n自动下载失败按下回车取消") # input(str(E) + "\n自动下载失败按下回车取消")
# exit() # exit()
# print('\033[7m{}\033[0m'.format("正在下载pip\nDownloading pip")) # print('\033[7m{}\033[0m'.format("正在下载pip\nDownloading pip"))
# chdir('./python38') # chdir('./python38')
# srun(r'".\python.exe get-pip.py') # srun(r'".\python.exe get-pip.py')
# print('\033[7m{}\033[0m'.format('正在安装pip\nInstalling pip')) # print('\033[7m{}\033[0m'.format('正在安装pip\nInstalling pip'))
# for dire in listdir('./Lib/site-packages/'): # for dire in listdir('./Lib/site-packages/'):
# move('./Lib/site-packages/'+dire,'./'+dire) # move('./Lib/site-packages/'+dire,'./'+dire)
# print('\033[7m{}\033[0m'.format("完成!")) # print('\033[7m{}\033[0m'.format("完成!"))
# chdir('../') # chdir('../')
try: try:
choseurl = int( choseurl = int(
input( input(
'\033[7m{}\033[0m'.format( '\033[7m{}\033[0m'.format(
"""请选择 音·创 下载源,默认为0 """请选择 音·创 下载源,默认为0
Please choose a download source of Musicreater(default 0) Please choose a download source of Musicreater(default 0)
[0] 私有服务器<暂无> | Private Server<Haven't been built> [0] 私有服务器<暂无> | Private Server<Haven't been built>
[1] Gitee [1] Gitee
[2] Github\n:""" [2] Github\n:"""
) )
) )
) )
except Exception as E: except Exception as E:
print('\033[7m{}\033[0m'.format(str(E) + "\n将使用默认源\nUsing default source")) print('\033[7m{}\033[0m'.format(str(E) + "\n将使用默认源\nUsing default source"))
choseurl = 0 choseurl = 0
myurl = "" myurl = ""
Giteeurl = "https://gitee.com/EillesWan/Musicreater/repository/blazearchive/master.zip?Expires=1647771436&Signature=%2BkqLHwmvzScCd4cPQDP0LHLpqeZUxOrOv17QpRy%2FTzs%3D" Giteeurl = "https://gitee.com/EillesWan/Musicreater/repository/blazearchive/master.zip?Expires=1647771436&Signature=%2BkqLHwmvzScCd4cPQDP0LHLpqeZUxOrOv17QpRy%2FTzs%3D"
Githuburl = ( Githuburl = (
"https://codeload.github.com/EillesWan/Musicreater/zip/refs/heads/master" "https://codeload.github.com/EillesWan/Musicreater/zip/refs/heads/master"
) )
url = ( url = (
myurl myurl
if choseurl == 0 if choseurl == 0
else Giteeurl else Giteeurl
if choseurl == 1 if choseurl == 1
else Githuburl else Githuburl
if choseurl == 2 if choseurl == 2
else myurl else myurl
) )
print('\033[7m{}\033[0m'.format("正在下载音·创\nDownloading Musicreater")) print('\033[7m{}\033[0m'.format("正在下载音·创\nDownloading Musicreater"))
try: try:
urllib.request.urlretrieve(url, "./master.zip") urllib.request.urlretrieve(url, "./master.zip")
except Exception as E: except Exception as E:
input('\033[0{}\033[0m'.format(str(E) + "\n自动下载失败,按下回车取消")) input('\033[0{}\033[0m'.format(str(E) + "\n自动下载失败,按下回车取消"))
exit() exit()
print('\033[7m{}\033[0m'.format("安装音·创\nInstalling Musicreater")) print('\033[7m{}\033[0m'.format("安装音·创\nInstalling Musicreater"))
zipfile.ZipFile("./master.zip", "r").extractall() zipfile.ZipFile("./master.zip", "r").extractall()
remove("./master.zip") remove("./master.zip")
try: try:
rmtree("./Musicreater") rmtree("./Musicreater")
except: except:
pass pass
rename("./Musicreater-master/", "./Musicreater/") rename("./Musicreater-master/", "./Musicreater/")
elif platform == 'linux': elif platform == 'linux':
srun("sudo apt-get install python3") srun("sudo apt-get install python3")
srun("sudo apt-get install python3-pip") srun("sudo apt-get install python3-pip")
srun("sudo apt-get install git") srun("sudo apt-get install git")
try: try:
choseurl = int( choseurl = int(
input( input(
'\033[0{}\033[0m'.format( '\033[0{}\033[0m'.format(
"""请选择 音·创 下载源,默认为1 """请选择 音·创 下载源,默认为1
Please choose a download source of Musicreater(default 1) Please choose a download source of Musicreater(default 1)
[1] Gitee [1] Gitee
[2] Github\n:""" [2] Github\n:"""
) )
) )
) )
except Exception as E: except Exception as E:
print(str(E) + "\n将使用默认源\nUsing default source") print(str(E) + "\n将使用默认源\nUsing default source")
choseurl = 1 choseurl = 1
url = ( url = (
"https://gitee.com/EillesWan/Musicreater.git" "https://gitee.com/EillesWan/Musicreater.git"
if choseurl == 1 if choseurl == 1
else "https://github.com/EillesWan/Musicreater.git" else "https://github.com/EillesWan/Musicreater.git"
if choseurl == 2 if choseurl == 2
else "https://gitee.com/EillesWan/Musicreater.git" else "https://gitee.com/EillesWan/Musicreater.git"
) )
srun(f"sudo git clone {url}") srun(f"sudo git clone {url}")
print('\033[7m{}\033[0m'.format("编译音·创\nCompiling Musicreater")) print('\033[7m{}\033[0m'.format("编译音·创\nCompiling Musicreater"))
if platform == "linux": if platform == "linux":
srun("python3 -O -m compileall -b ./Musicreater/") srun("python3 -O -m compileall -b ./Musicreater/")
elif platform == "win32": elif platform == "win32":
srun("python -O -m compileall -b ./Musicreater/") srun("python -O -m compileall -b ./Musicreater/")
for parent, dirnames, filenames in walk("./Musicreater"): for parent, dirnames, filenames in walk("./Musicreater"):
for filename in filenames: for filename in filenames:
if filename[-3:] == ".py": if filename[-3:] == ".py":
fn = path.join(parent, filename) fn = path.join(parent, filename)
remove(fn) remove(fn)
print(f"删除文件 {fn}") print(f"删除文件 {fn}")
for dirname in dirnames: for dirname in dirnames:
if dirname == "__pycache__": if dirname == "__pycache__":
pn = path.join(parent, dirname) pn = path.join(parent, dirname)
rmtree(pn) rmtree(pn)
print(f"删除目录 {pn}") print(f"删除目录 {pn}")
print( print(
'\033[7m{}\033[0m'.format( '\033[7m{}\033[0m'.format(
"""您可以开始使用音·创了 """您可以开始使用音·创了
我们将在后台为您安装各项支持库 我们将在后台为您安装各项支持库
您可以运行Musicreater文件夹中的Musicreater.pyc文件来运行音· 您可以运行Musicreater文件夹中的Musicreater.pyc文件来运行音·
You can use Musicreater now, You can use Musicreater now,
We will setup the libraries ineed for you in background, We will setup the libraries ineed for you in background,
You can now open Musicreater.PYC in the directory of ./Musicreater to run Musicreater You can now open Musicreater.PYC in the directory of ./Musicreater to run Musicreater
""" """
) )
) )
if platform == "linux": if platform == "linux":
srun("python3 -m pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/") srun("python3 -m pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
elif platform == "win32": elif platform == "win32":
srun("pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/") srun("pip install -r ./Musicreater/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")

View File

@ -1,183 +1,183 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# 音·创 开发交流群 861684859 # 音·创 开发交流群 861684859
# Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com # Email EillesWan2006@163.com W-YI_DoctorYI@outlook.com EillesWan@outlook.com
# 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon") # 版权所有 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray") & 鸣凤鸽子("MingFengPigeon")
# 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可 # 若需转载或借鉴 请依照 Apache 2.0 许可证进行许可
""" """
· (Musicreater) · (Musicreater)
一款免费开源的 我的世界基岩版 音乐制作软件 一款免费开源的 我的世界基岩版 音乐制作软件
注意除了此源文件以外任何属于此仓库以及此项目的文件均依照Apache许可证进行许可 注意除了此源文件以外任何属于此仓库以及此项目的文件均依照Apache许可证进行许可
Musicreater (·) Musicreater (·)
A free opensource software which is used for creating all kinds of musics in Minecraft 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 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 Copyright 2022 all the developers of Musicreater
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.
""" """
# 下面为正文 # 下面为正文
# 音·创 为梦而创,为爱远航 # 音·创 为梦而创,为爱远航
from msctLib.buildIN import version from msctLib.buildIN import version
from languages.lang import _ from languages.lang import _
from msctLib.log import log from msctLib.log import log
import wx # 引入wxPython库 import wx # 引入wxPython库
__ver__ = f'{version.version[1]} {version.version[0]}' __ver__ = f'{version.version[1]} {version.version[0]}'
__author__ = '金羿Eilles' __author__ = '金羿Eilles'
class MainWindow(wx.Frame): class MainWindow(wx.Frame):
"""We simply derive a new class of Frame.""" """We simply derive a new class of Frame."""
def __init__(self, *args, **kargs): def __init__(self, *args, **kargs):
super(MainWindow, self).__init__(*args, **kargs) super(MainWindow, self).__init__(*args, **kargs)
#创建位于窗口的底部的状态栏 #创建位于窗口的底部的状态栏
self.CreateStatusBar() self.CreateStatusBar()
# 设置菜单 # 设置菜单
filemenu = wx.Menu() filemenu = wx.Menu()
#wx.ID_ABOUT和wx.ID_EXIT是wxWidgets提供的标准ID #wx.ID_ABOUT和wx.ID_EXIT是wxWidgets提供的标准ID
filemenu.Append(wx.ID_ABOUT, _(u"关于"), _(u"h关于")) filemenu.Append(wx.ID_ABOUT, _(u"关于"), _(u"h关于"))
filemenu.AppendSeparator() filemenu.AppendSeparator()
filemenu.Append(wx.ID_EXIT, item=_(u"退出"), helpString=_(r'h退出') ) filemenu.Append(wx.ID_EXIT, item=_(u"退出"), helpString=_(r'h退出') )
# 创建菜单栏 # 创建菜单栏
menuBar = wx.MenuBar() menuBar = wx.MenuBar()
menuBar.Append(filemenu, u"文件") menuBar.Append(filemenu, u"文件")
self.SetMenuBar(menuBar) self.SetMenuBar(menuBar)
# 创建图标 # 创建图标
icon = wx.Icon(name="./resources/msctIcon.png") icon = wx.Icon(name="./resources/msctIcon.png")
self.SetIcon(icon) self.SetIcon(icon)
self.Show(True) self.Show(True)
def initArgs( def initArgs(
self, self,
debug: bool = False, debug: bool = False,
menuWidget: dict = {}, menuWidget: dict = {},
wordView: str = '音·创 Musicreater', wordView: str = '音·创 Musicreater',
buttons: list = [], buttons: list = [],
settingBox: list = [], settingBox: list = [],
notemap: list = [], notemap: list = [],
infobar: str = '就绪', infobar: str = '就绪',
) -> None: ) -> None:
'''使用参数初始化一些基本的音·创窗口组件 '''使用参数初始化一些基本的音·创窗口组件
:param debug 是否将日志输出到控制台 :param debug 是否将日志输出到控制台
wordview: str #言论部分显示的字样 wordview: str #言论部分显示的字样
button: list = [ # 操作按钮部分 button: list = [ # 操作按钮部分
dict = { dict = {
按钮名称 : tuple(按钮图标,执行函数) 按钮名称 : tuple(按钮图标,执行函数)
}, },
], ],
settingbox: list = [ # 设置部分显示的字样及其对应的设置函数 settingbox: list = [ # 设置部分显示的字样及其对应的设置函数
( (
设置名称:str, 设置名称:str,
值类型:tuple, 值类型:tuple,
显示内容:str, 显示内容:str,
设置操作函数:<function>, 设置操作函数:<function>,
) )
], ],
map: list = [ # 一首曲目的音符数据 map: list = [ # 一首曲目的音符数据
音符数据 音符数据
] ]
:param infobar str 显示信息用 :param infobar str 显示信息用
''' '''
if debug: if debug:
log('载入参数') log('载入参数')
# 载入参量 注意!图标将不被载入参数 # 载入参量 注意!图标将不被载入参数
self.menuWidgets = menuWidget self.menuWidgets = menuWidget
'''菜单设定项''' '''菜单设定项'''
self.wordView = wordView self.wordView = wordView
'''言·论 所显示的文字''' '''言·论 所显示的文字'''
self.buttons = buttons self.buttons = buttons
'''快捷功能按钮''' '''快捷功能按钮'''
self.settingBox = settingBox self.settingBox = settingBox
'''设置框''' '''设置框'''
self.notemap = notemap self.notemap = notemap
'''音符列表''' '''音符列表'''
self.infoBar = infobar self.infoBar = infobar
'''信息显示版所显示的文字''' '''信息显示版所显示的文字'''
self.debug = debug self.debug = debug
'''是否打开调试模式''' '''是否打开调试模式'''
def setMenu(self) -> None: def setMenu(self) -> None:
'''设置根菜单''' '''设置根菜单'''
if not self.menuWidgets: if not self.menuWidgets:
# 如果传入空参数则返回当前菜单 # 如果传入空参数则返回当前菜单
try: try:
return self._RootMenu return self._RootMenu
except Exception as E: except Exception as E:
if self.debug: if self.debug:
raise E raise E
log('无法读取菜单信息', 'WARRING') log('无法读取菜单信息', 'WARRING')
# 如果不是空参数则新建菜单 # 如果不是空参数则新建菜单
log('新建一个菜单') log('新建一个菜单')
self._RootMenu = {} self._RootMenu = {}
self._mainMenuBar = tk.Menu(self.__root) self._mainMenuBar = tk.Menu(self.__root)
for menuName, menuCmd in self.menuWidgets.items(): for menuName, menuCmd in self.menuWidgets.items():
# 取得一个菜单名和一堆菜单函数及其显示名称 # 取得一个菜单名和一堆菜单函数及其显示名称
menu = tk.Menu(self._mainMenuBar, tearoff=0) menu = tk.Menu(self._mainMenuBar, tearoff=0)
for cmdName, cmdFunc in menuCmd.items(): for cmdName, cmdFunc in menuCmd.items():
if cmdName: if cmdName:
menu.add_command(label=cmdName, command=cmdFunc) menu.add_command(label=cmdName, command=cmdFunc)
log('菜单项 -- ' + cmdName) log('菜单项 -- ' + cmdName)
else: else:
menu.add_separator() menu.add_separator()
log('分隔符 -- 分隔符') log('分隔符 -- 分隔符')
self._mainMenuBar.add_cascade(label=menuName, menu=menu) self._mainMenuBar.add_cascade(label=menuName, menu=menu)
self._RootMenu[menuName] = menu self._RootMenu[menuName] = menu
log('计入一个菜单 -- ' + menuName) log('计入一个菜单 -- ' + menuName)
self.__root.config(menu=self._mainMenuBar) self.__root.config(menu=self._mainMenuBar)
log('菜单设置完毕') log('菜单设置完毕')
def __main__(): def __main__():
app = wx.App(False) app = wx.App(False)
frame = MainWindow(None, id=wx.ID_ANY, title=f"{_('F音创')} {__ver__}", size=(1600, 900)) frame = MainWindow(None, id=wx.ID_ANY, title=f"{_('F音创')} {__ver__}", size=(1600, 900))
app.MainLoop() app.MainLoop()
if __name__ == '__main__': if __name__ == '__main__':
__main__() __main__()

View File

@ -1,76 +1,76 @@
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
"""音·创的核心内置组件功能集合""" """音·创的核心内置组件功能集合"""
def author_reader(path:str = './resources/msctDevAuthors.txt'): def author_reader(path:str = './resources/msctDevAuthors.txt'):
'''读入作者数据,格式需要按照署名文件中的指定格式,详见/resources/msctDevAuthors.txt '''读入作者数据,格式需要按照署名文件中的指定格式,详见/resources/msctDevAuthors.txt
:param path: 作者署名文件所在路径 :param path: 作者署名文件所在路径
:return 指定的作者格式 :return 指定的作者格式
{ {
'作者常用名':{ '作者常用名':{
'语言码' : '对应语言的名字', '语言码' : '对应语言的名字',
}, },
}''' }'''
allAuthors = open(path,'r',encoding='utf-8').readlines() allAuthors = open(path,'r',encoding='utf-8').readlines()
result = {} result = {}
indexName = '' indexName = ''
for line in allAuthors: for line in allAuthors:
line = line.replace('\n', '') line = line.replace('\n', '')
if (not line.startswith('#')) and line: if (not line.startswith('#')) and line:
if line.startswith(''): if line.startswith(''):
if indexName: if indexName:
result[indexName] = authorList result[indexName] = authorList
indexName = line[line.index('')+1:] indexName = line[line.index('')+1:]
authorList = {} authorList = {}
continue continue
line_c = '' line_c = ''
for char in line: for char in line:
if not char == '#': if not char == '#':
line_c += char line_c += char
else: else:
break break
authorList[line_c.split(' ', 1)[0]] = line_c.split(' ', 1)[1] authorList[line_c.split(' ', 1)[0]] = line_c.split(' ', 1)[1]
result[indexName] = authorList result[indexName] = authorList
return result return result
class version: class version:
libraries = ( libraries = (
'wxPython', 'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin', 'wxPython', 'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
'pyinstaller', 'py7zr','websockets', 'zhdate', 'requests', 'pyinstaller', 'py7zr','websockets', 'zhdate', 'requests',
) )
"""当前所需库""" """当前所需库"""
version = ('0.3.0', '',) version = ('0.3.0', '',)
"""当前版本""" """当前版本"""
def __init__(self) -> None: def __init__(self) -> None:
self.libraries = version.libraries self.libraries = version.libraries
"""当前所需库""" """当前所需库"""
self.version = version.version self.version = version.version
"""当前版本""" """当前版本"""
def installLibraries(self,index:str = 'https://pypi.tuna.tsinghua.edu.cn/simple'): def installLibraries(self,index:str = 'https://pypi.tuna.tsinghua.edu.cn/simple'):
"""安装全部开发用库""" """安装全部开发用库"""
from sys import platform from sys import platform
import os import os
if platform == 'win32': if platform == 'win32':
for i in self.libraries: for i in self.libraries:
print("安装库:" + i) print("安装库:" + i)
os.system(f"python -m pip install {i} -i {index}") os.system(f"python -m pip install {i} -i {index}")
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-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)
os.system(f"sudo python3 -m pip install {i} -i {index}") os.system(f"sudo python3 -m pip install {i} -i {index}")
def __call__(self): def __call__(self):
'''直接安装库,顺便返回一下当前版本''' '''直接安装库,顺便返回一下当前版本'''
self.installLibraries() self.installLibraries()
return self.version return self.version

View File

@ -1,8 +1,8 @@
from os import system from os import system
from sys import platform from sys import platform
if platform == "linux": if platform == "linux":
system("python3 -m pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/") system("python3 -m pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")
elif platform == "win32": elif platform == "win32":
system("pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/") system("pip install -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/")

View File

@ -1,4 +1,4 @@
from msctLib.buildIN import author_reader from msctLib.buildIN import author_reader
input(author_reader()) input(author_reader())