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
There was an error reading from file:
") + _file + "
Cannot upload books to device there ' 'is no more free space available ')+where+ '
\nDetailed 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 + "
' + ', '.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 thehello
''') - 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')