From 7d85958b572dc8ac378a4f71425a72afb933444f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Nov 2021 20:56:09 +0530 Subject: [PATCH] more meaningless pyqt busywork PyQt6 makes exec_() no longer available as an alias for exec(). Just to waste my time, I suppose. --- manual/plugin_examples/webengine_demo/main.py | 2 +- src/calibre/customize/__init__.py | 4 +- src/calibre/devices/kobo/kobotouch_config.py | 6 +-- src/calibre/ebooks/covers.py | 2 +- src/calibre/ebooks/html/to_zip.py | 2 +- src/calibre/ebooks/pdf/develop.py | 2 +- src/calibre/ebooks/pdf/html_writer.py | 4 +- src/calibre/ebooks/render_html.py | 2 +- src/calibre/gui2/__init__.py | 10 ++--- src/calibre/gui2/actions/add.py | 12 ++--- src/calibre/gui2/actions/author_mapper.py | 2 +- src/calibre/gui2/actions/choose_library.py | 6 +-- src/calibre/gui2/actions/convert.py | 2 +- src/calibre/gui2/actions/copy_to_library.py | 8 ++-- src/calibre/gui2/actions/delete.py | 10 ++--- src/calibre/gui2/actions/device.py | 4 +- src/calibre/gui2/actions/edit_metadata.py | 10 ++--- src/calibre/gui2/actions/embed.py | 2 +- src/calibre/gui2/actions/mark_books.py | 2 +- src/calibre/gui2/actions/match_books.py | 8 ++-- src/calibre/gui2/actions/plugin_updates.py | 2 +- src/calibre/gui2/actions/polish.py | 8 ++-- src/calibre/gui2/actions/preferences.py | 6 +-- src/calibre/gui2/actions/show_book_details.py | 2 +- src/calibre/gui2/actions/show_quickview.py | 2 +- .../gui2/actions/show_stored_templates.py | 2 +- .../gui2/actions/show_template_tester.py | 4 +- src/calibre/gui2/actions/sort.py | 2 +- src/calibre/gui2/actions/store.py | 4 +- src/calibre/gui2/actions/tag_mapper.py | 2 +- src/calibre/gui2/actions/toc_edit.py | 4 +- src/calibre/gui2/actions/tweak_epub.py | 2 +- src/calibre/gui2/actions/unpack_book.py | 2 +- src/calibre/gui2/actions/view.py | 6 +-- src/calibre/gui2/add_filters.py | 2 +- src/calibre/gui2/author_mapper.py | 2 +- src/calibre/gui2/book_details.py | 4 +- src/calibre/gui2/comments_editor.py | 6 +-- src/calibre/gui2/complete2.py | 2 +- src/calibre/gui2/convert/font_key.py | 2 +- src/calibre/gui2/convert/look_and_feel.py | 2 +- src/calibre/gui2/convert/metadata.py | 6 +-- src/calibre/gui2/convert/regex_builder.py | 6 +-- .../gui2/convert/structure_detection.py | 2 +- src/calibre/gui2/convert/toc.py | 2 +- src/calibre/gui2/convert/xpath_wizard.py | 4 +- src/calibre/gui2/cover_flow.py | 4 +- src/calibre/gui2/covers.py | 8 ++-- src/calibre/gui2/css_transform_rules.py | 4 +- src/calibre/gui2/custom_column_widgets.py | 6 +-- src/calibre/gui2/device.py | 18 ++++---- src/calibre/gui2/device_drivers/mtp_config.py | 12 ++--- .../gui2/device_drivers/mtp_folder_browser.py | 4 +- .../device_drivers/tabbed_device_config.py | 2 +- src/calibre/gui2/dialogs/add_empty_book.py | 2 +- src/calibre/gui2/dialogs/authors_edit.py | 2 +- src/calibre/gui2/dialogs/book_info.py | 4 +- src/calibre/gui2/dialogs/check_library.py | 6 +-- src/calibre/gui2/dialogs/choose_format.py | 2 +- src/calibre/gui2/dialogs/choose_library.py | 2 +- src/calibre/gui2/dialogs/comments_dialog.py | 2 +- src/calibre/gui2/dialogs/confirm_delete.py | 2 +- .../gui2/dialogs/confirm_delete_location.py | 2 +- src/calibre/gui2/dialogs/confirm_merge.py | 4 +- src/calibre/gui2/dialogs/custom_recipes.py | 6 +-- .../gui2/dialogs/device_category_editor.py | 6 +-- src/calibre/gui2/dialogs/drm_error.py | 2 +- src/calibre/gui2/dialogs/duplicates.py | 2 +- .../gui2/dialogs/edit_authors_dialog.py | 4 +- src/calibre/gui2/dialogs/exim.py | 6 +-- src/calibre/gui2/dialogs/match_books.py | 4 +- src/calibre/gui2/dialogs/metadata_bulk.py | 17 +++---- src/calibre/gui2/dialogs/multisort.py | 2 +- src/calibre/gui2/dialogs/plugin_updater.py | 2 +- src/calibre/gui2/dialogs/progress.py | 2 +- src/calibre/gui2/dialogs/restore_library.py | 4 +- .../gui2/dialogs/saved_search_editor.py | 4 +- src/calibre/gui2/dialogs/scheduler.py | 6 +-- src/calibre/gui2/dialogs/search.py | 2 +- src/calibre/gui2/dialogs/select_formats.py | 2 +- src/calibre/gui2/dialogs/tag_categories.py | 8 ++-- src/calibre/gui2/dialogs/tag_editor.py | 4 +- src/calibre/gui2/dialogs/tag_list_editor.py | 8 ++-- src/calibre/gui2/dialogs/template_dialog.py | 6 +-- .../gui2/dialogs/template_line_editor.py | 4 +- src/calibre/gui2/dialogs/trim_image.py | 2 +- src/calibre/gui2/dnd.py | 2 +- src/calibre/gui2/ebook_download.py | 2 +- src/calibre/gui2/email.py | 4 +- src/calibre/gui2/font_family_chooser.py | 4 +- src/calibre/gui2/html_transform_rules.py | 2 +- src/calibre/gui2/icon_theme.py | 8 ++-- src/calibre/gui2/image_popup.py | 4 +- src/calibre/gui2/init.py | 4 +- src/calibre/gui2/jobs.py | 8 ++-- src/calibre/gui2/keyboard.py | 2 +- src/calibre/gui2/layout_menu.py | 2 +- src/calibre/gui2/library/alternate_views.py | 2 +- src/calibre/gui2/library/annotations.py | 8 ++-- src/calibre/gui2/library/delegates.py | 8 ++-- src/calibre/gui2/library/views.py | 2 +- src/calibre/gui2/linux_file_dialogs.py | 2 +- src/calibre/gui2/listener.py | 2 +- src/calibre/gui2/lrf_renderer/main.py | 8 ++-- src/calibre/gui2/main.py | 6 +-- src/calibre/gui2/metadata/basic_widgets.py | 24 +++++----- src/calibre/gui2/metadata/bulk_download.py | 2 +- src/calibre/gui2/metadata/diff.py | 2 +- src/calibre/gui2/metadata/pdf_covers.py | 2 +- src/calibre/gui2/metadata/single.py | 6 +-- src/calibre/gui2/metadata/single_download.py | 6 +-- src/calibre/gui2/open_with.py | 4 +- src/calibre/gui2/preferences/__init__.py | 2 +- src/calibre/gui2/preferences/adding.py | 6 +-- src/calibre/gui2/preferences/coloring.py | 14 +++--- .../gui2/preferences/create_custom_column.py | 4 +- src/calibre/gui2/preferences/device_debug.py | 2 +- .../gui2/preferences/device_user_defined.py | 4 +- src/calibre/gui2/preferences/look_feel.py | 12 ++--- src/calibre/gui2/preferences/main.py | 2 +- .../gui2/preferences/metadata_sources.py | 4 +- src/calibre/gui2/preferences/misc.py | 4 +- src/calibre/gui2/preferences/plugins.py | 12 ++--- src/calibre/gui2/preferences/save_template.py | 2 +- src/calibre/gui2/preferences/server.py | 10 ++--- .../gui2/preferences/template_functions.py | 6 +-- .../gui2/preferences/texture_chooser.py | 2 +- src/calibre/gui2/preferences/tweaks.py | 2 +- src/calibre/gui2/proceed.py | 2 +- .../gui2/progress_indicator/__init__.py | 4 +- src/calibre/gui2/search_box.py | 8 ++-- src/calibre/gui2/search_restriction_mixin.py | 8 ++-- src/calibre/gui2/shortcuts.py | 2 +- src/calibre/gui2/splash_screen.py | 2 +- .../store/config/chooser/chooser_widget.py | 2 +- .../gui2/store/config/chooser/results_view.py | 2 +- src/calibre/gui2/store/opensearch_store.py | 2 +- src/calibre/gui2/store/search/results_view.py | 2 +- src/calibre/gui2/store/search/search.py | 13 +++--- .../store/stores/baen_webscription_plugin.py | 2 +- .../store/stores/beam_ebooks_de_plugin.py | 2 +- .../gui2/store/stores/biblio_plugin.py | 2 +- src/calibre/gui2/store/stores/bn_plugin.py | 2 +- .../store/stores/bubok_portugal_plugin.py | 2 +- .../store/stores/bubok_publishing_plugin.py | 2 +- .../gui2/store/stores/chitanka_plugin.py | 2 +- .../gui2/store/stores/ebook_nl_plugin.py | 2 +- .../gui2/store/stores/ebookpoint_plugin.py | 2 +- .../gui2/store/stores/ebooks_com_plugin.py | 2 +- .../store/stores/ebookshoppe_uk_plugin.py | 2 +- src/calibre/gui2/store/stores/empik_plugin.py | 2 +- .../gui2/store/stores/google_books_plugin.py | 2 +- .../gui2/store/stores/gutenberg_plugin.py | 2 +- src/calibre/gui2/store/stores/kobo_plugin.py | 2 +- .../gui2/store/stores/legimi_plugin.py | 2 +- .../gui2/store/stores/libri_de_plugin.py | 2 +- .../gui2/store/stores/litres_plugin.py | 2 +- .../gui2/store/stores/mills_boon_uk_plugin.py | 2 +- .../mobileread/cache_progress_dialog.py | 5 ++- .../stores/mobileread/mobileread_plugin.py | 4 +- .../store/stores/mobileread/store_dialog.py | 2 +- src/calibre/gui2/store/stores/nexto_plugin.py | 2 +- .../gui2/store/stores/ozon_ru_plugin.py | 2 +- .../gui2/store/stores/publio_plugin.py | 2 +- .../gui2/store/stores/rw2010_plugin.py | 2 +- .../gui2/store/stores/smashwords_plugin.py | 2 +- .../gui2/store/stores/swiatebookow_plugin.py | 2 +- .../gui2/store/stores/virtualo_plugin.py | 2 +- .../store/stores/weightless_books_plugin.py | 2 +- .../gui2/store/stores/whsmith_uk_plugin.py | 2 +- .../gui2/store/stores/woblink_plugin.py | 2 +- .../gui2/store/stores/wolnelektury_plugin.py | 2 +- src/calibre/gui2/store/web_store.py | 2 +- src/calibre/gui2/store/web_store_dialog.py | 3 +- src/calibre/gui2/tag_browser/ui.py | 8 ++-- src/calibre/gui2/tag_browser/view.py | 4 +- src/calibre/gui2/tag_mapper.py | 12 ++--- src/calibre/gui2/throbber.py | 2 +- src/calibre/gui2/toc/main.py | 6 +-- src/calibre/gui2/tools.py | 12 ++--- src/calibre/gui2/tts/develop.py | 4 +- src/calibre/gui2/tts/linux_config.py | 2 +- src/calibre/gui2/tts/macos_config.py | 2 +- src/calibre/gui2/tts/windows_config.py | 2 +- src/calibre/gui2/tweak_book/boss.py | 44 +++++++++---------- src/calibre/gui2/tweak_book/char_select.py | 4 +- src/calibre/gui2/tweak_book/check.py | 4 +- src/calibre/gui2/tweak_book/check_links.py | 2 +- src/calibre/gui2/tweak_book/diff/main.py | 4 +- src/calibre/gui2/tweak_book/diff/view.py | 2 +- src/calibre/gui2/tweak_book/download.py | 2 +- src/calibre/gui2/tweak_book/editor/canvas.py | 2 +- src/calibre/gui2/tweak_book/editor/image.py | 4 +- .../gui2/tweak_book/editor/insert_resource.py | 8 ++-- .../gui2/tweak_book/editor/snippets.py | 4 +- src/calibre/gui2/tweak_book/editor/themes.py | 4 +- src/calibre/gui2/tweak_book/editor/widget.py | 4 +- src/calibre/gui2/tweak_book/file_list.py | 6 +-- .../gui2/tweak_book/function_replace.py | 4 +- src/calibre/gui2/tweak_book/live_css.py | 2 +- src/calibre/gui2/tweak_book/main.py | 2 +- src/calibre/gui2/tweak_book/manage_fonts.py | 6 +-- src/calibre/gui2/tweak_book/polish.py | 6 +-- src/calibre/gui2/tweak_book/preferences.py | 10 ++--- src/calibre/gui2/tweak_book/preview.py | 2 +- src/calibre/gui2/tweak_book/reports.py | 4 +- src/calibre/gui2/tweak_book/search.py | 10 ++--- src/calibre/gui2/tweak_book/spell.py | 18 ++++---- src/calibre/gui2/tweak_book/toc.py | 2 +- src/calibre/gui2/tweak_book/ui.py | 2 +- src/calibre/gui2/tweak_book/widgets.py | 16 +++---- src/calibre/gui2/ui.py | 4 +- src/calibre/gui2/update.py | 6 +-- src/calibre/gui2/viewer/highlights.py | 4 +- src/calibre/gui2/viewer/lookup.py | 8 ++-- src/calibre/gui2/viewer/main.py | 2 +- src/calibre/gui2/viewer/overlay.py | 2 +- src/calibre/gui2/viewer/printing.py | 4 +- src/calibre/gui2/viewer/toc.py | 2 +- src/calibre/gui2/viewer/toolbars.py | 6 +-- src/calibre/gui2/viewer/tts.py | 2 +- src/calibre/gui2/viewer/ui.py | 4 +- src/calibre/gui2/viewer/widgets.py | 2 +- src/calibre/gui2/webengine.py | 2 +- src/calibre/gui2/widgets.py | 8 ++-- src/calibre/gui2/widgets2.py | 2 +- src/calibre/gui2/win_file_dialogs.py | 2 +- src/calibre/gui2/wizard/__init__.py | 2 +- src/calibre/gui2/wizard/send_email.py | 8 ++-- src/calibre/srv/metadata.py | 2 +- src/calibre/test_build.py | 2 +- 231 files changed, 512 insertions(+), 508 deletions(-) diff --git a/manual/plugin_examples/webengine_demo/main.py b/manual/plugin_examples/webengine_demo/main.py index c776f726df..542c1f4798 100644 --- a/manual/plugin_examples/webengine_demo/main.py +++ b/manual/plugin_examples/webengine_demo/main.py @@ -18,4 +18,4 @@ def main(url): w.setUrl(QUrl(url)) w.show() w.raise_() - app.exec_() + app.exec() diff --git a/src/calibre/customize/__init__.py b/src/calibre/customize/__init__.py index 1587d20391..76aae05515 100644 --- a/src/calibre/customize/__init__.py +++ b/src/calibre/customize/__init__.py @@ -177,7 +177,7 @@ class Plugin: # {{{ v.addWidget(config_widget) v.addWidget(button_box) size_dialog() - config_dialog.exec_() + config_dialog.exec() if config_dialog.result() == QDialog.DialogCode.Accepted: if hasattr(config_widget, 'validate'): @@ -202,7 +202,7 @@ class Plugin: # {{{ v.addWidget(sc) v.addWidget(button_box) size_dialog() - config_dialog.exec_() + config_dialog.exec() if config_dialog.result() == QDialog.DialogCode.Accepted: sc = str(sc.text()).strip() diff --git a/src/calibre/devices/kobo/kobotouch_config.py b/src/calibre/devices/kobo/kobotouch_config.py index e45384f0de..dfc35d7015 100644 --- a/src/calibre/devices/kobo/kobotouch_config.py +++ b/src/calibre/devices/kobo/kobotouch_config.py @@ -586,7 +586,7 @@ class MetadataGroupBox(DeviceOptionsGroupBox): def edit_template(self): t = TemplateDialog(self, self.template) t.setWindowTitle(_('Edit template')) - if t.exec_(): + if t.exec(): self.t.setText(t.rule[1]) def validate(self): @@ -646,7 +646,7 @@ class TemplateConfig(QWidget): # {{{ def edit_template(self): t = TemplateDialog(self, self.template) t.setWindowTitle(_('Edit template')) - if t.exec_(): + if t.exec(): self.t.setText(t.rule[1]) def validate(self): @@ -686,6 +686,6 @@ if __name__ == '__main__': d.l.addWidget(bb) bb.accepted.connect(d.accept) bb.rejected.connect(d.reject) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: cw.commit() dev.shutdown() diff --git a/src/calibre/ebooks/covers.py b/src/calibre/ebooks/covers.py index 52c4dbbd9b..f81120c9d5 100644 --- a/src/calibre/ebooks/covers.py +++ b/src/calibre/ebooks/covers.py @@ -755,7 +755,7 @@ def test(scale=0.25): m.setCentralWidget(sa) w.resize(w.sizeHint()) m.show() - app.exec_() + app.exec() if __name__ == '__main__': diff --git a/src/calibre/ebooks/html/to_zip.py b/src/calibre/ebooks/html/to_zip.py index 9f7dc613cb..b066fd694b 100644 --- a/src/calibre/ebooks/html/to_zip.py +++ b/src/calibre/ebooks/html/to_zip.py @@ -110,7 +110,7 @@ every time you add an HTML file to the library.\ v.addWidget(bf) v.addWidget(button_box) size_dialog() - config_dialog.exec_() + config_dialog.exec() if config_dialog.result() == QDialog.DialogCode.Accepted: sc = str(sc.text()).strip() diff --git a/src/calibre/ebooks/pdf/develop.py b/src/calibre/ebooks/pdf/develop.py index eb75ced6b4..b190dc166e 100644 --- a/src/calibre/ebooks/pdf/develop.py +++ b/src/calibre/ebooks/pdf/develop.py @@ -35,7 +35,7 @@ def main(): renderer = Renderer() renderer.setUrl(QUrl.fromLocalFile(sys.argv[-1])) renderer.loadFinished.connect(renderer.do_print) - QApplication.instance().exec_() + QApplication.instance().exec() print('Output written to:', OUTPUT) diff --git a/src/calibre/ebooks/pdf/html_writer.py b/src/calibre/ebooks/pdf/html_writer.py index 1ac5acfbae..6ab9d5a0a2 100644 --- a/src/calibre/ebooks/pdf/html_writer.py +++ b/src/calibre/ebooks/pdf/html_writer.py @@ -309,7 +309,7 @@ class RenderManager(QObject): def run_loop(self): self.block_signal_handlers() try: - return QApplication.exec_() + return QApplication.exec() finally: self.restore_signal_handlers() @@ -336,7 +336,7 @@ class RenderManager(QObject): w = self.workers[0] self.evaljs_result = None w.runJavaScript(js, self.evaljs_callback) - QApplication.exec_() + QApplication.exec() return self.evaljs_result def evaljs_callback(self, result): diff --git a/src/calibre/ebooks/render_html.py b/src/calibre/ebooks/render_html.py index 20f012fab4..5603885703 100644 --- a/src/calibre/ebooks/render_html.py +++ b/src/calibre/ebooks/render_html.py @@ -104,7 +104,7 @@ def main(path_to_html, tdir, image_format='jpeg'): os.chdir(tdir) renderer = Render() renderer.start_load(path_to_html) - ret = QApplication.instance().exec_() + ret = QApplication.instance().exec() if ret == 0: page_images('rendered.pdf', image_format=image_format) ext = {'jpeg': 'jpg'}.get(image_format, image_format) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 8d7e5651ed..76a2ccb9c2 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -382,7 +382,7 @@ def warning_dialog(parent, title, msg, det_msg='', show=False, )+ ' ' + title, msg, det_msg, parent=parent, show_copy_button=show_copy_button) if show: - return d.exec_() + return d.exec() return d @@ -393,7 +393,7 @@ def error_dialog(parent, title, msg, det_msg='', show=False, ) + ' ' + title, msg, det_msg, parent=parent, show_copy_button=show_copy_button) if show: - return d.exec_() + return d.exec() return d @@ -441,7 +441,7 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=False, tc.setChecked(bool(skip_dialog_skip_precheck)) d.resize_needed.emit() - ret = d.exec_() == QDialog.DialogCode.Accepted + ret = d.exec() == QDialog.DialogCode.Accepted if add_abort_button and d.aborted: raise Aborted() @@ -459,7 +459,7 @@ def info_dialog(parent, title, msg, det_msg='', show=False, show_copy_button=show_copy_button, only_copy_details=only_copy_details) if show: - return d.exec_() + return d.exec() return d @@ -474,7 +474,7 @@ def show_restart_warning(msg, parent=None): d.do_restart = True b.clicked.connect(rf) d.set_details('') - d.exec_() + d.exec() b.clicked.disconnect() return d.do_restart diff --git a/src/calibre/gui2/actions/add.py b/src/calibre/gui2/actions/add.py index 9385d85f30..59966e4384 100644 --- a/src/calibre/gui2/actions/add.py +++ b/src/calibre/gui2/actions/add.py @@ -207,7 +207,7 @@ class AddAction(InterfaceAction): from calibre.ebooks.oeb.polish.create import valid_empty_formats from calibre.gui2.dialogs.choose_format import ChooseFormatDialog d = ChooseFormatDialog(self.gui, _('Choose format of empty file'), sorted(valid_empty_formats)) - if d.exec_() != QDialog.DialogCode.Accepted or not d.format(): + if d.exec() != QDialog.DialogCode.Accepted or not d.format(): return self._add_empty_format(d.format()) @@ -321,7 +321,7 @@ class AddAction(InterfaceAction): title = index.model().db.title(index.row()) dlg = AddEmptyBookDialog(self.gui, self.gui.library_view.model().db, author, series, dup_title=title) - if dlg.exec_() == QDialog.DialogCode.Accepted: + if dlg.exec() == QDialog.DialogCode.Accepted: temp_files = [] num = dlg.qty_to_add series = dlg.selected_series @@ -398,7 +398,7 @@ class AddAction(InterfaceAction): self.isbn_add_dialog = ProgressDialog(_('Adding'), _('Creating book records from ISBNs'), max=len(books), cancelable=False, parent=self.gui) - self.isbn_add_dialog.exec_() + self.isbn_add_dialog.exec() def do_one_isbn_add(self): try: @@ -516,7 +516,7 @@ class AddAction(InterfaceAction): def add_from_isbn(self, *args): from calibre.gui2.dialogs.add_from_isbn import AddFromISBN d = AddFromISBN(self.gui) - if d.exec_() == QDialog.DialogCode.Accepted and d.books: + if d.exec() == QDialog.DialogCode.Accepted and d.books: self.add_isbns(d.books, add_tags=d.set_tags, check_for_existing=d.check_for_existing) def add_books(self, *args): @@ -612,7 +612,7 @@ class AddAction(InterfaceAction): rows = view.selectionModel().selectedRows() if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Add to library'), _('No book selected')) - d.exec_() + d.exec() return paths = [p for p in view.model().paths(rows) if p is not None] ve = self.gui.device_manager.device.VIRTUAL_BOOK_EXTENSIONS @@ -632,7 +632,7 @@ class AddAction(InterfaceAction): return if not paths or len(paths) == 0: d = error_dialog(self.gui, _('Add to library'), _('No book files found')) - d.exec_() + d.exec() return self.gui.device_manager.prepare_addable_books(self.Dispatcher(partial( diff --git a/src/calibre/gui2/actions/author_mapper.py b/src/calibre/gui2/actions/author_mapper.py index 4f1f4ae99f..5fc792f190 100644 --- a/src/calibre/gui2/actions/author_mapper.py +++ b/src/calibre/gui2/actions/author_mapper.py @@ -42,7 +42,7 @@ class AuthorMapAction(InterfaceAction): 'The changes will be applied to one book in the library', 'The changes will be applied to {} books in the library', len(book_ids)) d.edit_widget.msg_label.setText(d.edit_widget.msg_label.text() + '

' + txt.format(len(book_ids))) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return with BusyCursor(): rules = d.rules diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index b71332e666..07deabb124 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -327,7 +327,7 @@ class ChooseLibraryAction(InterfaceAction): _('Cannot export/import data while there are running jobs.'), show=True) from calibre.gui2.dialogs.exim import EximDialog d = EximDialog(parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: if d.restart_needed: self.gui.iactions['Restart'].restart() @@ -629,7 +629,7 @@ class ChooseLibraryAction(InterfaceAction): if not exists: d = MovedDialog(self.stats, location, self.gui) - ret = d.exec_() + ret = d.exec() self.build_menus() self.gui.iactions['Copy To Library'].build_menus() if ret == QDialog.DialogCode.Accepted: @@ -673,7 +673,7 @@ class ChooseLibraryAction(InterfaceAction): location = self.stats.canonicalize_path(db.library_path) self.pre_choose_dialog_location = location c = ChooseLibrary(db, self.choose_library_callback, self.gui) - c.exec_() + c.exec() def choose_library_callback(self, newloc, copy_structure=False, library_renamed=False): self.gui.library_moved(newloc, copy_structure=copy_structure, diff --git a/src/calibre/gui2/actions/convert.py b/src/calibre/gui2/actions/convert.py index c9c79182f2..6fcf31e85f 100644 --- a/src/calibre/gui2/actions/convert.py +++ b/src/calibre/gui2/actions/convert.py @@ -150,7 +150,7 @@ class ConvertAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot convert'), _('No books selected')) - d.exec_() + d.exec() return None return [self.gui.library_view.model().db.id(r) for r in rows] diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index f0c6c25c69..b7a780d747 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -84,7 +84,7 @@ def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # { d.bb.accepted.connect(d.accept) d.bb.rejected.connect(d.reject) d.resize(d.sizeHint()) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: changes_made = False for k, cb in missing_widgets: if cb.isChecked(): @@ -382,7 +382,7 @@ class CopyToLibraryAction(InterfaceAction): db = self.gui.library_view.model().db locations = list(self.stats.locations(db)) d = ChooseLibrary(self.gui, locations) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: path, delete_after = d.args if not path: return @@ -447,7 +447,7 @@ class CopyToLibraryAction(InterfaceAction): duplicate_ids = self.do_copy(ids, db, loc, delete_after, False) if duplicate_ids: d = DuplicatesQuestion(self.gui, duplicate_ids, loc) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: ids = d.ids if ids: self.do_copy(list(ids), db, loc, delete_after, add_duplicates=True) @@ -467,7 +467,7 @@ class CopyToLibraryAction(InterfaceAction): self.worker.start() self.pd.canceled_signal.connect(self.worker.cancel_processing) - self.pd.exec_() + self.pd.exec() self.pd.canceled_signal.disconnect() if self.worker.left_after_cancel: diff --git a/src/calibre/gui2/actions/delete.py b/src/calibre/gui2/actions/delete.py index 859e2d9400..0a717d4770 100644 --- a/src/calibre/gui2/actions/delete.py +++ b/src/calibre/gui2/actions/delete.py @@ -162,7 +162,7 @@ class DeleteAction(InterfaceAction): c[x] += 1 d = SelectFormats(c, msg, parent=self.gui, exclude=exclude, single=single) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return None return d.selected_formats @@ -170,7 +170,7 @@ class DeleteAction(InterfaceAction): rows = self.gui.library_view.selectionModel().selectedRows() if not rows or len(rows) == 0: d = error_dialog(self.gui, err_title, _('No book selected')) - d.exec_() + d.exec() return set() return set(map(self.gui.library_view.model().id, rows)) @@ -269,7 +269,7 @@ class DeleteAction(InterfaceAction): if not self.gui.device_manager.is_device_present: d = error_dialog(self.gui, _('Cannot delete books'), _('No device is connected')) - d.exec_() + d.exec() return ids = self._get_selected_ids() if not ids: @@ -287,10 +287,10 @@ class DeleteAction(InterfaceAction): if not some_to_delete: d = error_dialog(self.gui, _('No books to delete'), _('None of the selected books are on the device')) - d.exec_() + d.exec() return d = DeleteMatchingFromDeviceDialog(self.gui, to_delete) - if d.exec_(): + if d.exec(): paths = {} ids = {} for (model, id, path) in d.result: diff --git a/src/calibre/gui2/actions/device.py b/src/calibre/gui2/actions/device.py index c4e117c41d..6b08493bc0 100644 --- a/src/calibre/gui2/actions/device.py +++ b/src/calibre/gui2/actions/device.py @@ -243,7 +243,7 @@ class ConnectShareAction(InterfaceAction): _('Stopping server, this could take up to a minute, please wait...'), show_copy_button=False) QTimer.singleShot(1000, self.check_exited) - self.stopping_msg.exec_() + self.stopping_msg.exec() def check_exited(self): if getattr(self.gui.content_server, 'is_running', False): @@ -264,7 +264,7 @@ class ConnectShareAction(InterfaceAction): dm.set_option('smartdevice', 'autostart', False) else: sd_dialog = SmartdeviceDialog(self.gui) - sd_dialog.exec_() + sd_dialog.exec() self.set_smartdevice_action_state() def check_smartdevice_menus(self): diff --git a/src/calibre/gui2/actions/edit_metadata.py b/src/calibre/gui2/actions/edit_metadata.py index edadd5dc49..c3bdc8bc53 100644 --- a/src/calibre/gui2/actions/edit_metadata.py +++ b/src/calibre/gui2/actions/edit_metadata.py @@ -369,7 +369,7 @@ class EditMetadataAction(InterfaceAction): action_button=(_('&View book'), I('view.png'), self.gui.iactions['View'].view_historical), db=db ) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: if d.mark_rejected: failed_ids |= d.rejected_ids restrict_to_failed = True @@ -416,7 +416,7 @@ class EditMetadataAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot edit metadata'), _('No books selected')) - d.exec_() + d.exec() return row_list = [r.row() for r in rows] m = self.gui.library_view.model() @@ -508,7 +508,7 @@ class EditMetadataAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot edit metadata'), _('No books selected')) - d.exec_() + d.exec() return self.do_edit_bulk_metadata(rows, ids) @@ -776,7 +776,7 @@ class EditMetadataAction(InterfaceAction): model = view.model() result = model.get_collections_with_ids() d = DeviceCategoryEditor(self.gui, tag_to_match=None, data=result, key=sort_key) - d.exec_() + d.exec() if d.result() == QDialog.DialogCode.Accepted: to_rename = d.to_rename # dict of new text to old ids to_delete = d.to_delete # list of ids @@ -965,7 +965,7 @@ class EditMetadataAction(InterfaceAction): 'Cannot read cover as the %s file is missing from this book') % 'PDF', show=True) from calibre.gui2.metadata.pdf_covers import PDFCovers d = PDFCovers(pdfpath, parent=self.gui) - ret = d.exec_() + ret = d.exec() if ret == QDialog.DialogCode.Accepted: cpath = d.cover_path if cpath: diff --git a/src/calibre/gui2/actions/embed.py b/src/calibre/gui2/actions/embed.py index 79f0f18d43..5f2096dc77 100644 --- a/src/calibre/gui2/actions/embed.py +++ b/src/calibre/gui2/actions/embed.py @@ -110,7 +110,7 @@ class EmbedAction(InterfaceAction): tc.setVisible(True), tc.setText(_('Show the &failed books in the main book list')) tc.setChecked(gprefs.get('show-embed-failed-books', False)) d.resize_needed.emit() - d.exec_() + d.exec() gprefs['show-embed-failed-books'] = tc.isChecked() if tc.isChecked(): failed_ids = {mi.book_id for mi, fmt, tb in errors} diff --git a/src/calibre/gui2/actions/mark_books.py b/src/calibre/gui2/actions/mark_books.py index 15464d093c..e09815f659 100644 --- a/src/calibre/gui2/actions/mark_books.py +++ b/src/calibre/gui2/actions/mark_books.py @@ -107,7 +107,7 @@ class MarkBooksAction(InterfaceAction): rows = self.gui.library_view.selectionModel().selectedRows() if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot mark'), _('No books selected')) - d.exec_() + d.exec() return set() return set(map(self.gui.library_view.model().id, rows)) diff --git a/src/calibre/gui2/actions/match_books.py b/src/calibre/gui2/actions/match_books.py index eb8507905f..3f059eee7a 100644 --- a/src/calibre/gui2/actions/match_books.py +++ b/src/calibre/gui2/actions/match_books.py @@ -33,11 +33,11 @@ class MatchBookAction(InterfaceAction): rows = view.selectionModel().selectedRows() if not rows or len(rows) != 1: d = error_dialog(self.gui, _('Match books'), _('You must select one book')) - d.exec_() + d.exec() return id_ = view.model().indices(rows)[0] - MatchBooks(self.gui, view, id_, rows[0]).exec_() + MatchBooks(self.gui, view, id_, rows[0]).exec() class ShowMatchedBookAction(InterfaceAction): @@ -62,7 +62,7 @@ class ShowMatchedBookAction(InterfaceAction): rows = view.selectionModel().selectedRows() if not rows or len(rows) != 1: d = error_dialog(self.gui, _('Match books'), _('You must select one book')) - d.exec_() + d.exec() return device_book_index = view.model().indices(rows)[0] @@ -74,7 +74,7 @@ class ShowMatchedBookAction(InterfaceAction): if question_dialog(self.gui, _('No matching books'), _( 'No matching books found in the calibre library. Do you want to specify the' ' matching book manually?')): - MatchBooks(self.gui, view, device_book_index, rows[0]).exec_() + MatchBooks(self.gui, view, device_book_index, rows[0]).exec() return ids = tuple(sorted(matching_book_ids, reverse=True)) self.gui.library_view.select_rows(ids) diff --git a/src/calibre/gui2/actions/plugin_updates.py b/src/calibre/gui2/actions/plugin_updates.py index ca179b434f..c98623595a 100644 --- a/src/calibre/gui2/actions/plugin_updates.py +++ b/src/calibre/gui2/actions/plugin_updates.py @@ -30,6 +30,6 @@ class PluginUpdaterAction(InterfaceAction): initial_filter = FILTER_ALL d = PluginUpdaterDialog(self.gui, initial_filter=initial_filter) - d.exec_() + d.exec() if d.do_restart: self.gui.quit(restart=True) diff --git a/src/calibre/gui2/actions/polish.py b/src/calibre/gui2/actions/polish.py index 7f92017582..14361e50be 100644 --- a/src/calibre/gui2/actions/polish.py +++ b/src/calibre/gui2/actions/polish.py @@ -251,7 +251,7 @@ class Polish(QDialog): # {{{ self.pd = ProgressDialog(_('Queueing books for polishing'), max=len(self.queue), parent=self) QTimer.singleShot(0, self.do_one) - self.pd.exec_() + self.pd.exec() def do_one(self): if not self.queue: @@ -458,7 +458,7 @@ class PolishAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot polish'), _('No books selected')) - d.exec_() + d.exec() return None db = self.gui.library_view.model().db ans = (db.id(r) for r in rows) @@ -506,7 +506,7 @@ class PolishAction(InterfaceAction): def do_polish(self, book_id_map): d = Polish(self.gui.library_view.model().db, book_id_map, parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted and d.jobs: + if d.exec() == QDialog.DialogCode.Accepted and d.jobs: show_reports = bool(d.show_reports.isChecked()) for desc, data, book_id, base, is_orig in reversed(d.jobs): job = self.gui.job_manager.run_job( @@ -562,4 +562,4 @@ if __name__ == '__main__': app from calibre.library import db d = Polish(db(), {1:{'EPUB'}, 2:{'AZW3'}}) - d.exec_() + d.exec() diff --git a/src/calibre/gui2/actions/preferences.py b/src/calibre/gui2/actions/preferences.py index 48bae8c6a6..324cc32f88 100644 --- a/src/calibre/gui2/actions/preferences.py +++ b/src/calibre/gui2/actions/preferences.py @@ -48,7 +48,7 @@ class PreferencesAction(InterfaceAction): FILTER_NOT_INSTALLED) d = PluginUpdaterDialog(self.gui, initial_filter=FILTER_NOT_INSTALLED) - d.exec_() + d.exec() if d.do_restart: self.gui.quit(restart=True) @@ -57,7 +57,7 @@ class PreferencesAction(InterfaceAction): if self.gui.job_manager.has_jobs(): d = error_dialog(self.gui, _('Cannot configure'), _('Cannot configure while there are running jobs.')) - d.exec_() + d.exec() return if self.gui.must_restart_before_config: do_restart = show_restart_warning(_('Cannot configure before calibre is restarted.')) @@ -68,7 +68,7 @@ class PreferencesAction(InterfaceAction): close_after_initial=close_after_initial) d.run_wizard_requested.connect(self.gui.run_wizard, type=Qt.ConnectionType.QueuedConnection) - d.exec_() + d.exec() if d.do_restart: self.gui.quit(restart=True) diff --git a/src/calibre/gui2/actions/show_book_details.py b/src/calibre/gui2/actions/show_book_details.py index 018f754f13..8d0ed60afe 100644 --- a/src/calibre/gui2/actions/show_book_details.py +++ b/src/calibre/gui2/actions/show_book_details.py @@ -29,7 +29,7 @@ class ShowBookDetailsAction(InterfaceAction): if self.gui.current_view() is not self.gui.library_view: error_dialog(self.gui, _('No detailed info available'), _('No detailed information is available for books ' - 'on the device.')).exec_() + 'on the device.')).exec() return index = self.gui.library_view.currentIndex() if index.isValid(): diff --git a/src/calibre/gui2/actions/show_quickview.py b/src/calibre/gui2/actions/show_quickview.py index d82bacdf49..94319f9a25 100644 --- a/src/calibre/gui2/actions/show_quickview.py +++ b/src/calibre/gui2/actions/show_quickview.py @@ -130,7 +130,7 @@ class ShowQuickviewAction(InterfaceAction): if self.gui.current_view() is not self.gui.library_view: error_dialog(self.gui, _('No quickview available'), _('Quickview is not available for books ' - 'on the device.')).exec_() + 'on the device.')).exec() return self.qv_button.set_state_to_hide() index = self.gui.library_view.currentIndex() diff --git a/src/calibre/gui2/actions/show_stored_templates.py b/src/calibre/gui2/actions/show_stored_templates.py index 9f68d9711f..e9becfdf5c 100644 --- a/src/calibre/gui2/actions/show_stored_templates.py +++ b/src/calibre/gui2/actions/show_stored_templates.py @@ -21,4 +21,4 @@ class ShowTemplateFunctionsAction(InterfaceAction): def show_template_editor(self, *args): d = Preferences(self.gui, initial_plugin=('Advanced', 'TemplateFunctions'), close_after_initial=True) - d.exec_() + d.exec() diff --git a/src/calibre/gui2/actions/show_template_tester.py b/src/calibre/gui2/actions/show_template_tester.py index 5147558c52..c29a1deda4 100644 --- a/src/calibre/gui2/actions/show_template_tester.py +++ b/src/calibre/gui2/actions/show_template_tester.py @@ -33,7 +33,7 @@ class ShowTemplateTesterAction(InterfaceAction): if view is not self.gui.library_view: return error_dialog(self.gui, _('No template tester available'), _('Template tester is not available for books ' - 'on the device.')).exec_() + 'on the device.')).exec() rows = view.selectionModel().selectedRows() if not rows: @@ -48,6 +48,6 @@ class ShowTemplateTesterAction(InterfaceAction): t = TemplateDialog(self.gui, self.previous_text, mi, text_is_placeholder=self.first_time) t.setWindowTitle(_('Template tester')) - if t.exec_() == QDialog.DialogCode.Accepted: + if t.exec() == QDialog.DialogCode.Accepted: self.previous_text = t.rule[1] self.first_time = False diff --git a/src/calibre/gui2/actions/sort.py b/src/calibre/gui2/actions/sort.py index c3e75ed1f1..8fadc4443d 100644 --- a/src/calibre/gui2/actions/sort.py +++ b/src/calibre/gui2/actions/sort.py @@ -128,7 +128,7 @@ class SortByAction(InterfaceAction): def choose_multisort(self): from calibre.gui2.dialogs.multisort import ChooseMultiSort d = ChooseMultiSort(self.gui.current_db, parent=self.gui, is_device_connected=self.gui.device_connected) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.gui.library_view.multisort(d.current_sort_spec) def sort_requested(self, key, ascending): diff --git a/src/calibre/gui2/actions/store.py b/src/calibre/gui2/actions/store.py index 64d4715ac6..e4ea512b81 100644 --- a/src/calibre/gui2/actions/store.py +++ b/src/calibre/gui2/actions/store.py @@ -57,7 +57,7 @@ class StoreAction(InterfaceAction): self.show_disclaimer() from calibre.gui2.store.search.search import SearchDialog sd = SearchDialog(self.gui, self.gui, query) - sd.exec_() + sd.exec() def _get_selected_row(self): rows = self.gui.current_view().selectionModel().selectedRows() @@ -118,7 +118,7 @@ class StoreAction(InterfaceAction): def choose(self): from calibre.gui2.store.config.chooser.chooser_dialog import StoreChooserDialog d = StoreChooserDialog(self.gui) - d.exec_() + d.exec() self.gui.load_store_plugins() self.load_menu() diff --git a/src/calibre/gui2/actions/tag_mapper.py b/src/calibre/gui2/actions/tag_mapper.py index e684b86f33..6bba1426de 100644 --- a/src/calibre/gui2/actions/tag_mapper.py +++ b/src/calibre/gui2/actions/tag_mapper.py @@ -43,7 +43,7 @@ class TagMapAction(InterfaceAction): 'The changes will be applied to one book in the library', 'The changes will be applied to {} books in the library', len(book_ids)) d.edit_widget.msg_label.setText(d.edit_widget.msg_label.text() + '

' + txt.format(len(book_ids))) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return with BusyCursor(): rules = d.rules diff --git a/src/calibre/gui2/actions/toc_edit.py b/src/calibre/gui2/actions/toc_edit.py index 69265ac540..72ea093e46 100644 --- a/src/calibre/gui2/actions/toc_edit.py +++ b/src/calibre/gui2/actions/toc_edit.py @@ -130,7 +130,7 @@ class ToCEditAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot edit ToC'), _('No books selected')) - d.exec_() + d.exec() return None db = self.gui.current_db ans = (db.id(r) for r in rows) @@ -140,7 +140,7 @@ class ToCEditAction(InterfaceAction): for book_id, fmts in iteritems(book_id_map): if len(fmts) > 1: d = ChooseFormat(fmts, self.gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return fmts = d.formats for fmt in fmts: diff --git a/src/calibre/gui2/actions/tweak_epub.py b/src/calibre/gui2/actions/tweak_epub.py index 70bbbc3455..cdb65a8d85 100644 --- a/src/calibre/gui2/actions/tweak_epub.py +++ b/src/calibre/gui2/actions/tweak_epub.py @@ -127,7 +127,7 @@ class TweakEpubAction(InterfaceAction): if len(tweakable_fmts) > 1: if tprefs['choose_tweak_fmt']: d = Choose(sorted(tweakable_fmts, key=tprefs.defaults['tweak_fmt_order'].index), self.gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return tweakable_fmts = {d.fmt} else: diff --git a/src/calibre/gui2/actions/unpack_book.py b/src/calibre/gui2/actions/unpack_book.py index dbea570b46..d25435630d 100644 --- a/src/calibre/gui2/actions/unpack_book.py +++ b/src/calibre/gui2/actions/unpack_book.py @@ -343,5 +343,5 @@ class UnpackBookAction(InterfaceAction): '\n\nFirst convert the book to one of these formats.'), show=True) dlg = UnpackBook(self.gui, book_id, tweakable_fmts, db) - dlg.exec_() + dlg.exec() dlg.cleanup() diff --git a/src/calibre/gui2/actions/view.py b/src/calibre/gui2/actions/view.py index 189459a778..43bb8a7f86 100644 --- a/src/calibre/gui2/actions/view.py +++ b/src/calibre/gui2/actions/view.py @@ -209,7 +209,7 @@ class ViewAction(InterfaceAction): rows = list(self.gui.library_view.selectionModel().selectedRows()) if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot view'), _('No book selected')) - d.exec_() + d.exec() return db = self.gui.library_view.model().db @@ -228,7 +228,7 @@ class ViewAction(InterfaceAction): d = ChooseFormatDialog(self.gui, _('Choose the format to view'), list(sorted(all_fmts)), show_open_with=True) self.gui.book_converted.connect(d.book_converted) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: formats = [[x.upper() for x in db.new_api.formats(book_id)] for book_id in book_ids] fmt = d.format() orig_num = len(rows) @@ -266,7 +266,7 @@ class ViewAction(InterfaceAction): if not rows or len(rows) == 0: d = error_dialog(self.gui, _('Cannot open folder'), _('No book selected')) - d.exec_() + d.exec() return if not self._view_check(len(rows), max_=10, skip_dialog_name='open-folder-many-check'): return diff --git a/src/calibre/gui2/add_filters.py b/src/calibre/gui2/add_filters.py index 4894049973..4db3a0e353 100644 --- a/src/calibre/gui2/add_filters.py +++ b/src/calibre/gui2/add_filters.py @@ -146,7 +146,7 @@ if __name__ == '__main__': {'action':'ignore', 'query':'ignore-me', 'match_type':'startswith'}, {'action':'add', 'query':'*.moose', 'match_type':'glob'}, ] - d.exec_() + d.exec() from pprint import pprint pprint(d.rules) del d, app diff --git a/src/calibre/gui2/author_mapper.py b/src/calibre/gui2/author_mapper.py index 3191a76237..d876a014f5 100644 --- a/src/calibre/gui2/author_mapper.py +++ b/src/calibre/gui2/author_mapper.py @@ -131,7 +131,7 @@ if __name__ == '__main__': d.rules = [ {'action':'replace', 'query':'alice B & alice bob', 'match_type':'one_of', 'replace':'Alice Bob'}, ] - d.exec_() + d.exec() from pprint import pprint pprint(d.rules) del d, app diff --git a/src/calibre/gui2/book_details.py b/src/calibre/gui2/book_details.py index 3239a16484..5266b9340e 100644 --- a/src/calibre/gui2/book_details.py +++ b/src/calibre/gui2/book_details.py @@ -466,7 +466,7 @@ def details_context_menu_event(view, ev, book_info, add_popup_action=False, edit ema = get_gui().iactions['Edit Metadata'].menuless_qaction menu.addAction(_('Open the Edit metadata window') + '\t' + ema.shortcut().toString(QKeySequence.SequenceFormat.NativeText), edit_metadata) if len(menu.actions()) > 0: - menu.exec_(ev.globalPos()) + menu.exec(ev.globalPos()) # }}} @@ -613,7 +613,7 @@ class CoverView(QWidget): # {{{ create_open_cover_with_menu(self, cm) cm.si = m = create_search_internet_menu(self.search_internet.emit) cm.addMenu(m) - cm.exec_(ev.globalPos()) + cm.exec(ev.globalPos()) def open_with(self, entry): id_ = self.data.get('id', None) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 527405f317..5cd87636ec 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -691,7 +691,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ d.bb.rejected.connect(d.reject) d.resize(d.sizeHint()) link, name, is_image = None, None, False - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: link, name = str(d.url.text()).strip(), str(d.name.text()).strip() is_image = d.treat_as_image.isChecked() return link, name, is_image @@ -832,7 +832,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ am.addAction(self.action_background) am.addAction(self.action_color) menu.addAction(_('Smarten punctuation'), parent.smarten_punctuation) - menu.exec_(ev.globalPos()) + menu.exec(ev.globalPos()) # }}} @@ -1228,5 +1228,5 @@ if __name__ == '__main__': set out to have an affair, much less a long-term, devoted one.

hello''' w.html = '

Testing a link.

\xa0

ss

' - app.exec_() + app.exec() # print w.html diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index 826a8f531d..454ad66290 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -535,4 +535,4 @@ if __name__ == '__main__': 'oothree', 'a1', 'a2','Edgas', 'Èdgar', 'Édgaq', 'Edgar', 'Édgar'] le.update_items_cache(items) le.show_initial_value('') - d.exec_() + d.exec() diff --git a/src/calibre/gui2/convert/font_key.py b/src/calibre/gui2/convert/font_key.py index 6e615c5fb7..2bf1956840 100644 --- a/src/calibre/gui2/convert/font_key.py +++ b/src/calibre/gui2/convert/font_key.py @@ -104,5 +104,5 @@ if __name__ == '__main__': from qt.core import QApplication app = QApplication([]) d = FontKeyChooser() - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/convert/look_and_feel.py b/src/calibre/gui2/convert/look_and_feel.py index 5556626238..a2ef626b54 100644 --- a/src/calibre/gui2/convert/look_and_feel.py +++ b/src/calibre/gui2/convert/look_and_feel.py @@ -115,7 +115,7 @@ class LookAndFeelWidget(Widget, Ui_Form): from calibre.gui2.convert.font_key import FontKeyChooser d = FontKeyChooser(self, self.opt_base_font_size.value(), str(self.opt_font_size_mapping.text()).strip()) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.opt_font_size_mapping.setText(', '.join(['%.1f'%x for x in d.fsizes])) self.opt_base_font_size.setValue(d.dbase) diff --git a/src/calibre/gui2/convert/metadata.py b/src/calibre/gui2/convert/metadata.py index 0d4336e8bf..a8b6f145b5 100644 --- a/src/calibre/gui2/convert/metadata.py +++ b/src/calibre/gui2/convert/metadata.py @@ -198,7 +198,7 @@ class MetadataWidget(Widget, Ui_Form): if not os.access(_file, os.R_OK): d = error_dialog(self.parent(), _('Cannot read'), _('You do not have permission to read the file: ') + _file) - d.exec_() + d.exec() return cover = None try: @@ -207,7 +207,7 @@ class MetadataWidget(Widget, Ui_Form): except OSError as e: d = error_dialog(self.parent(), _('Error reading file'), _("

There was an error reading from file:
") + _file + "


"+str(e)) - d.exec_() + d.exec() if cover: pix = QPixmap() pix.loadFromData(cover) @@ -215,7 +215,7 @@ class MetadataWidget(Widget, Ui_Form): if pix.isNull(): d = error_dialog(self.parent(), _('Error reading file'), _file + _(" is not a valid picture")) - d.exec_() + d.exec() else: self.cover_path.setText(_file) self.set_cover_tooltip(pix) diff --git a/src/calibre/gui2/convert/regex_builder.py b/src/calibre/gui2/convert/regex_builder.py index bae0263302..99291e0163 100644 --- a/src/calibre/gui2/convert/regex_builder.py +++ b/src/calibre/gui2/convert/regex_builder.py @@ -151,7 +151,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder): format = formats[0] elif len(formats) > 1: d = ChooseFormatDialog(self, _('Choose the format to view'), formats) - d.exec_() + d.exec() if d.result() == QDialog.DialogCode.Accepted: format = d.format() else: @@ -236,7 +236,7 @@ class RegexEdit(XPathEdit): if not self.doc_cache: self.doc_cache = bld.doc() self.doc_update.emit(self.doc_cache) - if bld.exec_() == QDialog.DialogCode.Accepted: + if bld.exec() == QDialog.DialogCode.Accepted: self.edit.setText(bld.regex.text()) def doc(self): @@ -285,6 +285,6 @@ if __name__ == '__main__': app = Application([]) d = RegexBuilder(None, None, 'a', doc='😉123abc XYZabc') d.do_test() - d.exec_() + d.exec() del d del app diff --git a/src/calibre/gui2/convert/structure_detection.py b/src/calibre/gui2/convert/structure_detection.py index 6be65cdb89..d291262914 100644 --- a/src/calibre/gui2/convert/structure_detection.py +++ b/src/calibre/gui2/convert/structure_detection.py @@ -40,6 +40,6 @@ class StructureDetectionWidget(Widget, Ui_Form): x = getattr(self, 'opt_'+x) if not x.check(): error_dialog(self, _('Invalid XPath'), - _('The XPath expression %s is invalid.')%x.text).exec_() + _('The XPath expression %s is invalid.')%x.text).exec() return False return True diff --git a/src/calibre/gui2/convert/toc.py b/src/calibre/gui2/convert/toc.py index 2a7961548f..650afd148a 100644 --- a/src/calibre/gui2/convert/toc.py +++ b/src/calibre/gui2/convert/toc.py @@ -39,6 +39,6 @@ class TOCWidget(Widget, Ui_Form): x = getattr(self, 'opt_'+x+'_toc') if not x.check(): error_dialog(self, _('Invalid XPath'), - _('The XPath expression %s is invalid.')%x.text).exec_() + _('The XPath expression %s is invalid.')%x.text).exec() return False return True diff --git a/src/calibre/gui2/convert/xpath_wizard.py b/src/calibre/gui2/convert/xpath_wizard.py index a6c88627b7..f1809ccb27 100644 --- a/src/calibre/gui2/convert/xpath_wizard.py +++ b/src/calibre/gui2/convert/xpath_wizard.py @@ -102,7 +102,7 @@ class XPathEdit(QWidget): def wizard(self): wiz = Wizard(self) - if wiz.exec_() == QDialog.DialogCode.Accepted: + if wiz.exec() == QDialog.DialogCode.Accepted: self.edit.setText(wiz.xpath) def setObjectName(self, *args): @@ -144,5 +144,5 @@ if __name__ == '__main__': w = XPathEdit() w.setObjectName('test') w.show() - app.exec_() + app.exec() print(w.xpath) diff --git a/src/calibre/gui2/cover_flow.py b/src/calibre/gui2/cover_flow.py index ee8600a2d3..93c128b2e6 100644 --- a/src/calibre/gui2/cover_flow.py +++ b/src/calibre/gui2/cover_flow.py @@ -506,7 +506,7 @@ def test(): w.show() cf.setFocus(Qt.FocusReason.OtherFocusReason) - sys.exit(app.exec_()) + sys.exit(app.exec()) def main(args=sys.argv): @@ -528,4 +528,4 @@ if __name__ == '__main__': w.show() cf.setFocus(Qt.FocusReason.OtherFocusReason) - sys.exit(app.exec_()) + sys.exit(app.exec()) diff --git a/src/calibre/gui2/covers.py b/src/calibre/gui2/covers.py index 66a635d15f..918f907b5c 100644 --- a/src/calibre/gui2/covers.py +++ b/src/calibre/gui2/covers.py @@ -400,7 +400,7 @@ class CoverSettingsWidget(QWidget): def create_color_scheme(self): scheme = self.colors_map[self.current_colors].data(Qt.ItemDataRole.UserRole) d = CreateColorScheme('#' + _('My Color Scheme'), scheme, set(self.colors_map), parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: name, scheme = d.data li = QListWidgetItem(name) li.setData(Qt.ItemDataRole.UserRole, scheme), li.setFlags(li.flags() | Qt.ItemFlag.ItemIsUserCheckable), li.setCheckState(Qt.CheckState.Checked) @@ -416,7 +416,7 @@ class CoverSettingsWidget(QWidget): ' color scheme instead.'), show=True) li = self.colors_map[cs] d = CreateColorScheme(cs, li.data(Qt.ItemDataRole.UserRole), set(self.colors_map), edit_scheme=True, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: name, scheme = d.data li.setText(name) li.setData(Qt.ItemDataRole.UserRole, scheme) @@ -454,7 +454,7 @@ class CoverSettingsWidget(QWidget): attr = which + '_template' templ = getattr(self, attr).text() d = TemplateDialog(self, templ, mi=self.mi, fm=field_metadata) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: templ = d.rule[1] getattr(self, attr).setText(templ) self.emit_changed() @@ -613,6 +613,6 @@ if __name__ == '__main__': app = Application([]) d = CoverSettingsDialog() d.show() - app.exec_() + app.exec() del d del app diff --git a/src/calibre/gui2/css_transform_rules.py b/src/calibre/gui2/css_transform_rules.py index d769441662..8530b82bbb 100644 --- a/src/calibre/gui2/css_transform_rules.py +++ b/src/calibre/gui2/css_transform_rules.py @@ -336,7 +336,7 @@ class RulesWidget(QWidget, SaveLoadMixin): # {{{ self.changed.emit() def test_rules(self): - self.TesterClass(self.rules_widget.rules, self).exec_() + self.TesterClass(self.rules_widget.rules, self).exec() @property def rules(self): @@ -360,7 +360,7 @@ if __name__ == '__main__': d.rules = [ {'property':'color', 'match_type':'*', 'query':'', 'action':'change', 'action_data':'green'}, ] - d.exec_() + d.exec() from pprint import pprint pprint(d.rules) del d, app diff --git a/src/calibre/gui2/custom_column_widgets.py b/src/calibre/gui2/custom_column_widgets.py index a4ce10aaf4..0d271b0fc3 100644 --- a/src/calibre/gui2/custom_column_widgets.py +++ b/src/calibre/gui2/custom_column_widgets.py @@ -489,7 +489,7 @@ def _save_dialog(parent, title, msg, det_msg=''): d.setWindowTitle(title) d.setText(msg) d.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No | QMessageBox.StandardButton.Cancel) - return d.exec_() + return d.exec() class Text(Base): @@ -576,7 +576,7 @@ class Text(Base): self.initialize(self.book_id) else: d = TagEditor(self.parent, self.db, self.book_id, self.key) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.setter(d.tags) def connect_data_changed(self, slot): @@ -1494,7 +1494,7 @@ class BulkText(BulkBase): return widget.setText('') d = TagEditor(self.parent, self.db, key=('#'+self.col_metadata['label'])) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: val = d.tags if not val: val = [] diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index a4cc8cfc2f..09d9eccc11 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -989,7 +989,7 @@ class DeviceMixin: # {{{ if cw.validate(): QDialog.accept(config_dialog) config_dialog.accept = validate - if config_dialog.exec_() == QDialog.DialogCode.Accepted: + if config_dialog.exec() == QDialog.DialogCode.Accepted: dev.save_settings(cw) do_restart = show_restart_warning(_('Restart calibre for the changes to %s' @@ -1042,7 +1042,7 @@ class DeviceMixin: # {{{ if getattr(job, 'exception', None).__class__.__name__ == 'MTPInvalidSendPathError': try: from calibre.gui2.device_drivers.mtp_config import SendError - return SendError(self, job.exception).exec_() + return SendError(self, job.exception).exec() except: traceback.print_exc() try: @@ -1234,7 +1234,7 @@ class DeviceMixin: # {{{ rows = self.library_view.selectionModel().selectedRows() if not rows or len(rows) == 0: error_dialog(self, _('No books'), _('No books')+' '+ - _('selected to send')).exec_() + _('selected to send')).exec() return fmt = None @@ -1264,7 +1264,7 @@ class DeviceMixin: # {{{ elif f in aval_out_formats: formats.append((f, _('0 of %i books') % len(rows), True)) d = ChooseFormatDeviceDialog(self, _('Choose format to send to device'), formats) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return if d.format(): fmt = d.format().lower() @@ -1272,15 +1272,15 @@ class DeviceMixin: # {{{ if dest in ('main', 'carda', 'cardb'): if not self.device_connected or not self.device_manager: error_dialog(self, _('No device'), - _('Cannot send: No device is connected')).exec_() + _('Cannot send: No device is connected')).exec() return if dest == 'carda' and not self.device_manager.has_card(): error_dialog(self, _('No card'), - _('Cannot send: Device has no storage card')).exec_() + _('Cannot send: Device has no storage card')).exec() return if dest == 'cardb' and not self.device_manager.has_card(): error_dialog(self, _('No card'), - _('Cannot send: Device has no storage card')).exec_() + _('Cannot send: Device has no storage card')).exec() return if dest == 'main': on_card = None @@ -1567,7 +1567,7 @@ class DeviceMixin: # {{{ 'as no suitable formats were found. Convert the book(s) to a ' 'format supported by your device first.' ), bad) - d.exec_() + d.exec() def upload_dirtied_booklists(self): ''' @@ -1645,7 +1645,7 @@ class DeviceMixin: # {{{ _('

Cannot upload books to device there ' 'is no more free space available ')+where+ '

\n'%(titles,)) - d.exec_() + d.exec() elif isinstance(job.exception, WrongDestinationError): error_dialog(self, _('Incorrect destination'), str(job.exception), show=True) diff --git a/src/calibre/gui2/device_drivers/mtp_config.py b/src/calibre/gui2/device_drivers/mtp_config.py index 2e067f9af4..313205630e 100644 --- a/src/calibre/gui2/device_drivers/mtp_config.py +++ b/src/calibre/gui2/device_drivers/mtp_config.py @@ -102,7 +102,7 @@ class TemplateConfig(QWidget): # {{{ def edit_template(self): t = TemplateDialog(self, self.template) t.setWindowTitle(_('Edit template')) - if t.exec_(): + if t.exec(): self.t.setText(t.rule[1]) def validate(self): @@ -149,7 +149,7 @@ class SendToConfig(QWidget): # {{{ def browse(self): b = Browser(self.device.filesystem_cache, show_files=False, parent=self) - if b.exec_() == QDialog.DialogCode.Accepted and b.current_item is not None: + if b.exec() == QDialog.DialogCode.Accepted and b.current_item is not None: sid, path = b.current_item self.t.setText('/'.join(path[1:])) @@ -255,7 +255,7 @@ class Rule(QWidget): def browse(self): b = Browser(self.device.filesystem_cache, show_files=False, parent=self) - if b.exec_() == QDialog.DialogCode.Accepted and b.current_item is not None: + if b.exec() == QDialog.DialogCode.Accepted and b.current_item is not None: sid, path = b.current_item self.folder.setText('/'.join(path[1:])) @@ -428,12 +428,12 @@ class MTPConfig(QTabWidget): bb.addButton(_('Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole) bb.clicked.connect(lambda : QApplication.clipboard().setText(v.toPlainText())) - d.exec_() + d.exec() def change_ignored_folders(self): d = IgnoredFolders(self.device, self.current_ignored_folders, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.current_ignored_folders = d.ignored_folders def ignore_device(self): @@ -547,6 +547,6 @@ if __name__ == '__main__': d.l.addWidget(bb) bb.accepted.connect(d.accept) bb.rejected.connect(d.reject) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: cw.commit() dev.shutdown() diff --git a/src/calibre/gui2/device_drivers/mtp_folder_browser.py b/src/calibre/gui2/device_drivers/mtp_folder_browser.py index 8389ec40d0..7b2444a22c 100644 --- a/src/calibre/gui2/device_drivers/mtp_folder_browser.py +++ b/src/calibre/gui2/device_drivers/mtp_folder_browser.py @@ -226,7 +226,7 @@ def browse(): app dev = setup_device() d = Browser(dev.filesystem_cache) - d.exec_() + d.exec() dev.shutdown() return d.current_item @@ -237,7 +237,7 @@ def ignored_folders(): app dev = setup_device() d = IgnoredFolders(dev) - d.exec_() + d.exec() dev.shutdown() return d.ignored_folders diff --git a/src/calibre/gui2/device_drivers/tabbed_device_config.py b/src/calibre/gui2/device_drivers/tabbed_device_config.py index b467f8294a..5ca799f1b3 100644 --- a/src/calibre/gui2/device_drivers/tabbed_device_config.py +++ b/src/calibre/gui2/device_drivers/tabbed_device_config.py @@ -389,6 +389,6 @@ if __name__ == '__main__': d.l.addWidget(bb) bb.accepted.connect(d.accept) bb.rejected.connect(d.reject) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: cw.commit() dev.shutdown() diff --git a/src/calibre/gui2/dialogs/add_empty_book.py b/src/calibre/gui2/dialogs/add_empty_book.py index 2b60a73cc0..25316071f0 100644 --- a/src/calibre/gui2/dialogs/add_empty_book.py +++ b/src/calibre/gui2/dialogs/add_empty_book.py @@ -179,4 +179,4 @@ if __name__ == '__main__': db = db() app = QApplication([]) d = AddEmptyBookDialog(None, db, 'Test Author') - d.exec_() + d.exec() diff --git a/src/calibre/gui2/dialogs/authors_edit.py b/src/calibre/gui2/dialogs/authors_edit.py index bb6bf89ef0..79d770e527 100644 --- a/src/calibre/gui2/dialogs/authors_edit.py +++ b/src/calibre/gui2/dialogs/authors_edit.py @@ -199,5 +199,5 @@ class AuthorsEdit(QDialog): if __name__ == '__main__': app = QApplication([]) d = AuthorsEdit(['kovid goyal', 'divok layog', 'other author'], ['kovid goyal', 'other author']) - d.exec_() + d.exec() print(d.authors) diff --git a/src/calibre/gui2/dialogs/book_info.py b/src/calibre/gui2/dialogs/book_info.py index 2d078cc5c3..622c72c2fa 100644 --- a/src/calibre/gui2/dialogs/book_info.py +++ b/src/calibre/gui2/dialogs/book_info.py @@ -223,7 +223,7 @@ class BookInfo(QDialog): def configure(self): d = Configure(get_gui().current_db, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: if self.current_row is not None: mi = self.view.model().get_book_display_info(self.current_row) if mi is not None: @@ -364,6 +364,6 @@ if __name__ == '__main__': app.current_db = db() get_gui.ans = app d = Configure(app.current_db) - d.exec_() + d.exec() del d del app diff --git a/src/calibre/gui2/dialogs/check_library.py b/src/calibre/gui2/dialogs/check_library.py index e843e31a08..d4265aaad1 100644 --- a/src/calibre/gui2/dialogs/check_library.py +++ b/src/calibre/gui2/dialogs/check_library.py @@ -46,7 +46,7 @@ class DBCheck(QDialog): # {{{ t.daemon = True t.start() QTimer.singleShot(100, self.check) - self.exec_() + self.exec() def vacuum(self): try: @@ -233,7 +233,7 @@ class CheckLibraryDialog(QDialog): probs += self.problem_count[c] if probs == 0: return False - self.exec_() + self.exec() return True def accept(self): @@ -467,4 +467,4 @@ if __name__ == '__main__': app = QApplication([]) from calibre.library import db d = CheckLibraryDialog(None, db()) - d.exec_() + d.exec() diff --git a/src/calibre/gui2/dialogs/choose_format.py b/src/calibre/gui2/dialogs/choose_format.py index 0e6e6509ba..f700b63a56 100644 --- a/src/calibre/gui2/dialogs/choose_format.py +++ b/src/calibre/gui2/dialogs/choose_format.py @@ -104,6 +104,6 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = ChooseFormatDialog(None, 'Testing choose format', ['epub', 'mobi', 'docx'], show_open_with=True) - d.exec_() + d.exec() print(d._format) del app diff --git a/src/calibre/gui2/dialogs/choose_library.py b/src/calibre/gui2/dialogs/choose_library.py index aadd5d13c4..ddc24a67fd 100644 --- a/src/calibre/gui2/dialogs/choose_library.py +++ b/src/calibre/gui2/dialogs/choose_library.py @@ -150,7 +150,7 @@ class ChooseLibrary(QDialog, Ui_Dialog): t = Thread(name='MoveLibrary', target=do_move) QTimer.singleShot(0, t.start) - pd.exec_() + pd.exec() if abort_move.is_set(): self.callback(self.db.library_path) return diff --git a/src/calibre/gui2/dialogs/comments_dialog.py b/src/calibre/gui2/dialogs/comments_dialog.py index b766ee2a7c..aa16dff83b 100644 --- a/src/calibre/gui2/dialogs/comments_dialog.py +++ b/src/calibre/gui2/dialogs/comments_dialog.py @@ -81,6 +81,6 @@ class PlainTextDialog(Dialog): if __name__ == '__main__': app = Application([]) d = CommentsDialog(None, 'testing', 'Comments') - d.exec_() + d.exec() del d del app diff --git a/src/calibre/gui2/dialogs/confirm_delete.py b/src/calibre/gui2/dialogs/confirm_delete.py index 46e5b59f19..06a7825d10 100644 --- a/src/calibre/gui2/dialogs/confirm_delete.py +++ b/src/calibre/gui2/dialogs/confirm_delete.py @@ -78,7 +78,7 @@ def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None, return True d = Dialog(msg, name, parent, config_set=config_set, icon=pixmap, extra_button=extra_button, title=title, confirm_msg=confirm_msg, show_cancel_button=show_cancel_button) - ret = d.exec_() == QDialog.DialogCode.Accepted + ret = d.exec() == QDialog.DialogCode.Accepted if extra_button: ret = ret, d.extra_button_clicked return ret diff --git a/src/calibre/gui2/dialogs/confirm_delete_location.py b/src/calibre/gui2/dialogs/confirm_delete_location.py index a649a47fa7..48274feebc 100644 --- a/src/calibre/gui2/dialogs/confirm_delete_location.py +++ b/src/calibre/gui2/dialogs/confirm_delete_location.py @@ -45,7 +45,7 @@ def confirm_location(msg, name, parent=None, pixmap='dialog_warning.png'): d.label.setPixmap(QPixmap(I(pixmap))) d.setWindowIcon(QIcon(I(pixmap))) d.resize(d.sizeHint()) - ret = d.exec_() + ret = d.exec() d.break_cycles() if ret == QDialog.DialogCode.Accepted: return d.choice() diff --git a/src/calibre/gui2/dialogs/confirm_merge.py b/src/calibre/gui2/dialogs/confirm_merge.py index b3d7ff7bcd..146d35045d 100644 --- a/src/calibre/gui2/dialogs/confirm_merge.py +++ b/src/calibre/gui2/dialogs/confirm_merge.py @@ -91,7 +91,7 @@ def confirm_merge(msg, name, parent, mi): if not config_set.get(confirm_config_name(name), True): return True d = ConfirmMerge(msg, name, parent, mi) - return d.exec_() == QDialog.DialogCode.Accepted + return d.exec() == QDialog.DialogCode.Accepted class ChooseMerge(Dialog): @@ -189,6 +189,6 @@ class ChooseMerge(Dialog): def merge_drop(dest_id, src_ids, gui): d = ChooseMerge(dest_id, src_ids, gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return None, None, None return d.merge_type diff --git a/src/calibre/gui2/dialogs/custom_recipes.py b/src/calibre/gui2/dialogs/custom_recipes.py index 69f14beebb..a80d232fd2 100644 --- a/src/calibre/gui2/dialogs/custom_recipes.py +++ b/src/calibre/gui2/dialogs/custom_recipes.py @@ -658,7 +658,7 @@ class CustomRecipes(Dialog): def customize_recipe(self): d = ChooseBuiltinRecipe(self.recipe_model, self) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return id_ = d.selected_recipe @@ -690,7 +690,7 @@ class CustomRecipes(Dialog): def import_opml(self): from calibre.gui2.dialogs.opml import ImportOPML d = ImportOPML(parent=self) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return oldest_article, max_articles_per_feed, replace_existing = d.oldest_article, d.articles_per_feed, d.replace_existing failed_recipes, replace_recipes, add_recipes = {}, {}, {} @@ -737,5 +737,5 @@ if __name__ == '__main__': from calibre.gui2 import Application from calibre.web.feeds.recipes.model import RecipeModel app = Application([]) - CustomRecipes(RecipeModel()).exec_() + CustomRecipes(RecipeModel()).exec() del app diff --git a/src/calibre/gui2/dialogs/device_category_editor.py b/src/calibre/gui2/dialogs/device_category_editor.py index 736379255c..54e547f167 100644 --- a/src/calibre/gui2/dialogs/device_category_editor.py +++ b/src/calibre/gui2/dialogs/device_category_editor.py @@ -85,7 +85,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor): def finish_editing(self, item): if not item.text(): error_dialog(self, _('Item is blank'), - _('An item cannot be set to nothing. Delete it instead.')).exec_() + _('An item cannot be set to nothing. Delete it instead.')).exec() item.setText(item.previous_text()) return if item.text() != item.initial_text(): @@ -99,7 +99,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor): def _rename_tag(self, item): if item is None: error_dialog(self, _('No item selected'), - _('You must select one item from the list of available items.')).exec_() + _('You must select one item from the list of available items.')).exec() return self.available_tags.editItem(item) @@ -107,7 +107,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor): deletes = self.available_tags.selectedItems() if not deletes: error_dialog(self, _('No items selected'), - _('You must select at least one item from the list.')).exec_() + _('You must select at least one item from the list.')).exec() return ct = ', '.join([str(item.text()) for item in deletes]) if not question_dialog(self, _('Are you sure?'), diff --git a/src/calibre/gui2/dialogs/drm_error.py b/src/calibre/gui2/dialogs/drm_error.py index e24f080517..df465ac766 100644 --- a/src/calibre/gui2/dialogs/drm_error.py +++ b/src/calibre/gui2/dialogs/drm_error.py @@ -32,5 +32,5 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = DRMErrorMessage(title='testing title') - d.exec_() + d.exec() del d diff --git a/src/calibre/gui2/dialogs/duplicates.py b/src/calibre/gui2/dialogs/duplicates.py index 961926cdb8..557d75b002 100644 --- a/src/calibre/gui2/dialogs/duplicates.py +++ b/src/calibre/gui2/dialogs/duplicates.py @@ -63,7 +63,7 @@ class DuplicatesQuestion(QDialog): geom = gprefs.get('duplicates-question-dialog-geometry', None) if geom is not None: QApplication.instance().safe_restore_geometry(self, geom) - self.exec_() + self.exec() def copy_to_clipboard(self): QApplication.clipboard().setText(self.as_text) diff --git a/src/calibre/gui2/dialogs/edit_authors_dialog.py b/src/calibre/gui2/dialogs/edit_authors_dialog.py index acd1d3de0f..6e952fa3fc 100644 --- a/src/calibre/gui2/dialogs/edit_authors_dialog.py +++ b/src/calibre/gui2/dialogs/edit_authors_dialog.py @@ -330,7 +330,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): ca.triggered.connect(self.copy_aus_to_au) m.addSeparator() m.addMenu(case_menu) - m.exec_(self.table.mapToGlobal(point)) + m.exec(self.table.mapToGlobal(point)) def undo_cell(self, old_value): self.context_item.setText(old_value) @@ -481,7 +481,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog): aut_list = string_to_authors(aut) if len(aut_list) != 1: error_dialog(self.parent(), _('Invalid author name'), - _('You cannot change an author to multiple authors.')).exec_() + _('You cannot change an author to multiple authors.')).exec() aut = ' % '.join(aut_list) self.table.item(row, 0).setText(aut) item.set_sort_key() diff --git a/src/calibre/gui2/dialogs/exim.py b/src/calibre/gui2/dialogs/exim.py index 836443adf6..164459cb0b 100644 --- a/src/calibre/gui2/dialogs/exim.py +++ b/src/calibre/gui2/dialogs/exim.py @@ -361,7 +361,7 @@ class EximDialog(Dialog): dbmap[db.library_path] = db.new_api return RunAction(_('Exporting all calibre data...'), _( 'Failed to export data.'), partial(export, self.export_dir, library_paths=library_paths, dbmap=dbmap), - parent=self).exec_() == QDialog.DialogCode.Accepted + parent=self).exec() == QDialog.DialogCode.Accepted def run_import_action(self): library_path_map = {} @@ -369,7 +369,7 @@ class EximDialog(Dialog): if w.path: library_path_map[w.lpath] = w.path return RunAction(_('Importing all calibre data...'), _( - 'Failed to import data.'), partial(import_data, self.importer, library_path_map), parent=self).exec_() == QDialog.DialogCode.Accepted + 'Failed to import data.'), partial(import_data, self.importer, library_path_map), parent=self).exec() == QDialog.DialogCode.Accepted def accept(self): if not self.validate(): @@ -388,5 +388,5 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = EximDialog(initial_panel='import') - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/dialogs/match_books.py b/src/calibre/gui2/dialogs/match_books.py index 713bb70e5a..448bac19d9 100644 --- a/src/calibre/gui2/dialogs/match_books.py +++ b/src/calibre/gui2/dialogs/match_books.py @@ -129,7 +129,7 @@ class MatchBooks(QDialog, Ui_MatchBooks): if not query: d = error_dialog(self.gui, _('Match books'), _('You must enter a search expression into the search field')) - d.exec_() + d.exec() return try: self.search_button.setEnabled(False) @@ -200,7 +200,7 @@ class MatchBooks(QDialog, Ui_MatchBooks): if not self.current_library_book_id: d = error_dialog(self.gui, _('Match books'), _('You must select a matching book')) - d.exec_() + d.exec() return mi = self.library_db.get_metadata(self.current_library_book_id, index_is_id=True, get_user_categories=False, diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 50454e567b..5b8e38309d 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -162,10 +162,11 @@ class MyBlockingBusy(QDialog): # {{{ self.error = (err, traceback.format_exc()) QDialog.accept(self) - def exec_(self): + def exec(self): self.thread = Thread(target=self.do_it) self.thread.start() - return QDialog.exec_(self) + return QDialog.exec(self) + exec_ = exec def do_it(self): try: @@ -575,7 +576,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): self.authors.setFocus(Qt.FocusReason.OtherFocusReason) self.generate_cover_settings = None self.button_config_cover_gen.clicked.connect(self.customize_cover_generation) - self.exec_() + self.exec() def sizeHint(self): desktop = QCoreApplication.instance().desktop() @@ -586,13 +587,13 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): def customize_cover_generation(self): from calibre.gui2.covers import CoverSettingsDialog d = CoverSettingsDialog(parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.generate_cover_settings = d.prefs_for_rendering def set_comments(self): from calibre.gui2.dialogs.comments_dialog import CommentsDialog d = CommentsDialog(self, '' if self.comments is null else (self.comments or ''), _('Comments')) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.comments = d.textbox.html b = self.comments_button b.setStyleSheet('QPushButton { font-weight: bold }') @@ -1139,7 +1140,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): def tag_editor(self, *args): d = TagEditor(self, self.db, None) - d.exec_() + d.exec() if d.result() == QDialog.DialogCode.Accepted: tag_string = ', '.join(d.tags) self.tags.setText(tag_string) @@ -1253,7 +1254,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): # which can slow down bulk editing of large numbers of books self.model.stop_metadata_backup() try: - bb.exec_() + bb.exec() finally: self.model.start_metadata_backup() @@ -1274,7 +1275,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog): 'Covers were compressed by {percent:.1%} from a total size of' ' {old} to {new}.').format( percent=percent, old=human_readable(total_old), new=human_readable(total_new)) - ).exec_() + ).exec() return QDialog.accept(self) def series_changed(self, *args): diff --git a/src/calibre/gui2/dialogs/multisort.py b/src/calibre/gui2/dialogs/multisort.py index 50c0c7de64..09c3fc5479 100644 --- a/src/calibre/gui2/dialogs/multisort.py +++ b/src/calibre/gui2/dialogs/multisort.py @@ -201,7 +201,7 @@ if __name__ == '__main__': app = Application([]) from calibre.library import db d = ChooseMultiSort(db()) - d.exec_() + d.exec() print(d.current_sort_spec) del d del app diff --git a/src/calibre/gui2/dialogs/plugin_updater.py b/src/calibre/gui2/dialogs/plugin_updater.py index 1b37b619fb..63b3331e07 100644 --- a/src/calibre/gui2/dialogs/plugin_updater.py +++ b/src/calibre/gui2/dialogs/plugin_updater.py @@ -732,7 +732,7 @@ class PluginUpdaterDialog(SizePersistedDialog): d.do_restart = True b.clicked.connect(rf) d.set_details('') - d.exec_() + d.exec() b.clicked.disconnect() do_restart = d.do_restart diff --git a/src/calibre/gui2/dialogs/progress.py b/src/calibre/gui2/dialogs/progress.py index 9aed79ec4d..95c12ba4c9 100644 --- a/src/calibre/gui2/dialogs/progress.py +++ b/src/calibre/gui2/dialogs/progress.py @@ -172,4 +172,4 @@ if __name__ == '__main__': d = ProgressDialog('A title', 'A message', icon='lt.png') d.show(), d.canceled_signal.connect(app.quit) QTimer.singleShot(1000, lambda : (setattr(d, 'value', 10), setattr(d, 'msg', ('A message ' * 100)))) - app.exec_() + app.exec() diff --git a/src/calibre/gui2/dialogs/restore_library.py b/src/calibre/gui2/dialogs/restore_library.py index c4a1573b66..1042369cb0 100644 --- a/src/calibre/gui2/dialogs/restore_library.py +++ b/src/calibre/gui2/dialogs/restore_library.py @@ -111,7 +111,7 @@ def restore_database(db, parent=None): return False db.close() d = DBRestore(parent, db.library_path) - d.exec_() + d.exec() r = d.restorer d.restorer = None if d.rejected: @@ -127,7 +127,7 @@ def restore_database(db, parent=None): def repair_library_at(library_path, parent=None, wait_time=2): d = DBRestore(parent, library_path, wait_time=wait_time) - d.exec_() + d.exec() if d.rejected: return False r = d.restorer diff --git a/src/calibre/gui2/dialogs/saved_search_editor.py b/src/calibre/gui2/dialogs/saved_search_editor.py index 3229dda830..677b0cc640 100644 --- a/src/calibre/gui2/dialogs/saved_search_editor.py +++ b/src/calibre/gui2/dialogs/saved_search_editor.py @@ -155,7 +155,7 @@ class SavedSearchEditor(Dialog): def add_search(self): d = AddSavedSearch(parent=self, commit_changes=False, validate=self.validate_add) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return name, expression = d.accepted_data self.searches[name] = expression @@ -184,7 +184,7 @@ class SavedSearchEditor(Dialog): d.setWindowTitle(_('Edit saved search')) d.sname.setText(n) d.search.setPlainText(self.searches[n]) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return name, expression = d.accepted_data self.slist.currentItem().setText(name) diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 6be18f6a14..42dd6541ae 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -628,7 +628,7 @@ class Scheduler(QObject): try: d = SchedulerDialog(self.recipe_model) d.download.connect(self.download_clicked) - d.exec_() + d.exec() gconf['oldest_news'] = self.oldest = d.old_news.value() d.break_cycles() finally: @@ -638,7 +638,7 @@ class Scheduler(QObject): from calibre.gui2.dialogs.custom_recipes import CustomRecipes d = CustomRecipes(self.recipe_model, self._parent) try: - d.exec_() + d.exec() finally: d.deleteLater() @@ -729,5 +729,5 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = SchedulerDialog(RecipeModel()) - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/dialogs/search.py b/src/calibre/gui2/dialogs/search.py index 74e29e3efd..e113885926 100644 --- a/src/calibre/gui2/dialogs/search.py +++ b/src/calibre/gui2/dialogs/search.py @@ -490,6 +490,6 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = SearchDialog(None, db) - d.exec_() + d.exec() print(d.search_string()) diff --git a/src/calibre/gui2/dialogs/select_formats.py b/src/calibre/gui2/dialogs/select_formats.py index f28b90eb29..ddcca2168f 100644 --- a/src/calibre/gui2/dialogs/select_formats.py +++ b/src/calibre/gui2/dialogs/select_formats.py @@ -98,5 +98,5 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = SelectFormats(['epub', 'lrf', 'lit', 'mobi'], 'Choose a format') - d.exec_() + d.exec() print(d.selected_formats) diff --git a/src/calibre/gui2/dialogs/tag_categories.py b/src/calibre/gui2/dialogs/tag_categories.py index 29ee09c6b4..b4afaba44e 100644 --- a/src/calibre/gui2/dialogs/tag_categories.py +++ b/src/calibre/gui2/dialogs/tag_categories.py @@ -236,14 +236,14 @@ class TagCategories(QDialog, Ui_TagCategories): error_dialog(self, _('Invalid name'), _('That name contains leading or trailing periods, ' 'multiple periods in a row or spaces before ' - 'or after periods.')).exec_() + 'or after periods.')).exec() return False for c in sorted(self.categories.keys(), key=sort_key): if strcmp(c, cat_name) == 0 or \ (icu_lower(cat_name).startswith(icu_lower(c) + '.') and not cat_name.startswith(c + '.')): error_dialog(self, _('Name already used'), - _('That name is already used, perhaps with different case.')).exec_() + _('That name is already used, perhaps with different case.')).exec() return False if cat_name not in self.categories: self.category_box.clear() @@ -267,13 +267,13 @@ class TagCategories(QDialog, Ui_TagCategories): error_dialog(self, _('Invalid name'), _('That name contains leading or trailing periods, ' 'multiple periods in a row or spaces before ' - 'or after periods.')).exec_() + 'or after periods.')).exec() return False for c in self.categories: if strcmp(c, cat_name) == 0: error_dialog(self, _('Name already used'), - _('That name is already used, perhaps with different case.')).exec_() + _('That name is already used, perhaps with different case.')).exec() return False # The order below is important because of signals self.categories[cat_name] = self.categories[self.current_cat_name] diff --git a/src/calibre/gui2/dialogs/tag_editor.py b/src/calibre/gui2/dialogs/tag_editor.py index 429b21f5ae..78352b84f6 100644 --- a/src/calibre/gui2/dialogs/tag_editor.py +++ b/src/calibre/gui2/dialogs/tag_editor.py @@ -114,7 +114,7 @@ class TagEditor(QDialog, Ui_TagEditor): confirms, deletes = [], [] items = self.available_tags.selectedItems() if item is None else [item] if not items: - error_dialog(self, 'No tags selected', 'You must select at least one tag from the list of Available tags.').exec_() + error_dialog(self, 'No tags selected', 'You must select at least one tag from the list of Available tags.').exec() return if not confirm( _('Deleting tags is done immediately and there is no undo.'), @@ -258,5 +258,5 @@ if __name__ == '__main__': db = db() app = Application([]) d = TagEditor(None, db, current_tags='a b c'.split()) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: print(d.tags) diff --git a/src/calibre/gui2/dialogs/tag_list_editor.py b/src/calibre/gui2/dialogs/tag_list_editor.py index 1908e6d272..3c3492ee3b 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.py +++ b/src/calibre/gui2/dialogs/tag_list_editor.py @@ -323,7 +323,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): action_title_case.triggered.connect(partial(self.do_case, titlecase)) action_capitalize.triggered.connect(partial(self.do_case, capitalize)) m.addMenu(case_menu) - m.exec_(self.table.mapToGlobal(point)) + m.exec(self.table.mapToGlobal(point)) def search_for_books(self, item): from calibre.gui2.ui import get_gui @@ -564,7 +564,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): indexes = self.table.selectionModel().selectedRows() if not indexes: error_dialog(self, _('No item selected'), - _('You must select one item from the list of available items.')).exec_() + _('You must select one item from the list of available items.')).exec() return if not confirm( @@ -589,7 +589,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): def _rename_tag(self, item): if item is None: error_dialog(self, _('No item selected'), - _('You must select one item from the list of available items.')).exec_() + _('You must select one item from the list of available items.')).exec() return for col_zero_item in self.table.selectedItems(): if col_zero_item.is_deleted: @@ -616,7 +616,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): deletes = self.table.selectedItems() if not deletes: error_dialog(self, _('No items selected'), - _('You must select at least one item from the list.')).exec_() + _('You must select at least one item from the list.')).exec() return to_del = [] diff --git a/src/calibre/gui2/dialogs/template_dialog.py b/src/calibre/gui2/dialogs/template_dialog.py index 469c8e58bd..16cf8ca648 100644 --- a/src/calibre/gui2/dialogs/template_dialog.py +++ b/src/calibre/gui2/dialogs/template_dialog.py @@ -494,7 +494,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): ca.triggered.connect(self.load_template_from_file) ca = m.addAction(_('Save template to file')) ca.triggered.connect(self.save_template) - m.exec_(self.textbox.mapToGlobal(point)) + m.exec(self.textbox.mapToGlobal(point)) def load_last_template_text(self): from calibre.customize.ui import find_plugin @@ -606,7 +606,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog): return self.break_reporter_dialog = BreakReporter(self, mi_to_use, txt, val, locals_, line_number) - if not self.break_reporter_dialog.exec_(): + if not self.break_reporter_dialog.exec(): raise StopException() def filename_button_clicked(self): @@ -887,5 +887,5 @@ if __name__ == '__main__': app = Application([]) from calibre.ebooks.metadata.book.base import field_metadata d = TemplateDialog(None, '{title}', fm=field_metadata) - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/dialogs/template_line_editor.py b/src/calibre/gui2/dialogs/template_line_editor.py index b735e5e6d4..e4911e947a 100644 --- a/src/calibre/gui2/dialogs/template_line_editor.py +++ b/src/calibre/gui2/dialogs/template_line_editor.py @@ -34,7 +34,7 @@ class TemplateLineEditor(QLineEdit): action_clear_field.triggered.connect(self.clear_field) action_open_editor = menu.addAction(_('Open template editor')) action_open_editor.triggered.connect(self.open_editor) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) def clear_field(self): self.setText('') @@ -42,5 +42,5 @@ class TemplateLineEditor(QLineEdit): def open_editor(self): t = TemplateDialog(self, self.text(), mi=self.mi) t.setWindowTitle(_('Edit template')) - if t.exec_(): + if t.exec(): self.setText(t.rule[1]) diff --git a/src/calibre/gui2/dialogs/trim_image.py b/src/calibre/gui2/dialogs/trim_image.py index c5d03eb68b..956d8534e8 100644 --- a/src/calibre/gui2/dialogs/trim_image.py +++ b/src/calibre/gui2/dialogs/trim_image.py @@ -119,7 +119,7 @@ if __name__ == '__main__': with open(fname, 'rb') as f: data = f.read() d = TrimImage(data) - if d.exec_() == QDialog.DialogCode.Accepted and d.image_data is not None: + if d.exec() == QDialog.DialogCode.Accepted and d.image_data is not None: b, ext = os.path.splitext(fname) fname = b + '-trimmed' + ext with open(fname, 'wb') as f: diff --git a/src/calibre/gui2/dnd.py b/src/calibre/gui2/dnd.py index 4c1f2fa746..1c46d7e1a4 100644 --- a/src/calibre/gui2/dnd.py +++ b/src/calibre/gui2/dnd.py @@ -94,7 +94,7 @@ class DownloadDialog(QDialog): # {{{ def start_download(self): self.worker.start() QTimer.singleShot(50, self.update) - self.exec_() + self.exec() if self.worker.err is not None: error_dialog(self.parent(), _('Download failed'), _('Failed to download from %(url)r with error: %(err)s')%dict( diff --git a/src/calibre/gui2/ebook_download.py b/src/calibre/gui2/ebook_download.py index 31776249bc..52d0b89640 100644 --- a/src/calibre/gui2/ebook_download.py +++ b/src/calibre/gui2/ebook_download.py @@ -43,7 +43,7 @@ class DownloadInfo(MessageBox): def show_download_info(filename, parent=None): if not gprefs.get('show_get_books_download_info', True): return - DownloadInfo(filename, parent).exec_() + DownloadInfo(filename, parent).exec() def get_download_filename(response): diff --git a/src/calibre/gui2/email.py b/src/calibre/gui2/email.py index f5b81a45f5..355469e331 100644 --- a/src/calibre/gui2/email.py +++ b/src/calibre/gui2/email.py @@ -306,7 +306,7 @@ class SelectRecipients(QDialog): # {{{ def select_recipients(parent=None): d = SelectRecipients(parent) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: return d.ans return () # }}} @@ -469,7 +469,7 @@ class EmailMixin: # {{{ d = warning_dialog(self, _('No suitable formats'), _('Could not email the following books ' 'as no suitable formats were found:'), bad) - d.exec_() + d.exec() def email_sent(self, job, remove=[]): if job.failed: diff --git a/src/calibre/gui2/font_family_chooser.py b/src/calibre/gui2/font_family_chooser.py index 338612a594..ccc151e206 100644 --- a/src/calibre/gui2/font_family_chooser.py +++ b/src/calibre/gui2/font_family_chooser.py @@ -365,7 +365,7 @@ class FontFamilyChooser(QWidget): def show_chooser(self): d = FontFamilyDialog(self.font_family, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.font_family = d.font_family @@ -376,7 +376,7 @@ def test(): d.setLayout(QVBoxLayout()) d.layout().addWidget(FontFamilyChooser(d)) d.layout().addWidget(QFontComboBox(d)) - d.exec_() + d.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/html_transform_rules.py b/src/calibre/gui2/html_transform_rules.py index 61a41eff12..a5b5c0b7a3 100644 --- a/src/calibre/gui2/html_transform_rules.py +++ b/src/calibre/gui2/html_transform_rules.py @@ -375,7 +375,7 @@ if __name__ == '__main__': d.rules = [ {'match_type':'xpath', 'query':'//h:h2', 'actions':[{'type': 'remove'}]}, ] - d.exec_() + d.exec() from pprint import pprint pprint(d.rules) del d, app diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py index ca7adab498..7980548cd2 100644 --- a/src/calibre/gui2/icon_theme.py +++ b/src/calibre/gui2/icon_theme.py @@ -416,11 +416,11 @@ def create_theme(folder=None, parent=None): return report = read_theme_from_folder(folder) d = ThemeCreateDialog(parent, report) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return d.save_metadata() d = Compress(d.report, parent=parent) - d.exec_() + d.exec() if d.wasCanceled() or d.raw is None: return raw, prefix = d.raw, d.prefix @@ -798,7 +798,7 @@ class ChooseTheme(Dialog): t = Thread(name='DownloadIconTheme', target=download) t.daemon = True t.start() - ret = d.exec_() + ret = d.exec() if self.downloaded_theme and not isinstance(self.downloaded_theme, BytesIO): return error_dialog(self, _('Download failed'), _( @@ -880,6 +880,6 @@ if __name__ == '__main__': app = Application([]) # create_theme('.') d = ChooseTheme() - if d.exec_() == QDialog.DialogCode.Accepted and d.commit_changes is not None: + if d.exec() == QDialog.DialogCode.Accepted and d.commit_changes is not None: d.commit_changes() del app diff --git a/src/calibre/gui2/image_popup.py b/src/calibre/gui2/image_popup.py index ec78866a13..a3cf0d689b 100644 --- a/src/calibre/gui2/image_popup.py +++ b/src/calibre/gui2/image_popup.py @@ -256,7 +256,7 @@ class ImageView(QDialog): title = _('Image: {name} {resolution}').format(name=self.current_image_name, resolution=reso) self.setWindowTitle(title) if use_exec: - self.exec_() + self.exec() else: self.show() @@ -314,4 +314,4 @@ if __name__ == '__main__': u = QUrl.fromLocalFile(sys.argv[-1]) d = ImageView(None, p, u) d() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/init.py b/src/calibre/gui2/init.py index a3fa79e97e..102a9b85c4 100644 --- a/src/calibre/gui2/init.py +++ b/src/calibre/gui2/init.py @@ -541,7 +541,7 @@ class VLTabs(QTabBar): # {{{ m.addSeparator() m.addAction(_('Edit "%s"') % vln, partial(self.gui.do_create_edit, name=vl)) m.addAction(_('Delete "%s"') % vln, partial(self.gui.remove_vl_triggered, name=vl)) - m.exec_(ev.globalPos()) + m.exec(ev.globalPos()) def sort_alphabetically(self): self.current_db.new_api.set_pref('virt_libs_order', ()) @@ -705,7 +705,7 @@ class LayoutMixin: # {{{ identifiers = db.field_for('identifiers', book_id, default_value={}) from calibre.gui2.metadata.basic_widgets import Identifiers d = Identifiers(identifiers, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: identifiers = d.get_identifiers() db.set_field('identifiers', {book_id: identifiers}) self.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id}) diff --git a/src/calibre/gui2/jobs.py b/src/calibre/gui2/jobs.py index bcf8a1c093..013ad34833 100644 --- a/src/calibre/gui2/jobs.py +++ b/src/calibre/gui2/jobs.py @@ -308,10 +308,10 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{ def kill_job(self, job, view): if isinstance(job, DeviceJob): return error_dialog(view, _('Cannot kill job'), - _('Cannot kill jobs that communicate with the device')).exec_() + _('Cannot kill jobs that communicate with the device')).exec() if job.duration is not None: return error_dialog(view, _('Cannot kill job'), - _('Job has already run')).exec_() + _('Job has already run')).exec() if not getattr(job, 'killable', True): return error_dialog(view, _('Cannot kill job'), _('This job cannot be stopped'), show=True) @@ -321,7 +321,7 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{ devjobs = [j for j in jobs if isinstance(j, DeviceJob)] if devjobs: error_dialog(view, _('Cannot kill job'), - _('Cannot kill jobs that communicate with the device')).exec_() + _('Cannot kill jobs that communicate with the device')).exec() jobs = [j for j in jobs if not isinstance(j, DeviceJob)] jobs = [j for j in jobs if j.duration is None] unkillable = [j for j in jobs if not getattr(j, 'killable', True)] @@ -673,7 +673,7 @@ class JobsDialog(QDialog, Ui_JobsDialog): row = index.row() job = self.model.row_to_job(row) d = DetailView(self, job) - d.exec_() + d.exec() d.timer.stop() def show_details(self, *args): diff --git a/src/calibre/gui2/keyboard.py b/src/calibre/gui2/keyboard.py index 9477999427..34f04001ab 100644 --- a/src/calibre/gui2/keyboard.py +++ b/src/calibre/gui2/keyboard.py @@ -683,7 +683,7 @@ class ShortcutConfig(QWidget): # {{{ menu = QMenu(self) menu.addAction(_('Expand all'), self.view.expandAll) menu.addAction(_('Collapse all'), self.view.collapseAll) - menu.exec_(self.view.mapToGlobal(pos)) + menu.exec(self.view.mapToGlobal(pos)) def restore_defaults(self): self._model.restore_defaults() diff --git a/src/calibre/gui2/layout_menu.py b/src/calibre/gui2/layout_menu.py index 2d24ad71ce..702e3d2ac9 100644 --- a/src/calibre/gui2/layout_menu.py +++ b/src/calibre/gui2/layout_menu.py @@ -142,4 +142,4 @@ if __name__ == '__main__': app = Application([]) w = LayoutMenu() w.show() - w.exec_() + w.exec() diff --git a/src/calibre/gui2/library/alternate_views.py b/src/calibre/gui2/library/alternate_views.py index 575fec0261..a18c0c9db0 100644 --- a/src/calibre/gui2/library/alternate_views.py +++ b/src/calibre/gui2/library/alternate_views.py @@ -208,7 +208,7 @@ def mouseMoveEvent(self, event): if not index.isValid(): return drag = self.drag_data() - drag.exec_(Qt.DropAction.CopyAction) + drag.exec(Qt.DropAction.CopyAction) self.drag_start_pos = None diff --git a/src/calibre/gui2/library/annotations.py b/src/calibre/gui2/library/annotations.py index f53c398b11..08fcb2e6d6 100644 --- a/src/calibre/gui2/library/annotations.py +++ b/src/calibre/gui2/library/annotations.py @@ -376,7 +376,7 @@ class ResultsList(QTreeWidget): m.addSeparator() m.addAction(_('Expand all'), self.expandAll) m.addAction(_('Collapse all'), self.collapseAll) - m.exec_(self.mapToGlobal(pos)) + m.exec(self.mapToGlobal(pos)) def edit_notes(self, item): r = item.data(0, Qt.ItemDataRole.UserRole) @@ -998,7 +998,7 @@ class AnnotationsBrowser(Dialog): if not annots: return error_dialog(self, _('No selected annotations'), _( 'No annotations have been selected'), show=True) - Export(annots, self).exec_() + Export(annots, self).exec() def delete_annotations(self, ids): if confirm(ngettext( @@ -1019,7 +1019,7 @@ class AnnotationsBrowser(Dialog): 'Editing is only supported for the notes associated with highlights'), show=True) notes = annot.get('notes') d = EditNotes(notes, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: notes = d.notes if notes and notes.strip(): annot['notes'] = notes.strip() @@ -1032,7 +1032,7 @@ class AnnotationsBrowser(Dialog): def show_dialog(self, restrict_to_book_ids=None): if self.parent() is None: self.browse_panel.effective_query_changed() - self.exec_() + self.exec() else: self.reinitialize(restrict_to_book_ids) self.show() diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 1868a1f7e8..fbceda62a5 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -353,7 +353,7 @@ class CompleteDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{ if check_key_modifier(Qt.KeyboardModifier.ShiftModifier) and col != 'authors': key = col if m.is_custom_column(col) else None d = TagEditor(parent, self.db, m.id(index.row()), key=key) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: m.setData(index, self.sep.join(d.tags), Qt.ItemDataRole.EditRole) return None editor = EditWithComplete(parent) @@ -523,7 +523,7 @@ class CcLongTextDelegate(QStyledItemDelegate): # {{{ else: text = m.db.data[index.row()][m.custom_columns[col]['rec_index']] d = PlainTextDialog(parent, text, column_name=m.custom_columns[col]['name']) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: m.setData(index, d.text, Qt.ItemDataRole.EditRole) return None @@ -671,7 +671,7 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{ else: text = m.db.data[index.row()][m.custom_columns[col]['rec_index']] editor = CommentsDialog(parent, text, column_name=m.custom_columns[col]['name']) - d = editor.exec_() + d = editor.exec() if d: m.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole) return None @@ -758,7 +758,7 @@ class CcTemplateDelegate(QStyledItemDelegate): # {{{ editor.setWindowTitle(_("Edit template")) editor.textbox.setTabChangesFocus(False) editor.textbox.setTabStopWidth(20) - d = editor.exec_() + d = editor.exec() if d: m.setData(index, (editor.rule[1]), Qt.ItemDataRole.EditRole) return None diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 79c4969d1e..0278cfde71 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -1451,7 +1451,7 @@ class DeviceBooksView(BooksView): # {{{ def dropEvent(self, *args): error_dialog(self, _('Not allowed'), - _('Dropping onto a device is not supported. First add the book to the calibre library.')).exec_() + _('Dropping onto a device is not supported. First add the book to the calibre library.')).exec() def set_editable(self, editable, supports_backloading): self._model.set_editable(editable) diff --git a/src/calibre/gui2/linux_file_dialogs.py b/src/calibre/gui2/linux_file_dialogs.py index 00289ebeff..41572648d7 100644 --- a/src/calibre/gui2/linux_file_dialogs.py +++ b/src/calibre/gui2/linux_file_dialogs.py @@ -314,7 +314,7 @@ def linux_native_dialog(name): t = Thread(name='FileDialogHelper', target=r) t.daemon = True t.start() - loop.exec_(QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) + loop.exec(QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) if ret[1] is not None: reraise(*ret[1]) return ret[0] diff --git a/src/calibre/gui2/listener.py b/src/calibre/gui2/listener.py index 5d2005e2fb..d9ff5eae3f 100644 --- a/src/calibre/gui2/listener.py +++ b/src/calibre/gui2/listener.py @@ -141,7 +141,7 @@ def test(): s.message_received.connect(show_message) l.show() - app.exec_() + app.exec() del app diff --git a/src/calibre/gui2/lrf_renderer/main.py b/src/calibre/gui2/lrf_renderer/main.py index 3ccadde75e..88084f3692 100644 --- a/src/calibre/gui2/lrf_renderer/main.py +++ b/src/calibre/gui2/lrf_renderer/main.py @@ -111,7 +111,7 @@ class Main(MainWindow, Ui_MainWindow): def configure(self, triggered): opts = self.opts d = Config(self, opts) - d.exec_() + d.exec() if d.result() == QDialog.DialogCode.Accepted: gprefs['lrf_viewer_white_background'] = opts.white_background = bool(d.white_background.isChecked()) gprefs['lrf_viewer_hyphenate'] = opts.hyphenate = bool(d.hyphenate.isChecked()) @@ -156,7 +156,7 @@ class Main(MainWindow, Ui_MainWindow): try: self.document.search(search) except StopIteration: - error_dialog(self, _('No matches found'), _('No matches for the search phrase %s were found.')%(search,)).exec_() + error_dialog(self, _('No matches found'), _('No matches for the search phrase %s were found.')%(search,)).exec() self.search.search_done(True) def parsed(self): @@ -204,7 +204,7 @@ class Main(MainWindow, Ui_MainWindow): msg += '

Detailed traceback:

'
             msg += self.renderer.formatted_traceback + '
' d = ConversionErrorDialog(self, 'Error while rendering file', msg) - d.exec_() + d.exec() def chapter_rendered(self, num): if num > 0: @@ -317,7 +317,7 @@ def main(args=sys.argv, logger=None): main.render() main.activateWindow() main.raise_() - return app.exec_() + return app.exec() return 0 diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 45feca9b6a..5366104446 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -408,7 +408,7 @@ def run_gui_(opts, args, app, gui_debug=None): app.load_builtin_fonts(scan_for_fonts=True) if not dynamic.get('welcome_wizard_was_run', False): from calibre.gui2.wizard import wizard - wizard().exec_() + wizard().exec() dynamic.set('welcome_wizard_was_run', True) from calibre.gui2.ui import Main if ismacos: @@ -416,10 +416,10 @@ def run_gui_(opts, args, app, gui_debug=None): else: actions = tuple(Main.get_menubar_actions()) runner = GuiRunner(opts, args, actions, app, gui_debug=gui_debug) - ret = app.exec_() + ret = app.exec() if getattr(runner.main, 'run_wizard_b4_shutdown', False): from calibre.gui2.wizard import wizard - wizard().exec_() + wizard().exec() if getattr(runner.main, 'restart_after_quit', False): after_quit_actions['restart_after_quit'] = True after_quit_actions['debug_on_restart'] = getattr(runner.main, 'debug_on_restart', False) or gui_debug is not None diff --git a/src/calibre/gui2/metadata/basic_widgets.py b/src/calibre/gui2/metadata/basic_widgets.py index d81c0bbbb8..b393771818 100644 --- a/src/calibre/gui2/metadata/basic_widgets.py +++ b/src/calibre/gui2/metadata/basic_widgets.py @@ -68,7 +68,7 @@ def save_dialog(parent, title, msg, det_msg=''): d.setWindowTitle(title) d.setText(msg) d.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No | QMessageBox.StandardButton.Cancel) - return d.exec_() + return d.exec() def clean_text(x): @@ -372,7 +372,7 @@ class AuthorsEdit(EditWithComplete, ToMetadataMixin): current_authors = self.current_val from calibre.gui2.dialogs.authors_edit import AuthorsEdit d = AuthorsEdit(all_authors, current_authors, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.set_value(d.authors) def manage_authors(self): @@ -1053,7 +1053,7 @@ class FormatsManager(QWidget): fmt = self.formats.item(0) if fmt is None: error_dialog(self, _('No format selected'), - _('No format selected')).exec_() + _('No format selected')).exec() return None return fmt.ext.lower() @@ -1078,7 +1078,7 @@ class FormatsManager(QWidget): fmt = self.formats.item(0) if fmt is None: error_dialog(self, _('No format selected'), - _('No format selected')).exec_() + _('No format selected')).exec() return None, None ext = fmt.ext.lower() if fmt.path is None: @@ -1194,7 +1194,7 @@ class Cover(ImageView): # {{{ if not os.access(_file, os.R_OK): d = error_dialog(self, _('Cannot read'), _('You do not have permission to read the file: ') + _file) - d.exec_() + d.exec() return cover = None try: @@ -1204,7 +1204,7 @@ class Cover(ImageView): # {{{ d = error_dialog( self, _('Error reading file'), _("

There was an error reading from file:
") + _file + "


"+str(e)) - d.exec_() + d.exec() if cover: orig = self.current_val self.current_val = cover @@ -1234,7 +1234,7 @@ class Cover(ImageView): # {{{ cdata = self.current_val from calibre.gui2.dialogs.trim_image import TrimImage d = TrimImage(cdata, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted and d.image_data is not None: + if d.exec() == QDialog.DialogCode.Accepted and d.image_data is not None: self.current_val = d.image_data self.cdata_before_trim = cdata @@ -1249,7 +1249,7 @@ class Cover(ImageView): # {{{ from calibre.gui2.covers import CoverSettingsDialog mi = self.dialog.to_book_metadata() d = CoverSettingsDialog(mi=mi, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.current_val = generate_cover(mi, prefs=d.prefs_for_rendering) def set_pixmap_from_data(self, data): @@ -1456,7 +1456,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{ self.initialize(self.db, id_) else: d = TagEditor(self, db, id_) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.current_val = d.tags self.update_items_cache(db.new_api.all_field_names('tags')) @@ -1590,11 +1590,11 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): ac = m.addAction(_('Edit identifiers in a dedicated window'), self.edit_identifiers) m.insertAction(first, ac) m.insertSeparator(first) - m.exec_(ev.globalPos()) + m.exec(ev.globalPos()) def edit_identifiers(self): d = Identifiers(self.current_val, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.current_val = d.get_identifiers() @property @@ -1686,7 +1686,7 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin): text = str(QApplication.clipboard().text()).strip() if not text or not check_isbn(text): d = ISBNDialog(self, text) - if not d.exec_(): + if not d.exec(): return text = d.text() if not text: diff --git a/src/calibre/gui2/metadata/bulk_download.py b/src/calibre/gui2/metadata/bulk_download.py index 4709391aae..7eecda4d1e 100644 --- a/src/calibre/gui2/metadata/bulk_download.py +++ b/src/calibre/gui2/metadata/bulk_download.py @@ -128,7 +128,7 @@ def split_jobs(ids, batch_size=100): def start_download(gui, ids, callback, ensure_fields=None): d = ConfirmDialog(ids, gui) - ret = d.exec_() + ret = d.exec() d.b.clicked.disconnect() if ret != QDialog.DialogCode.Accepted: return diff --git a/src/calibre/gui2/metadata/diff.py b/src/calibre/gui2/metadata/diff.py index e819148813..decd939bc7 100644 --- a/src/calibre/gui2/metadata/diff.py +++ b/src/calibre/gui2/metadata/diff.py @@ -781,7 +781,7 @@ if __name__ == '__main__': gm = partial(db.get_metadata, index_is_id=True, get_cover=True, cover_as_data=True) get_metadata = lambda x:list(map(gm, ids[x])) d = CompareMany(list(range(len(ids))), get_metadata, db.field_metadata, db=db) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: for changed, mi in itervalues(d.accepted): if changed and mi is not None: print(mi) diff --git a/src/calibre/gui2/metadata/pdf_covers.py b/src/calibre/gui2/metadata/pdf_covers.py index 93c875cb21..286c0ab0fe 100644 --- a/src/calibre/gui2/metadata/pdf_covers.py +++ b/src/calibre/gui2/metadata/pdf_covers.py @@ -148,6 +148,6 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = PDFCovers(sys.argv[-1]) - d.exec_() + d.exec() print(d.cover_path) del app diff --git a/src/calibre/gui2/metadata/single.py b/src/calibre/gui2/metadata/single.py index 645972beab..39ecba793e 100644 --- a/src/calibre/gui2/metadata/single.py +++ b/src/calibre/gui2/metadata/single.py @@ -436,7 +436,7 @@ class MetadataSingleDialogBase(QDialog): 'pdf') from calibre.gui2.metadata.pdf_covers import PDFCovers d = PDFCovers(pdfpath, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: cpath = d.cover_path if cpath: with open(cpath, 'rb') as f: @@ -472,7 +472,7 @@ class MetadataSingleDialogBase(QDialog): cdata = mi.cover_data[1] if cdata is None: error_dialog(self, _('Could not read cover'), - _('Could not read cover from %s format')%ext.upper()).exec_() + _('Could not read cover from %s format')%ext.upper()).exec() return self.update_cover(cdata, ext) @@ -680,7 +680,7 @@ class MetadataSingleDialogBase(QDialog): self.edit_format.connect(edit_slot) self.set_current_callback = set_current_callback self.do_one(apply_changes=False) - ret = self.exec_() + ret = self.exec() self.break_cycles() return ret diff --git a/src/calibre/gui2/metadata/single_download.py b/src/calibre/gui2/metadata/single_download.py index 00a4d54403..98d4f04768 100644 --- a/src/calibre/gui2/metadata/single_download.py +++ b/src/calibre/gui2/metadata/single_download.py @@ -822,7 +822,7 @@ class CoversView(QListView): # {{{ m = QMenu(self) m.addAction(QIcon(I('view.png')), _('View this cover at full size'), self.show_cover) m.addAction(QIcon(I('edit-copy.png')), _('Copy this cover to clipboard'), self.copy_cover) - m.exec_(QCursor.pos()) + m.exec(QCursor.pos()) def show_cover(self): idx = self.currentIndex() @@ -1126,7 +1126,7 @@ class FullFetch(QDialog): # {{{ self.title, self.authors = title, authors self.identify_widget.start(title=title, authors=authors, identifiers=identifiers) - return self.exec_() + return self.exec() # }}} @@ -1182,7 +1182,7 @@ class CoverFetch(QDialog): # {{{ book.identifiers = identifiers self.covers_widget.start(book, self.current_cover, title, authors, {}) - return self.exec_() + return self.exec() def view_log(self): self._lv = LogViewer(self.log, self) diff --git a/src/calibre/gui2/open_with.py b/src/calibre/gui2/open_with.py index eb026d00e3..5857ff90db 100644 --- a/src/calibre/gui2/open_with.py +++ b/src/calibre/gui2/open_with.py @@ -358,7 +358,7 @@ def choose_program(file_type='jpeg', parent=None, prefs=oprefs): oft = file_type = file_type.lower() file_type = {'cover_image':'jpeg'}.get(oft, oft) d = ChooseProgram(file_type, parent, prefs) - d.exec_() + d.exec() entry = choose_manually(file_type, parent) if d.select_manually else d.selected_entry if entry is not None: entry = finalize_entry(entry) @@ -471,7 +471,7 @@ class EditPrograms(Dialog): # {{{ def edit_programs(file_type, parent): d = EditPrograms(file_type, parent) - d.exec_() + d.exec() # }}} diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 2e77dbd2ae..e7864eae97 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -391,7 +391,7 @@ def show_config_widget(category, name, gui=None, show_restart_msg=False, w.initialize() if geom is not None: QApplication.instance().safe_restore_geometry(d, geom) - d.exec_() + d.exec() geom = bytearray(d.saveGeometry()) gprefs[conf_name] = geom rr = getattr(d, 'restart_required', False) diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index c970630a73..b9bdb61c1d 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -65,7 +65,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): d = RulesDialog(self) if gprefs.get('tag_map_on_add_rules'): d.rules = gprefs['tag_map_on_add_rules'] - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.tag_map_rules = d.rules self.changed_signal.emit() @@ -74,7 +74,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): d = RulesDialog(self) if gprefs.get('author_map_on_add_rules'): d.rules = gprefs['author_map_on_add_rules'] - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.author_map_rules = d.rules self.changed_signal.emit() @@ -83,7 +83,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): d = RulesDialog(self) if gprefs.get('add_filter_rules'): d.rules = gprefs['add_filter_rules'] - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.add_filter_rules = d.rules self.changed_signal.emit() diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index 6ef600ad6d..78018a58b1 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -654,7 +654,7 @@ class RuleEditor(QDialog): # {{{ def remove_icon_file_dialog(self): d = RemoveIconFileDialog(self, self.icon_file_names, self.icon_folder) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: if len(d.files_to_remove) > 0: for name in d.files_to_remove: try: @@ -1141,7 +1141,7 @@ class EditRules(QWidget): # {{{ def add_rule(self): d = RuleEditor(self.model.fm, self.pref_name) d.add_blank_condition() - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: kind, col, r = d.rule if kind and r and col: selected_row = self.get_first_selected_row() @@ -1153,7 +1153,7 @@ class EditRules(QWidget): # {{{ selected_row = self.get_first_selected_row() if self.pref_name == 'column_color_rules': td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, color_field='') - if td.exec_() == QDialog.DialogCode.Accepted: + if td.exec() == QDialog.DialogCode.Accepted: col, r = td.rule if r and col: idx = self.model.add_rule('color', col, r, selected_row=selected_row) @@ -1164,7 +1164,7 @@ class EditRules(QWidget): # {{{ td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, doing_emblem=True) else: td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, icon_field_key='') - if td.exec_() == QDialog.DialogCode.Accepted: + if td.exec() == QDialog.DialogCode.Accepted: typ, col, r = td.rule if typ and r and col: idx = self.model.add_rule(typ, col, r, selected_row=selected_row) @@ -1187,7 +1187,7 @@ class EditRules(QWidget): # {{{ d = TemplateDialog(self, rule, mi=self.mi, fm=self.fm, icon_field_key=col, icon_rule_kind=kind) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: if len(d.rule) == 2: # Convert template dialog rules to a triple d.rule = ('color', d.rule[0], d.rule[1]) kind, col, r = d.rule @@ -1296,7 +1296,7 @@ if __name__ == '__main__': if False: d = RuleEditor(db.field_metadata, 'column_icon_rules') d.add_blank_condition() - d.exec_() + d.exec() kind, col, r = d.rule @@ -1308,5 +1308,5 @@ if __name__ == '__main__': d.resize(QSize(800, 600)) d.initialize(db.field_metadata, db.prefs, None, 'column_color_rules') d.show() - app.exec_() + app.exec() d.commit(db.prefs) diff --git a/src/calibre/gui2/preferences/create_custom_column.py b/src/calibre/gui2/preferences/create_custom_column.py index cb30a17544..961c7843ac 100644 --- a/src/calibre/gui2/preferences/create_custom_column.py +++ b/src/calibre/gui2/preferences/create_custom_column.py @@ -118,7 +118,7 @@ class CreateCustomColumn(QDialog): if not self.editing_col: self.datatype_changed() - self.exec_() + self.exec() return self.setWindowTitle(_('Edit custom column')) @@ -202,7 +202,7 @@ class CreateCustomColumn(QDialog): all_colors = [str(s) for s in list(QColor.colorNames())] self.enum_colors_label.setToolTip('

' + ', '.join(all_colors) + '

') - self.exec_() + self.exec() def shortcut_activated(self, url): # {{{ which = str(url).split(':')[-1] diff --git a/src/calibre/gui2/preferences/device_debug.py b/src/calibre/gui2/preferences/device_debug.py index 68cc7e67fe..9feb1db43a 100644 --- a/src/calibre/gui2/preferences/device_debug.py +++ b/src/calibre/gui2/preferences/device_debug.py @@ -69,4 +69,4 @@ class DebugDevice(QDialog): if __name__ == '__main__': app = QApplication([]) d = DebugDevice() - d.exec_() + d.exec() diff --git a/src/calibre/gui2/preferences/device_user_defined.py b/src/calibre/gui2/preferences/device_user_defined.py index 7399c19db9..d6d747e10b 100644 --- a/src/calibre/gui2/preferences/device_user_defined.py +++ b/src/calibre/gui2/preferences/device_user_defined.py @@ -17,7 +17,7 @@ def step_dialog(parent, title, msg, det_msg=''): d.setWindowTitle(title) d.setText(msg) d.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel) - return d.exec_() & QMessageBox.StandardButton.Cancel + return d.exec() & QMessageBox.StandardButton.Cancel class UserDefinedDevice(QDialog): @@ -96,4 +96,4 @@ class UserDefinedDevice(QDialog): if __name__ == '__main__': app = QApplication([]) d = UserDefinedDevice() - d.exec_() + d.exec() diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 4f1ef44478..7abed62287 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -210,7 +210,7 @@ class IdLinksEditor(Dialog): if r > -1: key, name, template = map(lambda c: self.table.item(r, c).text(), range(3)) d = IdLinksRuleEdit(key, name, template, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: if r < 0: self.table.setRowCount(self.table.rowCount() + 1) r = self.table.rowCount() - 1 @@ -594,14 +594,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def choose_icon_theme(self): from calibre.gui2.icon_theme import ChooseTheme d = ChooseTheme(self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.commit_icon_theme = d.commit_changes self.icon_theme_title = d.new_theme_title or _('Default icons') self.icon_theme.setText(_('Icon theme: %s') % self.icon_theme_title) self.changed_signal.emit() def edit_id_link_rules(self): - if IdLinksEditor(self).exec_() == QDialog.DialogCode.Accepted: + if IdLinksEditor(self).exec() == QDialog.DialogCode.Accepted: self.changed_signal.emit() @property @@ -636,7 +636,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def edit_cb_title_template(self): t = TemplateDialog(self, self.opt_cover_browser_title_template.text(), fm=self.gui.current_db.field_metadata) t.setWindowTitle(_('Edit template for caption')) - if t.exec_(): + if t.exec(): self.opt_cover_browser_title_template.setText(t.rule[1]) def initialize(self): @@ -733,7 +733,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def change_cover_grid_texture(self): from calibre.gui2.preferences.texture_chooser import TextureChooser d = TextureChooser(parent=self, initial=self.cg_bg_widget.btex) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.set_cg_texture(d.texture) self.changed_signal.emit() @@ -758,7 +758,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def change_font(self, *args): fd = QFontDialog(self.build_font_obj(), self) - if fd.exec_() == QDialog.DialogCode.Accepted: + if fd.exec() == QDialog.DialogCode.Accepted: font = fd.selectedFont() fi = QFontInfo(font) self.current_font = [str(fi.family()), fi.pointSize(), diff --git a/src/calibre/gui2/preferences/main.py b/src/calibre/gui2/preferences/main.py index ba4755a58e..b1371c2821 100644 --- a/src/calibre/gui2/preferences/main.py +++ b/src/calibre/gui2/preferences/main.py @@ -439,5 +439,5 @@ if __name__ == '__main__': gui = init_gui() p = Preferences(gui) - p.exec_() + p.exec() gui.shutdown() diff --git a/src/calibre/gui2/preferences/metadata_sources.py b/src/calibre/gui2/preferences/metadata_sources.py index 788bce125b..ff12e20ece 100644 --- a/src/calibre/gui2/preferences/metadata_sources.py +++ b/src/calibre/gui2/preferences/metadata_sources.py @@ -364,7 +364,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): d = RulesDialog(self) if msprefs.get('tag_map_rules'): d.rules = msprefs['tag_map_rules'] - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.tag_map_rules = d.rules self.changed_signal.emit() @@ -373,7 +373,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): d = RulesDialog(self) if msprefs.get('author_map_rules'): d.rules = msprefs['author_map_rules'] - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.author_map_rules = d.rules self.changed_signal.emit() diff --git a/src/calibre/gui2/preferences/misc.py b/src/calibre/gui2/preferences/misc.py index 894fd8e8e9..5064d49453 100644 --- a/src/calibre/gui2/preferences/misc.py +++ b/src/calibre/gui2/preferences/misc.py @@ -58,12 +58,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def debug_device_detection(self, *args): from calibre.gui2.preferences.device_debug import DebugDevice d = DebugDevice(self.gui, self) - d.exec_() + d.exec() def user_defined_device(self, *args): from calibre.gui2.preferences.device_user_defined import UserDefinedDevice d = UserDefinedDevice(self) - d.exec_() + d.exec() def open_config_dir(self, *args): from calibre.utils.config import config_dir diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py index 1baefbc577..eb55bcec5d 100644 --- a/src/calibre/gui2/preferences/plugins.py +++ b/src/calibre/gui2/preferences/plugins.py @@ -257,7 +257,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): menu = QMenu(self) menu.addAction(_('Expand all'), self.plugin_view.expandAll) menu.addAction(_('Collapse all'), self.plugin_view.collapseAll) - menu.exec_(self.plugin_view.mapToGlobal(pos)) + menu.exec(self.plugin_view.mapToGlobal(pos)) def show_user_installed_plugins(self, state): self._plugin_model.toggle_shown_plugins(self.user_installed_plugins.isChecked()) @@ -343,7 +343,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.highlight_index(idx) else: error_dialog(self, _('No valid plugin path'), - _('%s is not a valid plugin path')%path).exec_() + _('%s is not a valid plugin path')%path).exec() def modify_plugin(self, op=''): index = self.plugin_view.currentIndex() @@ -369,7 +369,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if op == 'customize': if not plugin.is_customizable(): info_dialog(self, _('Plugin not customizable'), - _('Plugin: %s does not need customization')%plugin.name).exec_() + _('Plugin: %s does not need customization')%plugin.name).exec() return self.changed_signal.emit() from calibre.customize import InterfaceActionBase @@ -399,7 +399,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): else: error_dialog(self, _('Cannot remove builtin plugin'), plugin.name + _(' cannot be removed. It is a ' - 'builtin plugin. Try disabling it instead.')).exec_() + 'builtin plugin. Try disabling it instead.')).exec() def get_plugins(self): self.update_plugins(not_installed=True) @@ -409,7 +409,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): FILTER_UPDATE_AVAILABLE, FILTER_NOT_INSTALLED) mode = FILTER_NOT_INSTALLED if not_installed else FILTER_UPDATE_AVAILABLE d = PluginUpdaterDialog(self.gui, initial_filter=mode) - d.exec_() + d.exec() self._plugin_model.beginResetModel() self._plugin_model.populate() self._plugin_model.endResetModel() @@ -459,7 +459,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): from calibre.gui2.dialogs.choose_plugin_toolbars import ChoosePluginToolbarsDialog d = ChoosePluginToolbarsDialog(self, plugin_action, allowed_locations) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: for key, text in d.selected_locations(): installed_actions = list(gprefs.get('action-layout-'+key, [])) installed_actions.append(plugin_action.name) diff --git a/src/calibre/gui2/preferences/save_template.py b/src/calibre/gui2/preferences/save_template.py index d83e95c889..93a3d701e9 100644 --- a/src/calibre/gui2/preferences/save_template.py +++ b/src/calibre/gui2/preferences/save_template.py @@ -52,7 +52,7 @@ class SaveTemplate(QWidget, Ui_Form): def do_open_editor(self): t = TemplateDialog(self, self.opt_template.text(), fm=self.field_metadata) t.setWindowTitle(_('Edit template')) - if t.exec_(): + if t.exec(): self.opt_template.set_value(t.rule[1]) def changed(self, *args): diff --git a/src/calibre/gui2/preferences/server.py b/src/calibre/gui2/preferences/server.py index 7a361f35fd..80d1684bc0 100644 --- a/src/calibre/gui2/preferences/server.py +++ b/src/calibre/gui2/preferences/server.py @@ -740,7 +740,7 @@ class User(QWidget): def change_password(self): d = NewUser(self.user_data, self, self.username) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.user_data[self.username]['pw'] = d.password self.changed_signal.emit() @@ -797,7 +797,7 @@ class User(QWidget): self.user_data[self.username]['restriction'].copy(), parent=self ) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.user_data[self.username]['restriction'] = d.restriction self.update_restriction() self.changed_signal.emit() @@ -861,7 +861,7 @@ class Users(QWidget): def add_user(self): d = NewUser(self.user_data, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: un, pw = d.username, d.password self.user_data[un] = create_user_data(pw) self.user_list.insertItem(0, un) @@ -1273,7 +1273,7 @@ class ConfigWidget(ConfigWidgetBase): self, _('Failed to start Content server'), as_unicode(self.gui.content_server.exception) - ).exec_() + ).exec() self.gui.content_server = None return self.main_tab.update_button_state() @@ -1289,7 +1289,7 @@ class ConfigWidget(ConfigWidgetBase): show_copy_button=False ) QTimer.singleShot(500, self.check_exited) - self.stopping_msg.exec_() + self.stopping_msg.exec() def check_exited(self): if getattr(self.server, 'is_running', False): diff --git a/src/calibre/gui2/preferences/template_functions.py b/src/calibre/gui2/preferences/template_functions.py index 7532c7e83d..9baa5f053d 100644 --- a/src/calibre/gui2/preferences/template_functions.py +++ b/src/calibre/gui2/preferences/template_functions.py @@ -281,7 +281,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): show=False, show_copy_button=False) box.bb.setStandardButtons(box.bb.standardButtons() | QDialogButtonBox.StandardButton.Cancel) box.det_msg_toggle.setVisible(False) - if not box.exec_(): + if not box.exec(): return try: prog = str(self.program.toPlainText()) @@ -350,7 +350,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): mi=self.mi, fm=self.fm, text_is_placeholder=self.st_first_time, all_functions=all_funcs) t.setWindowTitle(_('Template tester')) - if t.exec_() == QDialog.DialogCode.Accepted: + if t.exec() == QDialog.DialogCode.Accepted: self.st_previous_text = t.rule[1] self.st_first_time = False else: @@ -432,7 +432,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): box.bb.setStandardButtons(box.bb.standardButtons() | QDialogButtonBox.StandardButton.Cancel) box.det_msg_toggle.setVisible(False) - if not box.exec_(): + if not box.exec(): self.te_name.blockSignals(True) dex = self.te_name.findText(self.st_current_program_name) self.te_name.setCurrentIndex(dex) diff --git a/src/calibre/gui2/preferences/texture_chooser.py b/src/calibre/gui2/preferences/texture_chooser.py index f472daa233..c29c2bd33a 100644 --- a/src/calibre/gui2/preferences/texture_chooser.py +++ b/src/calibre/gui2/preferences/texture_chooser.py @@ -152,5 +152,5 @@ class TextureChooser(QDialog): if __name__ == '__main__': app = QApplication([]) # noqa d = TextureChooser() - d.exec_() + d.exec() print(d.texture) diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index f3439b1b61..ca06fc6dc5 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -492,7 +492,7 @@ class ConfigWidget(ConfigWidgetBase): def plugin_tweaks(self): raw = self.tweaks.plugin_tweaks_string d = PluginTweaks(raw, self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: g, l = {}, {} try: exec(str(d.edit.toPlainText()), g, l) diff --git a/src/calibre/gui2/proceed.py b/src/calibre/gui2/proceed.py index 6154b9315a..c8c98322d6 100644 --- a/src/calibre/gui2/proceed.py +++ b/src/calibre/gui2/proceed.py @@ -422,7 +422,7 @@ def main(): det_msg='details shown first, with a long line to test wrapping of text and width layout', show_det=True, show_ok=True) QTimer.singleShot(10, doit) - app.exec_() + app.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/progress_indicator/__init__.py b/src/calibre/gui2/progress_indicator/__init__.py index 873117bc1c..a5fb3cf951 100644 --- a/src/calibre/gui2/progress_indicator/__init__.py +++ b/src/calibre/gui2/progress_indicator/__init__.py @@ -144,7 +144,7 @@ def develop(): w = Widget() l.addWidget(w) w.a.start() - d.exec_() + d.exec() del d del app @@ -158,6 +158,6 @@ if __name__ == '__main__': l = QVBoxLayout(d) l.addWidget(w) w.start() - d.exec_() + d.exec() del d del app diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index e1388191e2..33c103b8b7 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -65,7 +65,7 @@ class SearchLineEdit(QLineEdit): # {{{ if url: menu.addAction(_('Copy search as URL'), lambda : QApplication.clipboard().setText(url)) menu.addAction(_('&Clear search history')).triggered.connect(self.clear_history) - menu.exec_(ev.globalPos()) + menu.exec(ev.globalPos()) def paste_and_search(self): self.paste() @@ -532,7 +532,7 @@ class SearchBoxMixin: # {{{ def do_advanced_search(self, *args): d = SearchDialog(self, self.library_view.model().db) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.search.set_search_string(d.search_string(), store_in_history=True) def do_search_button(self): @@ -604,7 +604,7 @@ class SavedSearchBoxMixin: # {{{ def do_saved_search_edit(self, search): d = SavedSearchEditor(self, search) - d.exec_() + d.exec() if d.result() == QDialog.DialogCode.Accepted: self.do_rebuild_saved_searches() @@ -615,7 +615,7 @@ class SavedSearchBoxMixin: # {{{ def add_saved_search(self): from calibre.gui2.dialogs.saved_search_editor import AddSavedSearch d = AddSavedSearch(parent=self, search=self.search.current_text) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.current_db.new_api.ensure_has_search_category(fail_on_existing=False) self.do_rebuild_saved_searches() diff --git a/src/calibre/gui2/search_restriction_mixin.py b/src/calibre/gui2/search_restriction_mixin.py index 091303c94e..263ab8b660 100644 --- a/src/calibre/gui2/search_restriction_mixin.py +++ b/src/calibre/gui2/search_restriction_mixin.py @@ -245,7 +245,7 @@ class CreateVirtualLibrary(QDialog): # {{{ else: names = getattr(db, 'all_%s_names'%f)() d = SelectNames(names, txt, parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: prefix = f+'s' if f in {'tag', 'author'} else f if f == 'search': search = ['(%s)'%(db.saved_search_lookup(x)) for x in d.names] @@ -358,7 +358,7 @@ class SearchRestrictionMixin: db = self.library_view.model().db virt_libs = db.new_api.pref('virtual_libraries', {}) cd = CreateVirtualLibrary(self, virt_libs.keys(), editing=name) - if cd.exec_() == QDialog.DialogCode.Accepted: + if cd.exec() == QDialog.DialogCode.Accepted: if name: self._remove_vl(name, reapply=False) self.add_virtual_library(db, cd.library_name, cd.library_search) @@ -521,7 +521,7 @@ class SearchRestrictionMixin: d = QuickOpen( sorted(virt_libs.keys(), key=sort_key), parent=self, title=_('Choose Virtual library'), name='vl-open', level1=' ', help_text=help_text) - if d.exec_() == QDialog.DialogCode.Accepted and d.selected_result: + if d.exec() == QDialog.DialogCode.Accepted and d.selected_result: self.apply_virtual_library(library=d.selected_result) def _remove_vl(self, name, reapply=True): @@ -672,4 +672,4 @@ if __name__ == '__main__': app gui = init_gui() d = CreateVirtualLibrary(gui, []) - d.exec_() + d.exec() diff --git a/src/calibre/gui2/shortcuts.py b/src/calibre/gui2/shortcuts.py index 2a61f14afd..87975e4fc0 100644 --- a/src/calibre/gui2/shortcuts.py +++ b/src/calibre/gui2/shortcuts.py @@ -318,4 +318,4 @@ if __name__ == '__main__': conf = ShortcutConfig(model) conf.resize(400, 500) conf.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/splash_screen.py b/src/calibre/gui2/splash_screen.py index 1c17122710..e700ea20ea 100644 --- a/src/calibre/gui2/splash_screen.py +++ b/src/calibre/gui2/splash_screen.py @@ -123,7 +123,7 @@ def main(): spl = SplashScreen(develop=True) spl.show() spl.show_message('Testing the splash screen message...') - app.exec_() + app.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/store/config/chooser/chooser_widget.py b/src/calibre/gui2/store/config/chooser/chooser_widget.py index 3bbcb805cb..be7bd72eed 100644 --- a/src/calibre/gui2/store/config/chooser/chooser_widget.py +++ b/src/calibre/gui2/store/config/chooser/chooser_widget.py @@ -34,5 +34,5 @@ class StoreChooserWidget(QWidget, Ui_Form): def build_adv_search(self): adv = AdvSearchBuilderDialog(self) - if adv.exec_() == QDialog.DialogCode.Accepted: + if adv.exec() == QDialog.DialogCode.Accepted: self.query.setText(adv.search_string()) diff --git a/src/calibre/gui2/store/config/chooser/results_view.py b/src/calibre/gui2/store/config/chooser/results_view.py index a1b4c0ee8c..e8c9dcb71e 100644 --- a/src/calibre/gui2/store/config/chooser/results_view.py +++ b/src/calibre/gui2/store/config/chooser/results_view.py @@ -49,7 +49,7 @@ class ResultsView(QTreeView): ca = menu.addAction(_('Configure...'), partial(self.configure_plugin, plugin)) if not plugin.is_customizable(): ca.setEnabled(False) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) def configure_plugin(self, plugin): plugin.do_user_config(self) diff --git a/src/calibre/gui2/store/opensearch_store.py b/src/calibre/gui2/store/opensearch_store.py index 24dbcc51ad..16561b28ef 100644 --- a/src/calibre/gui2/store/opensearch_store.py +++ b/src/calibre/gui2/store/opensearch_store.py @@ -96,7 +96,7 @@ class OpenSearchOPDSStore(StorePlugin): d = WebStoreDialog(self.gui, self.web_url, parent, detail_item, create_browser=self.create_browser) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): if not getattr(self, 'open_search_url', None): diff --git a/src/calibre/gui2/store/search/results_view.py b/src/calibre/gui2/store/search/results_view.py index 162102833f..b3892e09b6 100644 --- a/src/calibre/gui2/store/search/results_view.py +++ b/src/calibre/gui2/store/search/results_view.py @@ -70,4 +70,4 @@ class ResultsView(QTreeView): da.setEnabled(False) menu.addSeparator() menu.addAction(_('Goto in store...'), partial(self.open_requested.emit, result)) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) diff --git a/src/calibre/gui2/store/search/search.py b/src/calibre/gui2/store/search/search.py index 20a013ba18..10077c3355 100644 --- a/src/calibre/gui2/store/search/search.py +++ b/src/calibre/gui2/store/search/search.py @@ -138,7 +138,7 @@ class SearchDialog(QDialog, Ui_Dialog): def build_adv_search(self): adv = AdvSearchBuilderDialog(self) - if adv.exec_() == QDialog.DialogCode.Accepted: + if adv.exec() == QDialog.DialogCode.Accepted: self.search_edit.setText(adv.search_string()) def resize_columns(self): @@ -340,7 +340,7 @@ class SearchDialog(QDialog, Ui_Dialog): tab_index = min(tab_index, tab_widget.count() - 1) tab_widget.setCurrentIndex(tab_index) - d.exec_() + d.exec() # Save dialog state. self.config['config_dialog_geometry'] = bytearray(d.saveGeometry()) @@ -393,7 +393,7 @@ class SearchDialog(QDialog, Ui_Dialog): def download_book(self, result): d = ChooseFormatDialog(self, _('Choose format to download to your library.'), list(result.downloads.keys())) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: ext = d.format() fname = result.title[:60] + '.' + ext.lower() fname = ascii_filename(fname) @@ -434,10 +434,11 @@ class SearchDialog(QDialog, Ui_Dialog): self.cache_pool.abort() self.save_state() - def exec_(self): + def exec(self): if str(self.search_edit.text()).strip() or str(self.search_title.text()).strip() or str(self.search_author.text()).strip(): self.do_search() - return QDialog.exec_(self) + return QDialog.exec(self) + exec_ = exec if __name__ == '__main__': @@ -449,4 +450,4 @@ if __name__ == '__main__': gui = init_gui() s = SearchDialog(gui, query=' '.join(sys.argv[1:])) - s.exec_() + s.exec() diff --git a/src/calibre/gui2/store/stores/baen_webscription_plugin.py b/src/calibre/gui2/store/stores/baen_webscription_plugin.py index 785e211e1e..d56b7243e9 100644 --- a/src/calibre/gui2/store/stores/baen_webscription_plugin.py +++ b/src/calibre/gui2/store/stores/baen_webscription_plugin.py @@ -85,7 +85,7 @@ class BaenWebScriptionStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item or url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): for result in search(query, max_results, timeout): diff --git a/src/calibre/gui2/store/stores/beam_ebooks_de_plugin.py b/src/calibre/gui2/store/stores/beam_ebooks_de_plugin.py index dca47bfa6a..1875e890fe 100644 --- a/src/calibre/gui2/store/stores/beam_ebooks_de_plugin.py +++ b/src/calibre/gui2/store/stores/beam_ebooks_de_plugin.py @@ -41,7 +41,7 @@ class BeamEBooksDEStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'https://www.beam-shop.de/search?saltFieldLimitation=all&sSearch=' + quote(query) diff --git a/src/calibre/gui2/store/stores/biblio_plugin.py b/src/calibre/gui2/store/stores/biblio_plugin.py index c59b67cfc8..63e7096857 100644 --- a/src/calibre/gui2/store/stores/biblio_plugin.py +++ b/src/calibre/gui2/store/stores/biblio_plugin.py @@ -33,7 +33,7 @@ class BiblioStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, self.web_url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): if isinstance(query, bytes): diff --git a/src/calibre/gui2/store/stores/bn_plugin.py b/src/calibre/gui2/store/stores/bn_plugin.py index fcdcfa0656..a8f0a4e5f3 100644 --- a/src/calibre/gui2/store/stores/bn_plugin.py +++ b/src/calibre/gui2/store/stores/bn_plugin.py @@ -37,7 +37,7 @@ class BNStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.barnesandnoble.com/s/%s?keyword=%s&store=ebook&view=list' % (query.decode('utf-8').replace(' ', '-'), quote_plus(query)) diff --git a/src/calibre/gui2/store/stores/bubok_portugal_plugin.py b/src/calibre/gui2/store/stores/bubok_portugal_plugin.py index dced5e721b..603afda8b1 100644 --- a/src/calibre/gui2/store/stores/bubok_portugal_plugin.py +++ b/src/calibre/gui2/store/stores/bubok_portugal_plugin.py @@ -35,7 +35,7 @@ class BubokPortugalStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.bubok.pt/resellers/calibre_search/' + quote_plus(query) diff --git a/src/calibre/gui2/store/stores/bubok_publishing_plugin.py b/src/calibre/gui2/store/stores/bubok_publishing_plugin.py index 281b3e1130..5d9da5b50d 100644 --- a/src/calibre/gui2/store/stores/bubok_publishing_plugin.py +++ b/src/calibre/gui2/store/stores/bubok_publishing_plugin.py @@ -35,7 +35,7 @@ class BubokPublishingStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.bubok.es/resellers/calibre_search/' + quote_plus(query) diff --git a/src/calibre/gui2/store/stores/chitanka_plugin.py b/src/calibre/gui2/store/stores/chitanka_plugin.py index 7e891babf6..27da2ef28c 100644 --- a/src/calibre/gui2/store/stores/chitanka_plugin.py +++ b/src/calibre/gui2/store/stores/chitanka_plugin.py @@ -81,7 +81,7 @@ class ChitankaStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): if isinstance(query, bytes): diff --git a/src/calibre/gui2/store/stores/ebook_nl_plugin.py b/src/calibre/gui2/store/stores/ebook_nl_plugin.py index 9ce643e073..8a3e053d25 100644 --- a/src/calibre/gui2/store/stores/ebook_nl_plugin.py +++ b/src/calibre/gui2/store/stores/ebook_nl_plugin.py @@ -42,7 +42,7 @@ class EBookNLStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = ('http://www.ebook.nl/store/advanced_search_result.php?keywords=' + quote(query)) diff --git a/src/calibre/gui2/store/stores/ebookpoint_plugin.py b/src/calibre/gui2/store/stores/ebookpoint_plugin.py index fe3dbf7c5d..3a9c557f45 100644 --- a/src/calibre/gui2/store/stores/ebookpoint_plugin.py +++ b/src/calibre/gui2/store/stores/ebookpoint_plugin.py @@ -55,7 +55,7 @@ class EbookpointStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=25, timeout=60): url = 'http://ebookpoint.pl/search?qa=&szukaj=' + quote_plus( diff --git a/src/calibre/gui2/store/stores/ebooks_com_plugin.py b/src/calibre/gui2/store/stores/ebooks_com_plugin.py index 8ff23b9de2..f82ff0c902 100644 --- a/src/calibre/gui2/store/stores/ebooks_com_plugin.py +++ b/src/calibre/gui2/store/stores/ebooks_com_plugin.py @@ -44,7 +44,7 @@ class EbookscomStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.ebooks.com/SearchApp/SearchResults.net?term=' + quote_plus(query) diff --git a/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py b/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py index b6522537db..9fd8cbebdf 100644 --- a/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py +++ b/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py @@ -42,7 +42,7 @@ class EBookShoppeUKStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.ebookshoppe.com/search.php?search_query=' + quote(query) diff --git a/src/calibre/gui2/store/stores/empik_plugin.py b/src/calibre/gui2/store/stores/empik_plugin.py index 914e63c1e1..8a2c4c5008 100644 --- a/src/calibre/gui2/store/stores/empik_plugin.py +++ b/src/calibre/gui2/store/stores/empik_plugin.py @@ -54,7 +54,7 @@ class EmpikStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'https://www.empik.com/ebooki/ebooki,3501,s?sort=scoreDesc&resultsPP={}&q={}'.format(max_results, quote(query)) diff --git a/src/calibre/gui2/store/stores/google_books_plugin.py b/src/calibre/gui2/store/stores/google_books_plugin.py index b2682b4a4e..f81ca04099 100644 --- a/src/calibre/gui2/store/stores/google_books_plugin.py +++ b/src/calibre/gui2/store/stores/google_books_plugin.py @@ -88,7 +88,7 @@ class GoogleBooksStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): for result in search_google(query, max_results=max_results, timeout=timeout): diff --git a/src/calibre/gui2/store/stores/gutenberg_plugin.py b/src/calibre/gui2/store/stores/gutenberg_plugin.py index 93d7b3383d..403d214614 100644 --- a/src/calibre/gui2/store/stores/gutenberg_plugin.py +++ b/src/calibre/gui2/store/stores/gutenberg_plugin.py @@ -95,7 +95,7 @@ class GutenbergStore(StorePlugin): return d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) - d.exec_() + d.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/store/stores/kobo_plugin.py b/src/calibre/gui2/store/stores/kobo_plugin.py index ff922a9c06..4eb40be013 100644 --- a/src/calibre/gui2/store/stores/kobo_plugin.py +++ b/src/calibre/gui2/store/stores/kobo_plugin.py @@ -107,7 +107,7 @@ class KoboStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, murl, parent, purl) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): for result in search_kobo(query, max_results=max_results, timeout=timeout): diff --git a/src/calibre/gui2/store/stores/legimi_plugin.py b/src/calibre/gui2/store/stores/legimi_plugin.py index c3d41c0870..d71925c036 100644 --- a/src/calibre/gui2/store/stores/legimi_plugin.py +++ b/src/calibre/gui2/store/stores/legimi_plugin.py @@ -54,7 +54,7 @@ class LegimiStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'https://www.legimi.pl/ebooki/?sort=score&searchphrase=' + quote_plus(query) diff --git a/src/calibre/gui2/store/stores/libri_de_plugin.py b/src/calibre/gui2/store/stores/libri_de_plugin.py index 701844674b..e7fbcf7398 100644 --- a/src/calibre/gui2/store/stores/libri_de_plugin.py +++ b/src/calibre/gui2/store/stores/libri_de_plugin.py @@ -43,7 +43,7 @@ class LibreDEStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = ('http://www.ebook.de/de/pathSearch?nav=52122&searchString=' + quote(query)) diff --git a/src/calibre/gui2/store/stores/litres_plugin.py b/src/calibre/gui2/store/stores/litres_plugin.py index 16c38806c3..5fb5310870 100644 --- a/src/calibre/gui2/store/stores/litres_plugin.py +++ b/src/calibre/gui2/store/stores/litres_plugin.py @@ -48,7 +48,7 @@ class LitResStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): search_url = u'http://robot.litres.ru/pages/catalit_browser/?checkpoint=2000-01-02&'\ diff --git a/src/calibre/gui2/store/stores/mills_boon_uk_plugin.py b/src/calibre/gui2/store/stores/mills_boon_uk_plugin.py index 1f65c9e708..6ab36e07c3 100644 --- a/src/calibre/gui2/store/stores/mills_boon_uk_plugin.py +++ b/src/calibre/gui2/store/stores/mills_boon_uk_plugin.py @@ -42,7 +42,7 @@ class MillsBoonUKStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): base_url = 'https://www.millsandboon.co.uk' diff --git a/src/calibre/gui2/store/stores/mobileread/cache_progress_dialog.py b/src/calibre/gui2/store/stores/mobileread/cache_progress_dialog.py index b8baff7360..bf3fa4017c 100644 --- a/src/calibre/gui2/store/stores/mobileread/cache_progress_dialog.py +++ b/src/calibre/gui2/store/stores/mobileread/cache_progress_dialog.py @@ -24,10 +24,11 @@ class CacheProgressDialog(QDialog, Ui_Dialog): self.progress.setMinimum(0) self.progress.setMaximum(total if total else 0) - def exec_(self): + def exec(self): self.completed = 0 self.canceled = False - QDialog.exec_(self) + QDialog.exec(self) + exec_ = exec def open(self): self.completed = 0 diff --git a/src/calibre/gui2/store/stores/mobileread/mobileread_plugin.py b/src/calibre/gui2/store/stores/mobileread/mobileread_plugin.py index d9c3e87dc0..470239ecdd 100644 --- a/src/calibre/gui2/store/stores/mobileread/mobileread_plugin.py +++ b/src/calibre/gui2/store/stores/mobileread/mobileread_plugin.py @@ -49,12 +49,12 @@ class MobileReadStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() else: self.update_cache(parent, 30) d = MobileReadStoreDialog(self, parent) d.setWindowTitle(self.name) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): books = self.get_book_list() diff --git a/src/calibre/gui2/store/stores/mobileread/store_dialog.py b/src/calibre/gui2/store/stores/mobileread/store_dialog.py index 7303fb3a86..15531cd1c8 100644 --- a/src/calibre/gui2/store/stores/mobileread/store_dialog.py +++ b/src/calibre/gui2/store/stores/mobileread/store_dialog.py @@ -52,7 +52,7 @@ class MobileReadStoreDialog(QDialog, Ui_Dialog): def build_adv_search(self): adv = AdvSearchBuilderDialog(self) - if adv.exec_() == QDialog.DialogCode.Accepted: + if adv.exec() == QDialog.DialogCode.Accepted: self.search_query.setText(adv.search_string()) def restore_state(self): diff --git a/src/calibre/gui2/store/stores/nexto_plugin.py b/src/calibre/gui2/store/stores/nexto_plugin.py index 3199787d8d..379e1689ff 100644 --- a/src/calibre/gui2/store/stores/nexto_plugin.py +++ b/src/calibre/gui2/store/stores/nexto_plugin.py @@ -58,7 +58,7 @@ class NextoStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + quote_plus(query) + '&scid=1015' diff --git a/src/calibre/gui2/store/stores/ozon_ru_plugin.py b/src/calibre/gui2/store/stores/ozon_ru_plugin.py index c3afbe1cb5..57fc4123fc 100644 --- a/src/calibre/gui2/store/stores/ozon_ru_plugin.py +++ b/src/calibre/gui2/store/stores/ozon_ru_plugin.py @@ -70,7 +70,7 @@ class OzonRUStore(StorePlugin): d = WebStoreDialog(self.gui, shop_url, parent, url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=15, timeout=60): for s in search(query, max_results=max_results, timeout=timeout): diff --git a/src/calibre/gui2/store/stores/publio_plugin.py b/src/calibre/gui2/store/stores/publio_plugin.py index 496ffa86d5..b351590ae4 100644 --- a/src/calibre/gui2/store/stores/publio_plugin.py +++ b/src/calibre/gui2/store/stores/publio_plugin.py @@ -53,7 +53,7 @@ class PublioStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=20, timeout=60): diff --git a/src/calibre/gui2/store/stores/rw2010_plugin.py b/src/calibre/gui2/store/stores/rw2010_plugin.py index f57af28270..ae9173ee30 100644 --- a/src/calibre/gui2/store/stores/rw2010_plugin.py +++ b/src/calibre/gui2/store/stores/rw2010_plugin.py @@ -37,7 +37,7 @@ class RW2010Store(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://www.rw2010.pl/go.live.php/?launch_macro=catalogue-search-rd' diff --git a/src/calibre/gui2/store/stores/smashwords_plugin.py b/src/calibre/gui2/store/stores/smashwords_plugin.py index a27597882a..4c0da7feea 100644 --- a/src/calibre/gui2/store/stores/smashwords_plugin.py +++ b/src/calibre/gui2/store/stores/smashwords_plugin.py @@ -102,7 +102,7 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): for a in search(query, max_results=max_results, timeout=timeout): diff --git a/src/calibre/gui2/store/stores/swiatebookow_plugin.py b/src/calibre/gui2/store/stores/swiatebookow_plugin.py index b67adf5d4f..2e863a36ad 100644 --- a/src/calibre/gui2/store/stores/swiatebookow_plugin.py +++ b/src/calibre/gui2/store/stores/swiatebookow_plugin.py @@ -54,7 +54,7 @@ class SwiatEbookowStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): diff --git a/src/calibre/gui2/store/stores/virtualo_plugin.py b/src/calibre/gui2/store/stores/virtualo_plugin.py index 4ddf691471..ba89460bf4 100644 --- a/src/calibre/gui2/store/stores/virtualo_plugin.py +++ b/src/calibre/gui2/store/stores/virtualo_plugin.py @@ -55,7 +55,7 @@ class VirtualoStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=12, timeout=60): url = 'http://virtualo.pl/?q=' + quote(query) diff --git a/src/calibre/gui2/store/stores/weightless_books_plugin.py b/src/calibre/gui2/store/stores/weightless_books_plugin.py index c6215b85ba..55adb42b7c 100644 --- a/src/calibre/gui2/store/stores/weightless_books_plugin.py +++ b/src/calibre/gui2/store/stores/weightless_books_plugin.py @@ -36,7 +36,7 @@ class WeightlessBooksStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_item) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'http://weightlessbooks.com/?s=' + quote_plus(query) diff --git a/src/calibre/gui2/store/stores/whsmith_uk_plugin.py b/src/calibre/gui2/store/stores/whsmith_uk_plugin.py index 655ab29ec3..e22ce6e6f2 100644 --- a/src/calibre/gui2/store/stores/whsmith_uk_plugin.py +++ b/src/calibre/gui2/store/stores/whsmith_uk_plugin.py @@ -42,7 +42,7 @@ class WHSmithUKStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = ('https://www.whsmith.co.uk/search?keywordCategoryId=wc_dept_ebooks&results=60' diff --git a/src/calibre/gui2/store/stores/woblink_plugin.py b/src/calibre/gui2/store/stores/woblink_plugin.py index 027ecbfdd9..50aff52a54 100644 --- a/src/calibre/gui2/store/stores/woblink_plugin.py +++ b/src/calibre/gui2/store/stores/woblink_plugin.py @@ -103,7 +103,7 @@ class WoblinkStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url if detail_url else aff_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): for s in search(query, max_results, timeout): diff --git a/src/calibre/gui2/store/stores/wolnelektury_plugin.py b/src/calibre/gui2/store/stores/wolnelektury_plugin.py index a912595a32..cae75f1ff1 100644 --- a/src/calibre/gui2/store/stores/wolnelektury_plugin.py +++ b/src/calibre/gui2/store/stores/wolnelektury_plugin.py @@ -41,7 +41,7 @@ class WolneLekturyStore(BasicStoreConfig, StorePlugin): d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) - d.exec_() + d.exec() def search(self, query, max_results=10, timeout=60): url = 'https://wolnelektury.pl/szukaj?q=' + quote_plus(query) diff --git a/src/calibre/gui2/store/web_store.py b/src/calibre/gui2/store/web_store.py index 94533ec7c3..777ea37f57 100644 --- a/src/calibre/gui2/store/web_store.py +++ b/src/calibre/gui2/store/web_store.py @@ -242,7 +242,7 @@ def main(args): app = Application(args, override_program_name=override) m = Main(data) m.show(), m.raise_() - app.exec_() + app.exec() del m del app diff --git a/src/calibre/gui2/store/web_store_dialog.py b/src/calibre/gui2/store/web_store_dialog.py index 7a34de6146..43a6adc779 100644 --- a/src/calibre/gui2/store/web_store_dialog.py +++ b/src/calibre/gui2/store/web_store_dialog.py @@ -28,7 +28,7 @@ class WebStoreDialog: def set_tags(self, tags): self.tags = tags - def exec_(self): + def exec(self): data = { 'base_url': self.base_url, 'detail_url': self.detail_url, @@ -44,3 +44,4 @@ class WebStoreDialog: data = data.decode('ascii') args = ['store-dialog', data] self.gui.job_manager.launch_gui_app(args[0], kwargs={'args': args}) + exec_ = exec diff --git a/src/calibre/gui2/tag_browser/ui.py b/src/calibre/gui2/tag_browser/ui.py index 6c6b65b2f5..15dc5e408d 100644 --- a/src/calibre/gui2/tag_browser/ui.py +++ b/src/calibre/gui2/tag_browser/ui.py @@ -148,7 +148,7 @@ class TagBrowserMixin: # {{{ db = self.library_view.model().db d = TagCategories(self, db, on_category, book_ids=self.tags_view.model().get_book_ids_to_use()) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: # Order is important. The categories must be removed before setting # the preference because setting the pref recomputes the dynamic categories db.field_metadata.remove_user_categories() @@ -269,7 +269,7 @@ class TagBrowserMixin: # {{{ get_book_ids=partial(self.get_book_ids, db=db, category=category), sorter=key, ttm_is_first_letter=is_first_letter, fm=db.field_metadata[category]) - d.exec_() + d.exec() if d.result() == QDialog.DialogCode.Accepted: to_rename = d.to_rename # dict of old id to new name to_delete = d.to_delete # list of ids @@ -415,7 +415,7 @@ class TagBrowserMixin: # {{{ def edit_enum_values(self, parent, db, key): from calibre.gui2.dialogs.enum_values_edit import EnumValuesEdit d = EnumValuesEdit(parent, db, key) - d.exec_() + d.exec() def do_tag_item_renamed(self): # Clean up library view and search @@ -446,7 +446,7 @@ class TagBrowserMixin: # {{{ break editor = EditAuthorsDialog(parent, db, id_, select_sort, select_link, get_authors_func, is_first_letter) - if editor.exec_() == QDialog.DialogCode.Accepted: + if editor.exec() == QDialog.DialogCode.Accepted: # Save and restore the current selections. Note that some changes # will cause sort orders to change, so don't bother with attempting # to restore the position. Restoring the state has the side effect diff --git a/src/calibre/gui2/tag_browser/view.py b/src/calibre/gui2/tag_browser/view.py index 4ecd29ed14..ed74391c0c 100644 --- a/src/calibre/gui2/tag_browser/view.py +++ b/src/calibre/gui2/tag_browser/view.py @@ -460,9 +460,9 @@ class TagsView(QTreeView): # {{{ categories stops working. Don't know why. To avoid the problem we fix the action in dragMoveEvent. ''' - drag.exec_(Qt.DropAction.CopyAction|Qt.DropAction.MoveAction, Qt.DropAction.CopyAction) + drag.exec(Qt.DropAction.CopyAction|Qt.DropAction.MoveAction, Qt.DropAction.CopyAction) else: - drag.exec_(Qt.DropAction.CopyAction) + drag.exec(Qt.DropAction.CopyAction) def mouseDoubleClickEvent(self, event): # swallow these to avoid toggling and editing at the same time diff --git a/src/calibre/gui2/tag_mapper.py b/src/calibre/gui2/tag_mapper.py index 47d649e3ae..902c4cae8d 100644 --- a/src/calibre/gui2/tag_mapper.py +++ b/src/calibre/gui2/tag_mapper.py @@ -35,7 +35,7 @@ class QueryEdit(QLineEdit): def contextMenuEvent(self, ev): menu = self.createStandardContextMenu() self.parent().specialise_context_menu(menu) - menu.exec_(ev.globalPos()) + menu.exec(ev.globalPos()) class RuleEdit(QWidget): @@ -154,7 +154,7 @@ class RuleEdit(QWidget): def edit_tags(self): from calibre.gui2.dialogs.tag_editor import TagEditor d = TagEditor(self, get_gui().current_db, current_tags=list(filter(None, [x.strip() for x in self.query.text().split(',')]))) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.query.setText(', '.join(d.tags)) @property @@ -321,7 +321,7 @@ class Rules(QWidget): def add_rule(self): d = self.RuleEditDialogClass(self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: i = self.RuleItemClass(d.edit_widget.rule, self.rule_list) self.rule_list.scrollToItem(i) self.changed.emit() @@ -331,7 +331,7 @@ class Rules(QWidget): if i is not None: d = self.RuleEditDialogClass(self) d.edit_widget.rule = i.data(Qt.ItemDataRole.UserRole) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: rule = d.edit_widget.rule i.setData(DATA_ROLE, rule) i.setData(RENDER_ROLE, self.RuleItemClass.text_from_rule(rule, self.rule_list)) @@ -525,7 +525,7 @@ class RulesDialog(Dialog, SaveLoadMixin): self.edit_widget.rules = rules def test_rules(self): - self.TesterClass(self.rules, self).exec_() + self.TesterClass(self.rules, self).exec() def sizeHint(self): ans = super().sizeHint() @@ -541,7 +541,7 @@ if __name__ == '__main__': {'action':'replace', 'query':'moose,sfdg,sfdg,dfsg,dfgsh,sd,er,erg,egrer,ger,s,fgfsgfsga', 'match_type':'one_of', 'replace':'xxxx'}, {'action':'split', 'query':'/', 'match_type':'has', 'replace':'/'}, ] - d.exec_() + d.exec() from pprint import pprint pprint(d.rules) del d, app diff --git a/src/calibre/gui2/throbber.py b/src/calibre/gui2/throbber.py index b0ede83650..5d30ea67ed 100644 --- a/src/calibre/gui2/throbber.py +++ b/src/calibre/gui2/throbber.py @@ -88,4 +88,4 @@ if __name__ == '__main__': b.set_normal_icon_size(64, 64) b.start_animation() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/toc/main.py b/src/calibre/gui2/toc/main.py index 55b4d7d348..926c33b8c7 100644 --- a/src/calibre/gui2/toc/main.py +++ b/src/calibre/gui2/toc/main.py @@ -330,7 +330,7 @@ class ItemView(QStackedWidget): # {{{ def create_from_user_xpath(self): d = XPathDialog(self, self.prefs) - if d.exec_() == QDialog.DialogCode.Accepted and d.xpaths: + if d.exec() == QDialog.DialogCode.Accepted and d.xpaths: self.create_from_xpath.emit(d.xpaths, d.remove_duplicates_cb.isChecked()) def hide_azw3_warning(self): @@ -693,7 +693,7 @@ class TreeWidget(QTreeWidget): # {{{ case_menu.addAction(_('Capitalize'), self.capitalize) m.addMenu(case_menu) - m.exec_(QCursor.pos()) + m.exec(QCursor.pos()) # }}} @@ -1163,7 +1163,7 @@ def main(path=None, title=None): d = TOCEditor(path, title=title, write_result_to=path + '.result') d.start() ret = 1 - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: ret = 0 del d del app diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 3612b70f07..9159eed9ea 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -47,7 +47,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ d.accept() result = QDialog.DialogCode.Accepted else: - result = d.exec_() + result = d.exec() if result == QDialog.DialogCode.Accepted: # if not convert_existing(parent, db, [book_id], d.output_format): @@ -126,7 +126,7 @@ def convert_single_ebook(parent, db, book_ids, auto_conversion=False, # {{{ if len(res) == 1 else _('Could not convert {num} of {tot} books, because no supported source formats were found.') ).format(num=len(res), tot=total), - msg).exec_() + msg).exec() return jobs, changed, bad # }}} @@ -143,7 +143,7 @@ def convert_bulk_ebook(parent, queue, db, book_ids, out_format=None, args=[]): d = BulkConfig(parent, db, out_format, has_saved_settings=has_saved_settings, book_ids=book_ids) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return None output_format = d.output_format @@ -168,7 +168,7 @@ class QueueBulk(QProgressDialog): self.use_saved_single_settings = use_saved_single_settings self.i, self.bad, self.jobs, self.changed = 0, [], [], False QTimer.singleShot(0, self.do_book) - self.exec_() + self.exec() def do_book(self): if self.i >= len(self.book_ids): @@ -262,7 +262,7 @@ class QueueBulk(QProgressDialog): warning_dialog(self.parent, _('Could not convert some books'), _('Could not convert %(num)d of %(tot)d books, because no suitable ' 'source format was found.') % dict(num=len(res), tot=len(self.book_ids)), - msg).exec_() + msg).exec() self.parent = None self.jobs.reverse() self.queue(self.jobs, self.changed, self.bad, *self.args) @@ -327,7 +327,7 @@ def generate_catalog(parent, dbspec, ids, device_manager, db): # {{{ # Build the Catalog dialog in gui2.dialogs.catalog d = Catalog(parent, dbspec, ids, db) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return None # Create the output file diff --git a/src/calibre/gui2/tts/develop.py b/src/calibre/gui2/tts/develop.py index 6872263550..b572cc8ea6 100644 --- a/src/calibre/gui2/tts/develop.py +++ b/src/calibre/gui2/tts/develop.py @@ -159,7 +159,7 @@ def main(): tts.show_status.connect(la.setText) w.setCentralWidget(tts) w.show() - app.exec_() + app.exec() tts.dispatch_on_main_thread_signal.disconnect() tts.mark_changed.disconnect() tts.tts.shutdown() @@ -182,7 +182,7 @@ def headless(): c.speak_marked_text(text, callback) QTimer.singleShot(10, run) QTimer.singleShot(5000, app.quit) - app.exec_() + app.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/tts/linux_config.py b/src/calibre/gui2/tts/linux_config.py index eaf589648f..05373d36d1 100644 --- a/src/calibre/gui2/tts/linux_config.py +++ b/src/calibre/gui2/tts/linux_config.py @@ -199,5 +199,5 @@ if __name__ == '__main__': c = Client({}) w = Widget(c, {}) w.show() - app.exec_() + app.exec() print(w.backend_settings) diff --git a/src/calibre/gui2/tts/macos_config.py b/src/calibre/gui2/tts/macos_config.py index c9e8389000..181c6d3fcc 100644 --- a/src/calibre/gui2/tts/macos_config.py +++ b/src/calibre/gui2/tts/macos_config.py @@ -171,7 +171,7 @@ def develop(): c = Client() w = Widget(c, {}) w.show() - app.exec_() + app.exec() print(w.backend_settings) diff --git a/src/calibre/gui2/tts/windows_config.py b/src/calibre/gui2/tts/windows_config.py index 16a2337b34..48fac07db4 100644 --- a/src/calibre/gui2/tts/windows_config.py +++ b/src/calibre/gui2/tts/windows_config.py @@ -193,7 +193,7 @@ def develop(): c = Client() w = Widget(c, {}) w.show() - app.exec_() + app.exec() print(w.backend_settings) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 8e899aa91f..fa007539d6 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -189,7 +189,7 @@ class Boss(QObject): orig_spell = tprefs['inline_spell_check'] orig_size = tprefs['toolbar_icon_size'] p = Preferences(self.gui) - ret = p.exec_() + ret = p.exec() if p.dictionaries_changed: dictionaries.clear_caches() dictionaries.initialize(force=True) # Reread user dictionaries @@ -256,7 +256,7 @@ class Boss(QObject): if not self._check_before_open(): return d = NewBook(self.gui) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: fmt = d.fmt.lower() path = choose_save_file(self.gui, 'edit-book-new-book', _('Choose file location'), filters=[(fmt.upper(), (fmt,))], all_files=False) @@ -273,7 +273,7 @@ class Boss(QObject): d = ImportForeign(self.gui) if hasattr(path, 'rstrip'): d.set_src(os.path.abspath(path)) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: for name in tuple(editors): self.close_editor(name) from calibre.ebooks.oeb.polish.import_book import import_book_as_epub @@ -348,7 +348,7 @@ class Boss(QObject): if job.traceback is not None: if 'DRMError:' in job.traceback: from calibre.gui2.dialogs.drm_error import DRMErrorMessage - return DRMErrorMessage(self.gui).exec_() + return DRMErrorMessage(self.gui).exec() if 'ObfuscationKeyMissing:' in job.traceback: return error_dialog(self.gui, _('Failed to open book'), _( 'Failed to open book, it has obfuscated fonts, but the obfuscation key is missing from the OPF.' @@ -484,7 +484,7 @@ class Boss(QObject): return self.commit_dirty_opf() d = NewFileDialog(self.gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return added_name = self.do_add_file(d.file_name, d.file_data, using_template=d.using_template, edit_file=True) if d.file_name.rpartition('.')[2].lower() in ('ttf', 'otf', 'woff'): @@ -560,7 +560,7 @@ class Boss(QObject): d = AddCover(current_container(), self.gui) d.import_requested.connect(self.do_add_file) try: - if d.exec_() == QDialog.DialogCode.Accepted and d.file_name is not None: + if d.exec() == QDialog.DialogCode.Accepted and d.file_name is not None: report = [] with BusyCursor(): self.add_savepoint(_('Before: Add cover')) @@ -582,7 +582,7 @@ class Boss(QObject): return self.add_savepoint(_('Before: Edit Table of Contents')) d = TOCEditor(title=self.current_metadata.title, parent=self.gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: self.rewind_savepoint() return with BusyCursor(): @@ -636,7 +636,7 @@ class Boss(QObject): d = RulesDialog(self.gui) d.rules = last_used_html_transform_rules d.transform_scope = tprefs['html_transform_scope'] - ret = d.exec_() + ret = d.exec() last_used_html_transform_rules = d.rules scope = d.transform_scope tprefs.set('html_transform_scope', scope) @@ -679,7 +679,7 @@ class Boss(QObject): from calibre.ebooks.css_transform_rules import transform_container d = RulesDialog(self.gui) d.rules = last_used_transform_rules - ret = d.exec_() + ret = d.exec() last_used_transform_rules = d.rules if ret != QDialog.DialogCode.Accepted: return @@ -707,7 +707,7 @@ class Boss(QObject): self.add_savepoint(_('Before: Get external resources')) try: d = DownloadResources(self.gui) - d.exec_() + d.exec() except Exception: self.rewind_savepoint() raise @@ -742,7 +742,7 @@ class Boss(QObject): _('The %s format does not support file and folder names internally, therefore' ' arranging files into folders is not allowed.') % c.book_type.upper(), show=True) d = RationalizeFolders(self.gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return self.commit_all_editors_to_container() name_map = rationalize_folders(c, d.folder_map) @@ -898,7 +898,7 @@ class Boss(QObject): d.b = b = bb.addButton(_('See what &changed'), QDialogButtonBox.ButtonRole.AcceptRole) b.setIcon(QIcon(I('diff.png'))), b.setAutoDefault(False) bb.button(QDialogButtonBox.StandardButton.Close).setDefault(True) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.show_current_diff(allow_revert=allow_revert, to_container=to_container) def compare_book(self): @@ -1005,11 +1005,11 @@ class Boss(QObject): elif action[0] == 'insert_hyperlink': self.commit_all_editors_to_container() d = InsertLink(current_container(), edname, initial_text=ed.get_smart_selection(), parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: ed.insert_hyperlink(d.href, d.text, template=d.rendered_template) elif action[0] == 'insert_tag': d = InsertTag(parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: ed.insert_tag(d.tag) else: ed.action_triggered(action) @@ -1039,7 +1039,7 @@ class Boss(QObject): return error_dialog(self.gui, _('Not supported'), _( 'Semantics are not supported for the AZW3 format.'), show=True) d = InsertSemantics(c, parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted and d.changes: + if d.exec() == QDialog.DialogCode.Accepted and d.changes: self.add_savepoint(_('Before: Set Semantics')) d.apply_changes(current_container()) self.apply_container_update_to_gui() @@ -1052,7 +1052,7 @@ class Boss(QObject): if current_name and c.mime_map[current_name] not in OEB_DOCS | OEB_STYLES: current_name = None d = FilterCSS(current_name=current_name, parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted and d.filtered_properties: + if d.exec() == QDialog.DialogCode.Accepted and d.filtered_properties: self.add_savepoint(_('Before: Filter style information')) with BusyCursor(): changed = filter_css(current_container(), d.filtered_properties, names=d.filter_names) @@ -1367,7 +1367,7 @@ class Boss(QObject): if name is None: return d = MultiSplit(self.gui) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: with BusyCursor(): self.add_savepoint(_('Before: Split %s') % self.gui.elided_text(name)) try: @@ -1593,11 +1593,11 @@ class Boss(QObject): return from calibre.gui2.tweak_book.polish import show_report, CompressImages, CompressImagesProgress d = CompressImages(self.gui) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: with BusyCursor(): self.add_savepoint(_('Before: compress images')) d = CompressImagesProgress(names=d.names, jpeg_quality=d.jpeg_quality, parent=self.gui) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: self.rewind_savepoint() return changed, report = d.result @@ -1755,7 +1755,7 @@ class Boss(QObject): c = current_container() files = [name for name, mime in iteritems(c.mime_map) if c.exists(name) and syntax_from_mime(name, mime) is not None] d = QuickOpen(files, parent=self.gui) - if d.exec_() == QDialog.DialogCode.Accepted and d.selected_result is not None: + if d.exec() == QDialog.DialogCode.Accepted and d.selected_result is not None: self.edit_file_requested(d.selected_result, None, c.mime_map[d.selected_result]) # Editor basic controls {{{ @@ -1861,7 +1861,7 @@ class Boss(QObject): def manage_snippets(self): from calibre.gui2.tweak_book.editor.snippets import UserSnippets - UserSnippets(self.gui).exec_() + UserSnippets(self.gui).exec() # Shutdown {{{ @@ -1912,7 +1912,7 @@ class Boss(QObject): b = d.bb.addButton(_('&Quit without saving'), QDialogButtonBox.ButtonRole.ActionRole) connect_lambda(b.clicked, d, lambda d: endit(d, False)) d.resize(d.sizeHint()) - if d.exec_() != QDialog.DialogCode.Accepted or d.do_save is None: + if d.exec() != QDialog.DialogCode.Accepted or d.do_save is None: return False if d.do_save: self.gui.action_save.trigger() diff --git a/src/calibre/gui2/tweak_book/char_select.py b/src/calibre/gui2/tweak_book/char_select.py index 3cfebad1f2..1a8c92e6e9 100644 --- a/src/calibre/gui2/tweak_book/char_select.py +++ b/src/calibre/gui2/tweak_book/char_select.py @@ -665,7 +665,7 @@ class CharView(QListView): partial(self.remove_from_favorites, char_code)) if self.showing_favorites: m.addAction(_('Restore favorites to defaults'), self.restore_defaults) - m.exec_(self.mapToGlobal(pos)) + m.exec(self.mapToGlobal(pos)) def restore_defaults(self): del tprefs['charmap_favorites'] @@ -829,4 +829,4 @@ if __name__ == '__main__': w = CharSelect() w.initialize() w.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/tweak_book/check.py b/src/calibre/gui2/tweak_book/check.py index eef84f7768..78b0166058 100644 --- a/src/calibre/gui2/tweak_book/check.py +++ b/src/calibre/gui2/tweak_book/check.py @@ -95,7 +95,7 @@ class Check(QSplitter): if self.items.count() > 0: m.addAction(QIcon(I('edit-copy.png')), _('Copy list of errors to clipboard'), self.copy_to_clipboard) if list(m.actions()): - m.exec_(self.mapToGlobal(pos)) + m.exec(self.mapToGlobal(pos)) def copy_to_clipboard(self): items = [] @@ -260,7 +260,7 @@ def main(): d = Check() d.run_checks(container) d.show() - app.exec_() + app.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/tweak_book/check_links.py b/src/calibre/gui2/tweak_book/check_links.py index 9e2c2f34d1..4c01594b35 100644 --- a/src/calibre/gui2/tweak_book/check_links.py +++ b/src/calibre/gui2/tweak_book/check_links.py @@ -175,5 +175,5 @@ if __name__ == '__main__': set_current_container(get_container(sys.argv[-1])) d = CheckExternalLinks() d.refresh() - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/tweak_book/diff/main.py b/src/calibre/gui2/tweak_book/diff/main.py index 5d6ae1a223..080859ed72 100644 --- a/src/calibre/gui2/tweak_book/diff/main.py +++ b/src/calibre/gui2/tweak_book/diff/main.py @@ -472,7 +472,7 @@ def compare_books(path1, path2, revert_msg=None, revert_callback=None, parent=No if revert_msg is not None: d.revert_requested.connect(revert_callback) QTimer.singleShot(0, partial(d.ebook_diff, path1, path2, names=names)) - d.exec_() + d.exec() try: d.revert_requested.disconnect() except: @@ -499,7 +499,7 @@ def main(args=sys.argv): func = getattr(d, attr) QTimer.singleShot(0, lambda : func(left, right)) d.show() - app.exec_() + app.exec() return 0 diff --git a/src/calibre/gui2/tweak_book/diff/view.py b/src/calibre/gui2/tweak_book/diff/view.py index 007e843830..6f4789d615 100644 --- a/src/calibre/gui2/tweak_book/diff/view.py +++ b/src/calibre/gui2/tweak_book/diff/view.py @@ -182,7 +182,7 @@ class TextBrowser(PlainTextEdit): # {{{ a(QIcon(I('tweak.png')), _('Open file in the editor'), partial(self.generate_sync_request, b.blockNumber())) if len(m.actions()) > 0: - m.exec_(self.mapToGlobal(pos)) + m.exec(self.mapToGlobal(pos)) def mouseDoubleClickEvent(self, ev): if ev.button() == 1: diff --git a/src/calibre/gui2/tweak_book/download.py b/src/calibre/gui2/tweak_book/download.py index 6b0c8e17fe..3e4b5e7366 100644 --- a/src/calibre/gui2/tweak_book/download.py +++ b/src/calibre/gui2/tweak_book/download.py @@ -266,6 +266,6 @@ if __name__ == '__main__': from calibre.gui2.tweak_book.boss import get_container set_current_container(get_container(sys.argv[-1])) d = DownloadResources() - d.exec_() + d.exec() print(d.show_diff) del d, app diff --git a/src/calibre/gui2/tweak_book/editor/canvas.py b/src/calibre/gui2/tweak_book/editor/canvas.py index 32020980a3..c5075ce2fc 100644 --- a/src/calibre/gui2/tweak_book/editor/canvas.py +++ b/src/calibre/gui2/tweak_book/editor/canvas.py @@ -692,4 +692,4 @@ if __name__ == '__main__': c = Canvas() c.load_image(data) c.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/tweak_book/editor/image.py b/src/calibre/gui2/tweak_book/editor/image.py index 4fad515d40..f82e5f17f9 100644 --- a/src/calibre/gui2/tweak_book/editor/image.py +++ b/src/calibre/gui2/tweak_book/editor/image.py @@ -309,7 +309,7 @@ class Editor(QMainWindow): def resize_image(self): im = self.canvas.current_image d = ResizeDialog(im.width(), im.height(), self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.canvas.resize_image(d.width, d.height) def sharpen_image(self): @@ -341,7 +341,7 @@ def launch_editor(path_to_edit, path_is_raw=False): t = Editor('raster_image') t.data = raw t.show() - app.exec_() + app.exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/tweak_book/editor/insert_resource.py b/src/calibre/gui2/tweak_book/editor/insert_resource.py index 2c6762d425..aa9673c195 100644 --- a/src/calibre/gui2/tweak_book/editor/insert_resource.py +++ b/src/calibre/gui2/tweak_book/editor/insert_resource.py @@ -299,7 +299,7 @@ class InsertImage(Dialog): n, e = basename.rpartition('.')[0::2] basename = n + '.' + e.lower() d = ChooseName(basename, self) - if d.exec_() == QDialog.DialogCode.Accepted and d.filename: + if d.exec() == QDialog.DialogCode.Accepted and d.filename: self.accept() self.chosen_image_is_external = (d.filename, path) @@ -320,7 +320,7 @@ class InsertImage(Dialog): return error_dialog(self, _('No image'), _( 'There is no image on the clipboard'), show=True) d = ChooseName('image.jpg', self) - if d.exec_() == QDialog.DialogCode.Accepted and d.filename: + if d.exec() == QDialog.DialogCode.Accepted and d.filename: fmt = d.filename.rpartition('.')[-1].lower() if fmt not in {'jpg', 'jpeg', 'png'}: return error_dialog(self, _('Invalid file extension'), _( @@ -354,7 +354,7 @@ class InsertImage(Dialog): def get_resource_data(rtype, parent): if rtype == 'image': d = InsertImage(parent) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: return d.chosen_image, d.chosen_image_is_external, d.fullpage.isChecked(), d.preserve_aspect_ratio.isChecked() @@ -497,4 +497,4 @@ if __name__ == '__main__': set_current_container(get_container(sys.argv[-1])) d = InsertImage(for_browsing=True) - d.exec_() + d.exec() diff --git a/src/calibre/gui2/tweak_book/editor/snippets.py b/src/calibre/gui2/tweak_book/editor/snippets.py index b008fb0298..9d1b8f5bd1 100644 --- a/src/calibre/gui2/tweak_book/editor/snippets.py +++ b/src/calibre/gui2/tweak_book/editor/snippets.py @@ -709,7 +709,7 @@ class UserSnippets(Dialog): d.bb = bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) l.addWidget(bb) bb.accepted.connect(d.accept), bb.rejected.connect(d.reject) - if d.exec_() == QDialog.DialogCode.Accepted and lw.currentItem() is not None: + if d.exec() == QDialog.DialogCode.Accepted and lw.currentItem() is not None: self.stack.setCurrentIndex(1) self.edit_snip.apply_snip(lw.currentItem().data(Qt.ItemDataRole.UserRole), creating_snippet=True) # }}} @@ -719,5 +719,5 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = UserSnippets() - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/tweak_book/editor/themes.py b/src/calibre/gui2/tweak_book/editor/themes.py index cb83b95774..5b0449f11e 100644 --- a/src/calibre/gui2/tweak_book/editor/themes.py +++ b/src/calibre/gui2/tweak_book/editor/themes.py @@ -659,7 +659,7 @@ class ThemeEditor(Dialog): def create_new_theme(self): d = CreateNewTheme(self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: name = '*' + d.theme_name base = str(d.base.currentText()) theme = {} @@ -697,5 +697,5 @@ if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) d = ThemeEditor() - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/tweak_book/editor/widget.py b/src/calibre/gui2/tweak_book/editor/widget.py index ed027ef013..36c123a9b1 100644 --- a/src/calibre/gui2/tweak_book/editor/widget.py +++ b/src/calibre/gui2/tweak_book/editor/widget.py @@ -615,7 +615,7 @@ class Editor(QMainWindow): m.addMenu(cm) if self.syntax == 'html': m.addAction(actions['multisplit']) - m.exec_(self.editor.viewport().mapToGlobal(pos)) + m.exec(self.editor.viewport().mapToGlobal(pos)) def goto_sourceline(self, *args, **kwargs): return self.editor.goto_sourceline(*args, **kwargs) @@ -661,4 +661,4 @@ def launch_editor(path_to_edit, path_is_raw=False, syntax='html', callback=None) if callback is not None: callback(t) t.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/tweak_book/file_list.py b/src/calibre/gui2/tweak_book/file_list.py index d9a0be8a07..6e5f2d0718 100644 --- a/src/calibre/gui2/tweak_book/file_list.py +++ b/src/calibre/gui2/tweak_book/file_list.py @@ -106,7 +106,7 @@ def get_bulk_rename_settings(parent, number, msg=None, sanitize=sanitize_file_na l.addRow(bb) ans = {'prefix': None, 'start': None} - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: prefix = sanitize(str(d.prefix.text())) previous[category] = prefix tprefs.set('file-list-bulk-rename-prefix', previous) @@ -721,7 +721,7 @@ class FileList(QTreeWidget, OpenWithHandler): def start_merge(self, category, names): d = MergeDialog(names, self) - if d.exec_() == QDialog.DialogCode.Accepted and d.ans: + if d.exec() == QDialog.DialogCode.Accepted and d.ans: self.merge_requested.emit(category, names, d.ans) def edit_current_item(self): @@ -1008,7 +1008,7 @@ class FileList(QTreeWidget, OpenWithHandler): d.bb = bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) bb.accepted.connect(d.accept), bb.rejected.connect(d.reject) l.addWidget(bb) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: tprefs['remove_existing_links_when_linking_sheets'] = r.isChecked() sheets = [str(s.item(il).text()) for il in range(s.count()) if s.item(il).checkState() == Qt.CheckState.Checked] if sheets: diff --git a/src/calibre/gui2/tweak_book/function_replace.py b/src/calibre/gui2/tweak_book/function_replace.py index 7997ed892c..673d809c92 100644 --- a/src/calibre/gui2/tweak_book/function_replace.py +++ b/src/calibre/gui2/tweak_book/function_replace.py @@ -211,7 +211,7 @@ class FunctionBox(EditWithComplete): menu.addSeparator() menu.addAction(_('Save current search'), self.save_search.emit) menu.addAction(_('Show saved searches'), self.show_saved_searches.emit) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) class FunctionEditor(Dialog): @@ -373,5 +373,5 @@ def replace_swapcase_ignore_tags(match, number, file_name, metadata, dictionarie if __name__ == '__main__': app = QApplication([]) - FunctionEditor().exec_() + FunctionEditor().exec() del app diff --git a/src/calibre/gui2/tweak_book/live_css.py b/src/calibre/gui2/tweak_book/live_css.py index 018fb26888..b2d9e89d51 100644 --- a/src/calibre/gui2/tweak_book/live_css.py +++ b/src/calibre/gui2/tweak_book/live_css.py @@ -359,7 +359,7 @@ class Box(QWidget): all_lines += w.lines_for_copy all_text = '\n'.join(all_lines).replace('\xa0', ' ') m.addAction(QIcon(I('edit-copy.png')), _('Copy everything'), lambda : QApplication.instance().clipboard().setText(all_text)) - m.exec_(ev.globalPos()) + m.exec(ev.globalPos()) class Property: diff --git a/src/calibre/gui2/tweak_book/main.py b/src/calibre/gui2/tweak_book/main.py index ae07734bae..ac49543ce6 100644 --- a/src/calibre/gui2/tweak_book/main.py +++ b/src/calibre/gui2/tweak_book/main.py @@ -86,7 +86,7 @@ def _run(args, notify=None): main.boss.open_book(path) break app.file_event_hook = main.boss.open_book - app.exec_() + app.exec() # Ensure that the parse worker has quit so that temp files can be deleted # on windows st = time.time() diff --git a/src/calibre/gui2/tweak_book/manage_fonts.py b/src/calibre/gui2/tweak_book/manage_fonts.py index cfbdd201ae..240e0d12e7 100644 --- a/src/calibre/gui2/tweak_book/manage_fonts.py +++ b/src/calibre/gui2/tweak_book/manage_fonts.py @@ -301,7 +301,7 @@ class ManageFonts(Dialog): 'The font %s was not found on your computer. If you have the font files,' ' you can install it using the "Install fonts" button in the lower left corner.' ) % family, show=True) - EmbeddingData(family, faces, self).exec_() + EmbeddingData(family, faces, self).exec() def install_fonts(self): from calibre.gui2.font_family_chooser import add_fonts @@ -333,7 +333,7 @@ class ManageFonts(Dialog): if not fonts: return d = ChangeFontFamily(', '.join(fonts), {f for f, embedded in iteritems(self.model.font_data) if embedded}, self) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return changed = False new_family = d.normalized_family @@ -370,5 +370,5 @@ if __name__ == '__main__': c = get_container(sys.argv[-1], tweak_mode=True) set_current_container(c) d = ManageFonts() - d.exec_() + d.exec() del app diff --git a/src/calibre/gui2/tweak_book/polish.py b/src/calibre/gui2/tweak_book/polish.py index 7f503c26bf..1f4d9faf06 100644 --- a/src/calibre/gui2/tweak_book/polish.py +++ b/src/calibre/gui2/tweak_book/polish.py @@ -72,7 +72,7 @@ def customize_remove_unused_css(name, parent, ans): d.l.addWidget(d.bb) d.bb.rejected.connect(d.reject) d.bb.accepted.connect(d.accept) - ret = d.exec_() + ret = d.exec() ans['remove_unused_classes'] = tprefs['remove_unused_classes'] = c.isChecked() ans['merge_identical_selectors'] = tprefs['merge_identical_selectors'] = m.isChecked() ans['merge_rules_with_identical_properties'] = tprefs['merge_rules_with_identical_properties'] = p.isChecked() @@ -139,7 +139,7 @@ def show_report(changed, title, report, parent, show_current_diff): d.bb.rejected.connect(d.reject) d.bb.accepted.connect(d.accept) d.resize(600, 400) - d.exec_() + d.exec() b.clicked.disconnect() if d.show_changes: show_current_diff(allow_revert=True) @@ -310,7 +310,7 @@ if __name__ == '__main__': c = get_container(sys.argv[-1], tweak_mode=True) set_current_container(c) d = CompressImages() - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: pass sip.delete(app) del app diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index 153f33ed95..742c166962 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -186,7 +186,7 @@ class EditorSettings(BasicSettings): # {{{ self.tb = b = QPushButton(_('Change &templates')) l.addRow(_('Templates for new files:'), b) - connect_lambda(b.clicked, self, lambda self: TemplatesDialog(self).exec_()) + connect_lambda(b.clicked, self, lambda self: TemplatesDialog(self).exec()) lw = self('editor_line_wrap') lw.setText(_('&Wrap long lines in the editor')) @@ -243,13 +243,13 @@ class EditorSettings(BasicSettings): # {{{ def manage_dictionaries(self): d = ManageDictionaries(self) - d.exec_() + d.exec() self.dictionaries_changed = True def manage_snippets(self): from calibre.gui2.tweak_book.editor.snippets import UserSnippets d = UserSnippets(self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.snippets_changed = True def theme_choices(self): @@ -259,7 +259,7 @@ class EditorSettings(BasicSettings): # {{{ def custom_theme(self): d = ThemeEditor(parent=self) - d.exec_() + d.exec() choices = self.theme_choices() s = self.settings['editor_theme'] current_val = s.getter(s.widget) @@ -870,4 +870,4 @@ if __name__ == '__main__': opts = option_parser().parse_args(['dev']) main = Main(opts) d = Preferences(main) - d.exec_() + d.exec() diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index 9433f071bc..41f97ee9c6 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -484,7 +484,7 @@ class WebView(RestartingWebEngineView, OpenWithHandler): mime = c.mime_map[resource_name] if mime.startswith('image/'): menu.addAction(_('Edit %s') % resource_name, partial(self.edit_image, resource_name)) - menu.exec_(ev.globalPos()) + menu.exec(ev.globalPos()) def open_with(self, file_name, fmt, entry): self.parent().open_file_with.emit(file_name, fmt, entry) diff --git a/src/calibre/gui2/tweak_book/reports.py b/src/calibre/gui2/tweak_book/reports.py index 39227b11be..04e2c60b80 100644 --- a/src/calibre/gui2/tweak_book/reports.py +++ b/src/calibre/gui2/tweak_book/reports.py @@ -200,7 +200,7 @@ class FilesView(QTableView): m.addAction(_('Delete selected files'), self.delete_selected) self.customize_context_menu(m, locations, self.current_location) if len(m.actions()) > 0: - m.exec_(pos) + m.exec(pos) def to_csv(self): buf = StringIO(newline='') @@ -1486,5 +1486,5 @@ if __name__ == '__main__': set_current_container(get_container(sys.argv[-1])) d = Reports() d.refresh() - d.exec_() + d.exec() del d, app diff --git a/src/calibre/gui2/tweak_book/search.py b/src/calibre/gui2/tweak_book/search.py index fe41480459..c8c09c5938 100644 --- a/src/calibre/gui2/tweak_book/search.py +++ b/src/calibre/gui2/tweak_book/search.py @@ -120,7 +120,7 @@ class HistoryBox(HistoryComboBox): menu.addSeparator() menu.addAction(_('Save current search'), self.save_search.emit) menu.addAction(_('Show saved searches'), self.show_saved_searches.emit) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) def toggle_popups(self): self.disable_popup = not bool(self.disable_popup) @@ -340,7 +340,7 @@ class SearchWidget(QWidget): def edit_function(self): d = FunctionEditor(func_name=self.functions.text().strip(), parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.functions.setText(d.func_name) def remove_function(self): @@ -745,7 +745,7 @@ class EditSearch(QFrame): # {{{ def edit_function(self): d = FunctionEditor(func_name=self.function.text().strip(), parent=self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.function.setText(d.func_name) def remove_function(self): @@ -1490,7 +1490,7 @@ def run_search( d.show_changes = False b.setIcon(QIcon(I('diff.png'))), b.clicked.connect(d.accept) connect_lambda(b.clicked, d, lambda d: setattr(d, 'show_changes', True)) - d.exec_() + d.exec() if d.show_changes: show_current_diff(allow_revert=True) else: @@ -1586,4 +1586,4 @@ if __name__ == '__main__': app = QApplication([]) d = SavedSearches() d.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/tweak_book/spell.py b/src/calibre/gui2/tweak_book/spell.py index fcb39a5548..5928c655dc 100644 --- a/src/calibre/gui2/tweak_book/spell.py +++ b/src/calibre/gui2/tweak_book/spell.py @@ -153,7 +153,7 @@ class UserWordList(QListWidget): m = QMenu(self) m.addAction(_('Copy selected words to clipboard'), self.copy_to_clipboard) m.addAction(_('Select all words'), self.select_all) - m.exec_(ev.globalPos()) + m.exec(ev.globalPos()) def select_all(self): for item in (self.item(i) for i in range(self.count())): @@ -331,7 +331,7 @@ class ManageUserDictionaries(Dialog): d.bb = bb = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok|QDialogButtonBox.StandardButton.Cancel) bb.accepted.connect(d.accept), bb.rejected.connect(d.reject) l.addRow(bb) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return d.loc.update_recently_used() word = str(w.text()) @@ -369,7 +369,7 @@ class ManageUserDictionaries(Dialog): l.addRow(bb) bb.accepted.connect(d.accept), bb.rejected.connect(d.reject) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return lc = le.lang_codes if not lc: @@ -403,7 +403,7 @@ class ManageUserDictionaries(Dialog): @classmethod def test(cls): d = cls() - d.exec_() + d.exec() # }}} @@ -468,7 +468,7 @@ class ManageDictionaries(Dialog): # {{{ def manage_user_dictionaries(self): d = ManageUserDictionaries(self) - d.exec_() + d.exec() if d.dictionaries_changed: self.dictionaries_changed = True @@ -518,7 +518,7 @@ class ManageDictionaries(Dialog): # {{{ def add_dictionary(self): d = AddDictionary(self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.build_dictionaries(reread=True) def remove_dictionary(self): @@ -600,7 +600,7 @@ class ManageDictionaries(Dialog): # {{{ @classmethod def test(cls): d = cls() - d.exec_() + d.exec() # }}} # Spell Check Dialog {{{ @@ -894,7 +894,7 @@ class WordsView(QTableView): m.addSeparator() m.addAction(_('Copy selected words to clipboard'), self.copy_to_clipboard) - m.exec_(ev.globalPos()) + m.exec(ev.globalPos()) def copy_to_clipboard(self): rows = {i.row() for i in self.selectedIndexes()} @@ -1336,7 +1336,7 @@ class SpellCheck(Dialog): set_book_locale(current_container().mi.language) d = cls() QTimer.singleShot(0, d.refresh) - d.exec_() + d.exec() # }}} # Find next occurrence {{{ diff --git a/src/calibre/gui2/tweak_book/toc.py b/src/calibre/gui2/tweak_book/toc.py index 61dcd6048e..b05d8f9389 100644 --- a/src/calibre/gui2/tweak_book/toc.py +++ b/src/calibre/gui2/tweak_book/toc.py @@ -184,7 +184,7 @@ class TOCViewer(QWidget): menu.addAction(_('&Expand all'), self.view.expandAll) menu.addAction(_('&Collapse all'), self.view.collapseAll) menu.addAction(self.refresh_action) - menu.exec_(self.view.mapToGlobal(pos)) + menu.exec(self.view.mapToGlobal(pos)) def iter_items(self, parent=None): if parent is None: diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py index bbc27f0200..2b4b79bc8a 100644 --- a/src/calibre/gui2/tweak_book/ui.py +++ b/src/calibre/gui2/tweak_book/ui.py @@ -220,7 +220,7 @@ class Central(QStackedWidget): # {{{ menu.addSeparator() menu.addAction(actions['close-all-but-current-tab'].icon(), _('Close other tabs'), partial(self.close_all_but, ed)) menu.addAction(actions['close-tabs-to-right-of'].icon(), _('Close tabs to the right of this tab'), partial(self.close_to_right, ed)) - menu.exec_(self.editor_tabs.tabBar().mapToGlobal(event.pos())) + menu.exec(self.editor_tabs.tabBar().mapToGlobal(event.pos())) return True # }}} diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index fc8d14edab..d31b6b7e64 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -88,7 +88,7 @@ class InsertTag(Dialog): # {{{ @classmethod def test(cls): d = cls() - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: print(d.tag) # }}} @@ -494,7 +494,7 @@ class QuickOpen(Dialog): from calibre.utils.matcher import get_items_from_dir items = get_items_from_dir(os.getcwd(), lambda x:not x.endswith('.pyc')) d = cls(items) - d.exec_() + d.exec() print(d.selected_result) # }}} @@ -792,7 +792,7 @@ class InsertLink(Dialog): from calibre.ebooks.oeb.polish.container import get_container c = get_container(sys.argv[-1], tweak_mode=True) d = cls(c, next(c.spine_names)[0]) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: print(d.href, d.text) # }}} @@ -906,7 +906,7 @@ class InsertSemantics(Dialog): ' choose a file and optionally a location within the file to point to.\n\nThe' ' semantic information will be written in the section of the OPF file.')) d.resize(d.sizeHint()) - d.exec_() + d.exec() def dest_for_type(self, item_type): if item_type in self.changes: @@ -1012,7 +1012,7 @@ class InsertSemantics(Dialog): from calibre.ebooks.oeb.polish.container import get_container c = get_container(sys.argv[-1], tweak_mode=True) d = cls(c) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: import pprint pprint.pprint(d.changed_type_map) d.apply_changes(d.container) @@ -1084,7 +1084,7 @@ class FilterCSS(Dialog): # {{{ @classmethod def test(cls): d = cls() - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: print(d.filtered_properties) # }}} @@ -1217,7 +1217,7 @@ class AddCover(Dialog): from calibre.gui2.tweak_book.file_list import NewFileDialog d = NewFileDialog(self) d.do_import_file(ans[0], hide_button=True) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.import_requested.emit(d.file_name, d.file_data) self.container = current_container() self.names_filter.clear() @@ -1233,7 +1233,7 @@ class AddCover(Dialog): from calibre.ebooks.oeb.polish.container import get_container c = get_container(sys.argv[-1], tweak_mode=True) d = cls(c) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: pass # }}} diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 1d55ce1d02..d6afe2d62b 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -606,7 +606,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ if self.content_server is not None and \ self.content_server.exception is not None: error_dialog(self, _('Failed to start Content server'), - str(self.content_server.exception)).exec_() + str(self.content_server.exception)).exec() @property def current_db(self): @@ -1209,7 +1209,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ info_dialog(self, 'calibre', 'calibre '+ _('will keep running in the system tray. To close it, ' 'choose Quit in the context menu of the ' - 'system tray.'), show_copy_button=False).exec_() + 'system tray.'), show_copy_button=False).exec() dynamic['systray_msg'] = True self.hide_windows() e.ignore() diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index 6c3c442f09..116034d420 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -171,7 +171,7 @@ class UpdateNotification(QDialog): FILTER_UPDATE_AVAILABLE) d = PluginUpdaterDialog(self.parent(), initial_filter=FILTER_UPDATE_AVAILABLE) - d.exec_() + d.exec() if d.do_restart: QDialog.accept(self) from calibre.gui2.ui import get_gui @@ -240,7 +240,7 @@ class UpdateMixin: FILTER_UPDATE_AVAILABLE) d = PluginUpdaterDialog(self, initial_filter=FILTER_UPDATE_AVAILABLE) - d.exec_() + d.exec() if d.do_restart: self.quit(restart=True) @@ -270,5 +270,5 @@ class UpdateMixin: if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) - UpdateNotification('x.y.z', False).exec_() + UpdateNotification('x.y.z', False).exec() del app diff --git a/src/calibre/gui2/viewer/highlights.py b/src/calibre/gui2/viewer/highlights.py index ef62783eee..a9b35c8946 100644 --- a/src/calibre/gui2/viewer/highlights.py +++ b/src/calibre/gui2/viewer/highlights.py @@ -416,7 +416,7 @@ class NotesDisplay(Details): def edit_notes(self): current_text = self.current_notes d = NotesEditDialog(current_text, self) - if d.exec_() == QDialog.DialogCode.Accepted and d.notes != current_text: + if d.exec() == QDialog.DialogCode.Accepted and d.notes != current_text: self.notes_edited.emit(d.notes) @@ -539,7 +539,7 @@ class HighlightsPanel(QWidget): hl = list(self.highlights.all_highlights) if not hl: return error_dialog(self, _('No highlights'), _('This book has no highlights to export'), show=True) - Export(hl, self).exec_() + Export(hl, self).exec() def selected_text_changed(self, text, annot_id): if annot_id: diff --git a/src/calibre/gui2/viewer/lookup.py b/src/calibre/gui2/viewer/lookup.py index 82f3e6efd2..abf94a9e69 100644 --- a/src/calibre/gui2/viewer/lookup.py +++ b/src/calibre/gui2/viewer/lookup.py @@ -157,7 +157,7 @@ class SourcesEditor(Dialog): def add_source(self): d = SourceEditor(self) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.add_entry(d.entry, prepend=True) def remove_source(self): @@ -167,7 +167,7 @@ class SourcesEditor(Dialog): def edit_source(self, source_item): d = SourceEditor(self, source_item.data(Qt.ItemDataRole.UserRole)) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: source_item.setData(Qt.ItemDataRole.UserRole, d.entry) source_item.setData(Qt.ItemDataRole.DisplayRole, d.name) @@ -233,7 +233,7 @@ class View(QWebEngineView): menu.addAction(_('Zoom out'), self.page().zoom_out) menu.addAction(_('Default zoom'), self.page().default_zoom) menu.addAction(_('Inspect'), self.do_inspect_element) - menu.exec_(ev.globalPos()) + menu.exec(ev.globalPos()) def do_inspect_element(self): self.inspect_element.emit() @@ -307,7 +307,7 @@ class Lookup(QWidget): self._page.triggerAction(QWebEnginePage.WebAction.InspectElement) def add_sources(self): - if SourcesEditor(self).exec_() == QDialog.DialogCode.Accepted: + if SourcesEditor(self).exec() == QDialog.DialogCode.Accepted: self.populate_sources() self.source_box.setCurrentIndex(0) self.update_query() diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 16c97cbf98..c882d86628 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -162,7 +162,7 @@ def run_gui(app, opts, args, internal_book_data, listener=None): if opts.full_screen: main.set_full_screen(True) - app.exec_() + app.exec() def main(args=sys.argv): diff --git a/src/calibre/gui2/viewer/overlay.py b/src/calibre/gui2/viewer/overlay.py index cf700c64d0..92cc364d4b 100644 --- a/src/calibre/gui2/viewer/overlay.py +++ b/src/calibre/gui2/viewer/overlay.py @@ -71,4 +71,4 @@ if __name__ == '__main__': app = Application([]) w = LoadingOverlay() w.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/viewer/printing.py b/src/calibre/gui2/viewer/printing.py index 8ed366cf26..d97256d12a 100644 --- a/src/calibre/gui2/viewer/printing.py +++ b/src/calibre/gui2/viewer/printing.py @@ -225,12 +225,12 @@ class Printing(QProgressDialog): def print_book(path_to_book, parent=None, book_title=None): book_title = book_title or os.path.splitext(os.path.basename(path_to_book))[0] d = PrintDialog(book_title, parent) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: data = d.data data['input'] = path_to_book t = DoPrint(data) t.start() - Printing(t, data['show_file'], parent).exec_() + Printing(t, data['show_file'], parent).exec() if __name__ == '__main__': diff --git a/src/calibre/gui2/viewer/toc.py b/src/calibre/gui2/viewer/toc.py index f0d8970261..2a4847eff0 100644 --- a/src/calibre/gui2/viewer/toc.py +++ b/src/calibre/gui2/viewer/toc.py @@ -127,7 +127,7 @@ class TOCView(QTreeView): m.addAction(_('Collapse all items at the level of {}').format(index.data()), partial(self.collapse_at_level, index)) m.addSeparator() m.addAction(_('Copy Table of Contents to clipboard'), self.copy_to_clipboard) - m.exec_(self.mapToGlobal(pos)) + m.exec(self.mapToGlobal(pos)) def copy_to_clipboard(self): m = self.model() diff --git a/src/calibre/gui2/viewer/toolbars.py b/src/calibre/gui2/viewer/toolbars.py index 4bb66edc4d..5455953c77 100644 --- a/src/calibre/gui2/viewer/toolbars.py +++ b/src/calibre/gui2/viewer/toolbars.py @@ -131,7 +131,7 @@ class ActionsToolBar(ToolBar): a.triggered.connect(self.customize) a = m.addAction(_('Hide this toolbar')) a.triggered.connect(self.hide_toolbar) - m.exec_(self.mapToGlobal(pos)) + m.exec(self.mapToGlobal(pos)) def hide_toolbar(self): self.web_view.trigger_shortcut('toggle_toolbar') @@ -347,7 +347,7 @@ class ActionsToolBar(ToolBar): def customize(self): d = ConfigureToolBar(parent=self.parent()) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: self.add_actions() @@ -493,4 +493,4 @@ class ConfigureToolBar(Dialog): if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) - ConfigureToolBar().exec_() + ConfigureToolBar().exec() diff --git a/src/calibre/gui2/viewer/tts.py b/src/calibre/gui2/viewer/tts.py index 8e2a181cf8..abb26a154d 100644 --- a/src/calibre/gui2/viewer/tts.py +++ b/src/calibre/gui2/viewer/tts.py @@ -123,7 +123,7 @@ class TTS(QObject): def configure(self, data): ui_settings = get_pref_group('tts').copy() d = Config(self.tts_client, ui_settings, self.backend_settings, parent=self.parent()) - if d.exec_() == QDialog.DialogCode.Accepted: + if d.exec() == QDialog.DialogCode.Accepted: s = d.backend_settings self.backend_settings = s self.tts_client.apply_settings(s) diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index fb9aeb8d83..a6316610ef 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -237,7 +237,7 @@ class EbookViewer(MainWindow): m.addSeparator() a(_('Hide this scrollbar'), 'toggle_scrollbar') - q = m.exec_(QCursor.pos()) + q = m.exec(QCursor.pos()) if not q: return q = amap[q.text()] @@ -514,7 +514,7 @@ class EbookViewer(MainWindow): tb = re.split(r'^calibre\.gui2\.viewer\.convert_book\.ConversionFailure:\s*', tb, maxsplit=1, flags=re.M)[-1] last_line = tuple(tb.strip().splitlines())[-1] if last_line.startswith('calibre.ebooks.DRMError'): - DRMErrorMessage(self).exec_() + DRMErrorMessage(self).exec() else: error_dialog(self, _('Loading book failed'), _( 'Failed to open the book at {0}. Click "Show details" for more info.').format(data['pathtoebook']), diff --git a/src/calibre/gui2/viewer/widgets.py b/src/calibre/gui2/viewer/widgets.py index ce5a354b9d..9ce4e550e1 100644 --- a/src/calibre/gui2/viewer/widgets.py +++ b/src/calibre/gui2/viewer/widgets.py @@ -136,5 +136,5 @@ class SearchBox(HistoryComboBox): # {{{ menu = self.lineEdit().createStandardContextMenu() menu.addSeparator() menu.addAction(_('Clear search history'), self.clear_history) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) # }}} diff --git a/src/calibre/gui2/webengine.py b/src/calibre/gui2/webengine.py index 9ae40ba56e..d03267804e 100644 --- a/src/calibre/gui2/webengine.py +++ b/src/calibre/gui2/webengine.py @@ -184,7 +184,7 @@ if __name__ == '__main__': view.setHtml('''

hello

''') - app.exec_() + app.exec() del t del page del app diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py index 41e849fea3..fdf7426d25 100644 --- a/src/calibre/gui2/widgets.py +++ b/src/calibre/gui2/widgets.py @@ -119,7 +119,7 @@ class FilenamePattern(QWidget, Ui_Form): # {{{ pat = self.pattern() except Exception as err: error_dialog(self, _('Invalid regular expression'), - _('Invalid regular expression: %s')%err).exec_() + _('Invalid regular expression: %s')%err).exec() return mi = metadata_from_filename(fname, pat) if mi.title: @@ -284,7 +284,7 @@ class ImageDropMixin: # {{{ return cm def contextMenuEvent(self, ev): - self.build_context_menu().exec_(ev.globalPos()) + self.build_context_menu().exec(ev.globalPos()) def copy_to_clipboard(self): QApplication.instance().clipboard().setPixmap(self.get_pixmap()) @@ -490,7 +490,7 @@ class LineEditECM: # {{{ menu = self.createStandardContextMenu() menu.addSeparator() self.create_change_case_menu(menu) - menu.exec_(event.globalPos()) + menu.exec(event.globalPos()) def upper_case(self): from calibre.utils.icu import upper @@ -1300,4 +1300,4 @@ if __name__ == '__main__': # w.setSyntaxHighlighter(s) w.setText(open(__file__, 'rb').read().decode('utf-8')) w.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/widgets2.py b/src/calibre/gui2/widgets2.py index e2cf387760..90e18d3939 100644 --- a/src/calibre/gui2/widgets2.py +++ b/src/calibre/gui2/widgets2.py @@ -695,4 +695,4 @@ if __name__ == '__main__': app.load_builtin_fonts() w = RatingEditor.test() w.show() - app.exec_() + app.exec() diff --git a/src/calibre/gui2/win_file_dialogs.py b/src/calibre/gui2/win_file_dialogs.py index 9340f67ead..c91bc1aa59 100644 --- a/src/calibre/gui2/win_file_dialogs.py +++ b/src/calibre/gui2/win_file_dialogs.py @@ -190,7 +190,7 @@ def run_file_dialog( [HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE), data, loop.dialog_closed.emit) h.start() - loop.exec_(QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) + loop.exec(QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) def decode(x): x = x or b'' diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 8ce45d1e73..319bfdb754 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -963,4 +963,4 @@ def wizard(parent=None): if __name__ == '__main__': from calibre.gui2 import Application app = Application([]) - wizard().exec_() + wizard().exec() diff --git a/src/calibre/gui2/wizard/send_email.py b/src/calibre/gui2/wizard/send_email.py index 131a46db3d..d44ac991b8 100644 --- a/src/calibre/gui2/wizard/send_email.py +++ b/src/calibre/gui2/wizard/send_email.py @@ -188,7 +188,7 @@ class SendEmail(QWidget, Ui_Form): if not opts.relay_password or question_dialog(self, _('OK to proceed?'), _('This will display your email password on the screen' '. Is it OK to proceed?'), show_copy_button=False): - TestEmail(pa, self).exec_() + TestEmail(pa, self).exec() def test_email_settings(self, to): opts = smtp_prefs().parse() @@ -256,7 +256,7 @@ class SendEmail(QWidget, Ui_Form): } }[service] d = RelaySetup(service, self) - if d.exec_() != QDialog.DialogCode.Accepted: + if d.exec() != QDialog.DialogCode.Accepted: return self.relay_username.setText(d.username.text()) self.relay_password.setText(d.password.text()) @@ -269,7 +269,7 @@ class SendEmail(QWidget, Ui_Form): from_ = str(self.email_from.text()).strip() if to_set and not from_: error_dialog(self, _('Bad configuration'), - _('You must set the From email address')).exec_() + _('You must set the From email address')).exec() return False username = str(self.relay_username.text()).strip() password = str(self.relay_password.text()).strip() @@ -281,7 +281,7 @@ class SendEmail(QWidget, Ui_Form): if ((username and not password) or (not username and password)): error_dialog(self, _('Bad configuration'), _('You must either set both the username and password for ' - 'the mail server or no username and no password at all.')).exec_() + 'the mail server or no username and no password at all.')).exec() return False if not (username and password) and not question_dialog( self, _('Are you sure?'), diff --git a/src/calibre/srv/metadata.py b/src/calibre/srv/metadata.py index 1487759110..f33294e511 100644 --- a/src/calibre/srv/metadata.py +++ b/src/calibre/srv/metadata.py @@ -610,6 +610,6 @@ def test_tag_browser(library_path=None): from calibre.gui2.tweak_book.diff.main import Diff d = Diff(show_as_window=True) d.string_diff(m_data, srv_data, left_name='GUI', right_name='server') - d.exec_() + d.exec() del app # }}} diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 5aef0cb0b8..af9c0ba8ef 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -343,7 +343,7 @@ class BuildTest(unittest.TestCase): p.runJavaScript('1 + 1', callback) p.printToPdf(print_callback) QTimer.singleShot(5000, lambda: QApplication.instance().quit()) - QApplication.instance().exec_() + QApplication.instance().exec() test_flaky = ismacos and not is_ci if not test_flaky: self.assertTrue(hasattr(callback, 'result'), 'Qt WebEngine failed to run in 5 seconds')