mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for #6193
This commit is contained in:
parent
452083dc34
commit
5e4af6a58f
@ -28,9 +28,10 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
|||||||
|
|
||||||
if not db or not book_id:
|
if not db or not book_id:
|
||||||
self.button_box.addButton(QDialogButtonBox.Open)
|
self.button_box.addButton(QDialogButtonBox.Open)
|
||||||
else:
|
elif not self.select_format(db, book_id):
|
||||||
self.select_format(db, book_id)
|
self.cancelled = True
|
||||||
|
return
|
||||||
|
self.cancelled = False
|
||||||
self.connect(self.button_box, SIGNAL('clicked(QAbstractButton*)'), self.button_clicked)
|
self.connect(self.button_box, SIGNAL('clicked(QAbstractButton*)'), self.button_clicked)
|
||||||
self.connect(self.regex, SIGNAL('textChanged(QString)'), self.regex_valid)
|
self.connect(self.regex, SIGNAL('textChanged(QString)'), self.regex_valid)
|
||||||
self.connect(self.test, SIGNAL('clicked()'), self.do_test)
|
self.connect(self.test, SIGNAL('clicked()'), self.do_test)
|
||||||
@ -79,10 +80,12 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
|||||||
format = d.format()
|
format = d.format()
|
||||||
|
|
||||||
if not format:
|
if not format:
|
||||||
error_dialog(self, _('No formats available'), _('Cannot build regex using the GUI builder without a book.'))
|
error_dialog(self, _('No formats available'),
|
||||||
QDialog.reject()
|
_('Cannot build regex using the GUI builder without a book.'),
|
||||||
else:
|
show=True)
|
||||||
self.open_book(db.format_abspath(book_id, format, index_is_id=True))
|
return False
|
||||||
|
self.open_book(db.format_abspath(book_id, format, index_is_id=True))
|
||||||
|
return True
|
||||||
|
|
||||||
def open_book(self, pathtoebook):
|
def open_book(self, pathtoebook):
|
||||||
self.iterator = EbookIterator(pathtoebook)
|
self.iterator = EbookIterator(pathtoebook)
|
||||||
@ -117,6 +120,8 @@ class RegexEdit(QWidget, Ui_Edit):
|
|||||||
|
|
||||||
def builder(self):
|
def builder(self):
|
||||||
bld = RegexBuilder(self.db, self.book_id, self.edit.text(), self)
|
bld = RegexBuilder(self.db, self.book_id, self.edit.text(), self)
|
||||||
|
if bld.cancelled:
|
||||||
|
return
|
||||||
if bld.exec_() == bld.Accepted:
|
if bld.exec_() == bld.Accepted:
|
||||||
self.edit.setText(bld.regex.text())
|
self.edit.setText(bld.regex.text())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user