diff --git a/LunaTranslator/LunaTranslator/gui/settin.py b/LunaTranslator/LunaTranslator/gui/settin.py index 324b744f..e4cbd869 100644 --- a/LunaTranslator/LunaTranslator/gui/settin.py +++ b/LunaTranslator/LunaTranslator/gui/settin.py @@ -8,7 +8,7 @@ import functools from traceback import print_exc from myutils.config import globalconfig ,_TR from myutils.utils import wavmp3player -from myutils.config import globalconfig +from myutils.config import static_data from gui.settingpage1 import setTabOne,setTabOne_direct from gui.settingpage2 import setTabTwo,settab2d from gui.settingpage_xianshishezhi import setTabThree ,setTabThree_direct @@ -19,7 +19,6 @@ from gui.setting_lang import setTablang,setTablangd from gui.setting_proxy import setTab_proxy from gui.settingpage7 import setTab7 ,settab7direct from gui.settingpage_about import setTab_about,setTab_about_dicrect -from gui.usefulwidget import rotatetab from gui.usefulwidget import closeashidewindow class gridwidget(QWidget): pass @@ -187,10 +186,12 @@ class Settin(closeashidewindow) : darklight=['light','dark'][dark] try: - with open('./files/{}{}.qss'.format(darklight,globalconfig[darklight+'theme']),'r') as ff: + idx=globalconfig[darklight+'theme']-int(not dark) + if idx==-1:raise Exception() + with open('./files/themes/{}'.format(static_data['themes'][darklight][idx]["file"] ),'r') as ff: style=ff.read() except: - print_exc() + #print_exc() style='' style+="*{font: %spt '"%(globalconfig['settingfontsize'])+(globalconfig['settingfonttype'] )+"' ; }" self.setStyleSheet(style) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py b/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py index b3d836d5..bcc1191b 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py @@ -9,7 +9,7 @@ from PyQt5.QtCore import Qt,QSize from PyQt5.QtGui import QStandardItem, QStandardItemModel from PyQt5.QtWidgets import QLabel ,QSlider, QFontComboBox ,QDialog,QGridLayout from gui.inputdialog import multicolorset -from myutils.config import globalconfig ,_TR,_TRL ,magpie10_config +from myutils.config import globalconfig ,_TR,_TRL ,magpie10_config,static_data from myutils.wrapper import Singleton import qtawesome,gobject,json from myutils.hwnd import showintab @@ -147,6 +147,8 @@ def setTabThree_lazy(self) : def __changeshowintab(x): gobject.baseobject.translation_ui.showintab=x showintab(int(gobject.baseobject.translation_ui.winId()),x) + def themelist(t): + return [_['name'] for _ in static_data['themes'][t]] uigrid=[ [('设置界面字体',4),(self.sfont_comboBox,5)], [ ('字体大小',4),(getspinbox(1,100,globalconfig ,'settingfontsize',callback=__changefontsize),2)], @@ -167,8 +169,8 @@ def setTabThree_lazy(self) : [('选择文本窗口中文本框只读',6),getsimpleswitch(globalconfig,'textboxreadonly',callback=lambda x:gobject.baseobject.hookselectdialog.textOutput.setReadOnly(x) )], [], [('明暗',6),(getsimplecombobox(_TRL(['明亮','黑暗','跟随系统']),globalconfig,'darklight',callback=lambda _: self.setstylesheet()),5)], - [('明亮',6),(getsimplecombobox(_TRL(['default','1','2']),globalconfig,'lighttheme',callback=lambda _: self.setstylesheet()),5)], - [('黑暗',6),(getsimplecombobox(_TRL(['0','1']),globalconfig,'darktheme',callback=lambda _: self.setstylesheet()),5)], + [('明亮主题',6),(getsimplecombobox(_TRL(['默认'])+themelist('light'),globalconfig,'lighttheme',callback=lambda _: self.setstylesheet()),5)], + [('黑暗主题',6),(getsimplecombobox(themelist('dark'),globalconfig,'darktheme',callback=lambda _: self.setstylesheet()),5)], ] alleffect=['无','Bicubic','Bilinear','Jinc','Lanczos','Nearest','SSimDownscaler'] downsname=magpie10_config.get('downscalingEffect',{'name':'无'}).get('name') diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index fcc4fdc0..eab457e9 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -229,29 +229,7 @@ class resizableframeless(saveposwindow): self._lcorner_drag = False self._right_drag = False self._left_drag = False -class rotatetab(QTabBar): - def tabSizeHint(self, index): - s = QTabBar.tabSizeHint(self, index) - s.transpose() - return s - def paintEvent(self, e) : - painter = QStylePainter(self) - opt = QStyleOptionTab() - for i in range(self.count()) : - self.initStyleOption(opt, i) - painter.drawControl(QStyle.CE_TabBarTabShape, opt) - painter.save() - s = opt.rect.size() - s.transpose() - r = QRect(QPoint(), s) - r.moveCenter(opt.rect.center()) - opt.rect = r - c = self.tabRect(i).center() - painter.translate(c) - painter.rotate(90) - painter.translate(-c) - painter.drawControl(QStyle.CE_TabBarTabLabel, opt) - painter.restore() + class Prompt_dialog(QDialog): def __init__(self, parent,title,info,default='' ) -> None: super().__init__(parent) diff --git a/LunaTranslator/files/defaultconfig/static_data.json b/LunaTranslator/files/defaultconfig/static_data.json index 0a0900fc..a8b16eed 100644 --- a/LunaTranslator/files/defaultconfig/static_data.json +++ b/LunaTranslator/files/defaultconfig/static_data.json @@ -1,5 +1,15 @@ { - "version":"v2.40.6", + "version":"v2.41.0", + "themes":{ + "dark":[ + {"file":"dark1.qss","name":"PyQtDarkTheme"}, + {"file":"dark2.qss","name":"QDarkStyleSheet"} + ], + "light":[ + {"file":"light1.qss","name":"PyQtDarkTheme"}, + {"file":"light2.qss","name":"QDarkStyleSheet"} + ] + }, "language_list_show":["简体中文","日本語","English","Русский язык","Español","한국어","Français","繁體中文","Tiếng Việt","Türkçe","Polski","Українська Мова","Italiano","اللغة العربية","ภาษาไทย","བོད་སྐད།"] , "language_list_translator":["简体中文","日文","英文","俄语","西班牙语","韩语","法语","繁体中文","越南语","土耳其语","波兰语","乌克兰语","意大利语","阿拉伯语","泰语","藏语"], "language_list_translator_inner":["zh", "ja", "en","ru","es","ko","fr","cht","vi","tr","pl","uk","it","ar","th","bo"], diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index dff97441..abaf01b9 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -731,5 +731,8 @@ "明亮": "مشرق", "黑暗": "ظلام .", "跟随系统": "متابعة النظام", - "明暗": "الضوء والظل" + "明暗": "الضوء والظل", + "默认": "افتراضي", + "明亮主题": "موضوع مشرق", + "黑暗主题": "موضوع الظلام" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index b3149dcb..e4cd8ed2 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -731,5 +731,8 @@ "明亮": "明亮", "黑暗": "黑暗", "跟随系统": "跟隨系統", - "明暗": "明暗" + "明暗": "明暗", + "默认": "默認", + "明亮主题": "明亮主題", + "黑暗主题": "黑暗主題" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index e9913901..9011b4d5 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -731,5 +731,8 @@ "明亮": "bright", "黑暗": "dark", "跟随系统": "Follow system", - "明暗": "Brightness and darkness" + "明暗": "Brightness and darkness", + "默认": "default", + "明亮主题": "Bright Theme", + "黑暗主题": "Dark Theme" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index 1c640465..09ace880 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -731,5 +731,8 @@ "明亮": "Brillante", "黑暗": "Oscuridad", "跟随系统": "Sistema de seguimiento", - "明暗": "Luz y oscuridad" + "明暗": "Luz y oscuridad", + "默认": "Predeterminado", + "明亮主题": "Temas brillantes", + "黑暗主题": "Tema oscuro" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index af11c306..054a553f 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -731,5 +731,8 @@ "明亮": "Lumineux", "黑暗": "L'obscurité", "跟随系统": "Suivre le système", - "明暗": "Lumière et obscurité" + "明暗": "Lumière et obscurité", + "默认": "Par défaut", + "明亮主题": "Thème lumineux", + "黑暗主题": "Thème sombre" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index a73bba2e..f93785b3 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -731,5 +731,8 @@ "明亮": "luminoso", "黑暗": "scuro", "跟随系统": "Sistema di monitoraggio", - "明暗": "Luminosità e oscurità" + "明暗": "Luminosità e oscurità", + "默认": "default", + "明亮主题": "Tema luminoso", + "黑暗主题": "Tema scuro" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index 30abd46a..f91d8382 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -731,5 +731,8 @@ "明亮": "明るい", "黑暗": "暗い", "跟随系统": "フォローアップシステム", - "明暗": "明暗" + "明暗": "明暗", + "默认": "デフォルト", + "明亮主题": "明るいテーマ", + "黑暗主题": "暗いテーマ" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index 9bd9c7b1..89f1348b 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -731,5 +731,8 @@ "明亮": "밝기", "黑暗": "어둠", "跟随系统": "시스템 따르기", - "明暗": "명암" + "明暗": "명암", + "默认": "기본", + "明亮主题": "밝은 테마", + "黑暗主题": "다크 테마" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index 9743aceb..25e56581 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -731,5 +731,8 @@ "明亮": "jasne", "黑暗": "ciemność", "跟随系统": "System śledzenia", - "明暗": "Jasność i ciemność" + "明暗": "Jasność i ciemność", + "默认": "domyślne", + "明亮主题": "Jasny motyw", + "黑暗主题": "Ciemny motyw" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index 7c61f8e2..0b124124 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -731,5 +731,8 @@ "明亮": "Яркий", "黑暗": "Тьма.", "跟随系统": "Следующая система", - "明暗": "Свет и тьма" + "明暗": "Свет и тьма", + "默认": "По умолчанию", + "明亮主题": "Яркая тема", + "黑暗主题": "Темная тема" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index 5e2c400e..ea3fa294 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -731,5 +731,8 @@ "明亮": "สดใส", "黑暗": "ความมืด", "跟随系统": "ติดตามระบบ", - "明暗": "ความสว่างและความมืด" + "明暗": "ความสว่างและความมืด", + "默认": "ปริยาย", + "明亮主题": "ธีมสดใส", + "黑暗主题": "ธีมมืด" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index 02a7a8c0..1f20996a 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -731,5 +731,8 @@ "明亮": "bright", "黑暗": "karanlık", "跟随系统": "Sistemi takip et", - "明暗": "Parılık ve karanlık" + "明暗": "Parılık ve karanlık", + "默认": "öntanımlı", + "明亮主题": "Işık Tema", + "黑暗主题": "Karanlık Tema" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index 2477731e..4cde9f3f 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -731,5 +731,8 @@ "明亮": "яскравий", "黑暗": "темно", "跟随系统": "Слідкувати за системою", - "明暗": "Яскравість і темрява" + "明暗": "Яскравість і темрява", + "默认": "типовий", + "明亮主题": "Bright Theme", + "黑暗主题": "Темна тема" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index 2605ff2c..5ebf44e4 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -731,5 +731,8 @@ "明亮": "Minh Lượng", "黑暗": "Bóng tối", "跟随系统": "Theo dõi hệ thống", - "明暗": "Ánh sáng và bóng tối" + "明暗": "Ánh sáng và bóng tối", + "默认": "Mặc định", + "明亮主题": "Sắc thái tươi sáng", + "黑暗主题": "Chủ đề tối" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index cc0d4793..af47d8b5 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -731,5 +731,8 @@ "明亮": "", "黑暗": "", "跟随系统": "", - "明暗": "" + "明暗": "", + "默认": "", + "明亮主题": "", + "黑暗主题": "" } \ No newline at end of file diff --git a/LunaTranslator/files/dark0.qss b/LunaTranslator/files/themes/dark1.qss similarity index 100% rename from LunaTranslator/files/dark0.qss rename to LunaTranslator/files/themes/dark1.qss diff --git a/LunaTranslator/files/dark1.qss b/LunaTranslator/files/themes/dark2.qss similarity index 100% rename from LunaTranslator/files/dark1.qss rename to LunaTranslator/files/themes/dark2.qss diff --git a/LunaTranslator/files/light1.qss b/LunaTranslator/files/themes/light1.qss similarity index 100% rename from LunaTranslator/files/light1.qss rename to LunaTranslator/files/themes/light1.qss diff --git a/LunaTranslator/files/light2.qss b/LunaTranslator/files/themes/light2.qss similarity index 100% rename from LunaTranslator/files/light2.qss rename to LunaTranslator/files/themes/light2.qss