This commit is contained in:
恍兮惚兮 2024-07-14 01:46:07 +08:00
parent b16e6d758b
commit 78398bc624
19 changed files with 91 additions and 37 deletions

View File

@ -16,10 +16,7 @@ def getall(l, item="fanyi", name=None):
grids = []
i = 0
line = []
for fanyi in globalconfig[item]:
if fanyi not in l:
continue
for fanyi in l:
if name:
_f = name % fanyi
if not os.path.exists(_f):
@ -103,7 +100,7 @@ def makeproxytab(self, basel):
name="./Lunatranslator/ocrengines/%s.py",
)
meta = getall(
l=list(globalconfig["metadata"].keys()),
l=globalconfig["metadata"],
item="metadata",
name="./LunaTranslator/metadata/%s.py",
)
@ -123,7 +120,7 @@ def makeproxytab(self, basel):
name="./LunaTranslator/hiraparse/%s.py",
)
github = getall(
l=list(globalconfig["github"].keys()),
l=globalconfig["github"],
item="github",
)

View File

@ -2,6 +2,7 @@ from qtsymbols import *
import functools, os
import gobject
from myutils.config import globalconfig, ocrsetting, _TRL, ocrerrorfix, _TR
from myutils.utils import splitocrtypes
from gui.inputdialog import autoinitdialog, postconfigdialog, autoinitdialog_items
from gui.usefulwidget import (
D_getsimplecombobox,
@ -24,16 +25,11 @@ def __label2(self):
return self.threshold2label
def getocrgrid(self):
grids = []
grids_source = []
i = 0
self.ocrswitchs = {}
def initgridsources(self, names):
line = []
for name in globalconfig["ocr"]:
i = 0
grids_source = []
for name in names:
_f = "./Lunatranslator/ocrengines/{}.py".format(name)
if os.path.exists(_f) == False:
continue
@ -75,6 +71,15 @@ def getocrgrid(self):
i += 1
if len(line):
grids_source.append(line)
return grids_source
def getocrgrid(self):
grids = []
offline, online = splitocrtypes()
self.ocrswitchs = {}
def vissolvebtn(text):
_ = QPushButton()
@ -85,7 +90,34 @@ def getocrgrid(self):
grids += [
[
(
dict(title="引擎", type="grid", grid=grids_source),
dict(
title="引擎",
type="grid",
grid=[
[
(
dict(
title="离线",
type="grid",
grid=initgridsources(self, offline),
),
0,
"group",
)
],
[
(
dict(
title="在线",
type="grid",
grid=initgridsources(self, online),
),
0,
"group",
)
],
],
),
0,
"group",
)

View File

@ -32,10 +32,7 @@ def initsome11(self, l, label=None):
grids.append([(label, 8)])
i = 0
line = []
for fanyi in globalconfig["fanyi"]:
if fanyi not in l:
continue
for fanyi in l:
_f = "./Lunatranslator/translator/{}.py".format(fanyi)
if not os.path.exists(_f):

View File

@ -281,18 +281,31 @@ def checkportavailable(port):
def splittranslatortypes():
pre, offline, free, dev, api = set(), set(), set(), set(), set()
pre, offline, free, dev, api = [], [], [], [], []
for k in globalconfig["fanyi"]:
try:
{"pre": pre, "offline": offline, "free": free, "dev": dev, "api": api}[
globalconfig["fanyi"][k].get("type", "free")
].add(k)
].append(k)
except:
pass
return offline, pre, free, dev, api
def splitocrtypes():
offline, online = [], []
for k in globalconfig["ocr"]:
try:
{"online": online, "offline": offline}[
globalconfig["ocr"][k].get("type", "online")
].append(k)
except:
pass
return offline, online
def argsort(l):
ll = list(range(len(l)))
ll.sort(key=lambda x: l[x])

View File

@ -818,5 +818,6 @@
"游戏数据": "بيانات اللعبة",
"当前支持的语言": "اللغات المدعومة حاليا",
"添加语言包": "إضافة حزمة اللغة",
"未添加": "لا إضافة"
"未添加": "لا إضافة",
"在线": "آنلاین"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "遊戲數據",
"当前支持的语言": "當前支持的語言",
"添加语言包": "添加語言包",
"未添加": "未添加"
"未添加": "未添加",
"在线": "線上"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Game data",
"当前支持的语言": "Currently supported languages",
"添加语言包": "Add language pack",
"未添加": "Not added"
"未添加": "Not added",
"在线": "on-line"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Datos del juego",
"当前支持的语言": "Idiomas apoyados actualmente",
"添加语言包": "Añadir paquetes de idiomas",
"未添加": "Sin agregar"
"未添加": "Sin agregar",
"在线": "En línea"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Données du jeu",
"当前支持的语言": "Langues actuellement supportées",
"添加语言包": "Ajouter un pack de langue",
"未添加": "Non ajouté"
"未添加": "Non ajouté",
"在线": "En ligne"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Dati di gioco",
"当前支持的语言": "Lingue attualmente supportate",
"添加语言包": "Aggiungi pacchetto linguistico",
"未添加": "Non aggiunto"
"未添加": "Non aggiunto",
"在线": "on-line"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "ゲームデータ",
"当前支持的语言": "現在サポートされている言語",
"添加语言包": "言語パックの追加",
"未添加": "追加されていません"
"未添加": "追加されていません",
"在线": "オンライン"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "게임 데이터",
"当前支持的语言": "현재 지원되는 언어",
"添加语言包": "언어 팩 추가",
"未添加": "추가되지 않음"
"未添加": "추가되지 않음",
"在线": "온라인"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Dane gry",
"当前支持的语言": "Obecnie obsługiwane języki",
"添加语言包": "Dodaj pakiet językowy",
"未添加": "Nie dodano"
"未添加": "Nie dodano",
"在线": "on-line"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Игровые данные",
"当前支持的语言": "Поддерживаемые языки",
"添加语言包": "Добавить языковой пакет",
"未添加": "Не добавлено"
"未添加": "Не добавлено",
"在线": "Онлайн"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "ข้อมูลเกม",
"当前支持的语言": "ภาษาที่รองรับในปัจจุบัน",
"添加语言包": "เพิ่มแพคภาษา",
"未添加": "ไม่ได้เพิ่ม"
"未添加": "ไม่ได้เพิ่ม",
"在线": "ออนไลน์"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Oyun verileri",
"当前支持的语言": "Şu anda desteklenmiş diller",
"添加语言包": "Dil paketi ekle",
"未添加": "Eklenmedi"
"未添加": "Eklenmedi",
"在线": "on line"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Дані гри",
"当前支持的语言": "Поточно підтримувані мови",
"添加语言包": "Додати пакунок мови",
"未添加": "Не додано"
"未添加": "Не додано",
"在线": "онлайн"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "Dữ liệu trò chơi",
"当前支持的语言": "Ngôn ngữ được hỗ trợ hiện tại",
"添加语言包": "Thêm gói ngôn ngữ",
"未添加": "Chưa thêm"
"未添加": "Chưa thêm",
"在线": "Trực tuyến"
}

View File

@ -818,5 +818,6 @@
"游戏数据": "",
"当前支持的语言": "",
"添加语言包": "",
"未添加": ""
"未添加": "",
"在线": ""
}