From 61527b962db600e1fe05f5e6d7ce6be89129e5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Sat, 14 Dec 2024 15:31:24 +0800 Subject: [PATCH] . --- py/LunaTranslator/gui/attachprocessdialog.py | 21 +++++++++++++++++--- py/LunaTranslator/textsource/texthook.py | 1 + py/files/defaultconfig/config.json | 1 + py/files/lang/ar.json | 3 ++- py/files/lang/cht.json | 3 ++- py/files/lang/cs.json | 3 ++- py/files/lang/de.json | 3 ++- py/files/lang/en.json | 3 ++- py/files/lang/es.json | 3 ++- py/files/lang/fr.json | 3 ++- py/files/lang/it.json | 3 ++- py/files/lang/ja.json | 3 ++- py/files/lang/ko.json | 3 ++- py/files/lang/nl.json | 3 ++- py/files/lang/pl.json | 3 ++- py/files/lang/pt.json | 3 ++- py/files/lang/ru.json | 3 ++- py/files/lang/sv.json | 3 ++- py/files/lang/th.json | 3 ++- py/files/lang/tr.json | 3 ++- py/files/lang/uk.json | 3 ++- py/files/lang/vi.json | 3 ++- py/files/lang/zh.json | 3 ++- 23 files changed, 60 insertions(+), 23 deletions(-) diff --git a/py/LunaTranslator/gui/attachprocessdialog.py b/py/LunaTranslator/gui/attachprocessdialog.py index 0861f1d1..138c332f 100644 --- a/py/LunaTranslator/gui/attachprocessdialog.py +++ b/py/LunaTranslator/gui/attachprocessdialog.py @@ -11,7 +11,7 @@ from myutils.hwnd import ( getExeIcon, ) from gui.usefulwidget import saveposwindow, getQMessageBox -from gui.dynalang import LPushButton, LLabel +from gui.dynalang import LPushButton, LLabel, LCheckBox @Singleton_close @@ -48,7 +48,9 @@ class AttachProcessDialog(saveposwindow): self.setWindowTitle( "选择进程_当前权限_" + ("管理员" if windows.IsUserAnAdmin() else "非管理员") ) - self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selectgame"]["icon"])) + self.setWindowIcon( + qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selectgame"]["icon"]) + ) w = QWidget() self.layout1 = QVBoxLayout() self.label = LLabel( @@ -57,7 +59,13 @@ class AttachProcessDialog(saveposwindow): ) ) self.label.setWordWrap(True) - self.button = LPushButton("点击此按钮后点击游戏窗口") + + class __LPushButton(LPushButton): + def sizeHint(self): + size = super().sizeHint() + return QSize(size.width(), 2 * size.height()) + + self.button = __LPushButton("点击此按钮后点击游戏窗口") self.button.clicked.connect( functools.partial(mouseselectwindow, self.setcurrentpidpnamesignal.emit) ) @@ -87,6 +95,13 @@ class AttachProcessDialog(saveposwindow): refreshbutton = LPushButton("刷新") refreshbutton.clicked.connect(self.refreshfunction) bottomlayout.addWidget(refreshbutton) + autoopen = LCheckBox("打开选择文本窗口") + autoopen.setChecked(globalconfig["autoopenselecttext"]) + autoopen.stateChanged.connect( + lambda x: globalconfig.__setitem__("autoopenselecttext", x) + ) + bottomlayout.addStretch(1) + bottomlayout.addWidget(autoopen) bottomlayout.addWidget(self.buttonBox) self.layout1.addLayout(bottomlayout) diff --git a/py/LunaTranslator/textsource/texthook.py b/py/LunaTranslator/textsource/texthook.py index 17f638ee..19759bdb 100644 --- a/py/LunaTranslator/textsource/texthook.py +++ b/py/LunaTranslator/textsource/texthook.py @@ -371,6 +371,7 @@ class texthook(basetext): if ( len(autostarthookcode) == 0 and len(savehook_new_data[self.gameuid]["embedablehook"]) == 0 + and globalconfig["autoopenselecttext"] ): gobject.baseobject.hookselectdialog.realshowhide.emit(True) self.injectproc(injecttimeout, pids) diff --git a/py/files/defaultconfig/config.json b/py/files/defaultconfig/config.json index 41cc2c80..ddd9fedf 100644 --- a/py/files/defaultconfig/config.json +++ b/py/files/defaultconfig/config.json @@ -1,4 +1,5 @@ { + "autoopenselecttext": true, "lastapppath": null, "ocrafterrangeselect": true, "excule_from_self": true, diff --git a/py/files/lang/ar.json b/py/files/lang/ar.json index 112fa224..b3836b4f 100644 --- a/py/files/lang/ar.json +++ b/py/files/lang/ar.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "تخطي ترجمة أخرى عند النجاح", "截取指定行数": "اعتراض عدد محدد من الصفوف", "截取末尾": "اعتراض نهاية", - "更新记录": "تحديث السجلات" + "更新记录": "تحديث السجلات", + "打开选择文本窗口": "فتح نافذة اختيار النص" } \ No newline at end of file diff --git a/py/files/lang/cht.json b/py/files/lang/cht.json index b04a7630..d892f242 100644 --- a/py/files/lang/cht.json +++ b/py/files/lang/cht.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "成功時跳過其他翻譯", "截取指定行数": "截取指定行數", "截取末尾": "截取末尾", - "更新记录": "更新記錄" + "更新记录": "更新記錄", + "打开选择文本窗口": "打開選擇文字視窗" } \ No newline at end of file diff --git a/py/files/lang/cs.json b/py/files/lang/cs.json index 22ca8eca..aa74d878 100644 --- a/py/files/lang/cs.json +++ b/py/files/lang/cs.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Přeskočit další překlady po úspěchu", "截取指定行数": "Extrahovat zadaný počet řádků", "截取末尾": "Střih do konce", - "更新记录": "Aktualizovat záznam" + "更新记录": "Aktualizovat záznam", + "打开选择文本窗口": "Otevřít textové okno výběru" } \ No newline at end of file diff --git a/py/files/lang/de.json b/py/files/lang/de.json index 61d274e3..49eee4a6 100644 --- a/py/files/lang/de.json +++ b/py/files/lang/de.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Andere Übersetzungen überspringen, wenn erfolgreich", "截取指定行数": "Die angegebene Anzahl von Zeilen extrahieren", "截取末尾": "Bis zum Ende geschnitten", - "更新记录": "Datensatz aktualisieren" + "更新记录": "Datensatz aktualisieren", + "打开选择文本窗口": "Öffnen des Auswahltextfensters" } \ No newline at end of file diff --git a/py/files/lang/en.json b/py/files/lang/en.json index 1cb8deb5..bf8dbbb3 100644 --- a/py/files/lang/en.json +++ b/py/files/lang/en.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Skip other translations when successful", "截取指定行数": "Extract the specified number of rows", "截取末尾": "Cut to the end", - "更新记录": "Update Record" + "更新记录": "Update Record", + "打开选择文本窗口": "Open the selection text window" } \ No newline at end of file diff --git a/py/files/lang/es.json b/py/files/lang/es.json index 1a6533ea..ebe35673 100644 --- a/py/files/lang/es.json +++ b/py/files/lang/es.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Saltar otras traducciones cuando tenga éxito", "截取指定行数": "Interceptar el número de líneas especificadas", "截取末尾": "Fin de la interceptación", - "更新记录": "Actualización de registros" + "更新记录": "Actualización de registros", + "打开选择文本窗口": "Abrir la ventana de texto de selección" } \ No newline at end of file diff --git a/py/files/lang/fr.json b/py/files/lang/fr.json index d5d2556b..bd2aa06c 100644 --- a/py/files/lang/fr.json +++ b/py/files/lang/fr.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Sauter les autres traductions en cas de succès", "截取指定行数": "Intercepte le nombre de lignes spécifié", "截取末尾": "Fin de l'interception", - "更新记录": "Mettre à jour les enregistrements" + "更新记录": "Mettre à jour les enregistrements", + "打开选择文本窗口": "Ouvrir la fenêtre sélectionner le texte" } \ No newline at end of file diff --git a/py/files/lang/it.json b/py/files/lang/it.json index 2a700994..ddda534c 100644 --- a/py/files/lang/it.json +++ b/py/files/lang/it.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Salta altre traduzioni quando hai successo", "截取指定行数": "Estrarre il numero specificato di righe", "截取末尾": "Taglia fino alla fine", - "更新记录": "Aggiorna record" + "更新记录": "Aggiorna record", + "打开选择文本窗口": "Apri la finestra del testo di selezione" } \ No newline at end of file diff --git a/py/files/lang/ja.json b/py/files/lang/ja.json index 87b5fa0f..a8ef1a1f 100644 --- a/py/files/lang/ja.json +++ b/py/files/lang/ja.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "成功時に他の翻訳をスキップ", "截取指定行数": "指定した行数を切り取る", "截取末尾": "末尾を切り取る", - "更新记录": "レコードの更新" + "更新记录": "レコードの更新", + "打开选择文本窗口": "テキストの選択ウィンドウを開く" } \ No newline at end of file diff --git a/py/files/lang/ko.json b/py/files/lang/ko.json index f4a5d6d5..980bac3e 100644 --- a/py/files/lang/ko.json +++ b/py/files/lang/ko.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "성공 시 다른 번역 건너뛰기", "截取指定行数": "지정된 행 수 캡처", "截取末尾": "끝을 가로채다", - "更新记录": "레코드 업데이트" + "更新记录": "레코드 업데이트", + "打开选择文本窗口": "텍스트 선택 창 열기" } \ No newline at end of file diff --git a/py/files/lang/nl.json b/py/files/lang/nl.json index e5f9482b..eafe6a90 100644 --- a/py/files/lang/nl.json +++ b/py/files/lang/nl.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Andere vertalingen overslaan wanneer succesvol", "截取指定行数": "Het opgegeven aantal rijen uitpakken", "截取末尾": "Snijd tot het einde", - "更新记录": "Record bijwerken" + "更新记录": "Record bijwerken", + "打开选择文本窗口": "Het selectietekstvenster openen" } \ No newline at end of file diff --git a/py/files/lang/pl.json b/py/files/lang/pl.json index 2a137f1a..afffd7bf 100644 --- a/py/files/lang/pl.json +++ b/py/files/lang/pl.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Pomiń inne tłumaczenia po powodzeniu", "截取指定行数": "Wyciągnij określoną liczbę wierszy", "截取末尾": "Cięcie do końca", - "更新记录": "Aktualizuj rekord" + "更新记录": "Aktualizuj rekord", + "打开选择文本窗口": "Otwórz okno tekstowe zaznaczenia" } \ No newline at end of file diff --git a/py/files/lang/pt.json b/py/files/lang/pt.json index 1d7f0331..708ab38e 100644 --- a/py/files/lang/pt.json +++ b/py/files/lang/pt.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Ignorar outras traduções quando bem sucedidas", "截取指定行数": "Extrair o número especificado de linhas", "截取末尾": "Cortar até ao fim", - "更新记录": "Actualizar o Registo" + "更新记录": "Actualizar o Registo", + "打开选择文本窗口": "Abrir a janela de texto da selecção" } \ No newline at end of file diff --git a/py/files/lang/ru.json b/py/files/lang/ru.json index f397bffd..bddc4fd6 100644 --- a/py/files/lang/ru.json +++ b/py/files/lang/ru.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Скачать другие переводы при успехе", "截取指定行数": "Перехватить указанное число строк", "截取末尾": "Отрезать конец", - "更新记录": "Обновить запись" + "更新记录": "Обновить запись", + "打开选择文本窗口": "Открыть окно выбора текста" } \ No newline at end of file diff --git a/py/files/lang/sv.json b/py/files/lang/sv.json index ac5f618d..17e58bbb 100644 --- a/py/files/lang/sv.json +++ b/py/files/lang/sv.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Hoppa över andra översättningar när de lyckas", "截取指定行数": "Extrahera angivet antal rader", "截取末尾": "Klipp till slutet", - "更新记录": "Uppdatera post" + "更新记录": "Uppdatera post", + "打开选择文本窗口": "Öppna markeringstextfönstret" } \ No newline at end of file diff --git a/py/files/lang/th.json b/py/files/lang/th.json index 68b621c1..ef650ff5 100644 --- a/py/files/lang/th.json +++ b/py/files/lang/th.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "ข้ามการแปลอื่นเมื่อสำเร็จ", "截取指定行数": "สกัดกั้นจำนวนแถวที่ระบุ", "截取末尾": "ตัดตอนท้าย", - "更新记录": "บันทึกการปรับปรุง" + "更新记录": "บันทึกการปรับปรุง", + "打开选择文本窗口": "เปิดหน้าต่างเลือกข้อความ" } \ No newline at end of file diff --git a/py/files/lang/tr.json b/py/files/lang/tr.json index a514ec00..314ccc66 100644 --- a/py/files/lang/tr.json +++ b/py/files/lang/tr.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Başarılı olduğunda diğer çevirileri atla", "截取指定行数": "Belirtilen satır sayısını çıkart", "截取末尾": "Sonuna kesin.", - "更新记录": "Kayıt Güncelle" + "更新记录": "Kayıt Güncelle", + "打开选择文本窗口": "Seçim metin penceresini aç" } \ No newline at end of file diff --git a/py/files/lang/uk.json b/py/files/lang/uk.json index f1039b32..c58c9303 100644 --- a/py/files/lang/uk.json +++ b/py/files/lang/uk.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Пропустити інші переклади, якщо вони успішні", "截取指定行数": "Extract the specified number of rows", "截取末尾": "Вирізати до кінця", - "更新记录": "Оновити запис" + "更新记录": "Оновити запис", + "打开选择文本窗口": "Відкрити текстове вікно вибору" } \ No newline at end of file diff --git a/py/files/lang/vi.json b/py/files/lang/vi.json index 10aa56c3..47768b1f 100644 --- a/py/files/lang/vi.json +++ b/py/files/lang/vi.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "Bỏ qua các bản dịch khác khi thành công", "截取指定行数": "Chặn số dòng đã xác định", "截取末尾": "Kết thúc cắt", - "更新记录": "Cập nhật hồ sơ" + "更新记录": "Cập nhật hồ sơ", + "打开选择文本窗口": "Mở cửa sổ Select Text" } \ No newline at end of file diff --git a/py/files/lang/zh.json b/py/files/lang/zh.json index 06703ee7..3a8dc948 100644 --- a/py/files/lang/zh.json +++ b/py/files/lang/zh.json @@ -753,5 +753,6 @@ "成功时跳过其他翻译": "", "截取指定行数": "", "截取末尾": "", - "更新记录": "" + "更新记录": "", + "打开选择文本窗口": "" } \ No newline at end of file