mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
fix
This commit is contained in:
parent
f1445937fc
commit
cb0720f137
@ -577,16 +577,17 @@ class MAINUI:
|
||||
reader = self.reader
|
||||
else:
|
||||
engine, voice, _ = target
|
||||
reader = self.specialreaders.get((engine, voice), None)
|
||||
key = str((engine, voice)) # voice可能是list,无法hash
|
||||
reader = self.specialreaders.get(key, None)
|
||||
if reader == -1:
|
||||
reader = self.reader
|
||||
elif reader is None:
|
||||
try:
|
||||
reader = self.loadreader(engine, privateconfig={"voice": voice})
|
||||
self.specialreaders[(engine, voice)] = reader
|
||||
self.specialreaders[key] = reader
|
||||
except:
|
||||
reader = self.reader
|
||||
self.specialreaders[(engine, voice)] = -1
|
||||
self.specialreaders[key] = -1
|
||||
if reader is None:
|
||||
return
|
||||
if text2 is None:
|
||||
|
@ -26,6 +26,13 @@ def maybesetreferlabels(self, name, text):
|
||||
self.referlabels_data[name] = text
|
||||
|
||||
|
||||
def autoreadswitch(self):
|
||||
try:
|
||||
self.autoread.clicksignal.emit()
|
||||
except:
|
||||
globalconfig["autoread"] = not globalconfig["autoread"]
|
||||
|
||||
|
||||
def registrhotkeys(self):
|
||||
self.hotkeymanager = SystemHotkey()
|
||||
self.referlabels = {}
|
||||
@ -65,6 +72,7 @@ def registrhotkeys(self):
|
||||
"_29": lambda: gobject.baseobject.searchwordW.ankiwindow.recordbtn1.click(),
|
||||
"_30": lambda: gobject.baseobject.searchwordW.ankiwindow.recordbtn2.click(),
|
||||
"_31": lambda: gobject.baseobject.hualang_recordbtn.click(),
|
||||
"_32": functools.partial(autoreadswitch, self),
|
||||
}
|
||||
for name in globalconfig["quick_setting"]["all"]:
|
||||
if name not in self.bindfunctions:
|
||||
@ -89,9 +97,7 @@ def setTab_quick_lazy(self):
|
||||
),
|
||||
]
|
||||
]
|
||||
for name in globalconfig["quick_setting"]["all"]:
|
||||
if name not in self.bindfunctions:
|
||||
continue
|
||||
for name in self.bindfunctions:
|
||||
|
||||
grids.append(
|
||||
[
|
||||
|
@ -30,7 +30,7 @@ def showvoicelist(self, obj):
|
||||
vl = obj.voiceshowlist
|
||||
idx = obj.voicelist.index(obj.voice)
|
||||
try:
|
||||
|
||||
|
||||
self.voicecombo.clear()
|
||||
self.voicecombo.addItems(vl)
|
||||
self.voicecombo.setCurrentIndex(idx)
|
||||
@ -186,7 +186,9 @@ def setTab5lz(self):
|
||||
grid=[
|
||||
[
|
||||
"自动朗读",
|
||||
D_getsimpleswitch(globalconfig, "autoread"),
|
||||
D_getsimpleswitch(
|
||||
globalconfig, "autoread", name="autoread", parent=self
|
||||
),
|
||||
],
|
||||
[
|
||||
"不被打断",
|
||||
|
@ -471,7 +471,7 @@ class QUnFrameWindow(resizableframeless):
|
||||
def btnsetontopfunction(self):
|
||||
try:
|
||||
|
||||
gobject.baseobject.settin_ui.keepontopbutton.click()
|
||||
gobject.baseobject.settin_ui.keepontopbutton.clicksignal.emit()
|
||||
except:
|
||||
globalconfig["keepontop"] = not globalconfig["keepontop"]
|
||||
|
||||
@ -886,7 +886,7 @@ class QUnFrameWindow(resizableframeless):
|
||||
def setselectable(self):
|
||||
|
||||
try:
|
||||
gobject.baseobject.settin_ui.selectable_btn.click()
|
||||
gobject.baseobject.settin_ui.selectable_btn.clicksignal.emit()
|
||||
except:
|
||||
globalconfig["selectable"] = not globalconfig["selectable"]
|
||||
self.translate_text.textbrowser.setselectable(globalconfig["selectable"])
|
||||
@ -1042,7 +1042,7 @@ class QUnFrameWindow(resizableframeless):
|
||||
if idx == 0:
|
||||
|
||||
try:
|
||||
gobject.baseobject.settin_ui.mousetransbutton.click()
|
||||
gobject.baseobject.settin_ui.mousetransbutton.clicksignal.emit()
|
||||
except:
|
||||
globalconfig["mousetransparent"] = not globalconfig["mousetransparent"]
|
||||
self.mousetransparent_check()
|
||||
@ -1072,7 +1072,7 @@ class QUnFrameWindow(resizableframeless):
|
||||
|
||||
def changeshowhideraw(self):
|
||||
try:
|
||||
gobject.baseobject.settin_ui.show_original_switch.click()
|
||||
gobject.baseobject.settin_ui.show_original_switch.clicksignal.emit()
|
||||
except:
|
||||
globalconfig["isshowrawtext"] = not globalconfig["isshowrawtext"]
|
||||
self.refreshtoolicon()
|
||||
@ -1083,7 +1083,7 @@ class QUnFrameWindow(resizableframeless):
|
||||
|
||||
def changetoolslockstate(self):
|
||||
try:
|
||||
gobject.baseobject.settin_ui.locktoolsbutton.click()
|
||||
gobject.baseobject.settin_ui.locktoolsbutton.clicksignal.emit()
|
||||
except:
|
||||
globalconfig["locktools"] = not globalconfig["locktools"]
|
||||
self.refreshtoolicon()
|
||||
|
@ -310,6 +310,7 @@ def disablecolor(__: QColor):
|
||||
|
||||
class MySwitch(commonsolveevent):
|
||||
clicked = pyqtSignal(bool)
|
||||
clicksignal = pyqtSignal()
|
||||
|
||||
def click(self):
|
||||
self.setChecked(not self.checked)
|
||||
@ -325,7 +326,7 @@ class MySwitch(commonsolveevent):
|
||||
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
||||
self.checked = sign
|
||||
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
|
||||
self.clicksignal.connect(self.click)
|
||||
self.__currv = 0
|
||||
if sign:
|
||||
self.__currv = 20
|
||||
|
@ -1033,6 +1033,11 @@
|
||||
"use": false,
|
||||
"name": "画廊_录音",
|
||||
"keystring": ""
|
||||
},
|
||||
"_32": {
|
||||
"use": false,
|
||||
"name": "自动朗读",
|
||||
"keystring": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user