mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
More PyQt idiocy migration
This commit is contained in:
parent
9d1cb5376d
commit
ffcf941da1
@ -667,6 +667,6 @@ if __name__ == '__main__':
|
||||
d.l.addWidget(bb)
|
||||
bb.accepted.connect(d.accept)
|
||||
bb.rejected.connect(d.reject)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
cw.commit()
|
||||
dev.shutdown()
|
||||
|
@ -435,7 +435,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_() == d.Accepted
|
||||
ret = d.exec_() == QDialog.DialogCode.Accepted
|
||||
|
||||
if skip_dialog_name is not None and not d.toggle_checkbox.isChecked():
|
||||
auto_skip.add(skip_dialog_name)
|
||||
|
@ -10,7 +10,7 @@ import os
|
||||
from functools import partial
|
||||
from collections import defaultdict
|
||||
|
||||
from PyQt5.Qt import QPixmap, QTimer, QApplication
|
||||
from PyQt5.Qt import QPixmap, QTimer, QApplication, QDialog
|
||||
|
||||
from calibre import as_unicode, guess_type
|
||||
from calibre.gui2 import (error_dialog, choose_files, choose_dir,
|
||||
@ -206,7 +206,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_() != d.Accepted or not d.format():
|
||||
if d.exec_() != QDialog.DialogCode.Accepted or not d.format():
|
||||
return
|
||||
self._add_empty_format(d.format())
|
||||
|
||||
@ -320,7 +320,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_() == dlg.Accepted:
|
||||
if dlg.exec_() == QDialog.DialogCode.Accepted:
|
||||
temp_files = []
|
||||
num = dlg.qty_to_add
|
||||
series = dlg.selected_series
|
||||
@ -478,7 +478,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_() == d.Accepted and d.books:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.books:
|
||||
self.add_isbns(d.books, add_tags=d.set_tags)
|
||||
|
||||
def add_books(self, *args):
|
||||
|
@ -3,6 +3,7 @@
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
from PyQt5.Qt import QDialog
|
||||
from calibre.gui2 import gprefs
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
from polyglot.builtins import iteritems, map, range
|
||||
@ -41,7 +42,7 @@ class AuthorMapAction(InterfaceAction):
|
||||
'The changes will be applied to <b>one book in the library</b>',
|
||||
'The changes will be applied to <b>{} books in the library</b>', len(book_ids))
|
||||
d.edit_widget.msg_label.setText(d.edit_widget.msg_label.text() + '<p>' + txt.format(len(book_ids)))
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
with BusyCursor():
|
||||
rules = d.rules
|
||||
|
@ -311,7 +311,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
if d.restart_needed:
|
||||
self.gui.iactions['Restart'].restart()
|
||||
|
||||
@ -594,7 +594,7 @@ class ChooseLibraryAction(InterfaceAction):
|
||||
ret = d.exec_()
|
||||
self.build_menus()
|
||||
self.gui.iactions['Copy To Library'].build_menus()
|
||||
if ret == d.Accepted:
|
||||
if ret == QDialog.DialogCode.Accepted:
|
||||
loc = d.newloc.replace('/', os.sep)
|
||||
else:
|
||||
return
|
||||
|
@ -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_() == d.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_() == d.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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
ids = d.ids
|
||||
if ids:
|
||||
self.do_copy(list(ids), db, loc, delete_after, add_duplicates=True)
|
||||
|
@ -10,7 +10,7 @@ import errno, os
|
||||
from functools import partial
|
||||
from collections import Counter
|
||||
|
||||
from PyQt5.Qt import QObject, QTimer, QModelIndex
|
||||
from PyQt5.Qt import QObject, QTimer, QModelIndex, QDialog
|
||||
|
||||
from calibre.constants import ismacos
|
||||
from calibre.gui2 import error_dialog, question_dialog
|
||||
@ -158,7 +158,7 @@ class DeleteAction(InterfaceAction):
|
||||
c[x] += 1
|
||||
d = SelectFormats(c, msg, parent=self.gui, exclude=exclude,
|
||||
single=single)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return None
|
||||
return d.selected_formats
|
||||
|
||||
|
@ -10,7 +10,7 @@ import os, shutil, copy
|
||||
from functools import partial
|
||||
from io import BytesIO
|
||||
|
||||
from PyQt5.Qt import QMenu, QModelIndex, QTimer, QIcon, QApplication, QMimeData
|
||||
from PyQt5.Qt import QMenu, QModelIndex, QTimer, QIcon, QApplication, QMimeData, QDialog
|
||||
|
||||
from calibre.gui2 import error_dialog, Dispatcher, question_dialog, gprefs
|
||||
from calibre.gui2.dialogs.metadata_bulk import MetadataBulkDialog
|
||||
@ -315,7 +315,7 @@ class EditMetadataAction(InterfaceAction):
|
||||
action_button=(_('&View book'), I('view.png'), self.gui.iactions['View'].view_historical),
|
||||
db=db
|
||||
)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
if d.mark_rejected:
|
||||
failed_ids |= d.rejected_ids
|
||||
restrict_to_failed = True
|
||||
@ -723,7 +723,7 @@ class EditMetadataAction(InterfaceAction):
|
||||
result = model.get_collections_with_ids()
|
||||
d = DeviceCategoryEditor(self.gui, tag_to_match=None, data=result, key=sort_key)
|
||||
d.exec_()
|
||||
if d.result() == d.Accepted:
|
||||
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
|
||||
for old_id, new_name in iteritems(to_rename):
|
||||
@ -912,13 +912,13 @@ class EditMetadataAction(InterfaceAction):
|
||||
from calibre.gui2.metadata.pdf_covers import PDFCovers
|
||||
d = PDFCovers(pdfpath, parent=self.gui)
|
||||
ret = d.exec_()
|
||||
if ret == d.Accepted:
|
||||
if ret == QDialog.DialogCode.Accepted:
|
||||
cpath = d.cover_path
|
||||
if cpath:
|
||||
with open(cpath, 'rb') as f:
|
||||
cdata = f.read()
|
||||
d.cleanup()
|
||||
if ret != d.Accepted:
|
||||
if ret != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
else:
|
||||
stream = BytesIO()
|
||||
|
@ -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_() == d.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(
|
||||
|
@ -7,6 +7,7 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
from PyQt5.Qt import QDialog
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
from calibre.gui2.dialogs.template_dialog import TemplateDialog
|
||||
from calibre.gui2 import error_dialog
|
||||
@ -46,6 +47,6 @@ class ShowTemplateTesterAction(InterfaceAction):
|
||||
mi=db.get_metadata(index.row(), index_is_id=False, get_cover=False),
|
||||
text_is_placeholder=self.first_time)
|
||||
t.setWindowTitle(_('Template tester'))
|
||||
if t.exec_() == t.Accepted:
|
||||
if t.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.previous_text = t.rule[1]
|
||||
self.first_time = False
|
||||
|
@ -3,6 +3,7 @@
|
||||
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
from PyQt5.Qt import QDialog
|
||||
from polyglot.builtins import iteritems, map, range
|
||||
|
||||
from calibre.gui2 import gprefs
|
||||
@ -42,7 +43,7 @@ class TagMapAction(InterfaceAction):
|
||||
'The changes will be applied to <b>one book in the library</b>',
|
||||
'The changes will be applied to <b>{} books in the library</b>', len(book_ids))
|
||||
d.edit_widget.msg_label.setText(d.edit_widget.msg_label.text() + '<p>' + txt.format(len(book_ids)))
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
with BusyCursor():
|
||||
rules = d.rules
|
||||
|
@ -134,7 +134,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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
fmts = d.formats
|
||||
for fmt in fmts:
|
||||
|
@ -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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
tweakable_fmts = {d.fmt}
|
||||
else:
|
||||
|
@ -10,7 +10,7 @@ import json
|
||||
import os
|
||||
import time
|
||||
from functools import partial
|
||||
from PyQt5.Qt import QAction, QIcon, Qt, pyqtSignal
|
||||
from PyQt5.Qt import QAction, QIcon, Qt, pyqtSignal, QDialog
|
||||
|
||||
from calibre.constants import ismacos, iswindows
|
||||
from calibre.gui2 import (
|
||||
@ -218,7 +218,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_() == d.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)
|
||||
|
@ -687,7 +687,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
link, name = unicode_type(d.url.text()).strip(), unicode_type(d.name.text()).strip()
|
||||
is_image = d.treat_as_image.isChecked()
|
||||
return link, name, is_image
|
||||
|
@ -92,7 +92,7 @@ class Completer(QListView): # {{{
|
||||
self.max_visible_items = max_visible_items
|
||||
self.setEditTriggers(self.NoEditTriggers)
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.setUniformItemSizes(True)
|
||||
self.setAlternatingRowColors(True)
|
||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import json
|
||||
|
||||
from PyQt5.Qt import Qt
|
||||
from PyQt5.Qt import Qt, QDialog
|
||||
|
||||
from calibre.gui2.convert.look_and_feel_ui import Ui_Form
|
||||
from calibre.gui2.convert import Widget
|
||||
@ -115,7 +115,7 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
||||
from calibre.gui2.convert.font_key import FontKeyChooser
|
||||
d = FontKeyChooser(self, self.opt_base_font_size.value(),
|
||||
unicode_type(self.opt_font_size_mapping.text()).strip())
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.opt_font_size_mapping.setText(', '.join(['%.1f'%x for x in
|
||||
d.fsizes]))
|
||||
self.opt_base_font_size.setValue(d.dbase)
|
||||
|
@ -229,7 +229,7 @@ class RegexEdit(QWidget, Ui_Edit):
|
||||
if not self.doc_cache:
|
||||
self.doc_cache = bld.doc()
|
||||
self.doc_update.emit(self.doc_cache)
|
||||
if bld.exec_() == bld.Accepted:
|
||||
if bld.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.edit.setText(bld.regex.text())
|
||||
|
||||
def doc(self):
|
||||
|
@ -75,7 +75,7 @@ class XPathEdit(QWidget, Ui_Edit):
|
||||
|
||||
def wizard(self):
|
||||
wiz = Wizard(self)
|
||||
if wiz.exec_() == wiz.Accepted:
|
||||
if wiz.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.edit.setText(wiz.xpath)
|
||||
|
||||
def setObjectName(self, *args):
|
||||
|
@ -395,7 +395,7 @@ class CoverSettingsWidget(QWidget):
|
||||
def create_color_scheme(self):
|
||||
scheme = self.colors_map[self.current_colors].data(Qt.ItemDataRole.UserRole)
|
||||
d = CreateColorScheme('#' + _('My Color Scheme'), scheme, set(self.colors_map), parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
name, scheme = d.data
|
||||
li = QListWidgetItem(name)
|
||||
li.setData(Qt.ItemDataRole.UserRole, scheme), li.setFlags(li.flags() | Qt.ItemFlag.ItemIsUserCheckable), li.setCheckState(Qt.CheckState.Checked)
|
||||
@ -411,7 +411,7 @@ class CoverSettingsWidget(QWidget):
|
||||
' color scheme instead.'), show=True)
|
||||
li = self.colors_map[cs]
|
||||
d = CreateColorScheme(cs, li.data(Qt.ItemDataRole.UserRole), set(self.colors_map), edit_scheme=True, parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
name, scheme = d.data
|
||||
li.setText(name)
|
||||
li.setData(Qt.ItemDataRole.UserRole, scheme)
|
||||
@ -449,7 +449,7 @@ class CoverSettingsWidget(QWidget):
|
||||
attr = which + '_template'
|
||||
templ = getattr(self, attr).text()
|
||||
d = TemplateDialog(self, templ, mi=self.mi, fm=field_metadata)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
templ = d.rule[1]
|
||||
getattr(self, attr).setText(templ)
|
||||
self.emit_changed()
|
||||
|
@ -12,7 +12,7 @@ from functools import partial
|
||||
from PyQt5.Qt import (Qt, QComboBox, QLabel, QSpinBox, QDoubleSpinBox,
|
||||
QDateTime, QGroupBox, QVBoxLayout, QSizePolicy, QGridLayout, QUrl,
|
||||
QSpacerItem, QIcon, QCheckBox, QWidget, QHBoxLayout, QLineEdit,
|
||||
QMessageBox, QToolButton, QPlainTextEdit, QApplication, QStyle)
|
||||
QMessageBox, QToolButton, QPlainTextEdit, QApplication, QStyle, QDialog)
|
||||
|
||||
from calibre.utils.date import qt_to_dt, now, as_local_time, as_utc, internal_iso_format_string
|
||||
from calibre.gui2.complete2 import EditWithComplete
|
||||
@ -561,7 +561,7 @@ class Text(Base):
|
||||
else:
|
||||
self.setter(self.initial_val)
|
||||
d = TagEditor(self.parent, self.db, self.book_id, self.key)
|
||||
if d.exec_() == TagEditor.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.setter(d.tags)
|
||||
|
||||
def connect_data_changed(self, slot):
|
||||
@ -1468,7 +1468,7 @@ class BulkText(BulkBase):
|
||||
return
|
||||
widget.setText('')
|
||||
d = TagEditor(self.parent, self.db, key=('#'+self.col_metadata['label']))
|
||||
if d.exec_() == TagEditor.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
val = d.tags
|
||||
if not val:
|
||||
val = []
|
||||
|
@ -986,7 +986,7 @@ class DeviceMixin(object): # {{{
|
||||
if cw.validate():
|
||||
QDialog.accept(config_dialog)
|
||||
config_dialog.accept = validate
|
||||
if config_dialog.exec_() == config_dialog.Accepted:
|
||||
if config_dialog.exec_() == QDialog.DialogCode.Accepted:
|
||||
dev.save_settings(cw)
|
||||
|
||||
do_restart = show_restart_warning(_('Restart calibre for the changes to %s'
|
||||
|
@ -149,7 +149,7 @@ class SendToConfig(QWidget): # {{{
|
||||
def browse(self):
|
||||
b = Browser(self.device.filesystem_cache, show_files=False,
|
||||
parent=self)
|
||||
if b.exec_() == b.Accepted and b.current_item is not None:
|
||||
if b.exec_() == QDialog.DialogCode.Accepted and b.current_item is not None:
|
||||
sid, path = b.current_item
|
||||
self.t.setText('/'.join(path[1:]))
|
||||
|
||||
@ -255,7 +255,7 @@ class Rule(QWidget):
|
||||
def browse(self):
|
||||
b = Browser(self.device.filesystem_cache, show_files=False,
|
||||
parent=self)
|
||||
if b.exec_() == b.Accepted and b.current_item is not None:
|
||||
if b.exec_() == QDialog.DialogCode.Accepted and b.current_item is not None:
|
||||
sid, path = b.current_item
|
||||
self.folder.setText('/'.join(path[1:]))
|
||||
|
||||
@ -433,7 +433,7 @@ class MTPConfig(QTabWidget):
|
||||
def change_ignored_folders(self):
|
||||
d = IgnoredFolders(self.device,
|
||||
self.current_ignored_folders, parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.current_ignored_folders = d.ignored_folders
|
||||
|
||||
def ignore_device(self):
|
||||
@ -547,6 +547,6 @@ if __name__ == '__main__':
|
||||
d.l.addWidget(bb)
|
||||
bb.accepted.connect(d.accept)
|
||||
bb.rejected.connect(d.reject)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
cw.commit()
|
||||
dev.shutdown()
|
||||
|
@ -390,6 +390,6 @@ if __name__ == '__main__':
|
||||
d.l.addWidget(bb)
|
||||
bb.accepted.connect(d.accept)
|
||||
bb.rejected.connect(d.reject)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
cw.commit()
|
||||
dev.shutdown()
|
||||
|
@ -216,7 +216,7 @@ class BookInfo(QDialog):
|
||||
|
||||
def configure(self):
|
||||
d = Configure(get_gui().current_db, self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
if self.current_row is not None:
|
||||
mi = self.view.model().get_book_display_info(self.current_row)
|
||||
if mi is not None:
|
||||
|
@ -69,4 +69,4 @@ def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None,
|
||||
return True
|
||||
d = Dialog(msg, name, parent, config_set=config_set, icon=pixmap,
|
||||
title=title, confirm_msg=confirm_msg, show_cancel_button=show_cancel_button)
|
||||
return d.exec_() == d.Accepted
|
||||
return d.exec_() == QDialog.DialogCode.Accepted
|
||||
|
@ -47,6 +47,6 @@ def confirm_location(msg, name, parent=None, pixmap='dialog_warning.png'):
|
||||
d.resize(d.sizeHint())
|
||||
ret = d.exec_()
|
||||
d.break_cycles()
|
||||
if ret == d.Accepted:
|
||||
if ret == QDialog.DialogCode.Accepted:
|
||||
return d.choice()
|
||||
return None
|
||||
|
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QVBoxLayout, QSplitter, QWidget, QLabel, QCheckBox, QTextBrowser, Qt,
|
||||
QVBoxLayout, QSplitter, QWidget, QLabel, QCheckBox, QTextBrowser, Qt, QDialog
|
||||
)
|
||||
|
||||
from calibre.ebooks.metadata import authors_to_string
|
||||
@ -88,7 +88,7 @@ def confirm_merge(msg, name, parent, mi):
|
||||
if not config_set.get(confirm_config_name(name), True):
|
||||
return True
|
||||
d = ConfirmMerge(msg, name, parent, mi)
|
||||
return d.exec_() == d.Accepted
|
||||
return d.exec_() == QDialog.DialogCode.Accepted
|
||||
|
||||
|
||||
class ChooseMerge(Dialog):
|
||||
@ -186,6 +186,6 @@ class ChooseMerge(Dialog):
|
||||
|
||||
def merge_drop(dest_id, src_ids, gui):
|
||||
d = ChooseMerge(dest_id, src_ids, gui)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return None, None, None
|
||||
return d.merge_type
|
||||
|
@ -11,7 +11,7 @@ from PyQt5.Qt import (
|
||||
QVBoxLayout, QStackedWidget, QSize, QPushButton, QIcon, QWidget, QListView,
|
||||
QHBoxLayout, QAbstractListModel, Qt, QLabel, QSizePolicy, pyqtSignal, QSortFilterProxyModel,
|
||||
QFormLayout, QSpinBox, QLineEdit, QGroupBox, QListWidget, QListWidgetItem,
|
||||
QToolButton, QTreeView)
|
||||
QToolButton, QTreeView, QDialog)
|
||||
|
||||
from calibre.gui2 import error_dialog, open_local_file, choose_files, choose_save_file
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm as confirm_delete
|
||||
@ -656,7 +656,7 @@ class CustomRecipes(Dialog):
|
||||
|
||||
def customize_recipe(self):
|
||||
d = ChooseBuiltinRecipe(self.recipe_model, self)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
|
||||
id_ = d.selected_recipe
|
||||
@ -688,7 +688,7 @@ class CustomRecipes(Dialog):
|
||||
def import_opml(self):
|
||||
from calibre.gui2.dialogs.opml import ImportOPML
|
||||
d = ImportOPML(parent=self)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
oldest_article, max_articles_per_feed, replace_existing = d.oldest_article, d.articles_per_feed, d.replace_existing
|
||||
failed_recipes, replace_recipes, add_recipes = {}, {}, {}
|
||||
|
@ -362,7 +362,7 @@ class EximDialog(Dialog):
|
||||
dbmap[db.library_path] = db.new_api
|
||||
return RunAction(_('Exporting all calibre data...'), _(
|
||||
'Failed to export data.'), partial(export, self.export_dir, library_paths=library_paths, dbmap=dbmap),
|
||||
parent=self).exec_() == Dialog.Accepted
|
||||
parent=self).exec_() == QDialog.DialogCode.Accepted
|
||||
|
||||
def run_import_action(self):
|
||||
library_path_map = {}
|
||||
@ -370,7 +370,7 @@ class EximDialog(Dialog):
|
||||
if w.path:
|
||||
library_path_map[w.lpath] = w.path
|
||||
return RunAction(_('Importing all calibre data...'), _(
|
||||
'Failed to import data.'), partial(import_data, self.importer, library_path_map), parent=self).exec_() == Dialog.Accepted
|
||||
'Failed to import data.'), partial(import_data, self.importer, library_path_map), parent=self).exec_() == QDialog.DialogCode.Accepted
|
||||
|
||||
def accept(self):
|
||||
if not self.validate():
|
||||
|
@ -291,7 +291,7 @@ class ProceedNotification(MessageBox): # {{{
|
||||
|
||||
def do_proceed(self, result):
|
||||
from calibre.gui2.ui import get_gui
|
||||
func = (self.callback if result == self.Accepted else
|
||||
func = (self.callback if result == QDialog.DialogCode.Accepted else
|
||||
self.cancel_callback)
|
||||
gui = get_gui()
|
||||
gui.proceed_requested.emit(func, self.payload)
|
||||
|
@ -567,13 +567,13 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
||||
def customize_cover_generation(self):
|
||||
from calibre.gui2.covers import CoverSettingsDialog
|
||||
d = CoverSettingsDialog(parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.generate_cover_settings = d.prefs_for_rendering
|
||||
|
||||
def set_comments(self):
|
||||
from calibre.gui2.dialogs.comments_dialog import CommentsDialog
|
||||
d = CommentsDialog(self, '' if self.comments is null else (self.comments or ''), _('Comments'))
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.comments = d.textbox.html
|
||||
b = self.comments_button
|
||||
b.setStyleSheet('QPushButton { font-weight: bold }')
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QFormLayout, QIcon, QLabel, QLineEdit, QListWidget, Qt, QVBoxLayout
|
||||
QFormLayout, QIcon, QLabel, QLineEdit, QListWidget, Qt, QVBoxLayout, QDialog
|
||||
)
|
||||
|
||||
from calibre import prepare_string_for_xml
|
||||
@ -154,7 +154,7 @@ class SavedSearchEditor(Dialog):
|
||||
|
||||
def add_search(self):
|
||||
d = AddSavedSearch(parent=self, commit_changes=False)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
name, expression = d.accepted_data
|
||||
nmap = {icu_lower(n):n for n in self.searches}
|
||||
@ -188,7 +188,7 @@ class SavedSearchEditor(Dialog):
|
||||
d.setWindowTitle(_('Edit saved search'))
|
||||
d.sname.setText(n)
|
||||
d.search.setText(self.searches[n])
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
name, expression = d.accepted_data
|
||||
self.slist.currentItem().setText(name)
|
||||
|
@ -257,5 +257,5 @@ if __name__ == '__main__':
|
||||
db = db()
|
||||
app = Application([])
|
||||
d = TagEditor(None, db, current_tags='a b c'.split())
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
print(d.tags)
|
||||
|
@ -101,7 +101,7 @@ if __name__ == '__main__':
|
||||
with open(fname, 'rb') as f:
|
||||
data = f.read()
|
||||
d = TrimImage(data)
|
||||
if d.exec_() == d.Accepted and d.image_data is not None:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.image_data is not None:
|
||||
b, ext = os.path.splitext(fname)
|
||||
fname = b + '-trimmed' + ext
|
||||
with open(fname, 'wb') as f:
|
||||
|
@ -297,7 +297,7 @@ class SelectRecipients(QDialog): # {{{
|
||||
|
||||
def select_recipients(parent=None):
|
||||
d = SelectRecipients(parent)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
return d.ans
|
||||
return ()
|
||||
# }}}
|
||||
|
@ -366,7 +366,7 @@ class FontFamilyChooser(QWidget):
|
||||
|
||||
def show_chooser(self):
|
||||
d = FontFamilyDialog(self.font_family, self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.font_family = d.font_family
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ from multiprocessing.pool import ThreadPool
|
||||
from PyQt5.Qt import (
|
||||
QImageReader, QFormLayout, QVBoxLayout, QSplitter, QGroupBox, QListWidget,
|
||||
QLineEdit, QSpinBox, QTextEdit, QSize, QListWidgetItem, QIcon, QImage,
|
||||
pyqtSignal, QStackedLayout, QWidget, QLabel, Qt, QComboBox, QPixmap,
|
||||
pyqtSignal, QStackedLayout, QWidget, QLabel, Qt, QComboBox, QPixmap, QDialog,
|
||||
QGridLayout, QStyledItemDelegate, QApplication, QStaticText,
|
||||
QStyle, QPen, QProgressDialog, QAbstractItemView
|
||||
)
|
||||
@ -412,7 +412,7 @@ def create_theme(folder=None, parent=None):
|
||||
return
|
||||
report = read_theme_from_folder(folder)
|
||||
d = ThemeCreateDialog(parent, report)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
d.save_metadata()
|
||||
d = Compress(d.report, parent=parent)
|
||||
@ -788,7 +788,7 @@ class ChooseTheme(Dialog):
|
||||
if self.downloaded_theme and not isinstance(self.downloaded_theme, BytesIO):
|
||||
return error_dialog(self, _('Download failed'), _(
|
||||
'Failed to download icon theme, click "Show Details" for more information.'), show=True, det_msg=self.downloaded_theme)
|
||||
if ret == d.Rejected or not self.keep_downloading or d.canceled or self.downloaded_theme is None:
|
||||
if ret == QDialog.DialogCode.Rejected or not self.keep_downloading or d.canceled or self.downloaded_theme is None:
|
||||
return
|
||||
dt = self.downloaded_theme
|
||||
|
||||
@ -865,6 +865,6 @@ if __name__ == '__main__':
|
||||
app = Application([])
|
||||
# create_theme('.')
|
||||
d = ChooseTheme()
|
||||
if d.exec_() == d.Accepted and d.commit_changes is not None:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.commit_changes is not None:
|
||||
d.commit_changes()
|
||||
del app
|
||||
|
@ -10,7 +10,7 @@ import functools
|
||||
from PyQt5.Qt import (
|
||||
QAction, QApplication, QIcon, QLabel, QMenu, QPainter, QSizePolicy, QSplitter,
|
||||
QStackedWidget, QStatusBar, QStyle, QStyleOption, Qt, QTabBar, QTimer,
|
||||
QToolButton, QVBoxLayout, QWidget
|
||||
QToolButton, QVBoxLayout, QWidget, QDialog
|
||||
)
|
||||
|
||||
from calibre.constants import __appname__, get_version, ismacos
|
||||
@ -697,7 +697,7 @@ class LayoutMixin(object): # {{{
|
||||
identifiers = db.field_for('identifiers', book_id, default_value={})
|
||||
from calibre.gui2.metadata.basic_widgets import Identifiers
|
||||
d = Identifiers(identifiers, self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
identifiers = d.get_identifiers()
|
||||
db.set_field('identifiers', {book_id: identifiers})
|
||||
self.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id})
|
||||
|
@ -7,7 +7,7 @@ import json
|
||||
import os
|
||||
from functools import partial
|
||||
from PyQt5.Qt import (
|
||||
QApplication, QCheckBox, QComboBox, QCursor, QDateTime, QFont, QFormLayout,
|
||||
QApplication, QCheckBox, QComboBox, QCursor, QDateTime, QFont, QFormLayout, QDialog,
|
||||
QHBoxLayout, QIcon, QKeySequence, QLabel, QMenu, QPalette, QPlainTextEdit, QSize,
|
||||
QSplitter, Qt, QTextBrowser, QTimer, QToolButton, QTreeWidget, QTreeWidgetItem,
|
||||
QVBoxLayout, QWidget, pyqtSignal, QAbstractItemView
|
||||
@ -813,7 +813,7 @@ class AnnotationsBrowser(Dialog):
|
||||
'Editing is only supported for the notes associated with highlights'), show=True)
|
||||
notes = annot.get('notes')
|
||||
d = EditNotes(notes, self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
notes = d.notes
|
||||
if notes and notes.strip():
|
||||
annot['notes'] = notes.strip()
|
||||
|
@ -11,7 +11,7 @@ import sys
|
||||
from PyQt5.Qt import (Qt, QApplication, QStyle, QIcon, QDoubleSpinBox, QStyleOptionViewItem,
|
||||
QSpinBox, QStyledItemDelegate, QComboBox, QTextDocument, QMenu, QKeySequence,
|
||||
QAbstractTextDocumentLayout, QFont, QFontInfo, QDate, QDateTimeEdit, QDateTime,
|
||||
QStyleOptionComboBox, QStyleOptionSpinBox, QLocale, QSize, QLineEdit)
|
||||
QStyleOptionComboBox, QStyleOptionSpinBox, QLocale, QSize, QLineEdit, QDialog)
|
||||
|
||||
from calibre.ebooks.metadata import rating_to_stars
|
||||
from calibre.gui2 import UNDEFINED_QDATETIME, rating_font
|
||||
@ -350,7 +350,7 @@ class CompleteDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
|
||||
if check_key_modifier(Qt.KeyboardModifier.ShiftModifier) and col != 'authors':
|
||||
key = col if m.is_custom_column(col) else None
|
||||
d = TagEditor(parent, self.db, m.id(index.row()), key=key)
|
||||
if d.exec_() == TagEditor.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
m.setData(index, self.sep.join(d.tags), Qt.ItemDataRole.EditRole)
|
||||
return None
|
||||
editor = EditWithComplete(parent)
|
||||
@ -516,7 +516,7 @@ class CcLongTextDelegate(QStyledItemDelegate): # {{{
|
||||
else:
|
||||
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
||||
d = PlainTextDialog(parent, text, column_name=m.custom_columns[col]['name'])
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
m.setData(index, d.text, Qt.ItemDataRole.EditRole)
|
||||
return None
|
||||
|
||||
|
@ -360,7 +360,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.set_value(d.authors)
|
||||
|
||||
def manage_authors(self):
|
||||
@ -1207,7 +1207,7 @@ class Cover(ImageView): # {{{
|
||||
cdata = self.current_val
|
||||
from calibre.gui2.dialogs.trim_image import TrimImage
|
||||
d = TrimImage(cdata, parent=self)
|
||||
if d.exec_() == d.Accepted and d.image_data is not None:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.image_data is not None:
|
||||
self.current_val = d.image_data
|
||||
self.cdata_before_trim = cdata
|
||||
|
||||
@ -1222,7 +1222,7 @@ class Cover(ImageView): # {{{
|
||||
from calibre.gui2.covers import CoverSettingsDialog
|
||||
mi = self.dialog.to_book_metadata()
|
||||
d = CoverSettingsDialog(mi=mi, parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.current_val = generate_cover(mi, prefs=d.prefs_for_rendering)
|
||||
|
||||
def set_pixmap_from_data(self, data):
|
||||
@ -1417,7 +1417,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
|
||||
else:
|
||||
self.current_val = self.original_val
|
||||
d = TagEditor(self, db, id_)
|
||||
if d.exec_() == TagEditor.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.current_val = d.tags
|
||||
self.update_items_cache(db.new_api.all_field_names('tags'))
|
||||
|
||||
@ -1553,7 +1553,7 @@ class IdentifiersEdit(QLineEdit, ToMetadataMixin):
|
||||
|
||||
def edit_identifiers(self):
|
||||
d = Identifiers(self.current_val, self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.current_val = d.get_identifiers()
|
||||
|
||||
@property
|
||||
|
@ -130,7 +130,7 @@ def start_download(gui, ids, callback, ensure_fields=None):
|
||||
d = ConfirmDialog(ids, gui)
|
||||
ret = d.exec_()
|
||||
d.b.clicked.disconnect()
|
||||
if ret != d.Accepted:
|
||||
if ret != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
tf = PersistentTemporaryFile('_metadata_bulk.log')
|
||||
tf.close()
|
||||
|
@ -695,7 +695,7 @@ if __name__ == '__main__':
|
||||
gm = partial(db.get_metadata, index_is_id=True, get_cover=True, cover_as_data=True)
|
||||
get_metadata = lambda x:list(map(gm, ids[x]))
|
||||
d = CompareMany(list(range(len(ids))), get_metadata, db.field_metadata, db=db)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
for changed, mi in itervalues(d.accepted):
|
||||
if changed and mi is not None:
|
||||
print(mi)
|
||||
|
@ -432,7 +432,7 @@ class MetadataSingleDialogBase(QDialog):
|
||||
'pdf')
|
||||
from calibre.gui2.metadata.pdf_covers import PDFCovers
|
||||
d = PDFCovers(pdfpath, parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
cpath = d.cover_path
|
||||
if cpath:
|
||||
with open(cpath, 'rb') as f:
|
||||
@ -538,7 +538,7 @@ class MetadataSingleDialogBase(QDialog):
|
||||
d = FullFetch(self.cover.pixmap(), self)
|
||||
ret = d.start(title=self.title.current_val, authors=self.authors.current_val,
|
||||
identifiers=self.identifiers.current_val)
|
||||
if ret == d.Accepted:
|
||||
if ret == QDialog.DialogCode.Accepted:
|
||||
self.metadata_before_fetch = {f:getattr(self, f).current_val for f in fetched_fields}
|
||||
from calibre.ebooks.metadata.sources.prefs import msprefs
|
||||
mi = d.book
|
||||
@ -581,7 +581,7 @@ class MetadataSingleDialogBase(QDialog):
|
||||
d = CoverFetch(self.cover.pixmap(), self)
|
||||
ret = d.start(self.title.current_val, self.authors.current_val,
|
||||
self.identifiers.current_val)
|
||||
if ret == d.Accepted:
|
||||
if ret == QDialog.DialogCode.Accepted:
|
||||
if d.cover_pixmap is not None:
|
||||
self.cover.current_val = pixmap_to_data(d.cover_pixmap)
|
||||
|
||||
|
@ -216,7 +216,7 @@ class ResultsView(QTableView): # {{{
|
||||
self.rt_delegate = RichTextDelegate(self)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||
self.setAlternatingRowColors(True)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
self.setIconSize(QSize(24, 24))
|
||||
self.clicked.connect(self.show_details)
|
||||
self.doubleClicked.connect(self.select_index)
|
||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from PyQt5.Qt import Qt, QVBoxLayout, QFormLayout
|
||||
from PyQt5.Qt import Qt, QVBoxLayout, QFormLayout, QDialog
|
||||
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, \
|
||||
CommaSeparatedList, AbortCommit
|
||||
@ -66,7 +66,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
d = RulesDialog(self)
|
||||
if gprefs.get('tag_map_on_add_rules'):
|
||||
d.rules = gprefs['tag_map_on_add_rules']
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.tag_map_rules = d.rules
|
||||
self.changed_signal.emit()
|
||||
|
||||
@ -75,7 +75,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
d = RulesDialog(self)
|
||||
if gprefs.get('author_map_on_add_rules'):
|
||||
d.rules = gprefs['author_map_on_add_rules']
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.author_map_rules = d.rules
|
||||
self.changed_signal.emit()
|
||||
|
||||
@ -84,7 +84,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
d = RulesDialog(self)
|
||||
if gprefs.get('add_filter_rules'):
|
||||
d.rules = gprefs['add_filter_rules']
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.add_filter_rules = d.rules
|
||||
self.changed_signal.emit()
|
||||
|
||||
|
@ -992,7 +992,7 @@ class EditRules(QWidget): # {{{
|
||||
def add_rule(self):
|
||||
d = RuleEditor(self.model.fm, self.pref_name)
|
||||
d.add_blank_condition()
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
kind, col, r = d.rule
|
||||
if kind and r and col:
|
||||
idx = self.model.add_rule(kind, col, r)
|
||||
@ -1002,7 +1002,7 @@ class EditRules(QWidget): # {{{
|
||||
def add_advanced(self):
|
||||
if self.pref_name == 'column_color_rules':
|
||||
td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, color_field='')
|
||||
if td.exec_() == td.Accepted:
|
||||
if td.exec_() == QDialog.DialogCode.Accepted:
|
||||
col, r = td.rule
|
||||
if r and col:
|
||||
idx = self.model.add_rule('color', col, r)
|
||||
@ -1013,7 +1013,7 @@ class EditRules(QWidget): # {{{
|
||||
td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, doing_emblem=True)
|
||||
else:
|
||||
td = TemplateDialog(self, '', mi=self.mi, fm=self.fm, icon_field_key='')
|
||||
if td.exec_() == td.Accepted:
|
||||
if td.exec_() == QDialog.DialogCode.Accepted:
|
||||
typ, col, r = td.rule
|
||||
if typ and r and col:
|
||||
idx = self.model.add_rule(typ, col, r)
|
||||
@ -1036,7 +1036,7 @@ class EditRules(QWidget): # {{{
|
||||
d = TemplateDialog(self, rule, mi=self.mi, fm=self.fm, icon_field_key=col,
|
||||
icon_rule_kind=kind)
|
||||
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
if len(d.rule) == 2: # Convert template dialog rules to a triple
|
||||
d.rule = ('color', d.rule[0], d.rule[1])
|
||||
kind, col, r = d.rule
|
||||
|
@ -12,7 +12,7 @@ from collections import defaultdict
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QApplication, QFont, QFontInfo, QFontDialog, QColorDialog, QPainter,
|
||||
QApplication, QFont, QFontInfo, QFontDialog, QColorDialog, QPainter, QDialog,
|
||||
QAbstractListModel, Qt, QIcon, QKeySequence, QColor, pyqtSignal, QCursor,
|
||||
QWidget, QSizePolicy, QBrush, QPixmap, QSize, QPushButton, QVBoxLayout,
|
||||
QTableWidget, QTableWidgetItem, QLabel, QFormLayout, QLineEdit, QComboBox
|
||||
@ -205,7 +205,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
if r < 0:
|
||||
self.table.setRowCount(self.table.rowCount() + 1)
|
||||
r = self.table.rowCount() - 1
|
||||
@ -586,14 +586,14 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
def choose_icon_theme(self):
|
||||
from calibre.gui2.icon_theme import ChooseTheme
|
||||
d = ChooseTheme(self)
|
||||
if d.exec_() == d.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: <b>%s</b>') % self.icon_theme_title)
|
||||
self.changed_signal.emit()
|
||||
|
||||
def edit_id_link_rules(self):
|
||||
if IdLinksEditor(self).exec_() == Dialog.Accepted:
|
||||
if IdLinksEditor(self).exec_() == QDialog.DialogCode.Accepted:
|
||||
self.changed_signal.emit()
|
||||
|
||||
@property
|
||||
@ -725,7 +725,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.set_cg_texture(d.texture)
|
||||
self.changed_signal.emit()
|
||||
|
||||
@ -750,7 +750,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
|
||||
def change_font(self, *args):
|
||||
fd = QFontDialog(self.build_font_obj(), self)
|
||||
if fd.exec_() == fd.Accepted:
|
||||
if fd.exec_() == QDialog.DialogCode.Accepted:
|
||||
font = fd.selectedFont()
|
||||
fi = QFontInfo(font)
|
||||
self.current_font = [unicode_type(fi.family()), fi.pointSize(),
|
||||
|
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
||||
from operator import attrgetter
|
||||
from PyQt5.Qt import (
|
||||
QAbstractListModel, QAbstractTableModel, QDialogButtonBox, QFrame, QIcon, QLabel,
|
||||
QScrollArea, Qt, QVBoxLayout, QWidget, pyqtSignal
|
||||
QScrollArea, Qt, QVBoxLayout, QWidget, pyqtSignal, QDialog
|
||||
)
|
||||
|
||||
from calibre.customize.ui import (
|
||||
@ -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_() == d.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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.author_map_rules = d.rules
|
||||
self.changed_signal.emit()
|
||||
|
||||
|
@ -10,7 +10,7 @@ import textwrap, os
|
||||
from collections import OrderedDict
|
||||
|
||||
from PyQt5.Qt import (Qt, QModelIndex, QAbstractItemModel, QIcon,
|
||||
QBrush)
|
||||
QBrush, QDialog)
|
||||
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||
from calibre.gui2.preferences.plugins_ui import Ui_Form
|
||||
@ -449,7 +449,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_() == d.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)
|
||||
|
@ -745,7 +745,7 @@ class User(QWidget):
|
||||
|
||||
def change_password(self):
|
||||
d = NewUser(self.user_data, self, self.username)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.user_data[self.username]['pw'] = d.password
|
||||
self.changed_signal.emit()
|
||||
|
||||
@ -802,7 +802,7 @@ class User(QWidget):
|
||||
self.user_data[self.username]['restriction'].copy(),
|
||||
parent=self
|
||||
)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.user_data[self.username]['restriction'] = d.restriction
|
||||
self.update_restriction()
|
||||
self.changed_signal.emit()
|
||||
@ -866,7 +866,7 @@ class Users(QWidget):
|
||||
|
||||
def add_user(self):
|
||||
d = NewUser(self.user_data, parent=self)
|
||||
if d.exec_() == d.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)
|
||||
|
@ -488,7 +488,7 @@ class ConfigWidget(ConfigWidgetBase):
|
||||
def plugin_tweaks(self):
|
||||
raw = self.tweaks.plugin_tweaks_string
|
||||
d = PluginTweaks(raw, self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
g, l = {}, {}
|
||||
try:
|
||||
exec(unicode_type(d.edit.toPlainText()), g, l)
|
||||
|
@ -604,7 +604,7 @@ class SavedSearchBoxMixin(object): # {{{
|
||||
def do_saved_search_edit(self, search):
|
||||
d = SavedSearchEditor(self, search)
|
||||
d.exec_()
|
||||
if d.result() == d.Accepted:
|
||||
if d.result() == QDialog.DialogCode.Accepted:
|
||||
self.do_rebuild_saved_searches()
|
||||
|
||||
def do_rebuild_saved_searches(self):
|
||||
@ -614,7 +614,7 @@ class SavedSearchBoxMixin(object): # {{{
|
||||
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_() == d.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()
|
||||
|
||||
|
@ -245,7 +245,7 @@ class CreateVirtualLibrary(QDialog): # {{{
|
||||
else:
|
||||
names = getattr(db, 'all_%s_names'%f)()
|
||||
d = SelectNames(names, txt, parent=self)
|
||||
if d.exec_() == d.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]
|
||||
@ -357,7 +357,7 @@ class SearchRestrictionMixin(object):
|
||||
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_() == cd.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)
|
||||
@ -519,7 +519,7 @@ class SearchRestrictionMixin(object):
|
||||
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_() == d.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):
|
||||
|
@ -394,7 +394,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
ext = d.format()
|
||||
fname = result.title[:60] + '.' + ext.lower()
|
||||
fname = ascii_filename(fname)
|
||||
|
@ -10,7 +10,7 @@ import textwrap
|
||||
from functools import partial
|
||||
|
||||
from PyQt5.Qt import (
|
||||
Qt, QIcon, QWidget, QHBoxLayout, QVBoxLayout, QToolButton, QLabel, QFrame,
|
||||
Qt, QIcon, QWidget, QHBoxLayout, QVBoxLayout, QToolButton, QLabel, QFrame, QDialog,
|
||||
QTimer, QMenu, QActionGroup, QAction, QSizePolicy, pyqtSignal)
|
||||
|
||||
from calibre.gui2 import error_dialog, question_dialog, gprefs
|
||||
@ -143,7 +143,7 @@ class TagBrowserMixin(object): # {{{
|
||||
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_() == d.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()
|
||||
@ -265,7 +265,7 @@ class TagBrowserMixin(object): # {{{
|
||||
sorter=key, ttm_is_first_letter=is_first_letter,
|
||||
fm=db.field_metadata[category])
|
||||
d.exec_()
|
||||
if d.result() == d.Accepted:
|
||||
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
|
||||
orig_name = d.original_names # dict of id: name
|
||||
@ -414,7 +414,7 @@ class TagBrowserMixin(object): # {{{
|
||||
break
|
||||
editor = EditAuthorsDialog(parent, db, id_, select_sort, select_link,
|
||||
get_authors_func, is_first_letter)
|
||||
if editor.exec_() == editor.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
|
||||
|
@ -7,7 +7,7 @@ from collections import OrderedDict
|
||||
import textwrap
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QIcon,
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QIcon, QDialog,
|
||||
QSize, QComboBox, QLineEdit, QListWidgetItem, QStyledItemDelegate, QAbstractItemView,
|
||||
QStaticText, Qt, QStyle, QToolButton, QInputDialog, QMenu, pyqtSignal
|
||||
)
|
||||
@ -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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.query.setText(', '.join(d.tags))
|
||||
|
||||
@property
|
||||
@ -320,7 +320,7 @@ class Rules(QWidget):
|
||||
|
||||
def add_rule(self):
|
||||
d = self.RuleEditDialogClass(self)
|
||||
if d.exec_() == d.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()
|
||||
@ -330,7 +330,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_() == d.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))
|
||||
|
@ -327,7 +327,7 @@ class ItemView(QStackedWidget): # {{{
|
||||
|
||||
def create_from_user_xpath(self):
|
||||
d = XPathDialog(self, self.prefs)
|
||||
if d.exec_() == d.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):
|
||||
@ -1141,7 +1141,7 @@ def main(path=None, title=None):
|
||||
d = TOCEditor(path, title=title)
|
||||
d.start()
|
||||
ret = 1
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
ret = 0
|
||||
wf.write('{}'.format(ret).encode('ascii'))
|
||||
del d
|
||||
|
@ -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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return None
|
||||
|
||||
# Create the output file
|
||||
|
@ -205,12 +205,12 @@ class Boss(QObject):
|
||||
for bar in ed.bars:
|
||||
bar.setIconSize(QSize(tprefs['toolbar_icon_size'], tprefs['toolbar_icon_size']))
|
||||
|
||||
if ret == p.Accepted:
|
||||
if ret == QDialog.DialogCode.Accepted:
|
||||
setup_css_parser_serialization()
|
||||
self.gui.apply_settings()
|
||||
self.refresh_file_list()
|
||||
self.gui.preview.start_refresh_timer()
|
||||
if ret == p.Accepted or p.dictionaries_changed:
|
||||
if ret == QDialog.DialogCode.Accepted or p.dictionaries_changed:
|
||||
for ed in itervalues(editors):
|
||||
ed.apply_settings(dictionaries_changed=p.dictionaries_changed)
|
||||
if orig_spell != tprefs['inline_spell_check']:
|
||||
@ -257,7 +257,7 @@ class Boss(QObject):
|
||||
if not self._check_before_open():
|
||||
return
|
||||
d = NewBook(self.gui)
|
||||
if d.exec_() == d.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)
|
||||
@ -274,7 +274,7 @@ class Boss(QObject):
|
||||
d = ImportForeign(self.gui)
|
||||
if hasattr(path, 'rstrip'):
|
||||
d.set_src(os.path.abspath(path))
|
||||
if d.exec_() == d.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
|
||||
@ -479,7 +479,7 @@ class Boss(QObject):
|
||||
return
|
||||
self.commit_dirty_opf()
|
||||
d = NewFileDialog(self.gui)
|
||||
if d.exec_() != d.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'):
|
||||
@ -553,7 +553,7 @@ class Boss(QObject):
|
||||
d = AddCover(current_container(), self.gui)
|
||||
d.import_requested.connect(self.do_add_file)
|
||||
try:
|
||||
if d.exec_() == d.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'))
|
||||
@ -574,7 +574,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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
self.rewind_savepoint()
|
||||
return
|
||||
with BusyCursor():
|
||||
@ -625,7 +625,7 @@ class Boss(QObject):
|
||||
d.rules = last_used_transform_rules
|
||||
ret = d.exec_()
|
||||
last_used_transform_rules = d.rules
|
||||
if ret != d.Accepted:
|
||||
if ret != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
with BusyCursor():
|
||||
self.add_savepoint(_('Before style transformation'))
|
||||
@ -682,7 +682,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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
self.commit_all_editors_to_container()
|
||||
name_map = rationalize_folders(c, d.folder_map)
|
||||
@ -838,7 +838,7 @@ class Boss(QObject):
|
||||
d.b = b = bb.addButton(_('See what &changed'), bb.AcceptRole)
|
||||
b.setIcon(QIcon(I('diff.png'))), b.setAutoDefault(False)
|
||||
bb.button(bb.Close).setDefault(True)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.show_current_diff(allow_revert=allow_revert, to_container=to_container)
|
||||
|
||||
def compare_book(self):
|
||||
@ -943,11 +943,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_() == d.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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
ed.insert_tag(d.tag)
|
||||
else:
|
||||
ed.action_triggered(action)
|
||||
@ -959,7 +959,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_() == d.Accepted and d.changed_type_map:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.changed_type_map:
|
||||
self.add_savepoint(_('Before: Set Semantics'))
|
||||
d.apply_changes(current_container())
|
||||
self.apply_container_update_to_gui()
|
||||
@ -972,7 +972,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_() == d.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)
|
||||
@ -1254,7 +1254,7 @@ class Boss(QObject):
|
||||
if name is None:
|
||||
return
|
||||
d = MultiSplit(self.gui)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
with BusyCursor():
|
||||
self.add_savepoint(_('Before: Split %s') % self.gui.elided_text(name))
|
||||
try:
|
||||
@ -1473,11 +1473,11 @@ class Boss(QObject):
|
||||
return
|
||||
from calibre.gui2.tweak_book.polish import show_report, CompressImages, CompressImagesProgress
|
||||
d = CompressImages(self.gui)
|
||||
if d.exec_() == d.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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
self.rewind_savepoint()
|
||||
return
|
||||
changed, report = d.result
|
||||
@ -1631,7 +1631,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_() == d.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 {{{
|
||||
@ -1788,7 +1788,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_() != d.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()
|
||||
|
@ -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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.canvas.resize_image(d.width, d.height)
|
||||
|
||||
def sharpen_image(self):
|
||||
|
@ -12,7 +12,7 @@ from PyQt5.Qt import (
|
||||
QAbstractListModel, QApplication, QCheckBox, QFormLayout, QGridLayout,
|
||||
QHBoxLayout, QIcon, QInputDialog, QLabel, QLineEdit, QListView, QMenu, QPainter,
|
||||
QPixmap, QRect, QSize, QSizePolicy, QSortFilterProxyModel, QStyledItemDelegate,
|
||||
Qt, QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout, pyqtSignal
|
||||
Qt, QToolButton, QTreeWidget, QTreeWidgetItem, QVBoxLayout, pyqtSignal, QDialog
|
||||
)
|
||||
|
||||
from calibre import fit_image
|
||||
@ -300,7 +300,7 @@ class InsertImage(Dialog):
|
||||
n, e = basename.rpartition('.')[0::2]
|
||||
basename = n + '.' + e.lower()
|
||||
d = ChooseName(basename, self)
|
||||
if d.exec_() == d.Accepted and d.filename:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.filename:
|
||||
self.accept()
|
||||
self.chosen_image_is_external = (d.filename, path)
|
||||
|
||||
@ -321,7 +321,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_() == d.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'), _(
|
||||
@ -355,7 +355,7 @@ class InsertImage(Dialog):
|
||||
def get_resource_data(rtype, parent):
|
||||
if rtype == 'image':
|
||||
d = InsertImage(parent)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
return d.chosen_image, d.chosen_image_is_external, d.fullpage.isChecked(), d.preserve_aspect_ratio.isChecked()
|
||||
|
||||
|
||||
|
@ -707,7 +707,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_() == d.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)
|
||||
# }}}
|
||||
|
@ -10,7 +10,7 @@ from collections import namedtuple
|
||||
from PyQt5.Qt import (
|
||||
QColor, QBrush, QFont, QApplication, QPalette, QComboBox,
|
||||
QPushButton, QIcon, QFormLayout, QLineEdit, QWidget, QScrollArea,
|
||||
QVBoxLayout, Qt, QHBoxLayout, pyqtSignal, QPixmap, QColorDialog,
|
||||
QVBoxLayout, Qt, QHBoxLayout, pyqtSignal, QPixmap, QColorDialog, QDialog,
|
||||
QToolButton, QCheckBox, QSize, QLabel, QSplitter, QTextCharFormat)
|
||||
|
||||
from calibre.gui2 import error_dialog
|
||||
@ -659,7 +659,7 @@ class ThemeEditor(Dialog):
|
||||
|
||||
def create_new_theme(self):
|
||||
d = CreateNewTheme(self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
name = '*' + d.theme_name
|
||||
base = unicode_type(d.base.currentText())
|
||||
theme = {}
|
||||
|
@ -111,7 +111,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
prefix = sanitize(unicode_type(d.prefix.text()))
|
||||
previous[category] = prefix
|
||||
tprefs.set('file-list-bulk-rename-prefix', previous)
|
||||
@ -636,7 +636,7 @@ class FileList(QTreeWidget, OpenWithHandler):
|
||||
|
||||
def start_merge(self, category, names):
|
||||
d = MergeDialog(names, self)
|
||||
if d.exec_() == d.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):
|
||||
@ -942,7 +942,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
tprefs['remove_existing_links_when_linking_sheets'] = r.isChecked()
|
||||
sheets = [unicode_type(s.item(il).text()) for il in range(s.count()) if s.item(il).checkState() == Qt.CheckState.Checked]
|
||||
if sheets:
|
||||
|
@ -11,7 +11,7 @@ from io import BytesIO
|
||||
from PyQt5.Qt import (
|
||||
QSplitter, QVBoxLayout, QTableView, QWidget, QLabel, QAbstractTableModel,
|
||||
Qt, QTimer, QPushButton, pyqtSignal, QFormLayout, QLineEdit, QIcon, QSize,
|
||||
QHBoxLayout, QTextEdit, QApplication, QMessageBox, QAbstractItemView)
|
||||
QHBoxLayout, QTextEdit, QApplication, QMessageBox, QAbstractItemView, QDialog)
|
||||
|
||||
from calibre.ebooks.oeb.polish.container import get_container
|
||||
from calibre.ebooks.oeb.polish.fonts import font_family_data, change_font
|
||||
@ -254,7 +254,7 @@ class ManageFonts(Dialog):
|
||||
fv.setShowGrid(False)
|
||||
fv.setAlternatingRowColors(True)
|
||||
fv.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
fv.setSelectionBehavior(fv.SelectRows)
|
||||
fv.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
fv.horizontalHeader().setSortIndicator(1, Qt.SortOrder.AscendingOrder)
|
||||
self.container = c = QWidget()
|
||||
l = c.l = QVBoxLayout(c)
|
||||
@ -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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
changed = False
|
||||
new_family = d.normalized_family
|
||||
|
@ -66,7 +66,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)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
raise Abort()
|
||||
ans['remove_unused_classes'] = tprefs['remove_unused_classes'] = c.isChecked()
|
||||
ans['merge_identical_selectors'] = tprefs['merge_identical_selectors'] = m.isChecked()
|
||||
@ -301,7 +301,7 @@ if __name__ == '__main__':
|
||||
c = get_container(sys.argv[-1], tweak_mode=True)
|
||||
set_current_container(c)
|
||||
d = CompressImages()
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
pass
|
||||
sip.delete(app)
|
||||
del app
|
||||
|
@ -250,7 +250,7 @@ class EditorSettings(BasicSettings): # {{{
|
||||
def manage_snippets(self):
|
||||
from calibre.gui2.tweak_book.editor.snippets import UserSnippets
|
||||
d = UserSnippets(self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.snippets_changed = True
|
||||
|
||||
def theme_choices(self):
|
||||
|
@ -130,7 +130,7 @@ class FilesView(QTableView):
|
||||
|
||||
def __init__(self, model, parent=None):
|
||||
QTableView.__init__(self, parent)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
self.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.setAlternatingRowColors(True)
|
||||
self.setSortingEnabled(True)
|
||||
|
@ -13,7 +13,7 @@ from PyQt5.Qt import (
|
||||
QAbstractListModel, QAction, QApplication, QCheckBox, QComboBox, QFont, QFrame,
|
||||
QGridLayout, QHBoxLayout, QIcon, QItemSelection, QKeySequence, QLabel, QLineEdit,
|
||||
QListView, QMenu, QMimeData, QModelIndex, QPushButton, QScrollArea, QSize,
|
||||
QSizePolicy, QStackedLayout, QStyledItemDelegate, Qt, QTimer, QToolBar,
|
||||
QSizePolicy, QStackedLayout, QStyledItemDelegate, Qt, QTimer, QToolBar, QDialog,
|
||||
QToolButton, QVBoxLayout, QWidget, pyqtSignal, QAbstractItemView
|
||||
)
|
||||
|
||||
@ -342,7 +342,7 @@ class SearchWidget(QWidget):
|
||||
|
||||
def edit_function(self):
|
||||
d = FunctionEditor(func_name=self.functions.text().strip(), parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.functions.setText(d.func_name)
|
||||
|
||||
def remove_function(self):
|
||||
@ -747,7 +747,7 @@ class EditSearch(QFrame): # {{{
|
||||
|
||||
def edit_function(self):
|
||||
d = FunctionEditor(func_name=self.function.text().strip(), parent=self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.function.setText(d.func_name)
|
||||
|
||||
def remove_function(self):
|
||||
|
@ -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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
d.loc.update_recently_used()
|
||||
word = unicode_type(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_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
lc = le.lang_codes
|
||||
if not lc:
|
||||
@ -518,7 +518,7 @@ class ManageDictionaries(Dialog): # {{{
|
||||
|
||||
def add_dictionary(self):
|
||||
d = AddDictionary(self)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.build_dictionaries(reread=True)
|
||||
|
||||
def remove_dictionary(self):
|
||||
@ -847,7 +847,7 @@ class WordsView(QTableView):
|
||||
def __init__(self, parent=None):
|
||||
QTableView.__init__(self, parent)
|
||||
self.setSortingEnabled(True), self.setShowGrid(False), self.setAlternatingRowColors(True)
|
||||
self.setSelectionBehavior(self.SelectRows)
|
||||
self.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||
self.setTabKeyNavigation(False)
|
||||
self.verticalHeader().close()
|
||||
|
||||
|
@ -14,7 +14,7 @@ from PyQt5.Qt import (
|
||||
QPainter, QStaticText, pyqtSignal, QTextOption, QAbstractListModel,
|
||||
QModelIndex, QStyledItemDelegate, QStyle, QCheckBox, QListView,
|
||||
QTextDocument, QSize, QComboBox, QFrame, QCursor, QGroupBox, QSplitter,
|
||||
QPixmap, QRect, QPlainTextEdit, QMimeData)
|
||||
QPixmap, QRect, QPlainTextEdit, QMimeData, QDialog)
|
||||
|
||||
from calibre import prepare_string_for_xml, human_readable
|
||||
from calibre.constants import iswindows
|
||||
@ -75,7 +75,7 @@ class InsertTag(Dialog): # {{{
|
||||
@classmethod
|
||||
def test(cls):
|
||||
d = cls()
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
print(d.tag)
|
||||
|
||||
# }}}
|
||||
@ -778,7 +778,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_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
print(d.href, d.text)
|
||||
|
||||
# }}}
|
||||
@ -971,7 +971,7 @@ class InsertSemantics(Dialog):
|
||||
from calibre.ebooks.oeb.polish.container import get_container
|
||||
c = get_container(sys.argv[-1], tweak_mode=True)
|
||||
d = cls(c)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
import pprint
|
||||
pprint.pprint(d.changed_type_map)
|
||||
d.apply_changes(d.container)
|
||||
@ -1043,7 +1043,7 @@ class FilterCSS(Dialog): # {{{
|
||||
@classmethod
|
||||
def test(cls):
|
||||
d = cls()
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
print(d.filtered_properties)
|
||||
|
||||
# }}}
|
||||
@ -1176,7 +1176,7 @@ class AddCover(Dialog):
|
||||
from calibre.gui2.tweak_book.file_list import NewFileDialog
|
||||
d = NewFileDialog(self)
|
||||
d.do_import_file(ans[0], hide_button=True)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.import_requested.emit(d.file_name, d.file_data)
|
||||
self.container = current_container()
|
||||
self.names_filter.clear()
|
||||
@ -1191,7 +1191,7 @@ class AddCover(Dialog):
|
||||
from calibre.ebooks.oeb.polish.container import get_container
|
||||
c = get_container(sys.argv[-1], tweak_mode=True)
|
||||
d = cls(c)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
pass
|
||||
|
||||
# }}}
|
||||
|
@ -11,7 +11,7 @@ from PyQt5.Qt import (
|
||||
QColor, QFont, QHBoxLayout, QIcon, QImage, QItemSelectionModel, QKeySequence,
|
||||
QLabel, QMenu, QPainter, QPainterPath, QPixmap, QPushButton, QRect, QSizePolicy,
|
||||
Qt, QTextEdit, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget, pyqtSignal,
|
||||
QAbstractItemView
|
||||
QAbstractItemView, QDialog
|
||||
)
|
||||
|
||||
from calibre.constants import (
|
||||
@ -391,7 +391,7 @@ class NotesDisplay(Details):
|
||||
def edit_notes(self):
|
||||
current_text = self.current_notes
|
||||
d = NotesEditDialog(current_text, self)
|
||||
if d.exec_() == d.Accepted and d.notes != current_text:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted and d.notes != current_text:
|
||||
self.notes_edited.emit(d.notes)
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ import sys
|
||||
from threading import Thread
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QCheckBox, QDoubleSpinBox, QFormLayout, QHBoxLayout, QIcon, QLabel,
|
||||
QCheckBox, QDoubleSpinBox, QFormLayout, QHBoxLayout, QIcon, QLabel, QDialog,
|
||||
QLineEdit, QPageSize, QProgressDialog, QTimer, QToolButton, QVBoxLayout
|
||||
)
|
||||
|
||||
@ -225,7 +225,7 @@ class Printing(QProgressDialog):
|
||||
def print_book(path_to_book, parent=None, book_title=None):
|
||||
book_title = book_title or os.path.splitext(os.path.basename(path_to_book))[0]
|
||||
d = PrintDialog(book_title, parent)
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
data = d.data
|
||||
data['input'] = path_to_book
|
||||
t = DoPrint(data)
|
||||
|
@ -8,7 +8,7 @@ from functools import partial
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QAction, QGroupBox, QHBoxLayout, QIcon, QKeySequence, QLabel, QListWidget,
|
||||
QListWidgetItem, QMenu, Qt, QToolBar, QToolButton, QVBoxLayout, pyqtSignal,
|
||||
QListWidgetItem, QMenu, Qt, QToolBar, QToolButton, QVBoxLayout, pyqtSignal, QDialog,
|
||||
QAbstractItemView
|
||||
)
|
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage
|
||||
@ -298,7 +298,7 @@ class ActionsToolBar(ToolBar):
|
||||
|
||||
def customize(self):
|
||||
d = ConfigureToolBar(parent=self.parent())
|
||||
if d.exec_() == d.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.add_actions()
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from PyQt5.Qt import QDialogButtonBox, QObject, QVBoxLayout, pyqtSignal
|
||||
from PyQt5.Qt import QDialogButtonBox, QObject, QVBoxLayout, pyqtSignal, QDialog
|
||||
|
||||
from calibre.gui2 import error_dialog
|
||||
from calibre.gui2.viewer.config import get_pref_group, vprefs
|
||||
@ -126,6 +126,6 @@ class TTS(QObject):
|
||||
def configure(self, data):
|
||||
ui_settings = get_pref_group('tts').copy()
|
||||
d = Config(self.tts_client, ui_settings, self.backend_settings, parent=self.parent())
|
||||
if d.exec_() == d.DialogCode.Accepted:
|
||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
||||
self.backend_settings = d.backend_settings
|
||||
self.settings_changed.emit(d.ui_settings)
|
||||
|
@ -257,7 +257,7 @@ class SendEmail(QWidget, Ui_Form):
|
||||
}
|
||||
}[service]
|
||||
d = RelaySetup(service, self)
|
||||
if d.exec_() != d.Accepted:
|
||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
self.relay_username.setText(d.username.text())
|
||||
self.relay_password.setText(d.password.text())
|
||||
|
Loading…
x
Reference in New Issue
Block a user