mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Switch the bulk metadata edit dialog to also use the more advanced regex engine
Matches the rest of calibre
This commit is contained in:
parent
2847d36e36
commit
01c090592a
@ -3,7 +3,7 @@
|
|||||||
# License: GPLv3 Copyright: 2008, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPLv3 Copyright: 2008, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
|
||||||
import re, numbers
|
import regex, numbers
|
||||||
from collections import defaultdict, namedtuple
|
from collections import defaultdict, namedtuple
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
@ -973,22 +973,19 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
def s_r_paint_results(self, txt):
|
def s_r_paint_results(self, txt):
|
||||||
self.s_r_error = None
|
self.s_r_error = None
|
||||||
self.s_r_set_colors()
|
self.s_r_set_colors()
|
||||||
|
flags = regex.VERSION1 | regex.FULLCASE | regex.UNICODE
|
||||||
|
|
||||||
if self.case_sensitive.isChecked():
|
if self.case_sensitive.isChecked():
|
||||||
flags = 0
|
flags |= regex.IGNORECASE
|
||||||
else:
|
|
||||||
flags = re.I
|
|
||||||
|
|
||||||
flags |= re.UNICODE
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stext = unicode_type(self.search_for.text())
|
stext = unicode_type(self.search_for.text())
|
||||||
if not stext:
|
if not stext:
|
||||||
raise Exception(_('You must specify a search expression in the "Search for" field'))
|
raise Exception(_('You must specify a search expression in the "Search for" field'))
|
||||||
if self.search_mode.currentIndex() == 0:
|
if self.search_mode.currentIndex() == 0:
|
||||||
self.s_r_obj = re.compile(re.escape(stext), flags)
|
self.s_r_obj = regex.compile(regex.escape(stext), flags)
|
||||||
else:
|
else:
|
||||||
self.s_r_obj = re.compile(stext, flags)
|
self.s_r_obj = regex.compile(stext, flags)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.s_r_obj = None
|
self.s_r_obj = None
|
||||||
self.s_r_error = e
|
self.s_r_error = e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user