mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-01-31 23:41:44 +08:00
编辑器
This commit is contained in:
parent
7d9b63b9fe
commit
3d283bfded
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
12
.idea/Musicreater.iml
generated
Normal file
12
.idea/Musicreater.iml
generated
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
<component name="PyDocumentationSettings">
|
||||||
|
<option name="format" value="PLAIN" />
|
||||||
|
<option name="myDocStringFormat" value="Plain" />
|
||||||
|
</component>
|
||||||
|
</module>
|
47
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
47
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="LongLine" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyArgumentEqualDefaultInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyAugmentAssignmentInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyClassicStyleClassInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyCompatibilityInspection" enabled="false" level="WARNING" enabled_by_default="false">
|
||||||
|
<option name="ourVersions">
|
||||||
|
<value>
|
||||||
|
<list size="1">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="3.10" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyMandatoryEncodingInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyMissingTypeHintsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredErrors">
|
||||||
|
<list>
|
||||||
|
<option value="E501" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredErrors">
|
||||||
|
<list>
|
||||||
|
<option value="N802" />
|
||||||
|
<option value="N803" />
|
||||||
|
<option value="N806" />
|
||||||
|
<option value="N813" />
|
||||||
|
<option value="N801" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyUnboundLocalVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredIdentifiers">
|
||||||
|
<list>
|
||||||
|
<option value="list.__getitem__" />
|
||||||
|
<option value="list.split" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
4
.idea/misc.xml
generated
Normal file
4
.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Musicreater.iml" filepath="$PROJECT_DIR$/.idea/Musicreater.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
Binary file not shown.
Binary file not shown.
5
languages/autosave.tmp.txt
Normal file
5
languages/autosave.tmp.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
zh-CN
|
||||||
|
简体中文 中国大陆
|
||||||
|
Simplified Chinese, Chinese Mainland
|
||||||
|
简体中文 中国大陆
|
||||||
|
|
@ -1,8 +1,6 @@
|
|||||||
# -*- coding:utf-8 -*-
|
# -*- coding:utf-8 -*-
|
||||||
'''对于音·创的语言支持兼语言文件编辑器'''
|
'''对于音·创的语言支持兼语言文件编辑器'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright 2022 Team-Ryoun
|
Copyright 2022 Team-Ryoun
|
||||||
|
|
||||||
@ -19,11 +17,6 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULTLANGUAGE = 'zh-CN'
|
DEFAULTLANGUAGE = 'zh-CN'
|
||||||
|
|
||||||
LANGUAGELIST = {
|
LANGUAGELIST = {
|
||||||
@ -65,7 +58,6 @@ except:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __loadLanguage(languageFilename: str):
|
def __loadLanguage(languageFilename: str):
|
||||||
with open(languageFilename, 'r', encoding='utf-8') as languageFile:
|
with open(languageFilename, 'r', encoding='utf-8') as languageFile:
|
||||||
_text = {}
|
_text = {}
|
||||||
@ -84,8 +76,6 @@ def __loadLanguage(languageFilename : str):
|
|||||||
return _text
|
return _text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not DEFAULTLANGUAGE == 'zh-CN':
|
if not DEFAULTLANGUAGE == 'zh-CN':
|
||||||
if DEFAULTLANGUAGE in LANGUAGELIST.keys():
|
if DEFAULTLANGUAGE in LANGUAGELIST.keys():
|
||||||
_TEXT = __loadLanguage('./languages/' + DEFAULTLANGUAGE + '.lang')
|
_TEXT = __loadLanguage('./languages/' + DEFAULTLANGUAGE + '.lang')
|
||||||
@ -93,22 +83,18 @@ if not DEFAULTLANGUAGE == 'zh-CN':
|
|||||||
raise KeyError(f'无法打开默认语言{DEFAULTLANGUAGE}')
|
raise KeyError(f'无法打开默认语言{DEFAULTLANGUAGE}')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def wordTranslate(singleWord: str, debug: bool = False):
|
def wordTranslate(singleWord: str, debug: bool = False):
|
||||||
import requests
|
import requests
|
||||||
try:
|
try:
|
||||||
return requests.post('https://fanyi.baidu.com/sug', data={'kw': f'{singleWord}'}).json()['data'][0]['v'].split('; ')[0]
|
return \
|
||||||
|
requests.post('https://fanyi.baidu.com/sug', data={'kw': f'{singleWord}'}).json()['data'][0]['v'].split(
|
||||||
|
'; ')[0]
|
||||||
except:
|
except:
|
||||||
from msctLib.log import log
|
from msctLib.log import log
|
||||||
log(f"无法翻译文本{singleWord}", level='WARRING', isPrinted=debug)
|
log(f"无法翻译文本{singleWord}", level='WARRING', isPrinted=debug)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _(text: str, debug: bool = False):
|
def _(text: str, debug: bool = False):
|
||||||
try:
|
try:
|
||||||
return _TEXT[text]
|
return _TEXT[text]
|
||||||
@ -119,15 +105,14 @@ def _(text:str,debug:bool = False):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 启动语言编辑器
|
# 启动语言编辑器
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
from tkinter.filedialog import askopenfilename as askfilen
|
from tkinter.filedialog import askopenfilename as askfilen
|
||||||
|
|
||||||
LANGNAME = _('LANGLOCALNAME')
|
LANGNAME = _('LANGLOCALNAME')
|
||||||
|
|
||||||
|
|
||||||
def _changeDefaultLang():
|
def _changeDefaultLang():
|
||||||
global _TEXT
|
global _TEXT
|
||||||
global DEFAULTLANGUAGE
|
global DEFAULTLANGUAGE
|
||||||
@ -158,25 +143,35 @@ if __name__ == '__main__':
|
|||||||
f.write(Translatetextbar.get(1.0, 'end'))
|
f.write(Translatetextbar.get(1.0, 'end'))
|
||||||
print(str(event))
|
print(str(event))
|
||||||
|
|
||||||
|
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
|
|
||||||
root.geometry('600x500')
|
root.geometry('600x500')
|
||||||
|
|
||||||
root.bind_all(func=_autoSave)
|
root.bind_all(func=_autoSave)
|
||||||
|
|
||||||
|
root.bind("<Motion>", _autoSave)
|
||||||
|
|
||||||
nowText = ''
|
nowText = ''
|
||||||
|
|
||||||
Orignrame = tk.Frame(root, bd=2)
|
Orignrame = tk.Frame(root, bd=2)
|
||||||
Translaterame = tk.Frame(root, bd=2)
|
Translaterame = tk.Frame(root, bd=2)
|
||||||
|
|
||||||
|
|
||||||
Orignscrollbar = tk.Scrollbar(Orignrame)
|
Orignscrollbar = tk.Scrollbar(Orignrame)
|
||||||
Origntextbar = tk.Text(Orignrame, width=35, height=40)
|
Origntextbar = tk.Text(Orignrame, width=35, height=40)
|
||||||
|
|
||||||
Translatetextbar = tk.Text(Translaterame,width=40,height=37)
|
Translatetextbar = tk.Text(Translaterame, width=40, height=37, undo=True)
|
||||||
Translatescrollbar = tk.Scrollbar(Translaterame)
|
Translatescrollbar = tk.Scrollbar(Translaterame)
|
||||||
tk.Button(Translaterame,text='保存',command=_autoSave).pack(side='bottom',fill='x')
|
|
||||||
|
|
||||||
|
def ctrlZ():
|
||||||
|
Translatetextbar.edit_undo()
|
||||||
|
Translatetextbar.bind("<Control-z>", ctrlZ)
|
||||||
|
|
||||||
|
def ctrlY():
|
||||||
|
Translatetextbar.edit_redo()
|
||||||
|
Translatetextbar.bind("<Control-y>", ctrlY)
|
||||||
|
|
||||||
|
tk.Button(Translaterame, text='保存', command=_autoSave).pack(side='bottom', fill='x')
|
||||||
|
|
||||||
tk.Label(Orignrame, text='中文原文').pack(side='top')
|
tk.Label(Orignrame, text='中文原文').pack(side='top')
|
||||||
Origntextbar.pack(side='left', fill='y')
|
Origntextbar.pack(side='left', fill='y')
|
||||||
@ -190,19 +185,10 @@ if __name__ == '__main__':
|
|||||||
Orignscrollbar.config(command=Origntextbar.yview)
|
Orignscrollbar.config(command=Origntextbar.yview)
|
||||||
Origntextbar.config(yscrollcommand=Orignscrollbar.set)
|
Origntextbar.config(yscrollcommand=Orignscrollbar.set)
|
||||||
|
|
||||||
|
|
||||||
Translatescrollbar.config(command=Translatetextbar.yview)
|
Translatescrollbar.config(command=Translatetextbar.yview)
|
||||||
Translatetextbar.config(yscrollcommand=Translatescrollbar.set)
|
Translatetextbar.config(yscrollcommand=Translatescrollbar.set)
|
||||||
|
|
||||||
Orignrame.pack(side='left')
|
Orignrame.pack(side='left')
|
||||||
Translaterame.pack(side='right')
|
Translaterame.pack(side='right')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tk.mainloop()
|
tk.mainloop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user