mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2024-11-14 11:27:42 +08:00
重新设计UI,准备进行国际化支持
This commit is contained in:
parent
97f334789e
commit
8fe71dbe0d
@ -1,20 +1,64 @@
|
|||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
|
'''对于音·创的语言支持兼语言文件编辑器'''
|
||||||
|
|
||||||
DEFAULTLANGUAGE = 'zh-CN'
|
DEFAULTLANGUAGE = 'zh-CN'
|
||||||
|
|
||||||
LANGUAGELIST = {
|
LANGUAGELIST = {
|
||||||
|
# 第一个是语言的中文名称和地区
|
||||||
|
# 第二个是语言的英文名称和地区
|
||||||
|
# 第三个是语言的本地名称和地区
|
||||||
'zh-CN': (
|
'zh-CN': (
|
||||||
"简体中文 中国大陆",
|
"简体中文 中国大陆",
|
||||||
"Simplified Chinese, China Mainland",
|
"Simplified Chinese, Chinese Mainland",
|
||||||
|
"简体中文 中国大陆",
|
||||||
),
|
),
|
||||||
|
'zh-TW': (
|
||||||
|
"繁体中文 台湾省",
|
||||||
|
"Traditional Chinese, Taiwan Province",
|
||||||
|
"正體中文,台灣省",
|
||||||
|
),
|
||||||
|
# 'zh-HK': (
|
||||||
|
# "简体中文 中国大陆",
|
||||||
|
# "Traditional Chinese, the Hong Kong Special Administrative Region",
|
||||||
|
# "繁體中文,香港特別行政區",
|
||||||
|
# ),
|
||||||
|
# 'zh-MO': (
|
||||||
|
# "简体中文 中国大陆",
|
||||||
|
# "Traditional Chinese, the Macao Special Administrative Region",
|
||||||
|
# "繁體中文,澳門特別行政區",
|
||||||
|
# ),
|
||||||
'en-GB': (
|
'en-GB': (
|
||||||
"英式英语 大不列颠",
|
"英语 英国",
|
||||||
"British English, Great Britain",
|
"British English, the United Kingdom",
|
||||||
|
"British English, the United Kingdom",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
if DEFAULTLANGUAGE == 'zh-CN':
|
# 对于旧版本音·创的语言支持
|
||||||
from languages.zhCN import READABLETEXT
|
# 重构之后将停止使用
|
||||||
elif DEFAULTLANGUAGE == 'en-GB':
|
from languages.zhCN import READABLETEXT
|
||||||
from languages.enGB import READABLETEXT
|
|
||||||
|
if DEFAULTLANGUAGE in LANGUAGELIST.keys():
|
||||||
|
with open('./languages/'+DEFAULTLANGUAGE+'.lang','r',encoding='utf-8') as languageFile :
|
||||||
|
_text = []
|
||||||
|
for line in languageFile:
|
||||||
|
_text.append(line)
|
||||||
|
_TEXT = _text.copy()
|
||||||
|
else:
|
||||||
|
raise KeyError(f"无法打开默认语言{DEFAULTLANGUAGE}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# 启动语言编辑器
|
||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
|
||||||
|
root.geometry('900x600')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
0
languages/zh-CN.lang
Normal file
0
languages/zh-CN.lang
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 34 KiB |
@ -71,6 +71,8 @@ class disp:
|
|||||||
self.setTitle(title,debug)
|
self.setTitle(title,debug)
|
||||||
self.setGeometry(geometry,debug)
|
self.setGeometry(geometry,debug)
|
||||||
self.setIcon(*iconbitmap,debug=debug)
|
self.setIcon(*iconbitmap,debug=debug)
|
||||||
|
|
||||||
|
|
||||||
self.setMenu(menuWidget)
|
self.setMenu(menuWidget)
|
||||||
|
|
||||||
self.initWidget(wordView,buttons,settingBox,notemap)
|
self.initWidget(wordView,buttons,settingBox,notemap)
|
||||||
@ -175,6 +177,47 @@ class disp:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def authorMenu(authors:tuple = (('金羿','EillesWan@outlook.com'),('诸葛亮与八卦阵','474037765'))):
|
||||||
|
'''自定义作者界面'''
|
||||||
|
from languages.lang import
|
||||||
|
aabw = tk.Tk()
|
||||||
|
aabw.title(READABLETEXT[9])
|
||||||
|
aabw.geometry('550x600') # 像素
|
||||||
|
tk.Label(aabw, text='', font=('', 15)).pack()
|
||||||
|
tk.Label(aabw, text=READABLETEXT[10], font=('', 35)).pack()
|
||||||
|
tk.Label(aabw, text=READABLETEXT[11].format(VER[1] + VER[0]), font=('', 15)).pack()
|
||||||
|
# pack 的side可以赋值为LEFT RTGHT TOP BOTTOM
|
||||||
|
# grid 的row 是列数、column是行排,注意,这是针对空间控件本身大小来的,即是指向当前控件的第几个。
|
||||||
|
# place的 x、y是(x,y)坐标
|
||||||
|
# pic = tk.PhotoImage(file='./bin/pics/Ryoun_S.png')
|
||||||
|
# tk.Label(aabw, image=pic, width=200, height=200).pack()
|
||||||
|
# del pic
|
||||||
|
tk.Label(aabw, text='', font=('', 5)).pack()
|
||||||
|
tk.Label(aabw, text=READABLETEXT[12], font=('', 20)).pack()
|
||||||
|
tk.Label(aabw, text='', font=('', 15)).pack()
|
||||||
|
for i in READABLETEXT[15]:
|
||||||
|
tk.Label(aabw, text=i[0], font=('', 17 if i[1] else 15, 'bold' if i[1] else '')).pack()
|
||||||
|
tk.Label(aabw, text='', font=('', 5)).pack()
|
||||||
|
if DEFAULTLANGUAGE != 'zh-CN':
|
||||||
|
tk.Label(aabw, text=READABLETEXT[16], font=('', 15)).pack()
|
||||||
|
for i in READABLETEXT['Translator']:
|
||||||
|
tk.Label(aabw, text=i[0], font=('', 17 if i[1] else 15, 'bold' if i[1] else '')).pack()
|
||||||
|
|
||||||
|
def exitAboutWindow():
|
||||||
|
aabw.destroy()
|
||||||
|
|
||||||
|
tk.Button(aabw, text=READABLETEXT[13], command=exitAboutWindow).pack()
|
||||||
|
|
||||||
|
aabw.mainloop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProgressBar:
|
class ProgressBar:
|
||||||
|
|
||||||
def __init__(self,root:tk.Tk = tk.Tk(),style:tuple = (DEFAULTBLUE,BLACK,WHITE),
|
def __init__(self,root:tk.Tk = tk.Tk(),style:tuple = (DEFAULTBLUE,BLACK,WHITE),
|
||||||
|
Loading…
Reference in New Issue
Block a user