mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-14 16:33:54 +08:00
.
This commit is contained in:
parent
a93c1b9e1a
commit
80b1956756
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
#include <wil/com.h>
|
||||||
|
#include <uiautomation.h>
|
||||||
DECLARE_API void showintab(HWND hwnd, bool show, bool tool)
|
DECLARE_API void showintab(HWND hwnd, bool show, bool tool)
|
||||||
{
|
{
|
||||||
// WS_EX_TOOLWINDOW可以立即生效,WS_EX_APPWINDOW必须切换焦点才生效。但是WS_EX_TOOLWINDOW会改变窗口样式,因此只对无边框窗口使用。
|
// WS_EX_TOOLWINDOW可以立即生效,WS_EX_APPWINDOW必须切换焦点才生效。但是WS_EX_TOOLWINDOW会改变窗口样式,因此只对无边框窗口使用。
|
||||||
@ -154,4 +156,61 @@ DECLARE_API bool check_window_viewable(HWND hwnd)
|
|||||||
return false;
|
return false;
|
||||||
RECT _;
|
RECT _;
|
||||||
return IntersectRect(&_, &windowRect, &monitorInfo.rcWork);
|
return IntersectRect(&_, &windowRect, &monitorInfo.rcWork);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_API void GetSelectedText(void (*cb)(const wchar_t *))
|
||||||
|
{
|
||||||
|
CoInitialize(nullptr);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 初始化 COM
|
||||||
|
wil::com_ptr<IUIAutomation> automation;
|
||||||
|
if (FAILED(CoCreateInstance(CLSID_CUIAutomation, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&automation))) || !automation)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("无法初始化 UI Automation.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取焦点元素
|
||||||
|
wil::com_ptr<IUIAutomationElement> focusedElement;
|
||||||
|
if (FAILED(automation->GetFocusedElement(&focusedElement)) || !focusedElement)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("无法获取当前焦点元素.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否支持 TextPattern
|
||||||
|
wil::com_ptr<IUIAutomationTextPattern> textPattern;
|
||||||
|
if (FAILED(focusedElement->GetCurrentPatternAs(UIA_TextPatternId, IID_PPV_ARGS(&textPattern))) || !textPattern)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("当前元素不支持 TextPattern.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取选定的文本范围
|
||||||
|
wil::com_ptr<IUIAutomationTextRangeArray> selection;
|
||||||
|
if (FAILED(textPattern->GetSelection(&selection)) || !selection)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("无法获取选定的文本范围.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取第一个选定范围
|
||||||
|
wil::com_ptr<IUIAutomationTextRange> range;
|
||||||
|
if (FAILED(selection->GetElement(0, &range)) || !range)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("没有选定文本.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取文本
|
||||||
|
BSTR text;
|
||||||
|
if (FAILED(range->GetText(-1, &text)) || !text)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("无法提取选定的文本.");
|
||||||
|
}
|
||||||
|
std::wstring selectedText(text, SysStringLen(text));
|
||||||
|
SysFreeString(text);
|
||||||
|
cb(selectedText.c_str());
|
||||||
|
}
|
||||||
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
printf(e.what());
|
||||||
|
}
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
||||||
|
@ -130,6 +130,9 @@
|
|||||||
|
|
||||||
### **Dictionary Lookup**
|
### **Dictionary Lookup**
|
||||||
|
|
||||||
|
1. #### Search for keywords
|
||||||
|
Search for words in the text currently selected by the mouse
|
||||||
|
|
||||||
1. #### Anki Recording
|
1. #### Anki Recording
|
||||||
Shortcut key for the recording function in the Anki add interface in the dictionary lookup window.
|
Shortcut key for the recording function in the Anki add interface in the dictionary lookup window.
|
||||||
|
|
||||||
|
@ -130,6 +130,9 @@
|
|||||||
|
|
||||||
### **辞書検索**
|
### **辞書検索**
|
||||||
|
|
||||||
|
1. #### 単語を調べる
|
||||||
|
現在のマウスで選択されているテキストの単語検索
|
||||||
|
|
||||||
1. #### Anki録音
|
1. #### Anki録音
|
||||||
辞書検索ウィンドウのAnki追加インターフェースの録音機能のショートカットキー。
|
辞書検索ウィンドウのAnki追加インターフェースの録音機能のショートカットキー。
|
||||||
|
|
||||||
|
@ -131,6 +131,9 @@
|
|||||||
|
|
||||||
### **查词**
|
### **查词**
|
||||||
|
|
||||||
|
1. #### 查词
|
||||||
|
对当前鼠标选取到的文本查词
|
||||||
|
|
||||||
1. #### Anki 录音
|
1. #### Anki 录音
|
||||||
查词窗口中的Anki添加界面中的录音功能的快捷键
|
查词窗口中的Anki添加界面中的录音功能的快捷键
|
||||||
|
|
||||||
|
@ -387,7 +387,6 @@ class MAINUI:
|
|||||||
maybehaspremt = {}
|
maybehaspremt = {}
|
||||||
skip_other_on_success = False
|
skip_other_on_success = False
|
||||||
fix_rank = globalconfig["fix_translate_rank_rank"].copy()
|
fix_rank = globalconfig["fix_translate_rank_rank"].copy()
|
||||||
print(is_auto_run , globalconfig["fanyi"]["rengong"].get("manual", False))
|
|
||||||
if ("rengong" in self.translators) and (
|
if ("rengong" in self.translators) and (
|
||||||
not (is_auto_run and globalconfig["fanyi"]["rengong"].get("manual", False))
|
not (is_auto_run and globalconfig["fanyi"]["rengong"].get("manual", False))
|
||||||
):
|
):
|
||||||
|
@ -12,17 +12,17 @@ class jisho(cishubase):
|
|||||||
contents = []
|
contents = []
|
||||||
idx = 0
|
idx = 0
|
||||||
for title, res in allres:
|
for title, res in allres:
|
||||||
idx += 1
|
|
||||||
btns.append(
|
btns.append(
|
||||||
"""<button type="button" onclick="onclickbtn_xxxxxx_internal('buttonid_xxxxx_internal{idx}')" id="buttonid_xxxxx_internal{idx}" class="tab-button_xxxx_internal{klass}" data-tab="tab_xxxxx_internal{idx}">{title}</button>""".format(
|
"""<button type="button" onclick="onclickbtn_xxxxxx_internal('buttonid_xxxxx_internal{idx}')" id="buttonid_xxxxx_internal{idx}" class="tab-button_xxxx_internal{klass}" data-tab="tab_xxxxx_internal{idx}">{title}</button>""".format(
|
||||||
idx=idx, title=title, klass='' if idx==0 else ' active'
|
idx=idx, title=title, klass='' if idx!=0 else ' active'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
contents.append(
|
contents.append(
|
||||||
"""<div id="tab_xxxxx_internal{idx}" class="tab-pane_xxxxx_internal{klass}">{res}</div>""".format(
|
"""<div id="tab_xxxxx_internal{idx}" class="tab-pane_xxxxx_internal{klass}">{res}</div>""".format(
|
||||||
idx=idx, res=res,klass='' if idx==0 else ' active'
|
idx=idx, res=res,klass='' if idx!=0 else ' active'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
idx += 1
|
||||||
commonstyle = """
|
commonstyle = """
|
||||||
<script>
|
<script>
|
||||||
function onclickbtn_xxxxxx_internal(_id) {
|
function onclickbtn_xxxxxx_internal(_id) {
|
||||||
|
@ -22,8 +22,8 @@ from myutils.config import (
|
|||||||
from gui.usefulwidget import (
|
from gui.usefulwidget import (
|
||||||
saveposwindow,
|
saveposwindow,
|
||||||
getboxlayout,
|
getboxlayout,
|
||||||
MySwitch,
|
|
||||||
IconButton,
|
IconButton,
|
||||||
|
statusbutton,
|
||||||
getsimplecombobox,
|
getsimplecombobox,
|
||||||
FQLineEdit,
|
FQLineEdit,
|
||||||
FocusCombo,
|
FocusCombo,
|
||||||
@ -58,34 +58,22 @@ class dialog_savedgame_integrated(saveposwindow):
|
|||||||
dialog_savedgame_v3,
|
dialog_savedgame_v3,
|
||||||
dialog_savedgame_legacy,
|
dialog_savedgame_legacy,
|
||||||
][type]
|
][type]
|
||||||
|
btns = [self.layout1btn, self.layout2btn, self.layout3btn]
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][(type) % 3].setEnabled(
|
btns[(type + 0) % 3].setEnabled(False)
|
||||||
False
|
btns[(type + 1) % 3].setEnabled(False)
|
||||||
)
|
btns[(type + 2) % 3].setEnabled(False)
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][
|
btns[(type + 0) % 3].setChecked(True)
|
||||||
(type + 1) % 3
|
btns[(type + 1) % 3].setChecked(False)
|
||||||
].setEnabled(False)
|
btns[(type + 2) % 3].setChecked(False)
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][
|
|
||||||
(type + 2) % 3
|
|
||||||
].setEnabled(False)
|
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][
|
|
||||||
(type + 1) % 3
|
|
||||||
].setChecked(False)
|
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][
|
|
||||||
(type + 2) % 3
|
|
||||||
].setChecked(False)
|
|
||||||
_old = self.internallayout.takeAt(0).widget()
|
_old = self.internallayout.takeAt(0).widget()
|
||||||
_old.hide()
|
_old.hide()
|
||||||
_ = klass(self)
|
_ = klass(self)
|
||||||
self.internallayout.addWidget(_)
|
self.internallayout.addWidget(_)
|
||||||
_.directshow()
|
_.directshow()
|
||||||
_old.deleteLater()
|
_old.deleteLater()
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][
|
btns[(type + 0) % 3].setEnabled(False)
|
||||||
(type + 1) % 3
|
btns[(type + 1) % 3].setEnabled(True)
|
||||||
].setEnabled(True)
|
btns[(type + 2) % 3].setEnabled(True)
|
||||||
[self.layout1btn, self.layout2btn, self.layout3btn][
|
|
||||||
(type + 2) % 3
|
|
||||||
].setEnabled(True)
|
|
||||||
self.__internal = _
|
self.__internal = _
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
@ -106,15 +94,21 @@ class dialog_savedgame_integrated(saveposwindow):
|
|||||||
self.__internal = None
|
self.__internal = None
|
||||||
self.internallayout.addWidget(QWidget())
|
self.internallayout.addWidget(QWidget())
|
||||||
self.setCentralWidget(w)
|
self.setCentralWidget(w)
|
||||||
self.layout1btn = MySwitch(self, icon="fa.th")
|
|
||||||
self.layout2btn = MySwitch(self, icon="fa.th-list")
|
def createbtn(icon, i):
|
||||||
self.layout3btn = MySwitch(self, icon="fa.list")
|
btn = statusbutton(
|
||||||
self.layout1btn.clicked.connect(functools.partial(self.selectlayout, 0))
|
p=self,
|
||||||
self.layout2btn.clicked.connect(functools.partial(self.selectlayout, 1))
|
icons=icon,
|
||||||
self.layout3btn.clicked.connect(functools.partial(self.selectlayout, 2))
|
border=False,
|
||||||
self.layout1btn.setFixedSize(QSize(20, 25))
|
colors=["", globalconfig["buttoncolor2"]],
|
||||||
self.layout2btn.setFixedSize(QSize(20, 25))
|
)
|
||||||
self.layout3btn.setFixedSize(QSize(20, 25))
|
btn.clicked.connect(functools.partial(self.selectlayout, i))
|
||||||
|
btn.setFixedSize(QSize(20, 25))
|
||||||
|
return btn
|
||||||
|
|
||||||
|
self.layout1btn = createbtn("fa.th", 0)
|
||||||
|
self.layout2btn = createbtn("fa.th-list", 1)
|
||||||
|
self.layout3btn = createbtn("fa.list", 2)
|
||||||
self.syssettingbtn = IconButton(icon="fa.gear", parent=self)
|
self.syssettingbtn = IconButton(icon="fa.gear", parent=self)
|
||||||
self.syssettingbtn.setFixedSize(QSize(25, 25))
|
self.syssettingbtn.setFixedSize(QSize(25, 25))
|
||||||
self.syssettingbtn.clicked.connect(self.syssetting)
|
self.syssettingbtn.clicked.connect(self.syssetting)
|
||||||
@ -128,16 +122,15 @@ class dialog_savedgame_integrated(saveposwindow):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def resizeEvent(self, e: QResizeEvent):
|
def resizeEvent(self, e: QResizeEvent):
|
||||||
self.layout1btn.move(e.size().width() - self.layout1btn.width() - 5, 0)
|
self.layout1btn.move(e.size().width() - self.layout1btn.width(), 0)
|
||||||
self.layout2btn.move(
|
self.layout2btn.move(
|
||||||
e.size().width() - self.layout2btn.width() - self.layout1btn.width() - 5, 0
|
e.size().width() - self.layout2btn.width() - self.layout1btn.width(), 0
|
||||||
)
|
)
|
||||||
self.layout3btn.move(
|
self.layout3btn.move(
|
||||||
e.size().width()
|
e.size().width()
|
||||||
- self.layout3btn.width()
|
- self.layout3btn.width()
|
||||||
- self.layout2btn.width()
|
- self.layout2btn.width()
|
||||||
- self.layout1btn.width()
|
- self.layout1btn.width(),
|
||||||
- 5,
|
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
self.syssettingbtn.move(
|
self.syssettingbtn.move(
|
||||||
@ -145,8 +138,7 @@ class dialog_savedgame_integrated(saveposwindow):
|
|||||||
- self.syssettingbtn.width()
|
- self.syssettingbtn.width()
|
||||||
- self.layout3btn.width()
|
- self.layout3btn.width()
|
||||||
- self.layout2btn.width()
|
- self.layout2btn.width()
|
||||||
- self.layout1btn.width()
|
- self.layout1btn.width(),
|
||||||
- 5,
|
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -382,18 +382,18 @@ class viewpixmap_x(QWidget):
|
|||||||
self.centerwidgetlayout = QVBoxLayout()
|
self.centerwidgetlayout = QVBoxLayout()
|
||||||
audio = QHBoxLayout()
|
audio = QHBoxLayout()
|
||||||
self.recordbtn = statusbutton(
|
self.recordbtn = statusbutton(
|
||||||
icons=["fa.microphone", "fa.stop"], colors=["", ""]
|
icons=["fa.microphone", "fa.stop"]
|
||||||
)
|
)
|
||||||
self.recordbtn.statuschanged.connect(self.startorendrecord)
|
self.recordbtn.clicked.connect(self.startorendrecord)
|
||||||
self.centerwidget.setLayout(self.centerwidgetlayout)
|
self.centerwidget.setLayout(self.centerwidgetlayout)
|
||||||
self.centerwidgetlayout.addWidget(self.timenothide)
|
self.centerwidgetlayout.addWidget(self.timenothide)
|
||||||
self.centerwidgetlayout.addWidget(self.pathandopen)
|
self.centerwidgetlayout.addWidget(self.pathandopen)
|
||||||
self.centerwidgetlayout.addWidget(self.commentedit)
|
self.centerwidgetlayout.addWidget(self.commentedit)
|
||||||
self.centerwidgetlayout.addLayout(audio)
|
self.centerwidgetlayout.addLayout(audio)
|
||||||
audio.addWidget(self.recordbtn)
|
audio.addWidget(self.recordbtn)
|
||||||
self.btnplay = statusbutton(icons=["fa.play", "fa.stop"], colors=["", ""])
|
self.btnplay = statusbutton(icons=["fa.play", "fa.stop"])
|
||||||
audio.addWidget(self.btnplay)
|
audio.addWidget(self.btnplay)
|
||||||
self.btnplay.statuschanged.connect(self.playorstop)
|
self.btnplay.clicked.connect(self.playorstop)
|
||||||
gobject.baseobject.hualang_recordbtn = self.recordbtn
|
gobject.baseobject.hualang_recordbtn = self.recordbtn
|
||||||
self.centerwidget.setVisible(False)
|
self.centerwidget.setVisible(False)
|
||||||
self.pathview = fadeoutlabel(self)
|
self.pathview = fadeoutlabel(self)
|
||||||
@ -419,11 +419,11 @@ class viewpixmap_x(QWidget):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def playorstop(self, idx):
|
def playorstop(self, check):
|
||||||
if not self.checkplayable():
|
if not self.checkplayable():
|
||||||
return
|
return
|
||||||
mp3 = extradatas["imagerefmp3"][self.currentimage]
|
mp3 = extradatas["imagerefmp3"][self.currentimage]
|
||||||
if idx == 1:
|
if check:
|
||||||
self.play_context = playonce(mp3, globalconfig["ttscommon"]["volume"])
|
self.play_context = playonce(mp3, globalconfig["ttscommon"]["volume"])
|
||||||
self.sigtime = time.time()
|
self.sigtime = time.time()
|
||||||
|
|
||||||
@ -439,8 +439,8 @@ class viewpixmap_x(QWidget):
|
|||||||
return
|
return
|
||||||
self.play_context = None
|
self.play_context = None
|
||||||
|
|
||||||
def startorendrecord(self, idx):
|
def startorendrecord(self, check):
|
||||||
if idx == 1:
|
if check:
|
||||||
if self.play_context:
|
if self.play_context:
|
||||||
self.btnplay.click()
|
self.btnplay.click()
|
||||||
self.btnplay.setEnabled(False)
|
self.btnplay.setEnabled(False)
|
||||||
@ -897,6 +897,8 @@ class dialog_savedgame_v3(QWidget):
|
|||||||
|
|
||||||
spl.setSizes(globalconfig["dialog_savegame_layout"]["listitemwidth_2"])
|
spl.setSizes(globalconfig["dialog_savegame_layout"]["listitemwidth_2"])
|
||||||
spl.splitterMoved.connect(__)
|
spl.splitterMoved.connect(__)
|
||||||
|
spl.setStretchFactor(0, 0)
|
||||||
|
spl.setStretchFactor(1, 1)
|
||||||
rightlay.addWidget(self.pixview)
|
rightlay.addWidget(self.pixview)
|
||||||
|
|
||||||
isfirst = True
|
isfirst = True
|
||||||
|
@ -39,6 +39,8 @@ class TabWidget(QWidget):
|
|||||||
self.tab_widget.tabBar().hide()
|
self.tab_widget.tabBar().hide()
|
||||||
self.splitter.addWidget(self.list_widget)
|
self.splitter.addWidget(self.list_widget)
|
||||||
self.splitter.addWidget(self.tab_widget)
|
self.splitter.addWidget(self.tab_widget)
|
||||||
|
self.splitter.setStretchFactor(0, 0)
|
||||||
|
self.splitter.setStretchFactor(1, 1)
|
||||||
self.currentChanged.connect(
|
self.currentChanged.connect(
|
||||||
self.tab_widget.setCurrentIndex
|
self.tab_widget.setCurrentIndex
|
||||||
) # 监听 Tab 切换事件
|
) # 监听 Tab 切换事件
|
||||||
|
@ -20,7 +20,6 @@ from gui.usefulwidget import (
|
|||||||
D_getcolorbutton,
|
D_getcolorbutton,
|
||||||
D_getsimplecombobox,
|
D_getsimplecombobox,
|
||||||
)
|
)
|
||||||
from gui.showword import showdiction
|
|
||||||
from gui.setting_about import offlinelinks
|
from gui.setting_about import offlinelinks
|
||||||
|
|
||||||
|
|
||||||
@ -300,10 +299,7 @@ def setTabcishu_l(self):
|
|||||||
lambda: gobject.baseobject.searchwordW.showsignal.emit(),
|
lambda: gobject.baseobject.searchwordW.showsignal.emit(),
|
||||||
"fa.search",
|
"fa.search",
|
||||||
),
|
),
|
||||||
D_getIconButton(
|
"",
|
||||||
lambda: showdiction(self).show(),
|
|
||||||
"fa.book",
|
|
||||||
),
|
|
||||||
"",
|
"",
|
||||||
"辞书显示顺序",
|
"辞书显示顺序",
|
||||||
D_getIconButton(
|
D_getIconButton(
|
||||||
|
@ -143,9 +143,8 @@ def createinternalfontsettings(self, forml: LFormLayout, group, _type):
|
|||||||
lineW = getcolorbutton(
|
lineW = getcolorbutton(
|
||||||
dd,
|
dd,
|
||||||
key,
|
key,
|
||||||
transparent=False,
|
|
||||||
callback=functools.partial(
|
callback=functools.partial(
|
||||||
lambda dd, key, _: selectcolor(
|
lambda dd, key: selectcolor(
|
||||||
self, dd, key, self.miaobian_color_button
|
self, dd, key, self.miaobian_color_button
|
||||||
),
|
),
|
||||||
dd,
|
dd,
|
||||||
|
@ -93,6 +93,9 @@ def registrhotkeys(self):
|
|||||||
"36": lambda: gobject.baseobject.textgetmethod(
|
"36": lambda: gobject.baseobject.textgetmethod(
|
||||||
winsharedutils.clipboard_get(), False
|
winsharedutils.clipboard_get(), False
|
||||||
),
|
),
|
||||||
|
"37": lambda: gobject.baseobject.searchwordW.search_word.emit(
|
||||||
|
winsharedutils.GetSelectedText(), False
|
||||||
|
),
|
||||||
}
|
}
|
||||||
for name in self.bindfunctions:
|
for name in self.bindfunctions:
|
||||||
regist_or_not_key(self, name)
|
regist_or_not_key(self, name)
|
||||||
@ -105,7 +108,7 @@ hotkeys = [
|
|||||||
["剪贴板", ["36", "_4", "_28"]],
|
["剪贴板", ["36", "_4", "_28"]],
|
||||||
["TTS", ["_32", "_7", "_7_1"]],
|
["TTS", ["_32", "_7", "_7_1"]],
|
||||||
["游戏", ["_15", "_20", "_21", "_22", "_25", "_27", "_31"]],
|
["游戏", ["_15", "_20", "_21", "_22", "_25", "_27", "_31"]],
|
||||||
["查词", ["_29", "_30", "_35", "_33"]],
|
["查词", ["37", "_29", "_30", "_35", "_33"]],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ class AnkiWindow(QWidget):
|
|||||||
windows.keybd_event(mode, 0, windows.KEYEVENTF_KEYUP, 0)
|
windows.keybd_event(mode, 0, windows.KEYEVENTF_KEYUP, 0)
|
||||||
|
|
||||||
def startorendrecord(self, ii, target: QLineEdit, idx):
|
def startorendrecord(self, ii, target: QLineEdit, idx):
|
||||||
if idx == 1:
|
if idx:
|
||||||
self.recorders[ii] = loopbackrecorder()
|
self.recorders[ii] = loopbackrecorder()
|
||||||
self.simulate_key(ii)
|
self.simulate_key(ii)
|
||||||
else:
|
else:
|
||||||
@ -478,12 +478,12 @@ class AnkiWindow(QWidget):
|
|||||||
|
|
||||||
self.example.textChanged.connect(__)
|
self.example.textChanged.connect(__)
|
||||||
self.remarks = FQPlainTextEdit()
|
self.remarks = FQPlainTextEdit()
|
||||||
recordbtn1 = statusbutton(icons=["fa.microphone", "fa.stop"], colors=["", ""])
|
recordbtn1 = statusbutton(icons=["fa.microphone", "fa.stop"])
|
||||||
recordbtn1.statuschanged.connect(
|
recordbtn1.clicked.connect(
|
||||||
functools.partial(self.startorendrecord, 1, self.audiopath)
|
functools.partial(self.startorendrecord, 1, self.audiopath)
|
||||||
)
|
)
|
||||||
recordbtn2 = statusbutton(icons=["fa.microphone", "fa.stop"], colors=["", ""])
|
recordbtn2 = statusbutton(icons=["fa.microphone", "fa.stop"])
|
||||||
recordbtn2.statuschanged.connect(
|
recordbtn2.clicked.connect(
|
||||||
functools.partial(self.startorendrecord, 2, self.audiopath_sentence)
|
functools.partial(self.startorendrecord, 2, self.audiopath_sentence)
|
||||||
)
|
)
|
||||||
self.recordbtn1 = recordbtn1
|
self.recordbtn1 = recordbtn1
|
||||||
@ -518,7 +518,9 @@ class AnkiWindow(QWidget):
|
|||||||
btn = LPushButton("添加")
|
btn = LPushButton("添加")
|
||||||
btn.clicked.connect(functools.partial(self.errorwrap, False))
|
btn.clicked.connect(functools.partial(self.errorwrap, False))
|
||||||
btn.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
btn.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
btn.customContextMenuRequested.connect(functools.partial(self.errorwrap, True))
|
btn.customContextMenuRequested.connect(
|
||||||
|
functools.partial(self.errorwrap, True)
|
||||||
|
)
|
||||||
return btn
|
return btn
|
||||||
|
|
||||||
layout.addLayout(
|
layout.addLayout(
|
||||||
@ -871,7 +873,7 @@ class kpQTreeView(QTreeView):
|
|||||||
super().keyPressEvent(e)
|
super().keyPressEvent(e)
|
||||||
|
|
||||||
|
|
||||||
class showdiction(LMainWindow):
|
class showdiction(QWidget):
|
||||||
def setwordfilter(self, index=None):
|
def setwordfilter(self, index=None):
|
||||||
w = self.word.text()
|
w = self.word.text()
|
||||||
if index is None:
|
if index is None:
|
||||||
@ -940,33 +942,33 @@ class showdiction(LMainWindow):
|
|||||||
self.word = FQLineEdit()
|
self.word = FQLineEdit()
|
||||||
self.word.returnPressed.connect(self.setwordfilter)
|
self.word.returnPressed.connect(self.setwordfilter)
|
||||||
wordfilter.addWidget(self.word)
|
wordfilter.addWidget(self.word)
|
||||||
butn = getIconButton(self.setwordfilter, "fa.filter")
|
butn = getIconButton(self.setwordfilter, "fa.search")
|
||||||
wordfilter.addWidget(butn)
|
wordfilter.addWidget(butn)
|
||||||
|
refresh = getIconButton(self.refresh, "fa.refresh")
|
||||||
self.resize(400, parent.height())
|
wordfilter.addWidget(refresh)
|
||||||
self.setWindowTitle("查看")
|
|
||||||
self.setWindowIcon(qtawesome.icon("fa.book"))
|
|
||||||
self.tree = kpQTreeView(self)
|
self.tree = kpQTreeView(self)
|
||||||
self.tree.setUniformRowHeights(True)
|
self.tree.setUniformRowHeights(True)
|
||||||
self.tree.setHeaderHidden(True)
|
self.tree.setHeaderHidden(True)
|
||||||
self.tree.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
self.tree.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||||
__c = QWidget()
|
|
||||||
__lay = QVBoxLayout()
|
__lay = QVBoxLayout()
|
||||||
__c.setLayout(__lay)
|
self.setLayout(__lay)
|
||||||
__lay.setSpacing(0)
|
__lay.setSpacing(0)
|
||||||
__lay.setContentsMargins(0, 0, 0, 0)
|
__lay.setContentsMargins(0, 0, 0, 0)
|
||||||
__lay.addLayout(wordfilter)
|
__lay.addLayout(wordfilter)
|
||||||
__lay.addWidget(self.tree)
|
__lay.addWidget(self.tree)
|
||||||
self.setCentralWidget(__c)
|
|
||||||
|
|
||||||
self.model = DynamicTreeModel(self.setwordfilter)
|
self.model = DynamicTreeModel(self.setwordfilter)
|
||||||
self.tree.setModel(self.model)
|
self.tree.setModel(self.model)
|
||||||
self.tree.expanded.connect(self.model.loadChildren)
|
self.tree.expanded.connect(self.model.loadChildren)
|
||||||
root = self.model.invisibleRootItem()
|
|
||||||
self.tree.doubleClicked.connect(self.model.onDoubleClicked)
|
self.tree.doubleClicked.connect(self.model.onDoubleClicked)
|
||||||
self.tree.enterpressed.connect(self.model.onDoubleClicked)
|
self.tree.enterpressed.connect(self.model.onDoubleClicked)
|
||||||
self.tree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
self.tree.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
self.tree.customContextMenuRequested.connect(self.showmenu)
|
self.tree.customContextMenuRequested.connect(self.showmenu)
|
||||||
|
self.refresh()
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
self.model.clear()
|
||||||
|
root = self.model.invisibleRootItem()
|
||||||
rows = []
|
rows = []
|
||||||
for k in globalconfig["cishuvisrank"]:
|
for k in globalconfig["cishuvisrank"]:
|
||||||
cishu = gobject.baseobject.cishus[k]
|
cishu = gobject.baseobject.cishus[k]
|
||||||
@ -1089,15 +1091,15 @@ class searchwordW(closeashidewindow):
|
|||||||
self.vboxlayout.addLayout(self.searchlayout)
|
self.vboxlayout.addLayout(self.searchlayout)
|
||||||
self.searchtext = FQLineEdit()
|
self.searchtext = FQLineEdit()
|
||||||
self.searchtext.textChanged.connect(self.ankiwindow.reset)
|
self.searchtext.textChanged.connect(self.ankiwindow.reset)
|
||||||
self.history_last_btn = statusbutton(
|
|
||||||
icons=["fa.arrow-left", "fa.arrow-left"], colors=["", ""]
|
self.dictbutton = statusbutton(
|
||||||
|
icons="fa.book", colors=["", globalconfig["buttoncolor2"]]
|
||||||
)
|
)
|
||||||
|
self.history_last_btn = statusbutton(icons=["fa.arrow-left", "fa.arrow-left"])
|
||||||
self.history_last_btn.clicked.connect(
|
self.history_last_btn.clicked.connect(
|
||||||
functools.partial(self.__move_history_search, -1)
|
functools.partial(self.__move_history_search, -1)
|
||||||
)
|
)
|
||||||
self.history_next_btn = statusbutton(
|
self.history_next_btn = statusbutton(icons=["fa.arrow-right", "fa.arrow-right"])
|
||||||
icons=["fa.arrow-right", "fa.arrow-right"], colors=["", ""]
|
|
||||||
)
|
|
||||||
self.history_next_btn.clicked.connect(
|
self.history_next_btn.clicked.connect(
|
||||||
functools.partial(self.__move_history_search, 1)
|
functools.partial(self.__move_history_search, 1)
|
||||||
)
|
)
|
||||||
@ -1105,6 +1107,7 @@ class searchwordW(closeashidewindow):
|
|||||||
self.trace_history = []
|
self.trace_history = []
|
||||||
self.trace_history_idx = -1
|
self.trace_history_idx = -1
|
||||||
self.__set_history_btn_able()
|
self.__set_history_btn_able()
|
||||||
|
self.searchlayout.addWidget(self.dictbutton)
|
||||||
self.searchlayout.addWidget(self.history_last_btn)
|
self.searchlayout.addWidget(self.history_last_btn)
|
||||||
self.searchlayout.addWidget(self.history_next_btn)
|
self.searchlayout.addWidget(self.history_next_btn)
|
||||||
self.searchlayout.addWidget(self.searchtext)
|
self.searchlayout.addWidget(self.searchtext)
|
||||||
@ -1126,9 +1129,9 @@ class searchwordW(closeashidewindow):
|
|||||||
self.searchlayout.addWidget(soundbutton)
|
self.searchlayout.addWidget(soundbutton)
|
||||||
|
|
||||||
ankiconnect = statusbutton(
|
ankiconnect = statusbutton(
|
||||||
icons=["fa.adn", "fa.adn"], colors=["", globalconfig["buttoncolor2"]]
|
icons="fa.adn", colors=["", globalconfig["buttoncolor2"]]
|
||||||
)
|
)
|
||||||
ankiconnect.statuschanged.connect(self.onceaddankiwindow)
|
ankiconnect.clicked.connect(self.onceaddankiwindow)
|
||||||
ankiconnect.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
ankiconnect.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||||
ankiconnect.customContextMenuRequested.connect(
|
ankiconnect.customContextMenuRequested.connect(
|
||||||
lambda _: self.ankiwindow.errorwrap()
|
lambda _: self.ankiwindow.errorwrap()
|
||||||
@ -1183,12 +1186,29 @@ class searchwordW(closeashidewindow):
|
|||||||
w.setLayout(tablayout)
|
w.setLayout(tablayout)
|
||||||
self.vboxlayout.addWidget(self.spliter)
|
self.vboxlayout.addWidget(self.spliter)
|
||||||
self.isfirstshowanki = True
|
self.isfirstshowanki = True
|
||||||
|
self.isfirstshowdictwidget = True
|
||||||
self.spliter.setOrientation(Qt.Orientation.Vertical)
|
self.spliter.setOrientation(Qt.Orientation.Vertical)
|
||||||
|
|
||||||
self.spliter.addWidget(w)
|
self.dict_textoutput_spl = QSplitter()
|
||||||
|
self.dict_textoutput_spl.addWidget(w)
|
||||||
|
self.spliter.addWidget(self.dict_textoutput_spl)
|
||||||
|
self.dictbutton.clicked.connect(self.onceaddshowdictwidget)
|
||||||
|
|
||||||
|
def onceaddshowdictwidget(self, idx):
|
||||||
|
if idx:
|
||||||
|
if self.isfirstshowdictwidget:
|
||||||
|
self.showdictwidget = showdiction(self)
|
||||||
|
self.dict_textoutput_spl.insertWidget(0, self.showdictwidget)
|
||||||
|
self.dict_textoutput_spl.setStretchFactor(0, 0)
|
||||||
|
self.dict_textoutput_spl.setStretchFactor(1, 1)
|
||||||
|
else:
|
||||||
|
self.showdictwidget.show()
|
||||||
|
else:
|
||||||
|
self.showdictwidget.hide()
|
||||||
|
self.isfirstshowdictwidget = False
|
||||||
|
|
||||||
def onceaddankiwindow(self, idx):
|
def onceaddankiwindow(self, idx):
|
||||||
if idx == 1:
|
if idx:
|
||||||
if self.isfirstshowanki:
|
if self.isfirstshowanki:
|
||||||
self.spliter.addWidget(self.ankiwindow)
|
self.spliter.addWidget(self.ankiwindow)
|
||||||
self.ankiwindow.setMinimumHeight(1)
|
self.ankiwindow.setMinimumHeight(1)
|
||||||
|
@ -643,56 +643,6 @@ class MySwitch(commonsolveevent):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IconButton(commonsolveevent):
|
|
||||||
clicked = pyqtSignal()
|
|
||||||
|
|
||||||
def sizeHint(self):
|
|
||||||
return QSize(
|
|
||||||
int(1.42 * globalconfig["buttonsize2"]),
|
|
||||||
int(1.42 * globalconfig["buttonsize2"]),
|
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, icon, enable=True, qicon=None, parent=None):
|
|
||||||
super().__init__(parent)
|
|
||||||
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
|
||||||
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
|
||||||
self.enable = enable
|
|
||||||
self._icon = icon
|
|
||||||
self._qicon = qicon
|
|
||||||
|
|
||||||
def setEnabled(self, enable):
|
|
||||||
self.enable = enable
|
|
||||||
self.update()
|
|
||||||
|
|
||||||
def isEnabled(self):
|
|
||||||
return self.enable
|
|
||||||
|
|
||||||
def paintEvent(self, event):
|
|
||||||
painter = QPainter(self)
|
|
||||||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
|
||||||
painter.setPen(Qt.PenStyle.NoPen)
|
|
||||||
if self._qicon:
|
|
||||||
icon = self._qicon
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
__ = QColor(globalconfig["buttoncolor2"])
|
|
||||||
if not self.enable:
|
|
||||||
__ = disablecolor(__)
|
|
||||||
icon: QIcon = qtawesome.icon(self._icon, color=__)
|
|
||||||
bigw = self.size().width() - self.sizeHint().width()
|
|
||||||
bigh = self.size().height() - self.sizeHint().height()
|
|
||||||
x = bigw // 2
|
|
||||||
y = bigh // 2
|
|
||||||
painter.drawPixmap(x, y, icon.pixmap(self.sizeHint()))
|
|
||||||
|
|
||||||
def mouseReleaseEvent(self, event) -> None:
|
|
||||||
if not self.enable:
|
|
||||||
return
|
|
||||||
if event.button() == Qt.MouseButton.LeftButton:
|
|
||||||
self.clicked.emit()
|
|
||||||
|
|
||||||
|
|
||||||
class resizableframeless(saveposwindow):
|
class resizableframeless(saveposwindow):
|
||||||
def __init__(self, parent, flags, poslist) -> None:
|
def __init__(self, parent, flags, poslist) -> None:
|
||||||
super().__init__(parent, poslist, flags)
|
super().__init__(parent, poslist, flags)
|
||||||
@ -971,29 +921,17 @@ def getcolorbutton(
|
|||||||
icon="fa.paint-brush",
|
icon="fa.paint-brush",
|
||||||
constcolor=None,
|
constcolor=None,
|
||||||
enable=True,
|
enable=True,
|
||||||
transparent=True,
|
|
||||||
qicon=None,
|
qicon=None,
|
||||||
sizefixed=False,
|
sizefixed=False,
|
||||||
):
|
):
|
||||||
if qicon is None:
|
if qicon is None:
|
||||||
qicon = qtawesome.icon(icon, color=constcolor if constcolor else d[key])
|
qicon = qtawesome.icon(icon, color=constcolor if constcolor else d[key])
|
||||||
b = QPushButton()
|
b = IconButton(None, enable=enable, parent=parent, qicon=qicon)
|
||||||
b.setIcon(qicon)
|
|
||||||
b.setEnabled(enable)
|
|
||||||
sz = int(1.42 * globalconfig["buttonsize2"])
|
sz = int(1.42 * globalconfig["buttonsize2"])
|
||||||
b.setIconSize(QSize(sz, sz))
|
|
||||||
if sizefixed:
|
if sizefixed:
|
||||||
b.setFixedSize(QSize(sz, sz))
|
b.setFixedSize(QSize(sz, sz))
|
||||||
if transparent:
|
|
||||||
b.setStyleSheet(
|
|
||||||
"""background-color: rgba(255, 255, 255, 0);
|
|
||||||
color: black;
|
|
||||||
border: 0px;
|
|
||||||
font: 100 10pt;"""
|
|
||||||
)
|
|
||||||
if callback:
|
if callback:
|
||||||
b.clicked.connect(callback)
|
b.clicked.connect(callback)
|
||||||
b.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
|
||||||
if name:
|
if name:
|
||||||
setattr(parent, name, b)
|
setattr(parent, name, b)
|
||||||
return b
|
return b
|
||||||
@ -1008,7 +946,6 @@ def D_getcolorbutton(
|
|||||||
icon="fa.paint-brush",
|
icon="fa.paint-brush",
|
||||||
constcolor=None,
|
constcolor=None,
|
||||||
enable=True,
|
enable=True,
|
||||||
transparent=True,
|
|
||||||
qicon=None,
|
qicon=None,
|
||||||
sizefixed=False,
|
sizefixed=False,
|
||||||
):
|
):
|
||||||
@ -1021,7 +958,6 @@ def D_getcolorbutton(
|
|||||||
icon,
|
icon,
|
||||||
constcolor,
|
constcolor,
|
||||||
enable,
|
enable,
|
||||||
transparent,
|
|
||||||
qicon,
|
qicon,
|
||||||
sizefixed,
|
sizefixed,
|
||||||
)
|
)
|
||||||
@ -1748,7 +1684,7 @@ def makegroupingrid(args):
|
|||||||
if title:
|
if title:
|
||||||
group.setTitle(title)
|
group.setTitle(title)
|
||||||
else:
|
else:
|
||||||
group.setObjectName('notitle')
|
group.setObjectName("notitle")
|
||||||
|
|
||||||
if _type == "grid":
|
if _type == "grid":
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
@ -1832,9 +1768,7 @@ def automakegrid(grid: QGridLayout, lis, save=False, savelist=None):
|
|||||||
grid.setRowMinimumHeight(nowr, 25)
|
grid.setRowMinimumHeight(nowr, 25)
|
||||||
|
|
||||||
|
|
||||||
def makegrid(
|
def makegrid(grid=None, save=False, savelist=None, savelay=None, delay=False):
|
||||||
grid=None, save=False, savelist=None, savelay=None, delay=False
|
|
||||||
):
|
|
||||||
|
|
||||||
class gridwidget(QWidget):
|
class gridwidget(QWidget):
|
||||||
pass
|
pass
|
||||||
@ -2389,28 +2323,72 @@ class pixmapviewer(QWidget):
|
|||||||
|
|
||||||
|
|
||||||
class statusbutton(QPushButton):
|
class statusbutton(QPushButton):
|
||||||
statuschanged = pyqtSignal(int)
|
|
||||||
|
|
||||||
def __init__(self, icons, colors):
|
def __init__(self, icons, colors=None, border=True, p=None):
|
||||||
super().__init__()
|
super().__init__(p)
|
||||||
self.idx = 0
|
if colors:
|
||||||
self.icons = icons
|
self.colors = colors
|
||||||
self.colors = colors
|
else:
|
||||||
self.clicked.connect(self.setChecked)
|
self.colors = ["", ""]
|
||||||
|
if isinstance(icons, str):
|
||||||
|
self.icons = [icons, icons]
|
||||||
|
else:
|
||||||
|
self.icons = icons
|
||||||
|
self.setCheckable(True)
|
||||||
self.seticon()
|
self.seticon()
|
||||||
|
self.clicked.connect(self.seticon)
|
||||||
|
if not border:
|
||||||
|
self.setStyleSheet("border:transparent")
|
||||||
|
|
||||||
def seticon(self):
|
def seticon(self):
|
||||||
color = QColor(self.colors[self.idx])
|
color = QColor(self.colors[self.isChecked()])
|
||||||
if not self.isEnabled():
|
if not self.isEnabled():
|
||||||
color = disablecolor(color)
|
color = disablecolor(color)
|
||||||
icon = qtawesome.icon(self.icons[self.idx], color=color)
|
icon = qtawesome.icon(self.icons[self.isChecked()], color=color)
|
||||||
|
self.setIcon(icon)
|
||||||
|
|
||||||
|
def setChecked(self, a0):
|
||||||
|
super().setChecked(a0)
|
||||||
|
self.seticon()
|
||||||
|
|
||||||
|
def setEnabled(self, _):
|
||||||
|
super().setEnabled(_)
|
||||||
|
self.seticon()
|
||||||
|
|
||||||
|
|
||||||
|
class IconButton(QPushButton):
|
||||||
|
clicked = pyqtSignal()
|
||||||
|
|
||||||
|
def sizeHint(self):
|
||||||
|
return QSize(
|
||||||
|
int(1.42 * globalconfig["buttonsize2"]),
|
||||||
|
int(1.42 * globalconfig["buttonsize2"]),
|
||||||
|
)
|
||||||
|
|
||||||
|
def __init__(self, icon, enable=True, qicon=None, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
super().clicked.connect(self.clicked)
|
||||||
|
self._icon = icon
|
||||||
|
self._qicon = qicon
|
||||||
|
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
||||||
|
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
|
self.setIconSize(self.sizeHint())
|
||||||
|
self.setStyleSheet("border:transparent")
|
||||||
|
self.setEnabled(enable)
|
||||||
|
self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
||||||
|
|
||||||
|
def seticon(self):
|
||||||
|
if self._qicon:
|
||||||
|
icon = self._qicon
|
||||||
|
else:
|
||||||
|
__ = QColor(globalconfig["buttoncolor2"])
|
||||||
|
if not self.isEnabled():
|
||||||
|
__ = disablecolor(__)
|
||||||
|
icon: QIcon = qtawesome.icon(self._icon, color=__)
|
||||||
self.setIcon(icon)
|
self.setIcon(icon)
|
||||||
|
|
||||||
def setChecked(self, a0):
|
def setChecked(self, a0):
|
||||||
super().setChecked(a0)
|
super().setChecked(a0)
|
||||||
self.idx += 1
|
|
||||||
self.idx %= 2
|
|
||||||
self.statuschanged.emit(self.idx)
|
|
||||||
self.seticon()
|
self.seticon()
|
||||||
|
|
||||||
def setEnabled(self, _):
|
def setEnabled(self, _):
|
||||||
@ -2542,7 +2520,7 @@ class VisLFormLayout(LFormLayout):
|
|||||||
class CollapsibleBox(QGroupBox):
|
class CollapsibleBox(QGroupBox):
|
||||||
def __init__(self, delayloadfunction=None, parent=None, margin0=True):
|
def __init__(self, delayloadfunction=None, parent=None, margin0=True):
|
||||||
super(CollapsibleBox, self).__init__(parent)
|
super(CollapsibleBox, self).__init__(parent)
|
||||||
self.setObjectName('notitle')
|
self.setObjectName("notitle")
|
||||||
lay = QVBoxLayout(self)
|
lay = QVBoxLayout(self)
|
||||||
if margin0:
|
if margin0:
|
||||||
lay.setContentsMargins(0, 0, 0, 0)
|
lay.setContentsMargins(0, 0, 0, 0)
|
||||||
@ -2622,10 +2600,15 @@ class editswitchTextBrowser(QWidget):
|
|||||||
self.setLayout(l)
|
self.setLayout(l)
|
||||||
l.setContentsMargins(0, 0, 0, 0)
|
l.setContentsMargins(0, 0, 0, 0)
|
||||||
l.addWidget(stack)
|
l.addWidget(stack)
|
||||||
self.switch = MySwitch(self, icon="fa.edit")
|
self.switch = statusbutton(
|
||||||
|
p=self,
|
||||||
|
icons="fa.edit",
|
||||||
|
colors=["", globalconfig["buttoncolor2"]],
|
||||||
|
border=False,
|
||||||
|
)
|
||||||
self.switch.setFixedSize(QSize(25, 25))
|
self.switch.setFixedSize(QSize(25, 25))
|
||||||
self.switch.raise_()
|
self.switch.raise_()
|
||||||
self.switch.clicked.connect(lambda c: stack.setCurrentIndex(not c))
|
self.switch.clicked.connect(stack.setCurrentIndex)
|
||||||
|
|
||||||
def settext(self, text):
|
def settext(self, text):
|
||||||
self.edit.setPlainText(text)
|
self.edit.setPlainText(text)
|
||||||
|
@ -363,3 +363,13 @@ StopCaptureAsync.argtypes = (HANDLE,)
|
|||||||
check_window_viewable = utilsdll.check_window_viewable
|
check_window_viewable = utilsdll.check_window_viewable
|
||||||
check_window_viewable.argtypes = (HWND,)
|
check_window_viewable.argtypes = (HWND,)
|
||||||
check_window_viewable.restype = c_bool
|
check_window_viewable.restype = c_bool
|
||||||
|
_GetSelectedText = utilsdll.GetSelectedText
|
||||||
|
_GetSelectedText.argtypes = (c_void_p,)
|
||||||
|
|
||||||
|
|
||||||
|
def GetSelectedText():
|
||||||
|
ret = []
|
||||||
|
_GetSelectedText(CFUNCTYPE(None, c_wchar_p)(ret.append))
|
||||||
|
if len(ret):
|
||||||
|
return ret[0]
|
||||||
|
return None
|
||||||
|
@ -1051,6 +1051,11 @@
|
|||||||
"name": "复制到剪贴板_翻译",
|
"name": "复制到剪贴板_翻译",
|
||||||
"keystring": ""
|
"keystring": ""
|
||||||
},
|
},
|
||||||
|
"37": {
|
||||||
|
"use": false,
|
||||||
|
"name": "查词",
|
||||||
|
"keystring": ""
|
||||||
|
},
|
||||||
"_29": {
|
"_29": {
|
||||||
"use": false,
|
"use": false,
|
||||||
"name": "Anki_录音",
|
"name": "Anki_录音",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user