mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-02-07 19:36:46 +08:00
撤销了disp类,但是bug依旧没有变化。
This commit is contained in:
parent
ca2e8c9155
commit
f3c5044800
@ -38,12 +38,12 @@ A free opensource software which is used for creating all kinds of musics in Min
|
|||||||
# 一定会好起来的
|
# 一定会好起来的
|
||||||
|
|
||||||
|
|
||||||
from msctspt.bugReporter import version
|
from msctLib.buildIN import version
|
||||||
|
|
||||||
__ver__ = f'{version.version[1]} {version.version[0]}'
|
__ver__ = f'{version.version[1]} {version.version[0]}'
|
||||||
__author__ = '金羿Eilles'
|
__author__ = '金羿Eilles'
|
||||||
|
|
||||||
from msctLib.display import *
|
import msctLib.display as disp
|
||||||
|
|
||||||
from msctLib.function import *
|
from msctLib.function import *
|
||||||
|
|
||||||
@ -92,16 +92,18 @@ def __main__():
|
|||||||
def test2():
|
def test2():
|
||||||
print('???', end=' ')
|
print('???', end=' ')
|
||||||
|
|
||||||
window = disp(
|
disp.__root = disp.tk.Tk()
|
||||||
|
|
||||||
|
disp.initWindow(
|
||||||
geometry='1200x800',
|
geometry='1200x800',
|
||||||
menuWidget={
|
menuWidget={
|
||||||
'文件': {'新建': test, '打开': test},
|
'文件': {'新建': test, '打开': test},
|
||||||
'编辑': {'撤销': test, '重做': test},
|
'编辑': {'撤销': test, '重做': test},
|
||||||
'视图': {'缩放': test},
|
'视图': {'缩放': test},
|
||||||
'帮助': {'关于': authorWindowStarter},
|
'帮助': {'关于': disp.authorWindowStarter},
|
||||||
},
|
},
|
||||||
title='音·创 0.2 测试中',
|
title_='音·创 0.2 测试中',
|
||||||
buttons=[
|
button=[
|
||||||
{
|
{
|
||||||
'新建': ('', test2),
|
'新建': ('', test2),
|
||||||
'打开': ('', test2)
|
'打开': ('', test2)
|
||||||
@ -110,10 +112,10 @@ def __main__():
|
|||||||
'测试': ('', test2)
|
'测试': ('', test2)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
debug=True,
|
Debug=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
window.start()
|
disp.winstart()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
class version:
|
class version:
|
||||||
libraries = (
|
libraries = (
|
||||||
'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
|
'mido', 'amulet', 'amulet-core', 'amulet-nbt', 'piano_transcription_inference', 'pypinyin',
|
||||||
'pyinstaller', 'py7zr','websockets', 'torch', 'requests'
|
'pyinstaller', 'py7zr','websockets', 'zhdate', 'requests'
|
||||||
)
|
)
|
||||||
"""当前所需库"""
|
"""当前所需库"""
|
||||||
|
|
||||||
|
@ -34,27 +34,35 @@ tipsColor = PURPLE
|
|||||||
# 注:UI界面字体、代码字体
|
# 注:UI界面字体、代码字体
|
||||||
fontPattern = ('DengXian Light', 'Fira Code')
|
fontPattern = ('DengXian Light', 'Fira Code')
|
||||||
|
|
||||||
|
global __root
|
||||||
|
global title
|
||||||
|
global menuWidgets
|
||||||
|
global wordView
|
||||||
|
global buttons
|
||||||
|
global settingBox
|
||||||
|
global notemap
|
||||||
|
global infoBar
|
||||||
|
global debug
|
||||||
|
|
||||||
|
|
||||||
class disp:
|
__root = None
|
||||||
'''音·创 的基本Tk窗口显示库'''
|
'''窗口根'''
|
||||||
|
# 音·创 的基本Tk窗口显示函数
|
||||||
|
|
||||||
|
|
||||||
def __init__(
|
def initWindow(
|
||||||
self,
|
Debug: bool = False,
|
||||||
debug: bool = False,
|
title_: str = '音·创',
|
||||||
title: str = '音·创',
|
|
||||||
geometry: str = '0x0',
|
geometry: str = '0x0',
|
||||||
iconbitmap: tuple = ('./resources/musicreater.ico', './resources/musicreater.ico'),
|
iconbitmap: tuple = ('./resources/musicreater.ico', './resources/musicreater.ico'),
|
||||||
menuWidget: dict = {},
|
menuWidget: dict = {},
|
||||||
wordView: str = '音·创 Musicreater',
|
wordview: str = '音·创 Musicreater',
|
||||||
buttons: list = [],
|
button: list = [],
|
||||||
settingBox: list = [],
|
settingbox: list = [],
|
||||||
notemap: list = [],
|
notemap_: list = [],
|
||||||
infobar: str = '就绪',
|
infobar: str = '就绪',
|
||||||
) -> None:
|
) -> None:
|
||||||
'''使用参数建立基本的 音·创 窗口
|
'''使用参数建立基本的 音·创 窗口
|
||||||
:param root 根窗口
|
|
||||||
:param debug 是否将日志输出到控制台
|
:param debug 是否将日志输出到控制台
|
||||||
:param title 窗口标题
|
:param title 窗口标题
|
||||||
wordview: str #言论部分显示的字样
|
wordview: str #言论部分显示的字样
|
||||||
@ -77,75 +85,81 @@ class disp:
|
|||||||
:param infobar str 显示信息用
|
:param infobar str 显示信息用
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if debug:
|
if Debug:
|
||||||
log('载入参数')
|
log('载入参数')
|
||||||
|
|
||||||
# 载入参量 注意!图标将不被载入参数
|
# 载入参量 注意!图标将不被载入参数
|
||||||
|
|
||||||
|
global title
|
||||||
self.__root = tk.Tk()
|
global menuWidgets
|
||||||
'''窗口根'''
|
global wordView
|
||||||
|
global buttons
|
||||||
|
global settingBox
|
||||||
|
global notemap
|
||||||
|
global infoBar
|
||||||
|
global debug
|
||||||
|
|
||||||
|
|
||||||
self.title = title
|
|
||||||
|
title = title_
|
||||||
'''窗口标题'''
|
'''窗口标题'''
|
||||||
|
|
||||||
self.menuWidgets = menuWidget
|
menuWidgets = menuWidget
|
||||||
'''菜单设定项'''
|
'''菜单设定项'''
|
||||||
|
|
||||||
self.wordView = wordView
|
wordView = wordview
|
||||||
'''言·论 所显示的文字'''
|
'''言·论 所显示的文字'''
|
||||||
|
|
||||||
self.buttons = buttons
|
buttons = button
|
||||||
'''快捷功能按钮'''
|
'''快捷功能按钮'''
|
||||||
|
|
||||||
self.settingBox = settingBox
|
settingBox = settingbox
|
||||||
'''设置框'''
|
'''设置框'''
|
||||||
|
|
||||||
self.notemap = notemap
|
notemap = notemap_
|
||||||
'''音符列表'''
|
'''音符列表'''
|
||||||
|
|
||||||
self.infoBar = infobar
|
infoBar = infobar
|
||||||
'''信息显示版所显示的文字'''
|
'''信息显示版所显示的文字'''
|
||||||
|
|
||||||
self.debug = debug
|
debug = Debug
|
||||||
'''是否打开调试模式'''
|
'''是否打开调试模式'''
|
||||||
|
|
||||||
self.setTitle()
|
setTitle()
|
||||||
|
|
||||||
self.setGeometry(geometry)
|
setGeometry(geometry)
|
||||||
self.setIcon(*iconbitmap)
|
setIcon(*iconbitmap)
|
||||||
|
|
||||||
self.setMenu()
|
setMenu()
|
||||||
|
|
||||||
self.initWidget()
|
initWidget()
|
||||||
|
|
||||||
def start(self) -> None:
|
def winstart() -> None:
|
||||||
# 启动主消息循环
|
# 启动主消息循环
|
||||||
self.__root.mainloop()
|
__root.mainloop()
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
# 设定函数部分
|
# 设定函数部分
|
||||||
# =========================================================
|
# =========================================================
|
||||||
|
|
||||||
def setTitle(self, title: str = '') -> None:
|
def setTitle( title_: str = '') -> None:
|
||||||
'''设置窗口标题
|
'''设置窗口标题
|
||||||
:param title: str 窗口标题'''
|
:param title: str 窗口标题'''
|
||||||
|
global title
|
||||||
if title:
|
if title:
|
||||||
self.title = title
|
title = title_
|
||||||
self.__root.title(self.title)
|
__root.title(title)
|
||||||
if self.debug:
|
if debug:
|
||||||
log(f"设置窗口标题 {self.title}")
|
log(f"设置窗口标题 {title}")
|
||||||
|
|
||||||
def setGeometry(self, geometry: str = '0x0') -> None:
|
def setGeometry( geometry: str = '0x0') -> None:
|
||||||
'''设置窗口大小
|
'''设置窗口大小
|
||||||
:param geometry: str 窗口大小'''
|
:param geometry: str 窗口大小'''
|
||||||
self.__root.geometry(geometry)
|
__root.geometry(geometry)
|
||||||
if self.debug:
|
if debug:
|
||||||
log(f"设置窗口大小{geometry}")
|
log(f"设置窗口大小{geometry}")
|
||||||
|
|
||||||
def setIcon(self, bitmap: str = './musicreater.ico', default: str = '') -> bool:
|
def setIcon( bitmap: str = './musicreater.ico', default: str = '') -> bool:
|
||||||
'''设置窗口图标
|
'''设置窗口图标
|
||||||
:param bitmap: str 图标路径
|
:param bitmap: str 图标路径
|
||||||
:param default: str 设置对于全局的默认图标路径
|
:param default: str 设置对于全局的默认图标路径
|
||||||
@ -154,36 +168,40 @@ class disp:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if default:
|
if default:
|
||||||
self.__root.iconbitmap(bitmap, default)
|
__root.iconbitmap(bitmap, default)
|
||||||
log(f'设置图标为{bitmap},默认为{default}')
|
log(f'设置图标为{bitmap},默认为{default}')
|
||||||
else:
|
else:
|
||||||
self.__root.iconbitmap(bitmap)
|
__root.iconbitmap(bitmap)
|
||||||
log(f'设置图标为{bitmap}')
|
log(f'设置图标为{bitmap}')
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(str(e), 'ERROR')
|
log(str(e), 'ERROR')
|
||||||
if self.debug:
|
if debug:
|
||||||
raise e
|
raise e
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def setMenu(self) -> None:
|
def setMenu() -> None:
|
||||||
'''设置根菜单'''
|
'''设置根菜单'''
|
||||||
if not self.menuWidgets:
|
|
||||||
|
global _RootMenu
|
||||||
|
global _mainMenuBar
|
||||||
|
|
||||||
|
if not menuWidgets:
|
||||||
# 如果传入空参数则返回当前菜单
|
# 如果传入空参数则返回当前菜单
|
||||||
try:
|
try:
|
||||||
return self._RootMenu
|
return _RootMenu
|
||||||
except Exception as E:
|
except Exception as E:
|
||||||
if self.debug:
|
if debug:
|
||||||
raise E
|
raise E
|
||||||
log('无法读取菜单信息', 'WARRING')
|
log('无法读取菜单信息', 'WARRING')
|
||||||
# 如果不是空参数则新建菜单
|
# 如果不是空参数则新建菜单
|
||||||
log('新建一个菜单')
|
log('新建一个菜单')
|
||||||
|
|
||||||
self._RootMenu = {}
|
_RootMenu = {}
|
||||||
self._mainMenuBar = tk.Menu(self.__root)
|
_mainMenuBar = tk.Menu(__root)
|
||||||
for menuName, menuCmd in self.menuWidgets.items():
|
for menuName, menuCmd in menuWidgets.items():
|
||||||
# 取得一个菜单名和一堆菜单函数及其显示名称
|
# 取得一个菜单名和一堆菜单函数及其显示名称
|
||||||
menu = tk.Menu(self._mainMenuBar, tearoff=0)
|
menu = tk.Menu(_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)
|
||||||
@ -191,13 +209,13 @@ class disp:
|
|||||||
else:
|
else:
|
||||||
menu.add_separator()
|
menu.add_separator()
|
||||||
log('分隔符 -- 分隔符')
|
log('分隔符 -- 分隔符')
|
||||||
self._mainMenuBar.add_cascade(label=menuName, menu=menu)
|
_mainMenuBar.add_cascade(label=menuName, menu=menu)
|
||||||
self._RootMenu[menuName] = menu
|
_RootMenu[menuName] = menu
|
||||||
log('计入一个菜单 -- ' + menuName)
|
log('计入一个菜单 -- ' + menuName)
|
||||||
self.__root.config(menu=self._mainMenuBar)
|
__root.config(menu=_mainMenuBar)
|
||||||
log('菜单设置完毕')
|
log('菜单设置完毕')
|
||||||
|
|
||||||
def addMenu(self, menuRoot: str = '', menuLabel: str = '', menuCommand=None):
|
def addMenu( menuRoot: str = '', menuLabel: str = '', menuCommand=None):
|
||||||
'''增加一个菜单项
|
'''增加一个菜单项
|
||||||
:param menuRoot : str
|
:param menuRoot : str
|
||||||
菜单的根菜单,即所属的菜单上的文字
|
菜单的根菜单,即所属的菜单上的文字
|
||||||
@ -205,28 +223,32 @@ class disp:
|
|||||||
所需要增加的项目显示的文字
|
所需要增加的项目显示的文字
|
||||||
:param menuCommand : <function>
|
:param menuCommand : <function>
|
||||||
'''
|
'''
|
||||||
if menuRoot in self._RootMenu.keys:
|
|
||||||
|
global _RootMenu
|
||||||
|
global _mainMenuBar
|
||||||
|
|
||||||
|
if menuRoot in _RootMenu.keys:
|
||||||
# 如果已经有父菜单
|
# 如果已经有父菜单
|
||||||
if menuLabel:
|
if menuLabel:
|
||||||
# 增加菜单指令
|
# 增加菜单指令
|
||||||
self._RootMenu[menuRoot].add_command(
|
_RootMenu[menuRoot].add_command(
|
||||||
label=menuLabel, command=menuCommand
|
label=menuLabel, command=menuCommand
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# 增加分隔栏
|
# 增加分隔栏
|
||||||
self._RootMenu[menuRoot].add_separator()
|
_RootMenu[menuRoot].add_separator()
|
||||||
else:
|
else:
|
||||||
# 没有父菜单则新增一个父菜单
|
# 没有父菜单则新增一个父菜单
|
||||||
menu = tk.Menu(self._mainMenuBar, tearoff=False)
|
menu = tk.Menu(_mainMenuBar, tearoff=False)
|
||||||
if menuLabel:
|
if menuLabel:
|
||||||
menu.add_command(label=menuLabel, command=menuCommand)
|
menu.add_command(label=menuLabel, command=menuCommand)
|
||||||
else:
|
else:
|
||||||
menu.add_separator()
|
menu.add_separator()
|
||||||
self._mainMenuBar.add_cascade(label=menuRoot, menu=menu)
|
_mainMenuBar.add_cascade(label=menuRoot, menu=menu)
|
||||||
self._RootMenu[menuRoot] = menu
|
_RootMenu[menuRoot] = menu
|
||||||
|
|
||||||
def initWidget(
|
def initWidget(
|
||||||
self,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
'''设置窗口小部件,分为:
|
'''设置窗口小部件,分为:
|
||||||
:言·论 WordView
|
:言·论 WordView
|
||||||
@ -236,41 +258,46 @@ class disp:
|
|||||||
:各个音轨的显示框 TrackFrame
|
:各个音轨的显示框 TrackFrame
|
||||||
:信息显示版 InfoBar
|
:信息显示版 InfoBar
|
||||||
'''
|
'''
|
||||||
self._wordviewBar = tk.Label(
|
|
||||||
self.__root,
|
global _wordviewBar
|
||||||
|
global _infoBar
|
||||||
|
global _buttonBar
|
||||||
|
|
||||||
|
_wordviewBar = tk.Label(
|
||||||
|
__root,
|
||||||
bg='black',
|
bg='black',
|
||||||
fg='white',
|
fg='white',
|
||||||
text=self.wordView,
|
text=wordView,
|
||||||
font=(fontPattern[0], 30),
|
font=(fontPattern[0], 30),
|
||||||
)
|
)
|
||||||
# 定义 言·论 版面
|
# 定义 言·论 版面
|
||||||
log('言·论版面设置完成')
|
log('言·论版面设置完成')
|
||||||
|
|
||||||
self._infoBar = tk.Label(
|
_infoBar = tk.Label(
|
||||||
self.__root,
|
__root,
|
||||||
bg='white',
|
bg='white',
|
||||||
fg='black',
|
fg='black',
|
||||||
text=self.infoBar,
|
text=infoBar,
|
||||||
font=(fontPattern[0], 10),
|
font=(fontPattern[0], 10),
|
||||||
)
|
)
|
||||||
# 定义 信息显示版
|
# 定义 信息显示版
|
||||||
log('信息显示版设置完成')
|
log('信息显示版设置完成')
|
||||||
|
|
||||||
self._buttonBar = tk.Frame(
|
_buttonBar = tk.Frame(
|
||||||
self.__root,
|
__root,
|
||||||
bd=2,
|
bd=2,
|
||||||
)
|
)
|
||||||
# 定义 快捷按钮面板. 注意!这里是以一个Frame为容器,而不是一个Button列表,后面的版面也以Frame容器居多
|
# 定义 快捷按钮面板. 注意!这里是以一个Frame为容器,而不是一个Button列表,后面的版面也以Frame容器居多
|
||||||
|
|
||||||
self.setButtonBar(self.buttons)
|
setButtonBar(buttons)
|
||||||
|
|
||||||
self._wordviewBar.pack(side='top', fill='x')
|
_wordviewBar.pack(side='top', fill='x')
|
||||||
self._buttonBar.pack(side='top', fill='x')
|
_buttonBar.pack(side='top', fill='x')
|
||||||
|
|
||||||
self._infoBar.pack(side='bottom', fill='x')
|
_infoBar.pack(side='bottom', fill='x')
|
||||||
|
|
||||||
def setButtonBar(
|
def setButtonBar(
|
||||||
self,
|
|
||||||
buttonList: list = [],
|
buttonList: list = [],
|
||||||
defaultMissingTexturePath: str = './resources/uimage/missing_texture.png',
|
defaultMissingTexturePath: str = './resources/uimage/missing_texture.png',
|
||||||
separatorButtonTexturePath: str = './resources/uimage/separator_line.png',
|
separatorButtonTexturePath: str = './resources/uimage/separator_line.png',
|
||||||
@ -283,7 +310,9 @@ class disp:
|
|||||||
# 图标应该如下
|
# 图标应该如下
|
||||||
# 新建 打开 保存 |
|
# 新建 打开 保存 |
|
||||||
|
|
||||||
self._buttonBarList = []
|
global _buttonBarList
|
||||||
|
|
||||||
|
_buttonBarList = []
|
||||||
'''按钮对象列表,注意软件调用的时候千万别动!'''
|
'''按钮对象列表,注意软件调用的时候千万别动!'''
|
||||||
|
|
||||||
separatorimg = tk.PhotoImage(file=separatorButtonTexturePath)
|
separatorimg = tk.PhotoImage(file=separatorButtonTexturePath)
|
||||||
@ -296,11 +325,11 @@ class disp:
|
|||||||
img = tk.PhotoImage(file=args[0])
|
img = tk.PhotoImage(file=args[0])
|
||||||
except:
|
except:
|
||||||
log('载入图片失败,使用默认图片','WARNING')
|
log('载入图片失败,使用默认图片','WARNING')
|
||||||
if self.debug:
|
if debug:
|
||||||
raise FileNotFoundError(f'图片{args[0]}不存在')
|
raise FileNotFoundError(f'图片{args[0]}不存在')
|
||||||
img = tk.PhotoImage(file=defaultMissingTexturePath)
|
img = tk.PhotoImage(file=defaultMissingTexturePath)
|
||||||
button = tk.Button(
|
button = tk.Button(
|
||||||
self._buttonBar,
|
_buttonBar,
|
||||||
text=name,
|
text=name,
|
||||||
command=args[1],
|
command=args[1],
|
||||||
image=img,
|
image=img,
|
||||||
@ -309,19 +338,19 @@ class disp:
|
|||||||
font=(fontPattern[0], 10),
|
font=(fontPattern[0], 10),
|
||||||
)
|
)
|
||||||
button.pack(side='left', padx=5, pady=5)
|
button.pack(side='left', padx=5, pady=5)
|
||||||
self._buttonBarList.append(button)
|
_buttonBarList.append(button)
|
||||||
# 添加按钮
|
# 添加按钮
|
||||||
tk.Label(self._buttonBar, image=separatorimg).pack(
|
tk.Label(_buttonBar, image=separatorimg).pack(
|
||||||
side='left', padx=5, pady=5
|
side='left', padx=5, pady=5
|
||||||
)
|
)
|
||||||
|
|
||||||
def setWordView(self, text: str) -> None:
|
def setWordView( text: str) -> None:
|
||||||
'''重新设置言·论版的文字'''
|
'''重新设置言·论版的文字'''
|
||||||
self._wordviewBar['text'] = text
|
_wordviewBar['text'] = text
|
||||||
|
|
||||||
def setInfoBar(self, text: str) -> None:
|
def setInfoBar( text: str) -> None:
|
||||||
'''重新设置信息显示版的文字'''
|
'''重新设置信息显示版的文字'''
|
||||||
self._infoBar['text'] = text
|
_infoBar['text'] = text
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
# 预置函数部分
|
# 预置函数部分
|
||||||
@ -345,7 +374,7 @@ def authorWindowStarter(
|
|||||||
tk.Label(authorWindow, text=_('F音创'), font=('', 35)).pack()
|
tk.Label(authorWindow, text=_('F音创'), font=('', 35)).pack()
|
||||||
tk.Label(
|
tk.Label(
|
||||||
authorWindow,
|
authorWindow,
|
||||||
text='{} {}'.format(version.version[1] + version.version[0]),
|
text='{} {}'.format(version.version[1] , version.version[0]),
|
||||||
font=('', 15),
|
font=('', 15),
|
||||||
).pack()
|
).pack()
|
||||||
# pack 的side可以赋值为LEFT RTGHT TOP BOTTOM
|
# pack 的side可以赋值为LEFT RTGHT TOP BOTTOM
|
||||||
@ -397,7 +426,7 @@ def authorWindowStarter(
|
|||||||
|
|
||||||
class ProgressBar:
|
class ProgressBar:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
|
||||||
root: tk.Tk = tk.Tk(),
|
root: tk.Tk = tk.Tk(),
|
||||||
style: tuple = (DEFAULTBLUE, BLACK, WHITE),
|
style: tuple = (DEFAULTBLUE, BLACK, WHITE),
|
||||||
type: bool = False,
|
type: bool = False,
|
||||||
@ -415,7 +444,7 @@ class ProgressBar:
|
|||||||
显示的附加信息
|
显示的附加信息
|
||||||
:param debug : bool
|
:param debug : bool
|
||||||
是否输出日志到控制台'''
|
是否输出日志到控制台'''
|
||||||
self.root = root
|
root = root
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
@ -426,4 +455,4 @@ if __name__ == '__mian__':
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
os.chdir('../')
|
os.chdir('../')
|
||||||
disp.authorMenu()
|
authorWindowStarter()
|
||||||
|
@ -90,48 +90,4 @@ class report:
|
|||||||
os.remove("./Temps&Logs.zip")
|
os.remove("./Temps&Logs.zip")
|
||||||
|
|
||||||
|
|
||||||
class version:
|
from msctLib.buildIN import 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
|
|
Loading…
x
Reference in New Issue
Block a user