mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Conversion dialog: Regex builder: Workaround bug in Qt that prevented searching for non breaking spaces in the wizard used to test search expressions
This commit is contained in:
parent
092bafbe7e
commit
1adeef4743
@ -4,8 +4,7 @@
|
|||||||
import os
|
import os
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from qt.core import (
|
from qt.core import (
|
||||||
QBrush, QDialog, QDialogButtonBox, Qt, QTextCursor,
|
QBrush, QDialog, QDialogButtonBox, Qt, QTextCursor, QTextEdit, pyqtSignal,
|
||||||
QTextEdit, pyqtSignal
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.constants import iswindows
|
from calibre.constants import iswindows
|
||||||
@ -14,6 +13,7 @@ from calibre.gui2 import choose_files, error_dialog, gprefs
|
|||||||
from calibre.gui2.convert.regex_builder_ui import Ui_RegexBuilder
|
from calibre.gui2.convert.regex_builder_ui import Ui_RegexBuilder
|
||||||
from calibre.gui2.convert.xpath_wizard import XPathEdit
|
from calibre.gui2.convert.xpath_wizard import XPathEdit
|
||||||
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
|
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
|
||||||
|
from calibre.gui2.widgets2 import to_plain_text
|
||||||
from calibre.ptempfile import TemporaryFile
|
from calibre.ptempfile import TemporaryFile
|
||||||
from calibre.utils.icu import utf16_length
|
from calibre.utils.icu import utf16_length
|
||||||
from calibre.utils.ipc.simple_worker import WorkerError, fork_job
|
from calibre.utils.ipc.simple_worker import WorkerError, fork_job
|
||||||
@ -84,7 +84,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
|||||||
qt: int = 0
|
qt: int = 0
|
||||||
|
|
||||||
if self.regex_valid():
|
if self.regex_valid():
|
||||||
text = str(self.preview.toPlainText())
|
text = to_plain_text(self.preview)
|
||||||
regex = str(self.regex.text())
|
regex = str(self.regex.text())
|
||||||
cursor = QTextCursor(self.preview.document())
|
cursor = QTextCursor(self.preview.document())
|
||||||
extsel = QTextEdit.ExtraSelection()
|
extsel = QTextEdit.ExtraSelection()
|
||||||
@ -205,7 +205,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
|||||||
self.open_book(files[0])
|
self.open_book(files[0])
|
||||||
|
|
||||||
def doc(self):
|
def doc(self):
|
||||||
return str(self.preview.toPlainText())
|
return to_plain_text(self.preview)
|
||||||
|
|
||||||
|
|
||||||
class RegexEdit(XPathEdit):
|
class RegexEdit(XPathEdit):
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Regex Builder</string>
|
<string>Regex builder</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user