diff --git a/cpp/version.cmake b/cpp/version.cmake index 3f13de1f..f120de7d 100644 --- a/cpp/version.cmake +++ b/cpp/version.cmake @@ -1,7 +1,7 @@ set(VERSION_MAJOR 6) set(VERSION_MINOR 16) -set(VERSION_PATCH 11) +set(VERSION_PATCH 12) set(VERSION_REVISION 0) set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}") add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp) diff --git a/py/LunaTranslator/cishu/weblio.py b/py/LunaTranslator/cishu/weblio.py index b44a09d9..b37a714c 100644 --- a/py/LunaTranslator/cishu/weblio.py +++ b/py/LunaTranslator/cishu/weblio.py @@ -39,8 +39,9 @@ class weblio(cishubase): def makelink(self, link): if not self.style.get(link): - html = requests.get( + req = requests.get( link, proxies=self.proxy, - ).text + ) + html = req.text if req.status_code == 200 else "" self.style[link] = html diff --git a/py/LunaTranslator/gui/showword.py b/py/LunaTranslator/gui/showword.py index 66e11a02..829c480f 100644 --- a/py/LunaTranslator/gui/showword.py +++ b/py/LunaTranslator/gui/showword.py @@ -495,6 +495,29 @@ class AnkiWindow(QWidget): clearbtn.clicked.connect(lambda: target.clear()) return clearbtn + class ctrlbedit(FQPlainTextEdit): + def keyPressEvent(self, e): + if ( + e.modifiers() == Qt.KeyboardModifier.ControlModifier + and e.key() == Qt.Key.Key_B + ): + cursor = self.textCursor() + if cursor.hasSelection(): + selected_text = cursor.selectedText() + new_text = "{}".format(selected_text) + + start = cursor.selectionStart() + + cursor.beginEditBlock() + cursor.insertText(new_text) + cursor.endEditBlock() + cursor.setPosition(start, QTextCursor.MoveMode.MoveAnchor) + cursor.setPosition( + start + len(new_text), QTextCursor.MoveMode.KeepAnchor + ) + self.setTextCursor(cursor) + return super().keyPressEvent(e) + self.audiopath = QLineEdit() self.audiopath.setReadOnly(True) self.audiopath_sentence = QLineEdit() @@ -503,8 +526,8 @@ class AnkiWindow(QWidget): self.editpath.setReadOnly(True) self.viewimagelabel = pixmapviewer() self.editpath.textChanged.connect(self.wrappedpixmap) - self.example = FQPlainTextEdit() - self.zhuyinedit = FQPlainTextEdit() + self.example = ctrlbedit() + self.zhuyinedit = ctrlbedit() self.wordedit = FQLineEdit() self.wordedit.textChanged.connect(self.wordedit_t) self.example.hiras = None @@ -513,7 +536,7 @@ class AnkiWindow(QWidget): self.example.hiras = None self.example.textChanged.connect(__) - self.remarks = FQPlainTextEdit() + self.remarks = ctrlbedit() recordbtn1 = statusbutton(icons=["fa.microphone", "fa.stop"]) recordbtn1.clicked.connect( functools.partial(self.startorendrecord, 1, self.audiopath)