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