mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2024-11-14 11:27:42 +08:00
完全想好了窗口改怎么做了,正在逐步更新,顺便取代前尘旧物。
This commit is contained in:
parent
066e0b0cac
commit
d2a6ce2529
@ -50,11 +50,7 @@ from msctLib.data import uniteIO
|
|||||||
|
|
||||||
def __main__():
|
def __main__():
|
||||||
|
|
||||||
disp(
|
disp()
|
||||||
root,
|
|
||||||
False,
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
fcwslib/版权声明.png
Normal file
BIN
fcwslib/版权声明.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
@ -22,57 +22,99 @@ BLACK = (18, 17, 16)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class disp:
|
|
||||||
|
|
||||||
# 正在修改,没改完
|
|
||||||
def __init__(self,root:tk.Tk = tk.Tk(),debug:bool = False,title:str = '',
|
backgroundColor = WHITE
|
||||||
geometry : str = '0x0', iconbitmap : tuple = ('',''), menuWidget:dict = {},
|
frontgroundColor = BLACK
|
||||||
wordView : str = '音·创 Musicreater', ) -> None:
|
loadingColor = DEFAULTBLUE
|
||||||
'''传入root参数为窗口根,kwgs详见开发说明|指南'''
|
errorColor = RED
|
||||||
|
okColor = GREEN
|
||||||
|
tipsColor = PURPLE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 = []) -> None:
|
||||||
|
'''使用参数建立基本的 音·创 窗口
|
||||||
|
:param root 根窗口
|
||||||
|
:param debug 是否将日志输出到控制台
|
||||||
|
:param title 窗口标题
|
||||||
|
wordview: str #言论部分显示的字样
|
||||||
|
button: list = [ # 操作按钮部分
|
||||||
|
dict = {
|
||||||
|
按钮名称 : tuple(按钮图标,执行函数)
|
||||||
|
},
|
||||||
|
],
|
||||||
|
settingbox: list = [ # 设置部分显示的字样及其对应的设置函数
|
||||||
|
(
|
||||||
|
设置名称:str,
|
||||||
|
值类型:tuple,
|
||||||
|
显示内容:str,
|
||||||
|
设置操作函数:<function>,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
map: list = [ # 一首曲目的音符数据
|
||||||
|
音符数据
|
||||||
|
]
|
||||||
|
'''
|
||||||
|
|
||||||
self.root = root
|
self.root = root
|
||||||
|
|
||||||
self.FUNCLIST = {
|
self.setTitle(title,debug)
|
||||||
'title' : self.setTitle,
|
self.setGeometry(geometry,debug)
|
||||||
'geometry': self.setGeometry,
|
self.setIcon(*iconbitmap,debug=debug)
|
||||||
'iconbitmap': self.setIcon,
|
self.setMenu(menuWidget)
|
||||||
'menu': self.setMenu,
|
|
||||||
'widget': self.setWidget,
|
|
||||||
}
|
|
||||||
'''注:此处为引导传参,若传参错误且debug模式关闭则不会有任何反馈'''
|
|
||||||
|
|
||||||
for func,args in kwgs:
|
self.initWidget(wordView,buttons,settingBox,notemap)
|
||||||
if func in self.FUNCLIST.keys():
|
|
||||||
if type(args) == type([]):
|
|
||||||
self.FUNCLIST[func](*args)
|
|
||||||
if type(args) == type({}):
|
|
||||||
self.FUNCLIST[func](**args)
|
|
||||||
else:
|
|
||||||
self.FUNCLIST[func](args)
|
|
||||||
elif debug:
|
|
||||||
raise KeyError(f'无法定位函数{func}')
|
|
||||||
|
|
||||||
def setTitle(self,title:str = '',debug : bool = False) -> None:
|
def setTitle(self,title:str = '',debug : bool = False) -> None:
|
||||||
'''设置窗口标题'''
|
'''设置窗口标题'''
|
||||||
self.root.title = title
|
self.root.title = title
|
||||||
if debug:
|
if debug:
|
||||||
|
log(f"设置窗口标题{title}")
|
||||||
|
|
||||||
|
|
||||||
def setGeometry(self,geometry) -> None:
|
def setGeometry(self,geometry:str = '0x0',debug:bool = False) -> None:
|
||||||
'''设置窗口大小'''
|
'''设置窗口大小'''
|
||||||
self.root.geometry(geometry)
|
self.root.geometry(geometry)
|
||||||
|
if debug:
|
||||||
|
log(f"设置窗口大小{geometry}")
|
||||||
|
|
||||||
def setIcon(self,*icon) -> None:
|
def setIcon(self,bitmap:str = './musicreater.ico',default:str = '',debug:bool = False) -> None:
|
||||||
'''设置窗口图标'''
|
'''设置窗口图标
|
||||||
self.root.iconbitmap(*icon)
|
注意,default参数仅在Windows下有效,其意为将所有没有图标的窗口设置默认图标
|
||||||
|
如果在非Windows环境使用default参数,一个Error将被升起'''
|
||||||
|
if not 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,**kwgs) -> None:
|
def setMenu(self,menuWidgets: dict = {}) -> None:
|
||||||
'''设置根菜单'''
|
'''设置根菜单'''
|
||||||
if not kwgs:
|
if not menuWidgets:
|
||||||
|
# 如果传入空参数则返回当前菜单
|
||||||
return self.RootMenu
|
return self.RootMenu
|
||||||
|
# 如果不是空参数则新建菜单
|
||||||
self.RootMenu = {}
|
self.RootMenu = {}
|
||||||
self.mainMenuBar = tk.Menu(self.root)
|
self.mainMenuBar = tk.Menu(self.root)
|
||||||
for menuName,menuCmd in kwgs.items():
|
for menuName,menuCmd in 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:
|
||||||
@ -83,14 +125,24 @@ class disp:
|
|||||||
self.RootMenu[menuName] = menu
|
self.RootMenu[menuName] = menu
|
||||||
self.root.config(menu=self.mainMenuBar)
|
self.root.config(menu=self.mainMenuBar)
|
||||||
|
|
||||||
def addMenu(self,menuRoot:str = '',menuLabel:str = '',menuCommand:str = None):
|
def addMenu(self,menuRoot:str = '',menuLabel:str = '',menuCommand:function = None):
|
||||||
'''增加一个菜单项'''
|
'''增加一个菜单项
|
||||||
|
:param menuRoot : str
|
||||||
|
菜单的根菜单,即所属的菜单上的文字
|
||||||
|
:param menuLabel : str
|
||||||
|
所需要增加的项目显示的文字
|
||||||
|
:param menuCommand : <function>
|
||||||
|
'''
|
||||||
if menuRoot in self.RootMenu.keys:
|
if menuRoot in self.RootMenu.keys:
|
||||||
|
# 如果已经有父菜单
|
||||||
if menuLabel:
|
if menuLabel:
|
||||||
|
# 增加菜单指令
|
||||||
self.RootMenu[menuRoot].add_command(label = menuLabel, command = menuCommand)
|
self.RootMenu[menuRoot].add_command(label = menuLabel, command = menuCommand)
|
||||||
else:
|
else:
|
||||||
|
# 增加分隔栏
|
||||||
self.RootMenu[menuRoot].add_separator()
|
self.RootMenu[menuRoot].add_separator()
|
||||||
else:
|
else:
|
||||||
|
# 没有父菜单则新增一个父菜单
|
||||||
menu = tk.Menu(self.mainMenuBar,tearoff=False)
|
menu = tk.Menu(self.mainMenuBar,tearoff=False)
|
||||||
if menuLabel:
|
if menuLabel:
|
||||||
menu.add_command(label = menuLabel, command = menuCommand)
|
menu.add_command(label = menuLabel, command = menuCommand)
|
||||||
@ -100,14 +152,22 @@ class disp:
|
|||||||
self.RootMenu[menuRoot] = menu
|
self.RootMenu[menuRoot] = menu
|
||||||
|
|
||||||
|
|
||||||
|
def initWidget(self, wordView: str = '音·创 Musicreater', buttons: list = [],
|
||||||
|
settingBox: list = [], notemap: list = []) -> None:
|
||||||
|
'''设置窗口小部件,分为:
|
||||||
|
:言·论 WordView
|
||||||
|
:快捷按钮面板 ButtonBar
|
||||||
|
:设置框 SettingBar
|
||||||
|
:音轨框 TrackBar
|
||||||
|
:各个音轨的显示框 TrackFrame
|
||||||
|
:信息显示版 InfoBar
|
||||||
|
'''
|
||||||
|
self._wordviewBar = tk.Label(self.root,bg=frontgroundColor,fg=backgroundColor,text = wordView)
|
||||||
|
|
||||||
def setWidget(self,**kwgs) -> None:
|
self.setWordView(wordView)
|
||||||
self._wordviewBar = tk.Label(self.root)
|
|
||||||
pass
|
|
||||||
|
|
||||||
def setWordView(self, **kwgs) -> None:
|
def setWordView(self, text:str) -> None:
|
||||||
for key,value in kwgs.items():
|
self._wordviewBar['text'] = text
|
||||||
self._wordviewBar[key] = value
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
|||||||
'iconbitmap': ('./resources/musicreater.ico', './resources/musicreater.ico'),
|
'iconbitmap': ('./resources/musicreater.ico', './resources/musicreater.ico'),
|
||||||
'menu' : { #对setMenu有特殊说明
|
'menu' : { #对setMenu有特殊说明
|
||||||
'文件': {
|
'文件': {
|
||||||
'新建': lambda : x,
|
'新建': <function>,
|
||||||
'打开': lambda : x,
|
'打开': <function>,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'widget': { #对窗口部件又详细说明
|
'widget': { #对窗口部件又详细说明
|
||||||
@ -74,15 +74,21 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
|||||||
'text': str = 显示内容,
|
'text': str = 显示内容,
|
||||||
# ... 即可用 tk.Label 的参数
|
# ... 即可用 tk.Label 的参数
|
||||||
},
|
},
|
||||||
|
button: list = [
|
||||||
|
dict = {
|
||||||
|
按钮名称 : tuple(按钮图标,执行函数)
|
||||||
|
},
|
||||||
|
],
|
||||||
settingbox: list = [ #设置部分显示的字样及其对应的设置函数
|
settingbox: list = [ #设置部分显示的字样及其对应的设置函数
|
||||||
(设置名称:str,值类型,显示内容:str,设置操作函数:function,)
|
(
|
||||||
]
|
设置名称:str,
|
||||||
tracklist: int = 音轨数量 #音轨选择框
|
值类型:tuple,
|
||||||
operation: dict = {
|
显示内容:str,
|
||||||
按钮名称 : 执行函数
|
设置操作函数:<function>,
|
||||||
}
|
)
|
||||||
|
],
|
||||||
map: list = [
|
map: list = [
|
||||||
音符: class Note
|
音符数据
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
注:
|
注:
|
||||||
@ -98,9 +104,9 @@ functions.py中会调取./addon/目录下的全部功能文件,这些功能文
|
|||||||
| 参数 | 对应类中的变量 | 变量类型 | 说明 |
|
| 参数 | 对应类中的变量 | 变量类型 | 说明 |
|
||||||
|------------|------------------|---------------------------|---------------------|
|
|------------|------------------|---------------------------|---------------------|
|
||||||
| wordview | wordview | str | 显示在 言·论 区域的文字 |
|
| wordview | wordview | str | 显示在 言·论 区域的文字 |
|
||||||
|
| button | button | list[dict{}] | 操作按钮 |
|
||||||
| settingbox | settings | list[ Any ] | 设置项目中的值 |
|
| settingbox | settings | list[ Any ] | 设置项目中的值 |
|
||||||
| tracklist | tracknum | tuple(int,int) | 当前选择到的音轨与音轨总数|
|
| tracklist | tracknum | tuple(int,int) | 当前选择到的音轨与音轨总数|
|
||||||
| operation | buttons | list[ tkinter.Button ] | 按钮列表 |
|
|
||||||
| map | notes | list[ class Note ] | 当前的音符列表 |
|
| map | notes | list[ class Note ] | 当前的音符列表 |
|
||||||
|
|
||||||
|
|
||||||
|
49
msctplugin/pluginLoader.py
Normal file
49
msctplugin/pluginLoader.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# -*- 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
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
@ -25,6 +25,7 @@ Copyright © W-YI 2022
|
|||||||
16.支持读入Musescore的曲谱文件(.mscz、.mscx)
|
16.支持读入Musescore的曲谱文件(.mscz、.mscx)
|
||||||
17.支持自动搜寻地图目录位置(网易&微软)
|
17.支持自动搜寻地图目录位置(网易&微软)
|
||||||
18.支持读入JPword曲谱文件(.jpd)
|
18.支持读入JPword曲谱文件(.jpd)
|
||||||
|
19.新的UI设计,以及UI主题文件
|
||||||
|
|
||||||
===============
|
===============
|
||||||
2022 年度挑战
|
2022 年度挑战
|
||||||
@ -39,6 +40,16 @@ Copyright © W-YI 2022
|
|||||||
|
|
||||||
Delta 0.2.0
|
Delta 0.2.0
|
||||||
2022 2 10 ~ 2022 3
|
2022 2 10 ~ 2022 3
|
||||||
|
1.进行了大量的代码重构,使之更加易于开发
|
||||||
|
2.对功能进行了精简优化,能够更加方便的开发新功能
|
||||||
|
3.完善程序的一些外观与性能优化,使用了更多多线程板块
|
||||||
|
4.在读取和写入的时候加入进度条,会实时反馈当前的加载进度
|
||||||
|
5.能够使用可视化界面进行音乐的基本编辑
|
||||||
|
6.提高用户感受,修复已知问题
|
||||||
|
7.增强个性化设置,令用户能够用其所感
|
||||||
|
8.更新读我文档,使之更用户化
|
||||||
|
9.面对用户的操作加强
|
||||||
|
10.新增下载器,无需用户从源代码安装
|
||||||
|
|
||||||
|
|
||||||
Delta 0.1.5.2
|
Delta 0.1.5.2
|
||||||
|
Loading…
Reference in New Issue
Block a user