mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
fix
This commit is contained in:
parent
7bc0f9391a
commit
0212261546
@ -2,7 +2,7 @@ from qtsymbols import *
|
||||
import sqlite3, os, json, functools
|
||||
from traceback import print_exc
|
||||
from myutils.config import globalconfig, _TR
|
||||
from myutils.utils import autosql, dynamicapiname
|
||||
from myutils.utils import autosql, getannotatedapiname
|
||||
from gui.usefulwidget import getQMessageBox, SuperCombo
|
||||
from gui.dynalang import LFormLayout, LPushButton, LDialog
|
||||
from textsource.texthook import splitembedlines
|
||||
@ -50,7 +50,7 @@ def sqlite2json2(
|
||||
dialog.setLayout(formLayout)
|
||||
|
||||
combo = SuperCombo()
|
||||
combo.addItems([dynamicapiname(_) for _ in _collect], _collect)
|
||||
combo.addItems([getannotatedapiname(_) for _ in _collect], _collect)
|
||||
|
||||
formLayout.addRow("首选翻译", combo)
|
||||
e = QLineEdit(sqlitefile[: -(len(".sqlite"))])
|
||||
|
@ -1,7 +1,7 @@
|
||||
import functools, os
|
||||
import gobject
|
||||
from myutils.utils import splitocrtypes
|
||||
from myutils.config import globalconfig
|
||||
from myutils.config import globalconfig, _TR
|
||||
from gui.inputdialog import autoinitdialog, autoinitdialog_items
|
||||
from gui.usefulwidget import (
|
||||
yuitsu_switch,
|
||||
@ -109,7 +109,7 @@ def vistranslate_rank(self):
|
||||
"显示顺序",
|
||||
globalconfig["cishuvisrank"],
|
||||
isrankeditor=True,
|
||||
namemapfunction=lambda k: globalconfig["cishu"][k]["name"],
|
||||
namemapfunction=lambda k: _TR(globalconfig["cishu"][k]["name"]),
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
from qtsymbols import *
|
||||
import functools, platform
|
||||
import gobject, os, zipfile
|
||||
from myutils.config import globalconfig, static_data
|
||||
from myutils.config import globalconfig, static_data, _TR
|
||||
from gui.inputdialog import multicolorset, autoinitdialog
|
||||
from myutils.wrapper import tryprint
|
||||
from myutils.utils import dynamiclink, translate_exits, copytree, dynamicapiname
|
||||
from myutils.utils import dynamiclink, translate_exits, copytree, getannotatedapiname
|
||||
from gui.usefulwidget import (
|
||||
D_getsimplecombobox,
|
||||
getsimplecombobox,
|
||||
@ -332,7 +332,7 @@ def vistranslate_rank(self):
|
||||
("显示顺序"),
|
||||
globalconfig["fix_translate_rank_rank"],
|
||||
isrankeditor=True,
|
||||
namemapfunction=lambda k: dynamicapiname(k),
|
||||
namemapfunction=lambda k: _TR(getannotatedapiname(k))
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
from qtsymbols import *
|
||||
import functools, os, json
|
||||
import windows, gobject
|
||||
from myutils.utils import translate_exits, dynamicapiname
|
||||
from myutils.utils import translate_exits, getannotatedapiname, sortAwithB
|
||||
from myutils.config import (
|
||||
globalconfig,
|
||||
_TR,
|
||||
@ -274,22 +274,10 @@ def loadvalidtss():
|
||||
continue
|
||||
if not translate_exits(x):
|
||||
continue
|
||||
tp = globalconfig["fanyi"][x].get("type", "free")
|
||||
alltransvis.append(
|
||||
dynamicapiname(x)
|
||||
+ "_("
|
||||
+ {
|
||||
"free": "在线翻译",
|
||||
"api": "注册在线翻译",
|
||||
"dev": "调试浏览器",
|
||||
"pre": "预翻译",
|
||||
"offline": "离线翻译",
|
||||
}.get(tp, "unknown type")
|
||||
+ ")"
|
||||
)
|
||||
alltransvis.append(getannotatedapiname(x))
|
||||
alltrans.append(x)
|
||||
sorted_pairs = sorted(zip(alltransvis, alltrans))
|
||||
return [x[1] for x in sorted_pairs], [x[0] for x in sorted_pairs]
|
||||
sortAwithB(alltransvis, alltrans)
|
||||
return alltrans, alltransvis
|
||||
|
||||
|
||||
def gethookembedgrid(self):
|
||||
|
@ -61,7 +61,10 @@ class triggereditor(LDialog):
|
||||
self.hctable.removeselectedrows()
|
||||
|
||||
def moverank(self, dy):
|
||||
src, tgt = self.hctable.moverank(dy)
|
||||
_pair = self.hctable.moverank(dy)
|
||||
if not _pair:
|
||||
return
|
||||
src, tgt = _pair
|
||||
self.internalrealname.insert(tgt, self.internalrealname.pop(src))
|
||||
|
||||
def __init__(self, parent) -> None:
|
||||
|
@ -34,6 +34,7 @@ class FocusCombo(QComboBox):
|
||||
else:
|
||||
return super().wheelEvent(e)
|
||||
|
||||
|
||||
class SuperCombo(FocusCombo):
|
||||
Visoriginrole = Qt.ItemDataRole.UserRole + 1
|
||||
Internalrole = Visoriginrole + 1
|
||||
@ -1877,7 +1878,10 @@ class listediter(LDialog):
|
||||
self.moverank(1)
|
||||
|
||||
def moverank(self, dy):
|
||||
src, tgt = self.hctable.moverank(dy)
|
||||
_pair = self.hctable.moverank(dy)
|
||||
if not _pair:
|
||||
return
|
||||
src, tgt = _pair
|
||||
self.internalrealname.insert(tgt, self.internalrealname.pop(src))
|
||||
|
||||
def __init__(
|
||||
|
@ -836,7 +836,9 @@ class audiocapture:
|
||||
self.data = None
|
||||
self.cb1 = CFUNCTYPE(None, c_void_p, c_size_t)(self.__datacollect)
|
||||
self.cb2 = CFUNCTYPE(None, c_void_p)(self.__mutexcb)
|
||||
threading.Thread(target=winsharedutils.StartCaptureAsync, args=(self.cb1, self.cb2)).start()
|
||||
threading.Thread(
|
||||
target=winsharedutils.StartCaptureAsync, args=(self.cb1, self.cb2)
|
||||
).start()
|
||||
|
||||
|
||||
class loopbackrecorder:
|
||||
@ -1034,6 +1036,27 @@ def dynamicapiname(apiuid):
|
||||
)
|
||||
|
||||
|
||||
def getannotatedapiname(x):
|
||||
tp = globalconfig["fanyi"][x].get("type", "free")
|
||||
return (
|
||||
dynamicapiname(x)
|
||||
+ "_("
|
||||
+ {
|
||||
"free": "在线翻译",
|
||||
"api": "注册在线翻译",
|
||||
"dev": "调试浏览器",
|
||||
"pre": "预翻译",
|
||||
"offline": "离线翻译",
|
||||
}.get(tp, "unknown type")
|
||||
+ ")"
|
||||
)
|
||||
|
||||
|
||||
def sortAwithB(l1, l2):
|
||||
sorted_pairs = sorted(zip(l1, l2))
|
||||
return [x[0] for x in sorted_pairs], [x[1] for x in sorted_pairs]
|
||||
|
||||
|
||||
def inrange(n, s, e):
|
||||
return n >= s and n <= e
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user