diff --git a/src/calibre/debug.py b/src/calibre/debug.py index 66de8ccadb..d1e97efe2a 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -191,6 +191,8 @@ def main(args=sys.argv): exec opts.command elif opts.exec_file: sys.argv = args[:1] + base = os.path.dirname(os.path.abspath(opts.exec_file)) + sys.path.insert(0, base) execfile(opts.exec_file) elif opts.debug_device_driver: debug_device_driver() diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py index 5022a2ae76..383fe2d36f 100644 --- a/src/calibre/gui2/convert/__init__.py +++ b/src/calibre/gui2/convert/__init__.py @@ -164,6 +164,9 @@ class Widget(QWidget): def post_get_value(self, g): pass + def break_cycles(self): + self.db = None + def pre_commit_check(self): return True diff --git a/src/calibre/gui2/convert/single.py b/src/calibre/gui2/convert/single.py index 2f05d50a7f..d14f5c905d 100644 --- a/src/calibre/gui2/convert/single.py +++ b/src/calibre/gui2/convert/single.py @@ -115,7 +115,6 @@ class Config(ResizableDialog, Ui_Dialog): def __init__(self, parent, db, book_id, preferred_input_format=None, preferred_output_format=None): ResizableDialog.__init__(self, parent) - self.setup_input_output_formats(db, book_id, preferred_input_format, preferred_output_format) self.db, self.book_id = db, book_id @@ -248,8 +247,18 @@ class Config(ResizableDialog, Ui_Dialog): if self.db is not None: recs['gui_preferred_input_format'] = self.input_format save_specifics(self.db, self.book_id, recs) + self.break_cycles() ResizableDialog.accept(self) + def reject(self): + self.break_cycles() + ResizableDialog.reject(self) + + def break_cycles(self): + for i in range(self.stack.count()): + w = self.stack.widget(i) + w.break_cycles() + @property def recommendations(self): recs = [(k, v, OptionRecommendation.HIGH) for k, v in diff --git a/src/calibre/gui2/convert/structure_detection.py b/src/calibre/gui2/convert/structure_detection.py index c109b200be..1797a76760 100644 --- a/src/calibre/gui2/convert/structure_detection.py +++ b/src/calibre/gui2/convert/structure_detection.py @@ -41,6 +41,11 @@ class StructureDetectionWidget(Widget, Ui_Form): self.opt_footer_regex.set_book_id(book_id) self.opt_footer_regex.set_db(db) + def break_cycles(self): + Widget.break_cycles(self) + self.opt_header_regex.db = None + self.opt_footer_regex.db = None + def pre_commit_check(self): for x in ('header_regex', 'footer_regex'): x = getattr(self, 'opt_'+x) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 8ffaceaa64..26a417555a 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -77,6 +77,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, out_format jobs.append(('gui_convert', args, desc, d.output_format.upper(), book_id, temp_files)) changed = True + d.break_cycles() except NoSupportedInputFormats: bad.append(book_id)