From 3a7135a1bd836a13e19b69e305314858f860646d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Mon, 1 Jul 2024 00:16:29 +0800 Subject: [PATCH] fs --- LunaTranslator/LunaTranslator/gui/setting.py | 3 - .../gui/setting_display_text.py | 57 +++++++------------ .../LunaTranslator/gui/setting_hotkey.py | 2 - .../rendertext/somefunctions.py | 4 +- .../LunaTranslator/rendertext/textbrowser.py | 14 ++--- .../files/defaultconfig/config.json | 11 +--- LunaTranslator/files/lang/ar.json | 2 - LunaTranslator/files/lang/cht.json | 2 - LunaTranslator/files/lang/en.json | 2 - LunaTranslator/files/lang/es.json | 2 - LunaTranslator/files/lang/fr.json | 2 - LunaTranslator/files/lang/it.json | 2 - LunaTranslator/files/lang/ja.json | 2 - LunaTranslator/files/lang/ko.json | 2 - LunaTranslator/files/lang/pl.json | 2 - LunaTranslator/files/lang/ru.json | 2 - LunaTranslator/files/lang/th.json | 2 - LunaTranslator/files/lang/tr.json | 2 - LunaTranslator/files/lang/uk.json | 2 - LunaTranslator/files/lang/vi.json | 2 - LunaTranslator/files/lang/zh.json | 2 - 21 files changed, 31 insertions(+), 90 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/setting.py b/LunaTranslator/LunaTranslator/gui/setting.py index 5dc8b6ec..88fa909e 100644 --- a/LunaTranslator/LunaTranslator/gui/setting.py +++ b/LunaTranslator/LunaTranslator/gui/setting.py @@ -7,7 +7,6 @@ from gui.usefulwidget import closeashidewindow, makesubtab_lazy from gui.setting_textinput import setTabOne_lazy from gui.setting_translate import setTabTwo_lazy, checkconnected from gui.setting_display import setTabThree_lazy -from gui.setting_display_text import maybehavefontsizespin from gui.setting_tts import setTab5, showvoicelist from gui.setting_cishu import setTabcishu from gui.setting_hotkey import setTab_quick, registrhotkeys @@ -70,7 +69,6 @@ class Setting(closeashidewindow): mp3playsignal = pyqtSignal(bytes, int, bool) versiontextsignal = pyqtSignal(str) progresssignal = pyqtSignal(str, int) - fontbigsmallsignal = pyqtSignal(int) opensolvetextsig = pyqtSignal() showandsolvesig = pyqtSignal(str) @@ -81,7 +79,6 @@ class Setting(closeashidewindow): self.mp3playsignal.connect(self.mp3player.mp3playfunction) self.opensolvetextsig.connect(self.opensolvetextfun) self.showandsolvesig.connect(functools.partial(delaysetcomparetext, self)) - self.fontbigsmallsignal.connect(functools.partial(maybehavefontsizespin, self)) self.voicelistsignal.connect(functools.partial(showvoicelist, self)) self.versiontextsignal.connect( functools.partial(versionlabelmaybesettext, self) diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_text.py b/LunaTranslator/LunaTranslator/gui/setting_display_text.py index ebaadfde..b273ed54 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_text.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_text.py @@ -10,9 +10,7 @@ from gui.usefulwidget import ( Singleton_close, saveposwindow, getQMessageBox, - getsimpleswitch, D_getspinbox, - getspinbox, D_getIconButton, D_getcolorbutton, getcolorbutton, @@ -26,20 +24,6 @@ from gui.usefulwidget import ( ) -def maybehavefontsizespin(self, t): - if "fontSize_spinBox" in dir(self): - self.fontSize_spinBox.setValue(self.fontSize_spinBox.value() + 0.5 * t) - else: - globalconfig["fontsize"] += 0.5 * t - - -def createfontsizespin(self): - self.fontSize_spinBox = getspinbox( - 1, 100, globalconfig, "fontsize", double=True, step=0.1 - ) - return self.fontSize_spinBox - - def __changeuibuttonstate(self, x): gobject.baseobject.translation_ui.refreshtoolicon() try: @@ -497,15 +481,32 @@ def xianshigrid_style(self): type="grid", grid=( [ - ("原文字体", 3), - (functools.partial(createtextfontcom, "fonttype"), 6), + "原文字体", + (functools.partial(createtextfontcom, "fonttype"), 4), + "", + "字体大小", + D_getspinbox(1, 100, globalconfig, "fontsizeori", double=True, step=0.1), ], [ - ("译文字体", 3), - (functools.partial(createtextfontcom, "fonttype2"), 6), + "译文字体", + (functools.partial(createtextfontcom, "fonttype2"), 4), + "", + "字体大小", + D_getspinbox(1, 100, globalconfig, "fontsize", double=True, step=0.1), ], [ - ("原文颜色", 3), + "加粗字体", + D_getsimpleswitch(globalconfig, "showbold"), + "", + "居中显示", + D_getsimpleswitch(globalconfig, "showatcenter"), + "", + "额外的行间距", + D_getspinbox(-100, 100, globalconfig, "extra_space"), + "", + ], + [ + "原文颜色", D_getcolorbutton( globalconfig, "rawtextcolor", @@ -519,20 +520,6 @@ def xianshigrid_style(self): parent=self, ), ], - [ - ("字体大小", 3), - (functools.partial(createfontsizespin, self), 3), - "", - ("额外的行间距", 3), - (D_getspinbox(-100, 100, globalconfig, "extra_space"), 3), - ], - [ - ("居中显示", 3), - D_getsimpleswitch(globalconfig, "showatcenter"), - ("", 3), - ("加粗字体", 3), - D_getsimpleswitch(globalconfig, "showbold"), - ], ), ), 0, diff --git a/LunaTranslator/LunaTranslator/gui/setting_hotkey.py b/LunaTranslator/LunaTranslator/gui/setting_hotkey.py index 22eb4d5b..63137c35 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_hotkey.py +++ b/LunaTranslator/LunaTranslator/gui/setting_hotkey.py @@ -52,8 +52,6 @@ def registrhotkeys(self): "_15": gobject.baseobject.translation_ui.bindcropwindow_signal.emit, "_16": gobject.baseobject.translation_ui.showhideuisignal.emit, "_17": gobject.baseobject.translation_ui.quitf_signal.emit, - "_18": lambda: gobject.baseobject.settin_ui.fontbigsmallsignal.emit(1), - "_19": lambda: gobject.baseobject.settin_ui.fontbigsmallsignal.emit(-1), "_20": gobject.baseobject.translation_ui.fullsgame_signal.emit, "_21": grabwindow, "_22": gobject.baseobject.translation_ui.muteprocessignal.emit, diff --git a/LunaTranslator/LunaTranslator/rendertext/somefunctions.py b/LunaTranslator/LunaTranslator/rendertext/somefunctions.py index 7542417e..85b40619 100644 --- a/LunaTranslator/LunaTranslator/rendertext/somefunctions.py +++ b/LunaTranslator/LunaTranslator/rendertext/somefunctions.py @@ -27,9 +27,11 @@ class dataget: def _getfontinfo(self, origin): if origin: fm = globalconfig["fonttype"] + fs = globalconfig["fontsizeori"] else: fm = globalconfig["fonttype2"] - return fm, globalconfig["fontsize"], globalconfig["showbold"] + fs = globalconfig["fontsize"] + return fm, fs, globalconfig["showbold"] def _getfontinfo_kana(self): fm, fs, bold = self._getfontinfo(True) diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py index 8b366190..e5469395 100644 --- a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py @@ -518,16 +518,12 @@ class TextBrowser(QWidget, dataget): def _getfh(self, half, origin=True, getfm=False): font = QFont() - font.setBold(globalconfig["showbold"]) - if origin: - font.setFamily(globalconfig["fonttype"]) - else: - font.setFamily(globalconfig["fonttype2"]) - + fm, fs, bold = self._getfontinfo(origin) + font.setBold(bold) + font.setFamily(fm) if half: - font.setPointSizeF((globalconfig["fontsize"]) * globalconfig["kanarate"]) - else: - font.setPointSizeF((globalconfig["fontsize"])) + fs *= globalconfig["kanarate"] + font.setPointSizeF(fs) fm = QFontMetricsF(font) if getfm: return fm diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index 770129ab..b75c5c52 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -440,6 +440,7 @@ "transparent": 80, "transparent_tool": 50, "fontsize": 17.0, + "fontsizeori": 17.0, "localeswitchmethod": 0, "hide_not_exists": false, "startgamenototop": true, @@ -957,16 +958,6 @@ "name": "退出", "keystring": "" }, - "_18": { - "use": false, - "name": "字体增大(可长按)", - "keystring": "" - }, - "_19": { - "use": false, - "name": "字体缩小(可长按)", - "keystring": "" - }, "_20": { "use": false, "name": "缩放/恢复游戏窗口", diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index 565ad063..6f4ec454 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -198,7 +198,6 @@ "使用代理": "استخدام وكيل", "使用代理的项目": "استخدام وكيل المشروع", "优先录制的翻译源": "يفضل تسجيل مصدر الترجمة", - "字体缩小(可长按)": "حجم الخط ( الصحافة طويلة )", "Moji辞书": "معجم موجي", "显示错误信息": "عرض رسالة خطأ", "水奈瀬コウ": "شوي ناي", @@ -297,7 +296,6 @@ "未开始": "لا تبدأ", "显示保存的游戏按钮": "عرض زر حفظ اللعبة", "分": "منقسم", - "字体增大(可长按)": "تكبير الخط ( الصحافة طويلة )", "历史翻译": "تاريخ الترجمة", "ギャラ子": "ابن", "检测到游戏时自动开始": "تبدأ تلقائيا عندما يتم الكشف عن اللعبة", diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index f286b870..3e1aec99 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -129,8 +129,6 @@ "是否使用快捷键": "是否使用快速鍵", "绑定截图窗口": "綁定截圖視窗", "显示/隐藏翻译窗口": "顯示/隱藏翻譯視窗", - "字体增大(可长按)": "字體增大(可長按)", - "字体缩小(可长按)": "字體縮小(可長按)", "前景窗口截屏": "前景視窗截圖", "游戏静音": "遊戲靜音", "选择进程": "選擇行程", diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index fecc507f..9c3fb0e3 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -142,7 +142,6 @@ "感動詞": "Interjections", "字数统计": "Character count", "描边字体": "Stroke Font", - "字体缩小(可长按)": "Decrease Font Size (Long Press)", "不透明度": " Opacity", "形容詞": "Adjectives", "json文件": "JSON File", @@ -165,7 +164,6 @@ "次数统计": "Count Statistics", "代名詞": "Pronouns", "预翻译采用模糊匹配": "Pre-translation Uses Fuzzy Matching", - "字体增大(可长按)": "Increase Font Size (Long Press)", "必应": "Bing", "判定詞": "Copulas", "设置所有词条为全局词条": "Set All Entries as Global Entries", diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index cb5127a4..6fe93483 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -129,8 +129,6 @@ "是否使用快捷键": "Si usar atajos", "绑定截图窗口": "Ventana de captura de pantalla vinculada", "显示/隐藏翻译窗口": "Mostrar / ocultar la ventana de traducción", - "字体增大(可长按)": "Aumenta la fuente (se puede presionar durante mucho tiempo)", - "字体缩小(可长按)": "Reducción de la fuente (se puede presionar durante mucho tiempo)", "前景窗口截屏": "Captura de pantalla de la ventana de primer plano", "游戏静音": "Silencio del juego", "选择进程": "Proceso de selección", diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index 47ca8d2b..c4583446 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -129,8 +129,6 @@ "是否使用快捷键": "Utiliser ou non des raccourcis clavier", "绑定截图窗口": "Lier la fenêtre de capture d'écran", "显示/隐藏翻译窗口": "Afficher / masquer la fenêtre de traduction", - "字体增大(可长按)": "Police agrandie (peut être pressée longtemps)", - "字体缩小(可长按)": "Taille de la police (peut être pressée longtemps)", "前景窗口截屏": "Capture d'écran de la fenêtre de premier plan", "游戏静音": "Jeu muet", "选择进程": "Sélectionner le processus", diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index 2ca9d9a8..dc5b427a 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -123,8 +123,6 @@ "是否使用快捷键": "Vuoi usare i tasti di scelta rapida", "绑定截图窗口": "Finestra di collegamento dello screenshot", "显示/隐藏翻译窗口": "Mostra/nasconde finestra di traduzione", - "字体增大(可长按)": "Aumento del carattere (può essere premuto a lungo)", - "字体缩小(可长按)": "Riduzione dei caratteri (può essere premuto a lungo)", "前景窗口截屏": "Schermata della finestra di primo piano", "游戏静音": "Muto gioco", "选择进程": "Seleziona processo", diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index 46dccb07..c0910bcd 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -129,8 +129,6 @@ "是否使用快捷键": "ショートカットキーを使用するかどうか", "绑定截图窗口": "バインドスクリーンショットウィンドウ", "显示/隐藏翻译窗口": "翻訳ウィンドウの表示/非表示", - "字体增大(可长按)": "フォントを大きくする(長押し可能)", - "字体缩小(可长按)": "フォント縮小(長押し可能)", "前景窗口截屏": "前景ウィンドウのスクリーンショット", "游戏静音": "ゲームのミュート", "选择进程": "プロセスの選択", diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index 0acd12a1..2e1601fa 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -129,8 +129,6 @@ "是否使用快捷键": "단축키 사용 여부", "绑定截图窗口": "캡처 창 바인딩", "显示/隐藏翻译窗口": "번역 창 표시 / 숨기기", - "字体增大(可长按)": "글꼴 증가 (길게 누르기 가능)", - "字体缩小(可长按)": "글꼴 축소 (길게 누를 수 있음)", "前景窗口截屏": "전경 창 캡처", "游戏静音": "게임 무음", "选择进程": "프로세스 선택", diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index 568059f7..9572d161 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -129,8 +129,6 @@ "是否使用快捷键": "Czy chcesz użyć klawiszy skrótów?", "绑定截图窗口": "Wiążące okno zrzutu ekranu", "显示/隐藏翻译窗口": "Pokaż/ukryj okno tłumaczenia", - "字体增大(可长按)": "Zwiększenie czcionki (może być długo naciśnięte)", - "字体缩小(可长按)": "Redukcja czcionki (może być długo naciśnięta)", "前景窗口截屏": "Zrzut ekranu okna pierwszego planu", "游戏静音": "Wycisz grę", "选择进程": "Wybierz proces", diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index 330df0a3..e7fb33a3 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -129,8 +129,6 @@ "是否使用快捷键": "Настройки сочетания клавиш", "绑定截图窗口": "Окно привязки", "显示/隐藏翻译窗口": "Показать / скрыть окно перевода", - "字体增大(可长按)": "Увеличить шрифт (Зажать)", - "字体缩小(可长按)": "Уменьшить шрифт (Зажать)", "前景窗口截屏": "Окно переднего плана", "游戏静音": "Отключить звук игры", "选择进程": "Процесс отбора", diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index ef88b270..4f43db47 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -153,7 +153,6 @@ "查词": "ค้นหาคำ", "繁体中文(CP950,BIG5)": "ภาษาจีนดั้งเดิม (CP950, BIG5)", "使用自定义promt": "ใช้ promt ที่กำหนดเอง", - "字体缩小(可长按)": "ลดขนาดตัวอักษร (สามารถกดยาว)", "翻译结果修正": "แก้ไขผลการแปล", "显示": "แสดง", "选择文本输入源": "เลือกแหล่งป้อนข้อความ", @@ -351,7 +350,6 @@ "刷新": "รีเฟรช", "紲星あかり": "绁 สตาร์ อะคะริ", "英文": "ภาษาไทย", - "字体增大(可长按)": "แบบอักษรขยาย (สามารถกดยาว)", "时间周期执行": "การดำเนินการตามกรอบเวลา", "请重新下载并关闭杀毒软件后重试": "โปรดลองอีกครั้งหลังจากดาวน์โหลดและปิดโปรแกรมป้องกันไวรัส", "用户词典1": "พจนานุกรมผู้ใช้ 1", diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index a7fae22f..37ee27f2 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -129,8 +129,6 @@ "是否使用快捷键": "Kısayol tuşları kullanılması", "绑定截图窗口": "Ekran görüntüsü penceresini bağla", "显示/隐藏翻译窗口": "Çeviri penceresini göster/gizle", - "字体增大(可长按)": "Yazıtipi artması (uzun basın)", - "字体缩小(可长按)": "Yazıtipi düşürmesi (uzun basın)", "前景窗口截屏": "Ön plan penceresinin ekran resimi", "游戏静音": "Oyun Sessiz", "选择进程": "İşlemi Seç", diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index e64978a8..a1a46f53 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -123,8 +123,6 @@ "是否使用快捷键": "Do you want to use shortcut keys", "绑定截图窗口": "В’ єднання вікна знімку екрана", "显示/隐藏翻译窗口": "Показувати/сховати вікно перекладу", - "字体增大(可长按)": "Збільшення шрифту (можна довго натиснути)", - "字体缩小(可长按)": "Зменшення шрифту (можна довго натиснути)", "前景窗口截屏": "Знімок вікна переднього плану", "游戏静音": "Гра Вимкнути", "选择进程": "Виберіть процес", diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index 86cf87d5..a2c0bda5 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -129,8 +129,6 @@ "是否使用快捷键": "Dùng phím tắt hay không", "绑定截图窗口": "Cửa sổ ảnh chụp màn hình bị ràng buộc", "显示/隐藏翻译窗口": "Hiện/ẩn cửa sổ dịch", - "字体增大(可长按)": "Tăng phông chữ (có thể nhấn dài)", - "字体缩小(可长按)": "Thu nhỏ phông chữ (có thể nhấn dài)", "前景窗口截屏": "Ảnh chụp cửa sổ Foreground", "游戏静音": "Im lặng trò chơi", "选择进程": "Chọn tiến trình", diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index a39f67db..d8d2bb2f 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -154,7 +154,6 @@ "查词": "", "繁体中文(CP950,BIG5)": "", "使用自定义promt": "", - "字体缩小(可长按)": "", "翻译结果修正": "", "显示": "", "选择文本输入源": "", @@ -351,7 +350,6 @@ "刷新": "", "紲星あかり": "", "英文": "", - "字体增大(可长按)": "", "时间周期执行": "", "请重新下载并关闭杀毒软件后重试": "", "用户词典1": "",