mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
more meaningless pyqt busywork
PyQt6 makes exec_() no longer available as an alias for exec(). Just to waste my time, I suppose.
This commit is contained in:
parent
2ba2439e6f
commit
7d85958b57
@ -18,4 +18,4 @@ def main(url):
|
|||||||
w.setUrl(QUrl(url))
|
w.setUrl(QUrl(url))
|
||||||
w.show()
|
w.show()
|
||||||
w.raise_()
|
w.raise_()
|
||||||
app.exec_()
|
app.exec()
|
||||||
|
@ -177,7 +177,7 @@ class Plugin: # {{{
|
|||||||
v.addWidget(config_widget)
|
v.addWidget(config_widget)
|
||||||
v.addWidget(button_box)
|
v.addWidget(button_box)
|
||||||
size_dialog()
|
size_dialog()
|
||||||
config_dialog.exec_()
|
config_dialog.exec()
|
||||||
|
|
||||||
if config_dialog.result() == QDialog.DialogCode.Accepted:
|
if config_dialog.result() == QDialog.DialogCode.Accepted:
|
||||||
if hasattr(config_widget, 'validate'):
|
if hasattr(config_widget, 'validate'):
|
||||||
@ -202,7 +202,7 @@ class Plugin: # {{{
|
|||||||
v.addWidget(sc)
|
v.addWidget(sc)
|
||||||
v.addWidget(button_box)
|
v.addWidget(button_box)
|
||||||
size_dialog()
|
size_dialog()
|
||||||
config_dialog.exec_()
|
config_dialog.exec()
|
||||||
|
|
||||||
if config_dialog.result() == QDialog.DialogCode.Accepted:
|
if config_dialog.result() == QDialog.DialogCode.Accepted:
|
||||||
sc = str(sc.text()).strip()
|
sc = str(sc.text()).strip()
|
||||||
|
@ -586,7 +586,7 @@ class MetadataGroupBox(DeviceOptionsGroupBox):
|
|||||||
def edit_template(self):
|
def edit_template(self):
|
||||||
t = TemplateDialog(self, self.template)
|
t = TemplateDialog(self, self.template)
|
||||||
t.setWindowTitle(_('Edit template'))
|
t.setWindowTitle(_('Edit template'))
|
||||||
if t.exec_():
|
if t.exec():
|
||||||
self.t.setText(t.rule[1])
|
self.t.setText(t.rule[1])
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@ -646,7 +646,7 @@ class TemplateConfig(QWidget): # {{{
|
|||||||
def edit_template(self):
|
def edit_template(self):
|
||||||
t = TemplateDialog(self, self.template)
|
t = TemplateDialog(self, self.template)
|
||||||
t.setWindowTitle(_('Edit template'))
|
t.setWindowTitle(_('Edit template'))
|
||||||
if t.exec_():
|
if t.exec():
|
||||||
self.t.setText(t.rule[1])
|
self.t.setText(t.rule[1])
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@ -686,6 +686,6 @@ if __name__ == '__main__':
|
|||||||
d.l.addWidget(bb)
|
d.l.addWidget(bb)
|
||||||
bb.accepted.connect(d.accept)
|
bb.accepted.connect(d.accept)
|
||||||
bb.rejected.connect(d.reject)
|
bb.rejected.connect(d.reject)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
cw.commit()
|
cw.commit()
|
||||||
dev.shutdown()
|
dev.shutdown()
|
||||||
|
@ -755,7 +755,7 @@ def test(scale=0.25):
|
|||||||
m.setCentralWidget(sa)
|
m.setCentralWidget(sa)
|
||||||
w.resize(w.sizeHint())
|
w.resize(w.sizeHint())
|
||||||
m.show()
|
m.show()
|
||||||
app.exec_()
|
app.exec()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -110,7 +110,7 @@ every time you add an HTML file to the library.\
|
|||||||
v.addWidget(bf)
|
v.addWidget(bf)
|
||||||
v.addWidget(button_box)
|
v.addWidget(button_box)
|
||||||
size_dialog()
|
size_dialog()
|
||||||
config_dialog.exec_()
|
config_dialog.exec()
|
||||||
|
|
||||||
if config_dialog.result() == QDialog.DialogCode.Accepted:
|
if config_dialog.result() == QDialog.DialogCode.Accepted:
|
||||||
sc = str(sc.text()).strip()
|
sc = str(sc.text()).strip()
|
||||||
|
@ -35,7 +35,7 @@ def main():
|
|||||||
renderer = Renderer()
|
renderer = Renderer()
|
||||||
renderer.setUrl(QUrl.fromLocalFile(sys.argv[-1]))
|
renderer.setUrl(QUrl.fromLocalFile(sys.argv[-1]))
|
||||||
renderer.loadFinished.connect(renderer.do_print)
|
renderer.loadFinished.connect(renderer.do_print)
|
||||||
QApplication.instance().exec_()
|
QApplication.instance().exec()
|
||||||
print('Output written to:', OUTPUT)
|
print('Output written to:', OUTPUT)
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ class RenderManager(QObject):
|
|||||||
def run_loop(self):
|
def run_loop(self):
|
||||||
self.block_signal_handlers()
|
self.block_signal_handlers()
|
||||||
try:
|
try:
|
||||||
return QApplication.exec_()
|
return QApplication.exec()
|
||||||
finally:
|
finally:
|
||||||
self.restore_signal_handlers()
|
self.restore_signal_handlers()
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ class RenderManager(QObject):
|
|||||||
w = self.workers[0]
|
w = self.workers[0]
|
||||||
self.evaljs_result = None
|
self.evaljs_result = None
|
||||||
w.runJavaScript(js, self.evaljs_callback)
|
w.runJavaScript(js, self.evaljs_callback)
|
||||||
QApplication.exec_()
|
QApplication.exec()
|
||||||
return self.evaljs_result
|
return self.evaljs_result
|
||||||
|
|
||||||
def evaljs_callback(self, result):
|
def evaljs_callback(self, result):
|
||||||
|
@ -104,7 +104,7 @@ def main(path_to_html, tdir, image_format='jpeg'):
|
|||||||
os.chdir(tdir)
|
os.chdir(tdir)
|
||||||
renderer = Render()
|
renderer = Render()
|
||||||
renderer.start_load(path_to_html)
|
renderer.start_load(path_to_html)
|
||||||
ret = QApplication.instance().exec_()
|
ret = QApplication.instance().exec()
|
||||||
if ret == 0:
|
if ret == 0:
|
||||||
page_images('rendered.pdf', image_format=image_format)
|
page_images('rendered.pdf', image_format=image_format)
|
||||||
ext = {'jpeg': 'jpg'}.get(image_format, image_format)
|
ext = {'jpeg': 'jpg'}.get(image_format, image_format)
|
||||||
|
@ -382,7 +382,7 @@ def warning_dialog(parent, title, msg, det_msg='', show=False,
|
|||||||
)+ ' ' + title, msg, det_msg, parent=parent,
|
)+ ' ' + title, msg, det_msg, parent=parent,
|
||||||
show_copy_button=show_copy_button)
|
show_copy_button=show_copy_button)
|
||||||
if show:
|
if show:
|
||||||
return d.exec_()
|
return d.exec()
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ def error_dialog(parent, title, msg, det_msg='', show=False,
|
|||||||
) + ' ' + title, msg, det_msg, parent=parent,
|
) + ' ' + title, msg, det_msg, parent=parent,
|
||||||
show_copy_button=show_copy_button)
|
show_copy_button=show_copy_button)
|
||||||
if show:
|
if show:
|
||||||
return d.exec_()
|
return d.exec()
|
||||||
return d
|
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))
|
tc.setChecked(bool(skip_dialog_skip_precheck))
|
||||||
d.resize_needed.emit()
|
d.resize_needed.emit()
|
||||||
|
|
||||||
ret = d.exec_() == QDialog.DialogCode.Accepted
|
ret = d.exec() == QDialog.DialogCode.Accepted
|
||||||
if add_abort_button and d.aborted:
|
if add_abort_button and d.aborted:
|
||||||
raise 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)
|
show_copy_button=show_copy_button, only_copy_details=only_copy_details)
|
||||||
|
|
||||||
if show:
|
if show:
|
||||||
return d.exec_()
|
return d.exec()
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
@ -474,7 +474,7 @@ def show_restart_warning(msg, parent=None):
|
|||||||
d.do_restart = True
|
d.do_restart = True
|
||||||
b.clicked.connect(rf)
|
b.clicked.connect(rf)
|
||||||
d.set_details('')
|
d.set_details('')
|
||||||
d.exec_()
|
d.exec()
|
||||||
b.clicked.disconnect()
|
b.clicked.disconnect()
|
||||||
return d.do_restart
|
return d.do_restart
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ class AddAction(InterfaceAction):
|
|||||||
from calibre.ebooks.oeb.polish.create import valid_empty_formats
|
from calibre.ebooks.oeb.polish.create import valid_empty_formats
|
||||||
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
|
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
|
||||||
d = ChooseFormatDialog(self.gui, _('Choose format of empty file'), sorted(valid_empty_formats))
|
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
|
return
|
||||||
self._add_empty_format(d.format())
|
self._add_empty_format(d.format())
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ class AddAction(InterfaceAction):
|
|||||||
title = index.model().db.title(index.row())
|
title = index.model().db.title(index.row())
|
||||||
dlg = AddEmptyBookDialog(self.gui, self.gui.library_view.model().db,
|
dlg = AddEmptyBookDialog(self.gui, self.gui.library_view.model().db,
|
||||||
author, series, dup_title=title)
|
author, series, dup_title=title)
|
||||||
if dlg.exec_() == QDialog.DialogCode.Accepted:
|
if dlg.exec() == QDialog.DialogCode.Accepted:
|
||||||
temp_files = []
|
temp_files = []
|
||||||
num = dlg.qty_to_add
|
num = dlg.qty_to_add
|
||||||
series = dlg.selected_series
|
series = dlg.selected_series
|
||||||
@ -398,7 +398,7 @@ class AddAction(InterfaceAction):
|
|||||||
self.isbn_add_dialog = ProgressDialog(_('Adding'),
|
self.isbn_add_dialog = ProgressDialog(_('Adding'),
|
||||||
_('Creating book records from ISBNs'), max=len(books),
|
_('Creating book records from ISBNs'), max=len(books),
|
||||||
cancelable=False, parent=self.gui)
|
cancelable=False, parent=self.gui)
|
||||||
self.isbn_add_dialog.exec_()
|
self.isbn_add_dialog.exec()
|
||||||
|
|
||||||
def do_one_isbn_add(self):
|
def do_one_isbn_add(self):
|
||||||
try:
|
try:
|
||||||
@ -516,7 +516,7 @@ class AddAction(InterfaceAction):
|
|||||||
def add_from_isbn(self, *args):
|
def add_from_isbn(self, *args):
|
||||||
from calibre.gui2.dialogs.add_from_isbn import AddFromISBN
|
from calibre.gui2.dialogs.add_from_isbn import AddFromISBN
|
||||||
d = AddFromISBN(self.gui)
|
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)
|
self.add_isbns(d.books, add_tags=d.set_tags, check_for_existing=d.check_for_existing)
|
||||||
|
|
||||||
def add_books(self, *args):
|
def add_books(self, *args):
|
||||||
@ -612,7 +612,7 @@ class AddAction(InterfaceAction):
|
|||||||
rows = view.selectionModel().selectedRows()
|
rows = view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Add to library'), _('No book selected'))
|
d = error_dialog(self.gui, _('Add to library'), _('No book selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
paths = [p for p in view.model().paths(rows) if p is not None]
|
paths = [p for p in view.model().paths(rows) if p is not None]
|
||||||
ve = self.gui.device_manager.device.VIRTUAL_BOOK_EXTENSIONS
|
ve = self.gui.device_manager.device.VIRTUAL_BOOK_EXTENSIONS
|
||||||
@ -632,7 +632,7 @@ class AddAction(InterfaceAction):
|
|||||||
return
|
return
|
||||||
if not paths or len(paths) == 0:
|
if not paths or len(paths) == 0:
|
||||||
d = error_dialog(self.gui, _('Add to library'), _('No book files found'))
|
d = error_dialog(self.gui, _('Add to library'), _('No book files found'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
self.gui.device_manager.prepare_addable_books(self.Dispatcher(partial(
|
self.gui.device_manager.prepare_addable_books(self.Dispatcher(partial(
|
||||||
|
@ -42,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>one book in the library</b>',
|
||||||
'The changes will be applied to <b>{} books in the library</b>', len(book_ids))
|
'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)))
|
d.edit_widget.msg_label.setText(d.edit_widget.msg_label.text() + '<p>' + txt.format(len(book_ids)))
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
rules = d.rules
|
rules = d.rules
|
||||||
|
@ -327,7 +327,7 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
_('Cannot export/import data while there are running jobs.'), show=True)
|
_('Cannot export/import data while there are running jobs.'), show=True)
|
||||||
from calibre.gui2.dialogs.exim import EximDialog
|
from calibre.gui2.dialogs.exim import EximDialog
|
||||||
d = EximDialog(parent=self.gui)
|
d = EximDialog(parent=self.gui)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
if d.restart_needed:
|
if d.restart_needed:
|
||||||
self.gui.iactions['Restart'].restart()
|
self.gui.iactions['Restart'].restart()
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
|
|
||||||
if not exists:
|
if not exists:
|
||||||
d = MovedDialog(self.stats, location, self.gui)
|
d = MovedDialog(self.stats, location, self.gui)
|
||||||
ret = d.exec_()
|
ret = d.exec()
|
||||||
self.build_menus()
|
self.build_menus()
|
||||||
self.gui.iactions['Copy To Library'].build_menus()
|
self.gui.iactions['Copy To Library'].build_menus()
|
||||||
if ret == QDialog.DialogCode.Accepted:
|
if ret == QDialog.DialogCode.Accepted:
|
||||||
@ -673,7 +673,7 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
location = self.stats.canonicalize_path(db.library_path)
|
location = self.stats.canonicalize_path(db.library_path)
|
||||||
self.pre_choose_dialog_location = location
|
self.pre_choose_dialog_location = location
|
||||||
c = ChooseLibrary(db, self.choose_library_callback, self.gui)
|
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):
|
def choose_library_callback(self, newloc, copy_structure=False, library_renamed=False):
|
||||||
self.gui.library_moved(newloc, copy_structure=copy_structure,
|
self.gui.library_moved(newloc, copy_structure=copy_structure,
|
||||||
|
@ -150,7 +150,7 @@ class ConvertAction(InterfaceAction):
|
|||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot convert'),
|
d = error_dialog(self.gui, _('Cannot convert'),
|
||||||
_('No books selected'))
|
_('No books selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return None
|
return None
|
||||||
return [self.gui.library_view.model().db.id(r) for r in rows]
|
return [self.gui.library_view.model().db.id(r) for r in rows]
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ def ask_about_cc_mismatch(gui, db, newdb, missing_cols, incompatible_cols): # {
|
|||||||
d.bb.accepted.connect(d.accept)
|
d.bb.accepted.connect(d.accept)
|
||||||
d.bb.rejected.connect(d.reject)
|
d.bb.rejected.connect(d.reject)
|
||||||
d.resize(d.sizeHint())
|
d.resize(d.sizeHint())
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
changes_made = False
|
changes_made = False
|
||||||
for k, cb in missing_widgets:
|
for k, cb in missing_widgets:
|
||||||
if cb.isChecked():
|
if cb.isChecked():
|
||||||
@ -382,7 +382,7 @@ class CopyToLibraryAction(InterfaceAction):
|
|||||||
db = self.gui.library_view.model().db
|
db = self.gui.library_view.model().db
|
||||||
locations = list(self.stats.locations(db))
|
locations = list(self.stats.locations(db))
|
||||||
d = ChooseLibrary(self.gui, locations)
|
d = ChooseLibrary(self.gui, locations)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
path, delete_after = d.args
|
path, delete_after = d.args
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return
|
||||||
@ -447,7 +447,7 @@ class CopyToLibraryAction(InterfaceAction):
|
|||||||
duplicate_ids = self.do_copy(ids, db, loc, delete_after, False)
|
duplicate_ids = self.do_copy(ids, db, loc, delete_after, False)
|
||||||
if duplicate_ids:
|
if duplicate_ids:
|
||||||
d = DuplicatesQuestion(self.gui, duplicate_ids, loc)
|
d = DuplicatesQuestion(self.gui, duplicate_ids, loc)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
ids = d.ids
|
ids = d.ids
|
||||||
if ids:
|
if ids:
|
||||||
self.do_copy(list(ids), db, loc, delete_after, add_duplicates=True)
|
self.do_copy(list(ids), db, loc, delete_after, add_duplicates=True)
|
||||||
@ -467,7 +467,7 @@ class CopyToLibraryAction(InterfaceAction):
|
|||||||
self.worker.start()
|
self.worker.start()
|
||||||
self.pd.canceled_signal.connect(self.worker.cancel_processing)
|
self.pd.canceled_signal.connect(self.worker.cancel_processing)
|
||||||
|
|
||||||
self.pd.exec_()
|
self.pd.exec()
|
||||||
self.pd.canceled_signal.disconnect()
|
self.pd.canceled_signal.disconnect()
|
||||||
|
|
||||||
if self.worker.left_after_cancel:
|
if self.worker.left_after_cancel:
|
||||||
|
@ -162,7 +162,7 @@ class DeleteAction(InterfaceAction):
|
|||||||
c[x] += 1
|
c[x] += 1
|
||||||
d = SelectFormats(c, msg, parent=self.gui, exclude=exclude,
|
d = SelectFormats(c, msg, parent=self.gui, exclude=exclude,
|
||||||
single=single)
|
single=single)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return None
|
return None
|
||||||
return d.selected_formats
|
return d.selected_formats
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class DeleteAction(InterfaceAction):
|
|||||||
rows = self.gui.library_view.selectionModel().selectedRows()
|
rows = self.gui.library_view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, err_title, _('No book selected'))
|
d = error_dialog(self.gui, err_title, _('No book selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return set()
|
return set()
|
||||||
return set(map(self.gui.library_view.model().id, rows))
|
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:
|
if not self.gui.device_manager.is_device_present:
|
||||||
d = error_dialog(self.gui, _('Cannot delete books'),
|
d = error_dialog(self.gui, _('Cannot delete books'),
|
||||||
_('No device is connected'))
|
_('No device is connected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
ids = self._get_selected_ids()
|
ids = self._get_selected_ids()
|
||||||
if not ids:
|
if not ids:
|
||||||
@ -287,10 +287,10 @@ class DeleteAction(InterfaceAction):
|
|||||||
if not some_to_delete:
|
if not some_to_delete:
|
||||||
d = error_dialog(self.gui, _('No books to delete'),
|
d = error_dialog(self.gui, _('No books to delete'),
|
||||||
_('None of the selected books are on the device'))
|
_('None of the selected books are on the device'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
d = DeleteMatchingFromDeviceDialog(self.gui, to_delete)
|
d = DeleteMatchingFromDeviceDialog(self.gui, to_delete)
|
||||||
if d.exec_():
|
if d.exec():
|
||||||
paths = {}
|
paths = {}
|
||||||
ids = {}
|
ids = {}
|
||||||
for (model, id, path) in d.result:
|
for (model, id, path) in d.result:
|
||||||
|
@ -243,7 +243,7 @@ class ConnectShareAction(InterfaceAction):
|
|||||||
_('Stopping server, this could take up to a minute, please wait...'),
|
_('Stopping server, this could take up to a minute, please wait...'),
|
||||||
show_copy_button=False)
|
show_copy_button=False)
|
||||||
QTimer.singleShot(1000, self.check_exited)
|
QTimer.singleShot(1000, self.check_exited)
|
||||||
self.stopping_msg.exec_()
|
self.stopping_msg.exec()
|
||||||
|
|
||||||
def check_exited(self):
|
def check_exited(self):
|
||||||
if getattr(self.gui.content_server, 'is_running', False):
|
if getattr(self.gui.content_server, 'is_running', False):
|
||||||
@ -264,7 +264,7 @@ class ConnectShareAction(InterfaceAction):
|
|||||||
dm.set_option('smartdevice', 'autostart', False)
|
dm.set_option('smartdevice', 'autostart', False)
|
||||||
else:
|
else:
|
||||||
sd_dialog = SmartdeviceDialog(self.gui)
|
sd_dialog = SmartdeviceDialog(self.gui)
|
||||||
sd_dialog.exec_()
|
sd_dialog.exec()
|
||||||
self.set_smartdevice_action_state()
|
self.set_smartdevice_action_state()
|
||||||
|
|
||||||
def check_smartdevice_menus(self):
|
def check_smartdevice_menus(self):
|
||||||
|
@ -369,7 +369,7 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
action_button=(_('&View book'), I('view.png'), self.gui.iactions['View'].view_historical),
|
action_button=(_('&View book'), I('view.png'), self.gui.iactions['View'].view_historical),
|
||||||
db=db
|
db=db
|
||||||
)
|
)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
if d.mark_rejected:
|
if d.mark_rejected:
|
||||||
failed_ids |= d.rejected_ids
|
failed_ids |= d.rejected_ids
|
||||||
restrict_to_failed = True
|
restrict_to_failed = True
|
||||||
@ -416,7 +416,7 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot edit metadata'),
|
d = error_dialog(self.gui, _('Cannot edit metadata'),
|
||||||
_('No books selected'))
|
_('No books selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
row_list = [r.row() for r in rows]
|
row_list = [r.row() for r in rows]
|
||||||
m = self.gui.library_view.model()
|
m = self.gui.library_view.model()
|
||||||
@ -508,7 +508,7 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot edit metadata'),
|
d = error_dialog(self.gui, _('Cannot edit metadata'),
|
||||||
_('No books selected'))
|
_('No books selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
self.do_edit_bulk_metadata(rows, ids)
|
self.do_edit_bulk_metadata(rows, ids)
|
||||||
|
|
||||||
@ -776,7 +776,7 @@ class EditMetadataAction(InterfaceAction):
|
|||||||
model = view.model()
|
model = view.model()
|
||||||
result = model.get_collections_with_ids()
|
result = model.get_collections_with_ids()
|
||||||
d = DeviceCategoryEditor(self.gui, tag_to_match=None, data=result, key=sort_key)
|
d = DeviceCategoryEditor(self.gui, tag_to_match=None, data=result, key=sort_key)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.result() == QDialog.DialogCode.Accepted:
|
if d.result() == QDialog.DialogCode.Accepted:
|
||||||
to_rename = d.to_rename # dict of new text to old ids
|
to_rename = d.to_rename # dict of new text to old ids
|
||||||
to_delete = d.to_delete # list of 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)
|
'Cannot read cover as the %s file is missing from this book') % 'PDF', show=True)
|
||||||
from calibre.gui2.metadata.pdf_covers import PDFCovers
|
from calibre.gui2.metadata.pdf_covers import PDFCovers
|
||||||
d = PDFCovers(pdfpath, parent=self.gui)
|
d = PDFCovers(pdfpath, parent=self.gui)
|
||||||
ret = d.exec_()
|
ret = d.exec()
|
||||||
if ret == QDialog.DialogCode.Accepted:
|
if ret == QDialog.DialogCode.Accepted:
|
||||||
cpath = d.cover_path
|
cpath = d.cover_path
|
||||||
if cpath:
|
if cpath:
|
||||||
|
@ -110,7 +110,7 @@ class EmbedAction(InterfaceAction):
|
|||||||
tc.setVisible(True), tc.setText(_('Show the &failed books in the main book list'))
|
tc.setVisible(True), tc.setText(_('Show the &failed books in the main book list'))
|
||||||
tc.setChecked(gprefs.get('show-embed-failed-books', False))
|
tc.setChecked(gprefs.get('show-embed-failed-books', False))
|
||||||
d.resize_needed.emit()
|
d.resize_needed.emit()
|
||||||
d.exec_()
|
d.exec()
|
||||||
gprefs['show-embed-failed-books'] = tc.isChecked()
|
gprefs['show-embed-failed-books'] = tc.isChecked()
|
||||||
if tc.isChecked():
|
if tc.isChecked():
|
||||||
failed_ids = {mi.book_id for mi, fmt, tb in errors}
|
failed_ids = {mi.book_id for mi, fmt, tb in errors}
|
||||||
|
@ -107,7 +107,7 @@ class MarkBooksAction(InterfaceAction):
|
|||||||
rows = self.gui.library_view.selectionModel().selectedRows()
|
rows = self.gui.library_view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot mark'), _('No books selected'))
|
d = error_dialog(self.gui, _('Cannot mark'), _('No books selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return set()
|
return set()
|
||||||
return set(map(self.gui.library_view.model().id, rows))
|
return set(map(self.gui.library_view.model().id, rows))
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ class MatchBookAction(InterfaceAction):
|
|||||||
rows = view.selectionModel().selectedRows()
|
rows = view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) != 1:
|
if not rows or len(rows) != 1:
|
||||||
d = error_dialog(self.gui, _('Match books'), _('You must select one book'))
|
d = error_dialog(self.gui, _('Match books'), _('You must select one book'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
id_ = view.model().indices(rows)[0]
|
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):
|
class ShowMatchedBookAction(InterfaceAction):
|
||||||
@ -62,7 +62,7 @@ class ShowMatchedBookAction(InterfaceAction):
|
|||||||
rows = view.selectionModel().selectedRows()
|
rows = view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) != 1:
|
if not rows or len(rows) != 1:
|
||||||
d = error_dialog(self.gui, _('Match books'), _('You must select one book'))
|
d = error_dialog(self.gui, _('Match books'), _('You must select one book'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
device_book_index = view.model().indices(rows)[0]
|
device_book_index = view.model().indices(rows)[0]
|
||||||
@ -74,7 +74,7 @@ class ShowMatchedBookAction(InterfaceAction):
|
|||||||
if question_dialog(self.gui, _('No matching books'), _(
|
if question_dialog(self.gui, _('No matching books'), _(
|
||||||
'No matching books found in the calibre library. Do you want to specify the'
|
'No matching books found in the calibre library. Do you want to specify the'
|
||||||
' matching book manually?')):
|
' matching book manually?')):
|
||||||
MatchBooks(self.gui, view, device_book_index, rows[0]).exec_()
|
MatchBooks(self.gui, view, device_book_index, rows[0]).exec()
|
||||||
return
|
return
|
||||||
ids = tuple(sorted(matching_book_ids, reverse=True))
|
ids = tuple(sorted(matching_book_ids, reverse=True))
|
||||||
self.gui.library_view.select_rows(ids)
|
self.gui.library_view.select_rows(ids)
|
||||||
|
@ -30,6 +30,6 @@ class PluginUpdaterAction(InterfaceAction):
|
|||||||
initial_filter = FILTER_ALL
|
initial_filter = FILTER_ALL
|
||||||
|
|
||||||
d = PluginUpdaterDialog(self.gui, initial_filter=initial_filter)
|
d = PluginUpdaterDialog(self.gui, initial_filter=initial_filter)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.do_restart:
|
if d.do_restart:
|
||||||
self.gui.quit(restart=True)
|
self.gui.quit(restart=True)
|
||||||
|
@ -251,7 +251,7 @@ class Polish(QDialog): # {{{
|
|||||||
self.pd = ProgressDialog(_('Queueing books for polishing'),
|
self.pd = ProgressDialog(_('Queueing books for polishing'),
|
||||||
max=len(self.queue), parent=self)
|
max=len(self.queue), parent=self)
|
||||||
QTimer.singleShot(0, self.do_one)
|
QTimer.singleShot(0, self.do_one)
|
||||||
self.pd.exec_()
|
self.pd.exec()
|
||||||
|
|
||||||
def do_one(self):
|
def do_one(self):
|
||||||
if not self.queue:
|
if not self.queue:
|
||||||
@ -458,7 +458,7 @@ class PolishAction(InterfaceAction):
|
|||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot polish'),
|
d = error_dialog(self.gui, _('Cannot polish'),
|
||||||
_('No books selected'))
|
_('No books selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return None
|
return None
|
||||||
db = self.gui.library_view.model().db
|
db = self.gui.library_view.model().db
|
||||||
ans = (db.id(r) for r in rows)
|
ans = (db.id(r) for r in rows)
|
||||||
@ -506,7 +506,7 @@ class PolishAction(InterfaceAction):
|
|||||||
|
|
||||||
def do_polish(self, book_id_map):
|
def do_polish(self, book_id_map):
|
||||||
d = Polish(self.gui.library_view.model().db, book_id_map, parent=self.gui)
|
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())
|
show_reports = bool(d.show_reports.isChecked())
|
||||||
for desc, data, book_id, base, is_orig in reversed(d.jobs):
|
for desc, data, book_id, base, is_orig in reversed(d.jobs):
|
||||||
job = self.gui.job_manager.run_job(
|
job = self.gui.job_manager.run_job(
|
||||||
@ -562,4 +562,4 @@ if __name__ == '__main__':
|
|||||||
app
|
app
|
||||||
from calibre.library import db
|
from calibre.library import db
|
||||||
d = Polish(db(), {1:{'EPUB'}, 2:{'AZW3'}})
|
d = Polish(db(), {1:{'EPUB'}, 2:{'AZW3'}})
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
@ -48,7 +48,7 @@ class PreferencesAction(InterfaceAction):
|
|||||||
FILTER_NOT_INSTALLED)
|
FILTER_NOT_INSTALLED)
|
||||||
d = PluginUpdaterDialog(self.gui,
|
d = PluginUpdaterDialog(self.gui,
|
||||||
initial_filter=FILTER_NOT_INSTALLED)
|
initial_filter=FILTER_NOT_INSTALLED)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.do_restart:
|
if d.do_restart:
|
||||||
self.gui.quit(restart=True)
|
self.gui.quit(restart=True)
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class PreferencesAction(InterfaceAction):
|
|||||||
if self.gui.job_manager.has_jobs():
|
if self.gui.job_manager.has_jobs():
|
||||||
d = error_dialog(self.gui, _('Cannot configure'),
|
d = error_dialog(self.gui, _('Cannot configure'),
|
||||||
_('Cannot configure while there are running jobs.'))
|
_('Cannot configure while there are running jobs.'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
if self.gui.must_restart_before_config:
|
if self.gui.must_restart_before_config:
|
||||||
do_restart = show_restart_warning(_('Cannot configure before calibre is restarted.'))
|
do_restart = show_restart_warning(_('Cannot configure before calibre is restarted.'))
|
||||||
@ -68,7 +68,7 @@ class PreferencesAction(InterfaceAction):
|
|||||||
close_after_initial=close_after_initial)
|
close_after_initial=close_after_initial)
|
||||||
d.run_wizard_requested.connect(self.gui.run_wizard,
|
d.run_wizard_requested.connect(self.gui.run_wizard,
|
||||||
type=Qt.ConnectionType.QueuedConnection)
|
type=Qt.ConnectionType.QueuedConnection)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.do_restart:
|
if d.do_restart:
|
||||||
self.gui.quit(restart=True)
|
self.gui.quit(restart=True)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class ShowBookDetailsAction(InterfaceAction):
|
|||||||
if self.gui.current_view() is not self.gui.library_view:
|
if self.gui.current_view() is not self.gui.library_view:
|
||||||
error_dialog(self.gui, _('No detailed info available'),
|
error_dialog(self.gui, _('No detailed info available'),
|
||||||
_('No detailed information is available for books '
|
_('No detailed information is available for books '
|
||||||
'on the device.')).exec_()
|
'on the device.')).exec()
|
||||||
return
|
return
|
||||||
index = self.gui.library_view.currentIndex()
|
index = self.gui.library_view.currentIndex()
|
||||||
if index.isValid():
|
if index.isValid():
|
||||||
|
@ -130,7 +130,7 @@ class ShowQuickviewAction(InterfaceAction):
|
|||||||
if self.gui.current_view() is not self.gui.library_view:
|
if self.gui.current_view() is not self.gui.library_view:
|
||||||
error_dialog(self.gui, _('No quickview available'),
|
error_dialog(self.gui, _('No quickview available'),
|
||||||
_('Quickview is not available for books '
|
_('Quickview is not available for books '
|
||||||
'on the device.')).exec_()
|
'on the device.')).exec()
|
||||||
return
|
return
|
||||||
self.qv_button.set_state_to_hide()
|
self.qv_button.set_state_to_hide()
|
||||||
index = self.gui.library_view.currentIndex()
|
index = self.gui.library_view.currentIndex()
|
||||||
|
@ -21,4 +21,4 @@ class ShowTemplateFunctionsAction(InterfaceAction):
|
|||||||
def show_template_editor(self, *args):
|
def show_template_editor(self, *args):
|
||||||
d = Preferences(self.gui, initial_plugin=('Advanced', 'TemplateFunctions'),
|
d = Preferences(self.gui, initial_plugin=('Advanced', 'TemplateFunctions'),
|
||||||
close_after_initial=True)
|
close_after_initial=True)
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
@ -33,7 +33,7 @@ class ShowTemplateTesterAction(InterfaceAction):
|
|||||||
if view is not self.gui.library_view:
|
if view is not self.gui.library_view:
|
||||||
return error_dialog(self.gui, _('No template tester available'),
|
return error_dialog(self.gui, _('No template tester available'),
|
||||||
_('Template tester is not available for books '
|
_('Template tester is not available for books '
|
||||||
'on the device.')).exec_()
|
'on the device.')).exec()
|
||||||
|
|
||||||
rows = view.selectionModel().selectedRows()
|
rows = view.selectionModel().selectedRows()
|
||||||
if not rows:
|
if not rows:
|
||||||
@ -48,6 +48,6 @@ class ShowTemplateTesterAction(InterfaceAction):
|
|||||||
t = TemplateDialog(self.gui, self.previous_text,
|
t = TemplateDialog(self.gui, self.previous_text,
|
||||||
mi, text_is_placeholder=self.first_time)
|
mi, text_is_placeholder=self.first_time)
|
||||||
t.setWindowTitle(_('Template tester'))
|
t.setWindowTitle(_('Template tester'))
|
||||||
if t.exec_() == QDialog.DialogCode.Accepted:
|
if t.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.previous_text = t.rule[1]
|
self.previous_text = t.rule[1]
|
||||||
self.first_time = False
|
self.first_time = False
|
||||||
|
@ -128,7 +128,7 @@ class SortByAction(InterfaceAction):
|
|||||||
def choose_multisort(self):
|
def choose_multisort(self):
|
||||||
from calibre.gui2.dialogs.multisort import ChooseMultiSort
|
from calibre.gui2.dialogs.multisort import ChooseMultiSort
|
||||||
d = ChooseMultiSort(self.gui.current_db, parent=self.gui, is_device_connected=self.gui.device_connected)
|
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)
|
self.gui.library_view.multisort(d.current_sort_spec)
|
||||||
|
|
||||||
def sort_requested(self, key, ascending):
|
def sort_requested(self, key, ascending):
|
||||||
|
@ -57,7 +57,7 @@ class StoreAction(InterfaceAction):
|
|||||||
self.show_disclaimer()
|
self.show_disclaimer()
|
||||||
from calibre.gui2.store.search.search import SearchDialog
|
from calibre.gui2.store.search.search import SearchDialog
|
||||||
sd = SearchDialog(self.gui, self.gui, query)
|
sd = SearchDialog(self.gui, self.gui, query)
|
||||||
sd.exec_()
|
sd.exec()
|
||||||
|
|
||||||
def _get_selected_row(self):
|
def _get_selected_row(self):
|
||||||
rows = self.gui.current_view().selectionModel().selectedRows()
|
rows = self.gui.current_view().selectionModel().selectedRows()
|
||||||
@ -118,7 +118,7 @@ class StoreAction(InterfaceAction):
|
|||||||
def choose(self):
|
def choose(self):
|
||||||
from calibre.gui2.store.config.chooser.chooser_dialog import StoreChooserDialog
|
from calibre.gui2.store.config.chooser.chooser_dialog import StoreChooserDialog
|
||||||
d = StoreChooserDialog(self.gui)
|
d = StoreChooserDialog(self.gui)
|
||||||
d.exec_()
|
d.exec()
|
||||||
self.gui.load_store_plugins()
|
self.gui.load_store_plugins()
|
||||||
self.load_menu()
|
self.load_menu()
|
||||||
|
|
||||||
|
@ -43,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>one book in the library</b>',
|
||||||
'The changes will be applied to <b>{} books in the library</b>', len(book_ids))
|
'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)))
|
d.edit_widget.msg_label.setText(d.edit_widget.msg_label.text() + '<p>' + txt.format(len(book_ids)))
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
with BusyCursor():
|
with BusyCursor():
|
||||||
rules = d.rules
|
rules = d.rules
|
||||||
|
@ -130,7 +130,7 @@ class ToCEditAction(InterfaceAction):
|
|||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot edit ToC'),
|
d = error_dialog(self.gui, _('Cannot edit ToC'),
|
||||||
_('No books selected'))
|
_('No books selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return None
|
return None
|
||||||
db = self.gui.current_db
|
db = self.gui.current_db
|
||||||
ans = (db.id(r) for r in rows)
|
ans = (db.id(r) for r in rows)
|
||||||
@ -140,7 +140,7 @@ class ToCEditAction(InterfaceAction):
|
|||||||
for book_id, fmts in iteritems(book_id_map):
|
for book_id, fmts in iteritems(book_id_map):
|
||||||
if len(fmts) > 1:
|
if len(fmts) > 1:
|
||||||
d = ChooseFormat(fmts, self.gui)
|
d = ChooseFormat(fmts, self.gui)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
fmts = d.formats
|
fmts = d.formats
|
||||||
for fmt in fmts:
|
for fmt in fmts:
|
||||||
|
@ -127,7 +127,7 @@ class TweakEpubAction(InterfaceAction):
|
|||||||
if len(tweakable_fmts) > 1:
|
if len(tweakable_fmts) > 1:
|
||||||
if tprefs['choose_tweak_fmt']:
|
if tprefs['choose_tweak_fmt']:
|
||||||
d = Choose(sorted(tweakable_fmts, key=tprefs.defaults['tweak_fmt_order'].index), self.gui)
|
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
|
return
|
||||||
tweakable_fmts = {d.fmt}
|
tweakable_fmts = {d.fmt}
|
||||||
else:
|
else:
|
||||||
|
@ -343,5 +343,5 @@ class UnpackBookAction(InterfaceAction):
|
|||||||
'\n\nFirst convert the book to one of these formats.'),
|
'\n\nFirst convert the book to one of these formats.'),
|
||||||
show=True)
|
show=True)
|
||||||
dlg = UnpackBook(self.gui, book_id, tweakable_fmts, db)
|
dlg = UnpackBook(self.gui, book_id, tweakable_fmts, db)
|
||||||
dlg.exec_()
|
dlg.exec()
|
||||||
dlg.cleanup()
|
dlg.cleanup()
|
||||||
|
@ -209,7 +209,7 @@ class ViewAction(InterfaceAction):
|
|||||||
rows = list(self.gui.library_view.selectionModel().selectedRows())
|
rows = list(self.gui.library_view.selectionModel().selectedRows())
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot view'), _('No book selected'))
|
d = error_dialog(self.gui, _('Cannot view'), _('No book selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
db = self.gui.library_view.model().db
|
db = self.gui.library_view.model().db
|
||||||
@ -228,7 +228,7 @@ class ViewAction(InterfaceAction):
|
|||||||
d = ChooseFormatDialog(self.gui, _('Choose the format to view'),
|
d = ChooseFormatDialog(self.gui, _('Choose the format to view'),
|
||||||
list(sorted(all_fmts)), show_open_with=True)
|
list(sorted(all_fmts)), show_open_with=True)
|
||||||
self.gui.book_converted.connect(d.book_converted)
|
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]
|
formats = [[x.upper() for x in db.new_api.formats(book_id)] for book_id in book_ids]
|
||||||
fmt = d.format()
|
fmt = d.format()
|
||||||
orig_num = len(rows)
|
orig_num = len(rows)
|
||||||
@ -266,7 +266,7 @@ class ViewAction(InterfaceAction):
|
|||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
d = error_dialog(self.gui, _('Cannot open folder'),
|
d = error_dialog(self.gui, _('Cannot open folder'),
|
||||||
_('No book selected'))
|
_('No book selected'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
if not self._view_check(len(rows), max_=10, skip_dialog_name='open-folder-many-check'):
|
if not self._view_check(len(rows), max_=10, skip_dialog_name='open-folder-many-check'):
|
||||||
return
|
return
|
||||||
|
@ -146,7 +146,7 @@ if __name__ == '__main__':
|
|||||||
{'action':'ignore', 'query':'ignore-me', 'match_type':'startswith'},
|
{'action':'ignore', 'query':'ignore-me', 'match_type':'startswith'},
|
||||||
{'action':'add', 'query':'*.moose', 'match_type':'glob'},
|
{'action':'add', 'query':'*.moose', 'match_type':'glob'},
|
||||||
]
|
]
|
||||||
d.exec_()
|
d.exec()
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
pprint(d.rules)
|
pprint(d.rules)
|
||||||
del d, app
|
del d, app
|
||||||
|
@ -131,7 +131,7 @@ if __name__ == '__main__':
|
|||||||
d.rules = [
|
d.rules = [
|
||||||
{'action':'replace', 'query':'alice B & alice bob', 'match_type':'one_of', 'replace':'Alice Bob'},
|
{'action':'replace', 'query':'alice B & alice bob', 'match_type':'one_of', 'replace':'Alice Bob'},
|
||||||
]
|
]
|
||||||
d.exec_()
|
d.exec()
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
pprint(d.rules)
|
pprint(d.rules)
|
||||||
del d, app
|
del d, app
|
||||||
|
@ -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
|
ema = get_gui().iactions['Edit Metadata'].menuless_qaction
|
||||||
menu.addAction(_('Open the Edit metadata window') + '\t' + ema.shortcut().toString(QKeySequence.SequenceFormat.NativeText), edit_metadata)
|
menu.addAction(_('Open the Edit metadata window') + '\t' + ema.shortcut().toString(QKeySequence.SequenceFormat.NativeText), edit_metadata)
|
||||||
if len(menu.actions()) > 0:
|
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)
|
create_open_cover_with_menu(self, cm)
|
||||||
cm.si = m = create_search_internet_menu(self.search_internet.emit)
|
cm.si = m = create_search_internet_menu(self.search_internet.emit)
|
||||||
cm.addMenu(m)
|
cm.addMenu(m)
|
||||||
cm.exec_(ev.globalPos())
|
cm.exec(ev.globalPos())
|
||||||
|
|
||||||
def open_with(self, entry):
|
def open_with(self, entry):
|
||||||
id_ = self.data.get('id', None)
|
id_ = self.data.get('id', None)
|
||||||
|
@ -691,7 +691,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
|||||||
d.bb.rejected.connect(d.reject)
|
d.bb.rejected.connect(d.reject)
|
||||||
d.resize(d.sizeHint())
|
d.resize(d.sizeHint())
|
||||||
link, name, is_image = None, None, False
|
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()
|
link, name = str(d.url.text()).strip(), str(d.name.text()).strip()
|
||||||
is_image = d.treat_as_image.isChecked()
|
is_image = d.treat_as_image.isChecked()
|
||||||
return link, name, is_image
|
return link, name, is_image
|
||||||
@ -832,7 +832,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
|||||||
am.addAction(self.action_background)
|
am.addAction(self.action_background)
|
||||||
am.addAction(self.action_color)
|
am.addAction(self.action_color)
|
||||||
menu.addAction(_('Smarten punctuation'), parent.smarten_punctuation)
|
menu.addAction(_('Smarten punctuation'), parent.smarten_punctuation)
|
||||||
menu.exec_(ev.globalPos())
|
menu.exec(ev.globalPos())
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@ -1228,5 +1228,5 @@ if __name__ == '__main__':
|
|||||||
set <u>out</u> to have an <em>affair</em>, <span style="font-style:italic; background-color:red">
|
set <u>out</u> to have an <em>affair</em>, <span style="font-style:italic; background-color:red">
|
||||||
much</span> less a <s>long-term</s>, <b>devoted</b> one.</span><p>hello'''
|
much</span> less a <s>long-term</s>, <b>devoted</b> one.</span><p>hello'''
|
||||||
w.html = '<div><p id="moo">Testing <em>a</em> link.</p><p>\xa0</p><p>ss</p></div>'
|
w.html = '<div><p id="moo">Testing <em>a</em> link.</p><p>\xa0</p><p>ss</p></div>'
|
||||||
app.exec_()
|
app.exec()
|
||||||
# print w.html
|
# print w.html
|
||||||
|
@ -535,4 +535,4 @@ if __name__ == '__main__':
|
|||||||
'oothree', 'a1', 'a2','Edgas', 'Èdgar', 'Édgaq', 'Edgar', 'Édgar']
|
'oothree', 'a1', 'a2','Edgas', 'Èdgar', 'Édgaq', 'Edgar', 'Édgar']
|
||||||
le.update_items_cache(items)
|
le.update_items_cache(items)
|
||||||
le.show_initial_value('')
|
le.show_initial_value('')
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
@ -104,5 +104,5 @@ if __name__ == '__main__':
|
|||||||
from qt.core import QApplication
|
from qt.core import QApplication
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
d = FontKeyChooser()
|
d = FontKeyChooser()
|
||||||
d.exec_()
|
d.exec()
|
||||||
del app
|
del app
|
||||||
|
@ -115,7 +115,7 @@ class LookAndFeelWidget(Widget, Ui_Form):
|
|||||||
from calibre.gui2.convert.font_key import FontKeyChooser
|
from calibre.gui2.convert.font_key import FontKeyChooser
|
||||||
d = FontKeyChooser(self, self.opt_base_font_size.value(),
|
d = FontKeyChooser(self, self.opt_base_font_size.value(),
|
||||||
str(self.opt_font_size_mapping.text()).strip())
|
str(self.opt_font_size_mapping.text()).strip())
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.opt_font_size_mapping.setText(', '.join(['%.1f'%x for x in
|
self.opt_font_size_mapping.setText(', '.join(['%.1f'%x for x in
|
||||||
d.fsizes]))
|
d.fsizes]))
|
||||||
self.opt_base_font_size.setValue(d.dbase)
|
self.opt_base_font_size.setValue(d.dbase)
|
||||||
|
@ -198,7 +198,7 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
if not os.access(_file, os.R_OK):
|
if not os.access(_file, os.R_OK):
|
||||||
d = error_dialog(self.parent(), _('Cannot read'),
|
d = error_dialog(self.parent(), _('Cannot read'),
|
||||||
_('You do not have permission to read the file: ') + _file)
|
_('You do not have permission to read the file: ') + _file)
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
cover = None
|
cover = None
|
||||||
try:
|
try:
|
||||||
@ -207,7 +207,7 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
d = error_dialog(self.parent(), _('Error reading file'),
|
d = error_dialog(self.parent(), _('Error reading file'),
|
||||||
_("<p>There was an error reading from file: <br /><b>") + _file + "</b></p><br />"+str(e))
|
_("<p>There was an error reading from file: <br /><b>") + _file + "</b></p><br />"+str(e))
|
||||||
d.exec_()
|
d.exec()
|
||||||
if cover:
|
if cover:
|
||||||
pix = QPixmap()
|
pix = QPixmap()
|
||||||
pix.loadFromData(cover)
|
pix.loadFromData(cover)
|
||||||
@ -215,7 +215,7 @@ class MetadataWidget(Widget, Ui_Form):
|
|||||||
if pix.isNull():
|
if pix.isNull():
|
||||||
d = error_dialog(self.parent(), _('Error reading file'),
|
d = error_dialog(self.parent(), _('Error reading file'),
|
||||||
_file + _(" is not a valid picture"))
|
_file + _(" is not a valid picture"))
|
||||||
d.exec_()
|
d.exec()
|
||||||
else:
|
else:
|
||||||
self.cover_path.setText(_file)
|
self.cover_path.setText(_file)
|
||||||
self.set_cover_tooltip(pix)
|
self.set_cover_tooltip(pix)
|
||||||
|
@ -151,7 +151,7 @@ class RegexBuilder(QDialog, Ui_RegexBuilder):
|
|||||||
format = formats[0]
|
format = formats[0]
|
||||||
elif len(formats) > 1:
|
elif len(formats) > 1:
|
||||||
d = ChooseFormatDialog(self, _('Choose the format to view'), formats)
|
d = ChooseFormatDialog(self, _('Choose the format to view'), formats)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.result() == QDialog.DialogCode.Accepted:
|
if d.result() == QDialog.DialogCode.Accepted:
|
||||||
format = d.format()
|
format = d.format()
|
||||||
else:
|
else:
|
||||||
@ -236,7 +236,7 @@ class RegexEdit(XPathEdit):
|
|||||||
if not self.doc_cache:
|
if not self.doc_cache:
|
||||||
self.doc_cache = bld.doc()
|
self.doc_cache = bld.doc()
|
||||||
self.doc_update.emit(self.doc_cache)
|
self.doc_update.emit(self.doc_cache)
|
||||||
if bld.exec_() == QDialog.DialogCode.Accepted:
|
if bld.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.edit.setText(bld.regex.text())
|
self.edit.setText(bld.regex.text())
|
||||||
|
|
||||||
def doc(self):
|
def doc(self):
|
||||||
@ -285,6 +285,6 @@ if __name__ == '__main__':
|
|||||||
app = Application([])
|
app = Application([])
|
||||||
d = RegexBuilder(None, None, 'a', doc='😉123abc XYZabc')
|
d = RegexBuilder(None, None, 'a', doc='😉123abc XYZabc')
|
||||||
d.do_test()
|
d.do_test()
|
||||||
d.exec_()
|
d.exec()
|
||||||
del d
|
del d
|
||||||
del app
|
del app
|
||||||
|
@ -40,6 +40,6 @@ class StructureDetectionWidget(Widget, Ui_Form):
|
|||||||
x = getattr(self, 'opt_'+x)
|
x = getattr(self, 'opt_'+x)
|
||||||
if not x.check():
|
if not x.check():
|
||||||
error_dialog(self, _('Invalid XPath'),
|
error_dialog(self, _('Invalid XPath'),
|
||||||
_('The XPath expression %s is invalid.')%x.text).exec_()
|
_('The XPath expression %s is invalid.')%x.text).exec()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -39,6 +39,6 @@ class TOCWidget(Widget, Ui_Form):
|
|||||||
x = getattr(self, 'opt_'+x+'_toc')
|
x = getattr(self, 'opt_'+x+'_toc')
|
||||||
if not x.check():
|
if not x.check():
|
||||||
error_dialog(self, _('Invalid XPath'),
|
error_dialog(self, _('Invalid XPath'),
|
||||||
_('The XPath expression %s is invalid.')%x.text).exec_()
|
_('The XPath expression %s is invalid.')%x.text).exec()
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
@ -102,7 +102,7 @@ class XPathEdit(QWidget):
|
|||||||
|
|
||||||
def wizard(self):
|
def wizard(self):
|
||||||
wiz = Wizard(self)
|
wiz = Wizard(self)
|
||||||
if wiz.exec_() == QDialog.DialogCode.Accepted:
|
if wiz.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.edit.setText(wiz.xpath)
|
self.edit.setText(wiz.xpath)
|
||||||
|
|
||||||
def setObjectName(self, *args):
|
def setObjectName(self, *args):
|
||||||
@ -144,5 +144,5 @@ if __name__ == '__main__':
|
|||||||
w = XPathEdit()
|
w = XPathEdit()
|
||||||
w.setObjectName('test')
|
w.setObjectName('test')
|
||||||
w.show()
|
w.show()
|
||||||
app.exec_()
|
app.exec()
|
||||||
print(w.xpath)
|
print(w.xpath)
|
||||||
|
@ -506,7 +506,7 @@ def test():
|
|||||||
|
|
||||||
w.show()
|
w.show()
|
||||||
cf.setFocus(Qt.FocusReason.OtherFocusReason)
|
cf.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
|
|
||||||
def main(args=sys.argv):
|
def main(args=sys.argv):
|
||||||
@ -528,4 +528,4 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
w.show()
|
w.show()
|
||||||
cf.setFocus(Qt.FocusReason.OtherFocusReason)
|
cf.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec())
|
||||||
|
@ -400,7 +400,7 @@ class CoverSettingsWidget(QWidget):
|
|||||||
def create_color_scheme(self):
|
def create_color_scheme(self):
|
||||||
scheme = self.colors_map[self.current_colors].data(Qt.ItemDataRole.UserRole)
|
scheme = self.colors_map[self.current_colors].data(Qt.ItemDataRole.UserRole)
|
||||||
d = CreateColorScheme('#' + _('My Color Scheme'), scheme, set(self.colors_map), parent=self)
|
d = CreateColorScheme('#' + _('My Color Scheme'), scheme, set(self.colors_map), parent=self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
name, scheme = d.data
|
name, scheme = d.data
|
||||||
li = QListWidgetItem(name)
|
li = QListWidgetItem(name)
|
||||||
li.setData(Qt.ItemDataRole.UserRole, scheme), li.setFlags(li.flags() | Qt.ItemFlag.ItemIsUserCheckable), li.setCheckState(Qt.CheckState.Checked)
|
li.setData(Qt.ItemDataRole.UserRole, scheme), li.setFlags(li.flags() | Qt.ItemFlag.ItemIsUserCheckable), li.setCheckState(Qt.CheckState.Checked)
|
||||||
@ -416,7 +416,7 @@ class CoverSettingsWidget(QWidget):
|
|||||||
' color scheme instead.'), show=True)
|
' color scheme instead.'), show=True)
|
||||||
li = self.colors_map[cs]
|
li = self.colors_map[cs]
|
||||||
d = CreateColorScheme(cs, li.data(Qt.ItemDataRole.UserRole), set(self.colors_map), edit_scheme=True, parent=self)
|
d = CreateColorScheme(cs, li.data(Qt.ItemDataRole.UserRole), set(self.colors_map), edit_scheme=True, parent=self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
name, scheme = d.data
|
name, scheme = d.data
|
||||||
li.setText(name)
|
li.setText(name)
|
||||||
li.setData(Qt.ItemDataRole.UserRole, scheme)
|
li.setData(Qt.ItemDataRole.UserRole, scheme)
|
||||||
@ -454,7 +454,7 @@ class CoverSettingsWidget(QWidget):
|
|||||||
attr = which + '_template'
|
attr = which + '_template'
|
||||||
templ = getattr(self, attr).text()
|
templ = getattr(self, attr).text()
|
||||||
d = TemplateDialog(self, templ, mi=self.mi, fm=field_metadata)
|
d = TemplateDialog(self, templ, mi=self.mi, fm=field_metadata)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
templ = d.rule[1]
|
templ = d.rule[1]
|
||||||
getattr(self, attr).setText(templ)
|
getattr(self, attr).setText(templ)
|
||||||
self.emit_changed()
|
self.emit_changed()
|
||||||
@ -613,6 +613,6 @@ if __name__ == '__main__':
|
|||||||
app = Application([])
|
app = Application([])
|
||||||
d = CoverSettingsDialog()
|
d = CoverSettingsDialog()
|
||||||
d.show()
|
d.show()
|
||||||
app.exec_()
|
app.exec()
|
||||||
del d
|
del d
|
||||||
del app
|
del app
|
||||||
|
@ -336,7 +336,7 @@ class RulesWidget(QWidget, SaveLoadMixin): # {{{
|
|||||||
self.changed.emit()
|
self.changed.emit()
|
||||||
|
|
||||||
def test_rules(self):
|
def test_rules(self):
|
||||||
self.TesterClass(self.rules_widget.rules, self).exec_()
|
self.TesterClass(self.rules_widget.rules, self).exec()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def rules(self):
|
def rules(self):
|
||||||
@ -360,7 +360,7 @@ if __name__ == '__main__':
|
|||||||
d.rules = [
|
d.rules = [
|
||||||
{'property':'color', 'match_type':'*', 'query':'', 'action':'change', 'action_data':'green'},
|
{'property':'color', 'match_type':'*', 'query':'', 'action':'change', 'action_data':'green'},
|
||||||
]
|
]
|
||||||
d.exec_()
|
d.exec()
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
pprint(d.rules)
|
pprint(d.rules)
|
||||||
del d, app
|
del d, app
|
||||||
|
@ -489,7 +489,7 @@ def _save_dialog(parent, title, msg, det_msg=''):
|
|||||||
d.setWindowTitle(title)
|
d.setWindowTitle(title)
|
||||||
d.setText(msg)
|
d.setText(msg)
|
||||||
d.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No | QMessageBox.StandardButton.Cancel)
|
d.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No | QMessageBox.StandardButton.Cancel)
|
||||||
return d.exec_()
|
return d.exec()
|
||||||
|
|
||||||
|
|
||||||
class Text(Base):
|
class Text(Base):
|
||||||
@ -576,7 +576,7 @@ class Text(Base):
|
|||||||
self.initialize(self.book_id)
|
self.initialize(self.book_id)
|
||||||
else:
|
else:
|
||||||
d = TagEditor(self.parent, self.db, self.book_id, self.key)
|
d = TagEditor(self.parent, self.db, self.book_id, self.key)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.setter(d.tags)
|
self.setter(d.tags)
|
||||||
|
|
||||||
def connect_data_changed(self, slot):
|
def connect_data_changed(self, slot):
|
||||||
@ -1494,7 +1494,7 @@ class BulkText(BulkBase):
|
|||||||
return
|
return
|
||||||
widget.setText('')
|
widget.setText('')
|
||||||
d = TagEditor(self.parent, self.db, key=('#'+self.col_metadata['label']))
|
d = TagEditor(self.parent, self.db, key=('#'+self.col_metadata['label']))
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
val = d.tags
|
val = d.tags
|
||||||
if not val:
|
if not val:
|
||||||
val = []
|
val = []
|
||||||
|
@ -989,7 +989,7 @@ class DeviceMixin: # {{{
|
|||||||
if cw.validate():
|
if cw.validate():
|
||||||
QDialog.accept(config_dialog)
|
QDialog.accept(config_dialog)
|
||||||
config_dialog.accept = validate
|
config_dialog.accept = validate
|
||||||
if config_dialog.exec_() == QDialog.DialogCode.Accepted:
|
if config_dialog.exec() == QDialog.DialogCode.Accepted:
|
||||||
dev.save_settings(cw)
|
dev.save_settings(cw)
|
||||||
|
|
||||||
do_restart = show_restart_warning(_('Restart calibre for the changes to %s'
|
do_restart = show_restart_warning(_('Restart calibre for the changes to %s'
|
||||||
@ -1042,7 +1042,7 @@ class DeviceMixin: # {{{
|
|||||||
if getattr(job, 'exception', None).__class__.__name__ == 'MTPInvalidSendPathError':
|
if getattr(job, 'exception', None).__class__.__name__ == 'MTPInvalidSendPathError':
|
||||||
try:
|
try:
|
||||||
from calibre.gui2.device_drivers.mtp_config import SendError
|
from calibre.gui2.device_drivers.mtp_config import SendError
|
||||||
return SendError(self, job.exception).exec_()
|
return SendError(self, job.exception).exec()
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
try:
|
try:
|
||||||
@ -1234,7 +1234,7 @@ class DeviceMixin: # {{{
|
|||||||
rows = self.library_view.selectionModel().selectedRows()
|
rows = self.library_view.selectionModel().selectedRows()
|
||||||
if not rows or len(rows) == 0:
|
if not rows or len(rows) == 0:
|
||||||
error_dialog(self, _('No books'), _('No books')+' '+
|
error_dialog(self, _('No books'), _('No books')+' '+
|
||||||
_('selected to send')).exec_()
|
_('selected to send')).exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
fmt = None
|
fmt = None
|
||||||
@ -1264,7 +1264,7 @@ class DeviceMixin: # {{{
|
|||||||
elif f in aval_out_formats:
|
elif f in aval_out_formats:
|
||||||
formats.append((f, _('0 of %i books') % len(rows), True))
|
formats.append((f, _('0 of %i books') % len(rows), True))
|
||||||
d = ChooseFormatDeviceDialog(self, _('Choose format to send to device'), formats)
|
d = ChooseFormatDeviceDialog(self, _('Choose format to send to device'), formats)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
if d.format():
|
if d.format():
|
||||||
fmt = d.format().lower()
|
fmt = d.format().lower()
|
||||||
@ -1272,15 +1272,15 @@ class DeviceMixin: # {{{
|
|||||||
if dest in ('main', 'carda', 'cardb'):
|
if dest in ('main', 'carda', 'cardb'):
|
||||||
if not self.device_connected or not self.device_manager:
|
if not self.device_connected or not self.device_manager:
|
||||||
error_dialog(self, _('No device'),
|
error_dialog(self, _('No device'),
|
||||||
_('Cannot send: No device is connected')).exec_()
|
_('Cannot send: No device is connected')).exec()
|
||||||
return
|
return
|
||||||
if dest == 'carda' and not self.device_manager.has_card():
|
if dest == 'carda' and not self.device_manager.has_card():
|
||||||
error_dialog(self, _('No card'),
|
error_dialog(self, _('No card'),
|
||||||
_('Cannot send: Device has no storage card')).exec_()
|
_('Cannot send: Device has no storage card')).exec()
|
||||||
return
|
return
|
||||||
if dest == 'cardb' and not self.device_manager.has_card():
|
if dest == 'cardb' and not self.device_manager.has_card():
|
||||||
error_dialog(self, _('No card'),
|
error_dialog(self, _('No card'),
|
||||||
_('Cannot send: Device has no storage card')).exec_()
|
_('Cannot send: Device has no storage card')).exec()
|
||||||
return
|
return
|
||||||
if dest == 'main':
|
if dest == 'main':
|
||||||
on_card = None
|
on_card = None
|
||||||
@ -1567,7 +1567,7 @@ class DeviceMixin: # {{{
|
|||||||
'as no suitable formats were found. Convert the book(s) to a '
|
'as no suitable formats were found. Convert the book(s) to a '
|
||||||
'format supported by your device first.'
|
'format supported by your device first.'
|
||||||
), bad)
|
), bad)
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
|
||||||
def upload_dirtied_booklists(self):
|
def upload_dirtied_booklists(self):
|
||||||
'''
|
'''
|
||||||
@ -1645,7 +1645,7 @@ class DeviceMixin: # {{{
|
|||||||
_('<p>Cannot upload books to device there '
|
_('<p>Cannot upload books to device there '
|
||||||
'is no more free space available ')+where+
|
'is no more free space available ')+where+
|
||||||
'</p>\n<ul>%s</ul>'%(titles,))
|
'</p>\n<ul>%s</ul>'%(titles,))
|
||||||
d.exec_()
|
d.exec()
|
||||||
elif isinstance(job.exception, WrongDestinationError):
|
elif isinstance(job.exception, WrongDestinationError):
|
||||||
error_dialog(self, _('Incorrect destination'),
|
error_dialog(self, _('Incorrect destination'),
|
||||||
str(job.exception), show=True)
|
str(job.exception), show=True)
|
||||||
|
@ -102,7 +102,7 @@ class TemplateConfig(QWidget): # {{{
|
|||||||
def edit_template(self):
|
def edit_template(self):
|
||||||
t = TemplateDialog(self, self.template)
|
t = TemplateDialog(self, self.template)
|
||||||
t.setWindowTitle(_('Edit template'))
|
t.setWindowTitle(_('Edit template'))
|
||||||
if t.exec_():
|
if t.exec():
|
||||||
self.t.setText(t.rule[1])
|
self.t.setText(t.rule[1])
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@ -149,7 +149,7 @@ class SendToConfig(QWidget): # {{{
|
|||||||
def browse(self):
|
def browse(self):
|
||||||
b = Browser(self.device.filesystem_cache, show_files=False,
|
b = Browser(self.device.filesystem_cache, show_files=False,
|
||||||
parent=self)
|
parent=self)
|
||||||
if b.exec_() == QDialog.DialogCode.Accepted and b.current_item is not None:
|
if b.exec() == QDialog.DialogCode.Accepted and b.current_item is not None:
|
||||||
sid, path = b.current_item
|
sid, path = b.current_item
|
||||||
self.t.setText('/'.join(path[1:]))
|
self.t.setText('/'.join(path[1:]))
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ class Rule(QWidget):
|
|||||||
def browse(self):
|
def browse(self):
|
||||||
b = Browser(self.device.filesystem_cache, show_files=False,
|
b = Browser(self.device.filesystem_cache, show_files=False,
|
||||||
parent=self)
|
parent=self)
|
||||||
if b.exec_() == QDialog.DialogCode.Accepted and b.current_item is not None:
|
if b.exec() == QDialog.DialogCode.Accepted and b.current_item is not None:
|
||||||
sid, path = b.current_item
|
sid, path = b.current_item
|
||||||
self.folder.setText('/'.join(path[1:]))
|
self.folder.setText('/'.join(path[1:]))
|
||||||
|
|
||||||
@ -428,12 +428,12 @@ class MTPConfig(QTabWidget):
|
|||||||
bb.addButton(_('Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
|
bb.addButton(_('Copy to clipboard'), QDialogButtonBox.ButtonRole.ActionRole)
|
||||||
bb.clicked.connect(lambda :
|
bb.clicked.connect(lambda :
|
||||||
QApplication.clipboard().setText(v.toPlainText()))
|
QApplication.clipboard().setText(v.toPlainText()))
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
|
||||||
def change_ignored_folders(self):
|
def change_ignored_folders(self):
|
||||||
d = IgnoredFolders(self.device,
|
d = IgnoredFolders(self.device,
|
||||||
self.current_ignored_folders, parent=self)
|
self.current_ignored_folders, parent=self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.current_ignored_folders = d.ignored_folders
|
self.current_ignored_folders = d.ignored_folders
|
||||||
|
|
||||||
def ignore_device(self):
|
def ignore_device(self):
|
||||||
@ -547,6 +547,6 @@ if __name__ == '__main__':
|
|||||||
d.l.addWidget(bb)
|
d.l.addWidget(bb)
|
||||||
bb.accepted.connect(d.accept)
|
bb.accepted.connect(d.accept)
|
||||||
bb.rejected.connect(d.reject)
|
bb.rejected.connect(d.reject)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
cw.commit()
|
cw.commit()
|
||||||
dev.shutdown()
|
dev.shutdown()
|
||||||
|
@ -226,7 +226,7 @@ def browse():
|
|||||||
app
|
app
|
||||||
dev = setup_device()
|
dev = setup_device()
|
||||||
d = Browser(dev.filesystem_cache)
|
d = Browser(dev.filesystem_cache)
|
||||||
d.exec_()
|
d.exec()
|
||||||
dev.shutdown()
|
dev.shutdown()
|
||||||
return d.current_item
|
return d.current_item
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ def ignored_folders():
|
|||||||
app
|
app
|
||||||
dev = setup_device()
|
dev = setup_device()
|
||||||
d = IgnoredFolders(dev)
|
d = IgnoredFolders(dev)
|
||||||
d.exec_()
|
d.exec()
|
||||||
dev.shutdown()
|
dev.shutdown()
|
||||||
return d.ignored_folders
|
return d.ignored_folders
|
||||||
|
|
||||||
|
@ -389,6 +389,6 @@ if __name__ == '__main__':
|
|||||||
d.l.addWidget(bb)
|
d.l.addWidget(bb)
|
||||||
bb.accepted.connect(d.accept)
|
bb.accepted.connect(d.accept)
|
||||||
bb.rejected.connect(d.reject)
|
bb.rejected.connect(d.reject)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
cw.commit()
|
cw.commit()
|
||||||
dev.shutdown()
|
dev.shutdown()
|
||||||
|
@ -179,4 +179,4 @@ if __name__ == '__main__':
|
|||||||
db = db()
|
db = db()
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
d = AddEmptyBookDialog(None, db, 'Test Author')
|
d = AddEmptyBookDialog(None, db, 'Test Author')
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
@ -199,5 +199,5 @@ class AuthorsEdit(QDialog):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
d = AuthorsEdit(['kovid goyal', 'divok layog', 'other author'], ['kovid goyal', 'other author'])
|
d = AuthorsEdit(['kovid goyal', 'divok layog', 'other author'], ['kovid goyal', 'other author'])
|
||||||
d.exec_()
|
d.exec()
|
||||||
print(d.authors)
|
print(d.authors)
|
||||||
|
@ -223,7 +223,7 @@ class BookInfo(QDialog):
|
|||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
d = Configure(get_gui().current_db, self)
|
d = Configure(get_gui().current_db, self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
if self.current_row is not None:
|
if self.current_row is not None:
|
||||||
mi = self.view.model().get_book_display_info(self.current_row)
|
mi = self.view.model().get_book_display_info(self.current_row)
|
||||||
if mi is not None:
|
if mi is not None:
|
||||||
@ -364,6 +364,6 @@ if __name__ == '__main__':
|
|||||||
app.current_db = db()
|
app.current_db = db()
|
||||||
get_gui.ans = app
|
get_gui.ans = app
|
||||||
d = Configure(app.current_db)
|
d = Configure(app.current_db)
|
||||||
d.exec_()
|
d.exec()
|
||||||
del d
|
del d
|
||||||
del app
|
del app
|
||||||
|
@ -46,7 +46,7 @@ class DBCheck(QDialog): # {{{
|
|||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
QTimer.singleShot(100, self.check)
|
QTimer.singleShot(100, self.check)
|
||||||
self.exec_()
|
self.exec()
|
||||||
|
|
||||||
def vacuum(self):
|
def vacuum(self):
|
||||||
try:
|
try:
|
||||||
@ -233,7 +233,7 @@ class CheckLibraryDialog(QDialog):
|
|||||||
probs += self.problem_count[c]
|
probs += self.problem_count[c]
|
||||||
if probs == 0:
|
if probs == 0:
|
||||||
return False
|
return False
|
||||||
self.exec_()
|
self.exec()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
@ -467,4 +467,4 @@ if __name__ == '__main__':
|
|||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
from calibre.library import db
|
from calibre.library import db
|
||||||
d = CheckLibraryDialog(None, db())
|
d = CheckLibraryDialog(None, db())
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
@ -104,6 +104,6 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = ChooseFormatDialog(None, 'Testing choose format', ['epub', 'mobi', 'docx'], show_open_with=True)
|
d = ChooseFormatDialog(None, 'Testing choose format', ['epub', 'mobi', 'docx'], show_open_with=True)
|
||||||
d.exec_()
|
d.exec()
|
||||||
print(d._format)
|
print(d._format)
|
||||||
del app
|
del app
|
||||||
|
@ -150,7 +150,7 @@ class ChooseLibrary(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
t = Thread(name='MoveLibrary', target=do_move)
|
t = Thread(name='MoveLibrary', target=do_move)
|
||||||
QTimer.singleShot(0, t.start)
|
QTimer.singleShot(0, t.start)
|
||||||
pd.exec_()
|
pd.exec()
|
||||||
if abort_move.is_set():
|
if abort_move.is_set():
|
||||||
self.callback(self.db.library_path)
|
self.callback(self.db.library_path)
|
||||||
return
|
return
|
||||||
|
@ -81,6 +81,6 @@ class PlainTextDialog(Dialog):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = CommentsDialog(None, 'testing', 'Comments')
|
d = CommentsDialog(None, 'testing', 'Comments')
|
||||||
d.exec_()
|
d.exec()
|
||||||
del d
|
del d
|
||||||
del app
|
del app
|
||||||
|
@ -78,7 +78,7 @@ def confirm(msg, name, parent=None, pixmap='dialog_warning.png', title=None,
|
|||||||
return True
|
return True
|
||||||
d = Dialog(msg, name, parent, config_set=config_set, icon=pixmap, extra_button=extra_button,
|
d = Dialog(msg, name, parent, config_set=config_set, icon=pixmap, extra_button=extra_button,
|
||||||
title=title, confirm_msg=confirm_msg, show_cancel_button=show_cancel_button)
|
title=title, confirm_msg=confirm_msg, show_cancel_button=show_cancel_button)
|
||||||
ret = d.exec_() == QDialog.DialogCode.Accepted
|
ret = d.exec() == QDialog.DialogCode.Accepted
|
||||||
if extra_button:
|
if extra_button:
|
||||||
ret = ret, d.extra_button_clicked
|
ret = ret, d.extra_button_clicked
|
||||||
return ret
|
return ret
|
||||||
|
@ -45,7 +45,7 @@ def confirm_location(msg, name, parent=None, pixmap='dialog_warning.png'):
|
|||||||
d.label.setPixmap(QPixmap(I(pixmap)))
|
d.label.setPixmap(QPixmap(I(pixmap)))
|
||||||
d.setWindowIcon(QIcon(I(pixmap)))
|
d.setWindowIcon(QIcon(I(pixmap)))
|
||||||
d.resize(d.sizeHint())
|
d.resize(d.sizeHint())
|
||||||
ret = d.exec_()
|
ret = d.exec()
|
||||||
d.break_cycles()
|
d.break_cycles()
|
||||||
if ret == QDialog.DialogCode.Accepted:
|
if ret == QDialog.DialogCode.Accepted:
|
||||||
return d.choice()
|
return d.choice()
|
||||||
|
@ -91,7 +91,7 @@ def confirm_merge(msg, name, parent, mi):
|
|||||||
if not config_set.get(confirm_config_name(name), True):
|
if not config_set.get(confirm_config_name(name), True):
|
||||||
return True
|
return True
|
||||||
d = ConfirmMerge(msg, name, parent, mi)
|
d = ConfirmMerge(msg, name, parent, mi)
|
||||||
return d.exec_() == QDialog.DialogCode.Accepted
|
return d.exec() == QDialog.DialogCode.Accepted
|
||||||
|
|
||||||
|
|
||||||
class ChooseMerge(Dialog):
|
class ChooseMerge(Dialog):
|
||||||
@ -189,6 +189,6 @@ class ChooseMerge(Dialog):
|
|||||||
|
|
||||||
def merge_drop(dest_id, src_ids, gui):
|
def merge_drop(dest_id, src_ids, gui):
|
||||||
d = ChooseMerge(dest_id, src_ids, gui)
|
d = ChooseMerge(dest_id, src_ids, gui)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return None, None, None
|
return None, None, None
|
||||||
return d.merge_type
|
return d.merge_type
|
||||||
|
@ -658,7 +658,7 @@ class CustomRecipes(Dialog):
|
|||||||
|
|
||||||
def customize_recipe(self):
|
def customize_recipe(self):
|
||||||
d = ChooseBuiltinRecipe(self.recipe_model, self)
|
d = ChooseBuiltinRecipe(self.recipe_model, self)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
|
|
||||||
id_ = d.selected_recipe
|
id_ = d.selected_recipe
|
||||||
@ -690,7 +690,7 @@ class CustomRecipes(Dialog):
|
|||||||
def import_opml(self):
|
def import_opml(self):
|
||||||
from calibre.gui2.dialogs.opml import ImportOPML
|
from calibre.gui2.dialogs.opml import ImportOPML
|
||||||
d = ImportOPML(parent=self)
|
d = ImportOPML(parent=self)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
oldest_article, max_articles_per_feed, replace_existing = d.oldest_article, d.articles_per_feed, d.replace_existing
|
oldest_article, max_articles_per_feed, replace_existing = d.oldest_article, d.articles_per_feed, d.replace_existing
|
||||||
failed_recipes, replace_recipes, add_recipes = {}, {}, {}
|
failed_recipes, replace_recipes, add_recipes = {}, {}, {}
|
||||||
@ -737,5 +737,5 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
from calibre.web.feeds.recipes.model import RecipeModel
|
from calibre.web.feeds.recipes.model import RecipeModel
|
||||||
app = Application([])
|
app = Application([])
|
||||||
CustomRecipes(RecipeModel()).exec_()
|
CustomRecipes(RecipeModel()).exec()
|
||||||
del app
|
del app
|
||||||
|
@ -85,7 +85,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor):
|
|||||||
def finish_editing(self, item):
|
def finish_editing(self, item):
|
||||||
if not item.text():
|
if not item.text():
|
||||||
error_dialog(self, _('Item is blank'),
|
error_dialog(self, _('Item is blank'),
|
||||||
_('An item cannot be set to nothing. Delete it instead.')).exec_()
|
_('An item cannot be set to nothing. Delete it instead.')).exec()
|
||||||
item.setText(item.previous_text())
|
item.setText(item.previous_text())
|
||||||
return
|
return
|
||||||
if item.text() != item.initial_text():
|
if item.text() != item.initial_text():
|
||||||
@ -99,7 +99,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor):
|
|||||||
def _rename_tag(self, item):
|
def _rename_tag(self, item):
|
||||||
if item is None:
|
if item is None:
|
||||||
error_dialog(self, _('No item selected'),
|
error_dialog(self, _('No item selected'),
|
||||||
_('You must select one item from the list of available items.')).exec_()
|
_('You must select one item from the list of available items.')).exec()
|
||||||
return
|
return
|
||||||
self.available_tags.editItem(item)
|
self.available_tags.editItem(item)
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class DeviceCategoryEditor(QDialog, Ui_DeviceCategoryEditor):
|
|||||||
deletes = self.available_tags.selectedItems()
|
deletes = self.available_tags.selectedItems()
|
||||||
if not deletes:
|
if not deletes:
|
||||||
error_dialog(self, _('No items selected'),
|
error_dialog(self, _('No items selected'),
|
||||||
_('You must select at least one item from the list.')).exec_()
|
_('You must select at least one item from the list.')).exec()
|
||||||
return
|
return
|
||||||
ct = ', '.join([str(item.text()) for item in deletes])
|
ct = ', '.join([str(item.text()) for item in deletes])
|
||||||
if not question_dialog(self, _('Are you sure?'),
|
if not question_dialog(self, _('Are you sure?'),
|
||||||
|
@ -32,5 +32,5 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = DRMErrorMessage(title='testing title')
|
d = DRMErrorMessage(title='testing title')
|
||||||
d.exec_()
|
d.exec()
|
||||||
del d
|
del d
|
||||||
|
@ -63,7 +63,7 @@ class DuplicatesQuestion(QDialog):
|
|||||||
geom = gprefs.get('duplicates-question-dialog-geometry', None)
|
geom = gprefs.get('duplicates-question-dialog-geometry', None)
|
||||||
if geom is not None:
|
if geom is not None:
|
||||||
QApplication.instance().safe_restore_geometry(self, geom)
|
QApplication.instance().safe_restore_geometry(self, geom)
|
||||||
self.exec_()
|
self.exec()
|
||||||
|
|
||||||
def copy_to_clipboard(self):
|
def copy_to_clipboard(self):
|
||||||
QApplication.clipboard().setText(self.as_text)
|
QApplication.clipboard().setText(self.as_text)
|
||||||
|
@ -330,7 +330,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
|||||||
ca.triggered.connect(self.copy_aus_to_au)
|
ca.triggered.connect(self.copy_aus_to_au)
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
m.addMenu(case_menu)
|
m.addMenu(case_menu)
|
||||||
m.exec_(self.table.mapToGlobal(point))
|
m.exec(self.table.mapToGlobal(point))
|
||||||
|
|
||||||
def undo_cell(self, old_value):
|
def undo_cell(self, old_value):
|
||||||
self.context_item.setText(old_value)
|
self.context_item.setText(old_value)
|
||||||
@ -481,7 +481,7 @@ class EditAuthorsDialog(QDialog, Ui_EditAuthorsDialog):
|
|||||||
aut_list = string_to_authors(aut)
|
aut_list = string_to_authors(aut)
|
||||||
if len(aut_list) != 1:
|
if len(aut_list) != 1:
|
||||||
error_dialog(self.parent(), _('Invalid author name'),
|
error_dialog(self.parent(), _('Invalid author name'),
|
||||||
_('You cannot change an author to multiple authors.')).exec_()
|
_('You cannot change an author to multiple authors.')).exec()
|
||||||
aut = ' % '.join(aut_list)
|
aut = ' % '.join(aut_list)
|
||||||
self.table.item(row, 0).setText(aut)
|
self.table.item(row, 0).setText(aut)
|
||||||
item.set_sort_key()
|
item.set_sort_key()
|
||||||
|
@ -361,7 +361,7 @@ class EximDialog(Dialog):
|
|||||||
dbmap[db.library_path] = db.new_api
|
dbmap[db.library_path] = db.new_api
|
||||||
return RunAction(_('Exporting all calibre data...'), _(
|
return RunAction(_('Exporting all calibre data...'), _(
|
||||||
'Failed to export data.'), partial(export, self.export_dir, library_paths=library_paths, dbmap=dbmap),
|
'Failed to export data.'), partial(export, self.export_dir, library_paths=library_paths, dbmap=dbmap),
|
||||||
parent=self).exec_() == QDialog.DialogCode.Accepted
|
parent=self).exec() == QDialog.DialogCode.Accepted
|
||||||
|
|
||||||
def run_import_action(self):
|
def run_import_action(self):
|
||||||
library_path_map = {}
|
library_path_map = {}
|
||||||
@ -369,7 +369,7 @@ class EximDialog(Dialog):
|
|||||||
if w.path:
|
if w.path:
|
||||||
library_path_map[w.lpath] = w.path
|
library_path_map[w.lpath] = w.path
|
||||||
return RunAction(_('Importing all calibre data...'), _(
|
return RunAction(_('Importing all calibre data...'), _(
|
||||||
'Failed to import data.'), partial(import_data, self.importer, library_path_map), parent=self).exec_() == QDialog.DialogCode.Accepted
|
'Failed to import data.'), partial(import_data, self.importer, library_path_map), parent=self).exec() == QDialog.DialogCode.Accepted
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if not self.validate():
|
if not self.validate():
|
||||||
@ -388,5 +388,5 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = EximDialog(initial_panel='import')
|
d = EximDialog(initial_panel='import')
|
||||||
d.exec_()
|
d.exec()
|
||||||
del app
|
del app
|
||||||
|
@ -129,7 +129,7 @@ class MatchBooks(QDialog, Ui_MatchBooks):
|
|||||||
if not query:
|
if not query:
|
||||||
d = error_dialog(self.gui, _('Match books'),
|
d = error_dialog(self.gui, _('Match books'),
|
||||||
_('You must enter a search expression into the search field'))
|
_('You must enter a search expression into the search field'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.search_button.setEnabled(False)
|
self.search_button.setEnabled(False)
|
||||||
@ -200,7 +200,7 @@ class MatchBooks(QDialog, Ui_MatchBooks):
|
|||||||
if not self.current_library_book_id:
|
if not self.current_library_book_id:
|
||||||
d = error_dialog(self.gui, _('Match books'),
|
d = error_dialog(self.gui, _('Match books'),
|
||||||
_('You must select a matching book'))
|
_('You must select a matching book'))
|
||||||
d.exec_()
|
d.exec()
|
||||||
return
|
return
|
||||||
mi = self.library_db.get_metadata(self.current_library_book_id,
|
mi = self.library_db.get_metadata(self.current_library_book_id,
|
||||||
index_is_id=True, get_user_categories=False,
|
index_is_id=True, get_user_categories=False,
|
||||||
|
@ -162,10 +162,11 @@ class MyBlockingBusy(QDialog): # {{{
|
|||||||
self.error = (err, traceback.format_exc())
|
self.error = (err, traceback.format_exc())
|
||||||
QDialog.accept(self)
|
QDialog.accept(self)
|
||||||
|
|
||||||
def exec_(self):
|
def exec(self):
|
||||||
self.thread = Thread(target=self.do_it)
|
self.thread = Thread(target=self.do_it)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
return QDialog.exec_(self)
|
return QDialog.exec(self)
|
||||||
|
exec_ = exec
|
||||||
|
|
||||||
def do_it(self):
|
def do_it(self):
|
||||||
try:
|
try:
|
||||||
@ -575,7 +576,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
self.authors.setFocus(Qt.FocusReason.OtherFocusReason)
|
self.authors.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
self.generate_cover_settings = None
|
self.generate_cover_settings = None
|
||||||
self.button_config_cover_gen.clicked.connect(self.customize_cover_generation)
|
self.button_config_cover_gen.clicked.connect(self.customize_cover_generation)
|
||||||
self.exec_()
|
self.exec()
|
||||||
|
|
||||||
def sizeHint(self):
|
def sizeHint(self):
|
||||||
desktop = QCoreApplication.instance().desktop()
|
desktop = QCoreApplication.instance().desktop()
|
||||||
@ -586,13 +587,13 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
def customize_cover_generation(self):
|
def customize_cover_generation(self):
|
||||||
from calibre.gui2.covers import CoverSettingsDialog
|
from calibre.gui2.covers import CoverSettingsDialog
|
||||||
d = CoverSettingsDialog(parent=self)
|
d = CoverSettingsDialog(parent=self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.generate_cover_settings = d.prefs_for_rendering
|
self.generate_cover_settings = d.prefs_for_rendering
|
||||||
|
|
||||||
def set_comments(self):
|
def set_comments(self):
|
||||||
from calibre.gui2.dialogs.comments_dialog import CommentsDialog
|
from calibre.gui2.dialogs.comments_dialog import CommentsDialog
|
||||||
d = CommentsDialog(self, '' if self.comments is null else (self.comments or ''), _('Comments'))
|
d = CommentsDialog(self, '' if self.comments is null else (self.comments or ''), _('Comments'))
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.comments = d.textbox.html
|
self.comments = d.textbox.html
|
||||||
b = self.comments_button
|
b = self.comments_button
|
||||||
b.setStyleSheet('QPushButton { font-weight: bold }')
|
b.setStyleSheet('QPushButton { font-weight: bold }')
|
||||||
@ -1139,7 +1140,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
|
|
||||||
def tag_editor(self, *args):
|
def tag_editor(self, *args):
|
||||||
d = TagEditor(self, self.db, None)
|
d = TagEditor(self, self.db, None)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.result() == QDialog.DialogCode.Accepted:
|
if d.result() == QDialog.DialogCode.Accepted:
|
||||||
tag_string = ', '.join(d.tags)
|
tag_string = ', '.join(d.tags)
|
||||||
self.tags.setText(tag_string)
|
self.tags.setText(tag_string)
|
||||||
@ -1253,7 +1254,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
# which can slow down bulk editing of large numbers of books
|
# which can slow down bulk editing of large numbers of books
|
||||||
self.model.stop_metadata_backup()
|
self.model.stop_metadata_backup()
|
||||||
try:
|
try:
|
||||||
bb.exec_()
|
bb.exec()
|
||||||
finally:
|
finally:
|
||||||
self.model.start_metadata_backup()
|
self.model.start_metadata_backup()
|
||||||
|
|
||||||
@ -1274,7 +1275,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
'Covers were compressed by {percent:.1%} from a total size of'
|
'Covers were compressed by {percent:.1%} from a total size of'
|
||||||
' {old} to {new}.').format(
|
' {old} to {new}.').format(
|
||||||
percent=percent, old=human_readable(total_old), new=human_readable(total_new))
|
percent=percent, old=human_readable(total_old), new=human_readable(total_new))
|
||||||
).exec_()
|
).exec()
|
||||||
return QDialog.accept(self)
|
return QDialog.accept(self)
|
||||||
|
|
||||||
def series_changed(self, *args):
|
def series_changed(self, *args):
|
||||||
|
@ -201,7 +201,7 @@ if __name__ == '__main__':
|
|||||||
app = Application([])
|
app = Application([])
|
||||||
from calibre.library import db
|
from calibre.library import db
|
||||||
d = ChooseMultiSort(db())
|
d = ChooseMultiSort(db())
|
||||||
d.exec_()
|
d.exec()
|
||||||
print(d.current_sort_spec)
|
print(d.current_sort_spec)
|
||||||
del d
|
del d
|
||||||
del app
|
del app
|
||||||
|
@ -732,7 +732,7 @@ class PluginUpdaterDialog(SizePersistedDialog):
|
|||||||
d.do_restart = True
|
d.do_restart = True
|
||||||
b.clicked.connect(rf)
|
b.clicked.connect(rf)
|
||||||
d.set_details('')
|
d.set_details('')
|
||||||
d.exec_()
|
d.exec()
|
||||||
b.clicked.disconnect()
|
b.clicked.disconnect()
|
||||||
do_restart = d.do_restart
|
do_restart = d.do_restart
|
||||||
|
|
||||||
|
@ -172,4 +172,4 @@ if __name__ == '__main__':
|
|||||||
d = ProgressDialog('A title', 'A message', icon='lt.png')
|
d = ProgressDialog('A title', 'A message', icon='lt.png')
|
||||||
d.show(), d.canceled_signal.connect(app.quit)
|
d.show(), d.canceled_signal.connect(app.quit)
|
||||||
QTimer.singleShot(1000, lambda : (setattr(d, 'value', 10), setattr(d, 'msg', ('A message ' * 100))))
|
QTimer.singleShot(1000, lambda : (setattr(d, 'value', 10), setattr(d, 'msg', ('A message ' * 100))))
|
||||||
app.exec_()
|
app.exec()
|
||||||
|
@ -111,7 +111,7 @@ def restore_database(db, parent=None):
|
|||||||
return False
|
return False
|
||||||
db.close()
|
db.close()
|
||||||
d = DBRestore(parent, db.library_path)
|
d = DBRestore(parent, db.library_path)
|
||||||
d.exec_()
|
d.exec()
|
||||||
r = d.restorer
|
r = d.restorer
|
||||||
d.restorer = None
|
d.restorer = None
|
||||||
if d.rejected:
|
if d.rejected:
|
||||||
@ -127,7 +127,7 @@ def restore_database(db, parent=None):
|
|||||||
|
|
||||||
def repair_library_at(library_path, parent=None, wait_time=2):
|
def repair_library_at(library_path, parent=None, wait_time=2):
|
||||||
d = DBRestore(parent, library_path, wait_time=wait_time)
|
d = DBRestore(parent, library_path, wait_time=wait_time)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.rejected:
|
if d.rejected:
|
||||||
return False
|
return False
|
||||||
r = d.restorer
|
r = d.restorer
|
||||||
|
@ -155,7 +155,7 @@ class SavedSearchEditor(Dialog):
|
|||||||
|
|
||||||
def add_search(self):
|
def add_search(self):
|
||||||
d = AddSavedSearch(parent=self, commit_changes=False, validate=self.validate_add)
|
d = AddSavedSearch(parent=self, commit_changes=False, validate=self.validate_add)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
name, expression = d.accepted_data
|
name, expression = d.accepted_data
|
||||||
self.searches[name] = expression
|
self.searches[name] = expression
|
||||||
@ -184,7 +184,7 @@ class SavedSearchEditor(Dialog):
|
|||||||
d.setWindowTitle(_('Edit saved search'))
|
d.setWindowTitle(_('Edit saved search'))
|
||||||
d.sname.setText(n)
|
d.sname.setText(n)
|
||||||
d.search.setPlainText(self.searches[n])
|
d.search.setPlainText(self.searches[n])
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
name, expression = d.accepted_data
|
name, expression = d.accepted_data
|
||||||
self.slist.currentItem().setText(name)
|
self.slist.currentItem().setText(name)
|
||||||
|
@ -628,7 +628,7 @@ class Scheduler(QObject):
|
|||||||
try:
|
try:
|
||||||
d = SchedulerDialog(self.recipe_model)
|
d = SchedulerDialog(self.recipe_model)
|
||||||
d.download.connect(self.download_clicked)
|
d.download.connect(self.download_clicked)
|
||||||
d.exec_()
|
d.exec()
|
||||||
gconf['oldest_news'] = self.oldest = d.old_news.value()
|
gconf['oldest_news'] = self.oldest = d.old_news.value()
|
||||||
d.break_cycles()
|
d.break_cycles()
|
||||||
finally:
|
finally:
|
||||||
@ -638,7 +638,7 @@ class Scheduler(QObject):
|
|||||||
from calibre.gui2.dialogs.custom_recipes import CustomRecipes
|
from calibre.gui2.dialogs.custom_recipes import CustomRecipes
|
||||||
d = CustomRecipes(self.recipe_model, self._parent)
|
d = CustomRecipes(self.recipe_model, self._parent)
|
||||||
try:
|
try:
|
||||||
d.exec_()
|
d.exec()
|
||||||
finally:
|
finally:
|
||||||
d.deleteLater()
|
d.deleteLater()
|
||||||
|
|
||||||
@ -729,5 +729,5 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = SchedulerDialog(RecipeModel())
|
d = SchedulerDialog(RecipeModel())
|
||||||
d.exec_()
|
d.exec()
|
||||||
del app
|
del app
|
||||||
|
@ -490,6 +490,6 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = SearchDialog(None, db)
|
d = SearchDialog(None, db)
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
|
||||||
print(d.search_string())
|
print(d.search_string())
|
||||||
|
@ -98,5 +98,5 @@ if __name__ == '__main__':
|
|||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = SelectFormats(['epub', 'lrf', 'lit', 'mobi'], 'Choose a format')
|
d = SelectFormats(['epub', 'lrf', 'lit', 'mobi'], 'Choose a format')
|
||||||
d.exec_()
|
d.exec()
|
||||||
print(d.selected_formats)
|
print(d.selected_formats)
|
||||||
|
@ -236,14 +236,14 @@ class TagCategories(QDialog, Ui_TagCategories):
|
|||||||
error_dialog(self, _('Invalid name'),
|
error_dialog(self, _('Invalid name'),
|
||||||
_('That name contains leading or trailing periods, '
|
_('That name contains leading or trailing periods, '
|
||||||
'multiple periods in a row or spaces before '
|
'multiple periods in a row or spaces before '
|
||||||
'or after periods.')).exec_()
|
'or after periods.')).exec()
|
||||||
return False
|
return False
|
||||||
for c in sorted(self.categories.keys(), key=sort_key):
|
for c in sorted(self.categories.keys(), key=sort_key):
|
||||||
if strcmp(c, cat_name) == 0 or \
|
if strcmp(c, cat_name) == 0 or \
|
||||||
(icu_lower(cat_name).startswith(icu_lower(c) + '.') and
|
(icu_lower(cat_name).startswith(icu_lower(c) + '.') and
|
||||||
not cat_name.startswith(c + '.')):
|
not cat_name.startswith(c + '.')):
|
||||||
error_dialog(self, _('Name already used'),
|
error_dialog(self, _('Name already used'),
|
||||||
_('That name is already used, perhaps with different case.')).exec_()
|
_('That name is already used, perhaps with different case.')).exec()
|
||||||
return False
|
return False
|
||||||
if cat_name not in self.categories:
|
if cat_name not in self.categories:
|
||||||
self.category_box.clear()
|
self.category_box.clear()
|
||||||
@ -267,13 +267,13 @@ class TagCategories(QDialog, Ui_TagCategories):
|
|||||||
error_dialog(self, _('Invalid name'),
|
error_dialog(self, _('Invalid name'),
|
||||||
_('That name contains leading or trailing periods, '
|
_('That name contains leading or trailing periods, '
|
||||||
'multiple periods in a row or spaces before '
|
'multiple periods in a row or spaces before '
|
||||||
'or after periods.')).exec_()
|
'or after periods.')).exec()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
for c in self.categories:
|
for c in self.categories:
|
||||||
if strcmp(c, cat_name) == 0:
|
if strcmp(c, cat_name) == 0:
|
||||||
error_dialog(self, _('Name already used'),
|
error_dialog(self, _('Name already used'),
|
||||||
_('That name is already used, perhaps with different case.')).exec_()
|
_('That name is already used, perhaps with different case.')).exec()
|
||||||
return False
|
return False
|
||||||
# The order below is important because of signals
|
# The order below is important because of signals
|
||||||
self.categories[cat_name] = self.categories[self.current_cat_name]
|
self.categories[cat_name] = self.categories[self.current_cat_name]
|
||||||
|
@ -114,7 +114,7 @@ class TagEditor(QDialog, Ui_TagEditor):
|
|||||||
confirms, deletes = [], []
|
confirms, deletes = [], []
|
||||||
items = self.available_tags.selectedItems() if item is None else [item]
|
items = self.available_tags.selectedItems() if item is None else [item]
|
||||||
if not items:
|
if not items:
|
||||||
error_dialog(self, 'No tags selected', 'You must select at least one tag from the list of Available tags.').exec_()
|
error_dialog(self, 'No tags selected', 'You must select at least one tag from the list of Available tags.').exec()
|
||||||
return
|
return
|
||||||
if not confirm(
|
if not confirm(
|
||||||
_('Deleting tags is done immediately and there is no undo.'),
|
_('Deleting tags is done immediately and there is no undo.'),
|
||||||
@ -258,5 +258,5 @@ if __name__ == '__main__':
|
|||||||
db = db()
|
db = db()
|
||||||
app = Application([])
|
app = Application([])
|
||||||
d = TagEditor(None, db, current_tags='a b c'.split())
|
d = TagEditor(None, db, current_tags='a b c'.split())
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
print(d.tags)
|
print(d.tags)
|
||||||
|
@ -323,7 +323,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
action_title_case.triggered.connect(partial(self.do_case, titlecase))
|
action_title_case.triggered.connect(partial(self.do_case, titlecase))
|
||||||
action_capitalize.triggered.connect(partial(self.do_case, capitalize))
|
action_capitalize.triggered.connect(partial(self.do_case, capitalize))
|
||||||
m.addMenu(case_menu)
|
m.addMenu(case_menu)
|
||||||
m.exec_(self.table.mapToGlobal(point))
|
m.exec(self.table.mapToGlobal(point))
|
||||||
|
|
||||||
def search_for_books(self, item):
|
def search_for_books(self, item):
|
||||||
from calibre.gui2.ui import get_gui
|
from calibre.gui2.ui import get_gui
|
||||||
@ -564,7 +564,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
indexes = self.table.selectionModel().selectedRows()
|
indexes = self.table.selectionModel().selectedRows()
|
||||||
if not indexes:
|
if not indexes:
|
||||||
error_dialog(self, _('No item selected'),
|
error_dialog(self, _('No item selected'),
|
||||||
_('You must select one item from the list of available items.')).exec_()
|
_('You must select one item from the list of available items.')).exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
if not confirm(
|
if not confirm(
|
||||||
@ -589,7 +589,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
def _rename_tag(self, item):
|
def _rename_tag(self, item):
|
||||||
if item is None:
|
if item is None:
|
||||||
error_dialog(self, _('No item selected'),
|
error_dialog(self, _('No item selected'),
|
||||||
_('You must select one item from the list of available items.')).exec_()
|
_('You must select one item from the list of available items.')).exec()
|
||||||
return
|
return
|
||||||
for col_zero_item in self.table.selectedItems():
|
for col_zero_item in self.table.selectedItems():
|
||||||
if col_zero_item.is_deleted:
|
if col_zero_item.is_deleted:
|
||||||
@ -616,7 +616,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
|
|||||||
deletes = self.table.selectedItems()
|
deletes = self.table.selectedItems()
|
||||||
if not deletes:
|
if not deletes:
|
||||||
error_dialog(self, _('No items selected'),
|
error_dialog(self, _('No items selected'),
|
||||||
_('You must select at least one item from the list.')).exec_()
|
_('You must select at least one item from the list.')).exec()
|
||||||
return
|
return
|
||||||
|
|
||||||
to_del = []
|
to_del = []
|
||||||
|
@ -494,7 +494,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
|||||||
ca.triggered.connect(self.load_template_from_file)
|
ca.triggered.connect(self.load_template_from_file)
|
||||||
ca = m.addAction(_('Save template to file'))
|
ca = m.addAction(_('Save template to file'))
|
||||||
ca.triggered.connect(self.save_template)
|
ca.triggered.connect(self.save_template)
|
||||||
m.exec_(self.textbox.mapToGlobal(point))
|
m.exec(self.textbox.mapToGlobal(point))
|
||||||
|
|
||||||
def load_last_template_text(self):
|
def load_last_template_text(self):
|
||||||
from calibre.customize.ui import find_plugin
|
from calibre.customize.ui import find_plugin
|
||||||
@ -606,7 +606,7 @@ class TemplateDialog(QDialog, Ui_TemplateDialog):
|
|||||||
return
|
return
|
||||||
self.break_reporter_dialog = BreakReporter(self, mi_to_use,
|
self.break_reporter_dialog = BreakReporter(self, mi_to_use,
|
||||||
txt, val, locals_, line_number)
|
txt, val, locals_, line_number)
|
||||||
if not self.break_reporter_dialog.exec_():
|
if not self.break_reporter_dialog.exec():
|
||||||
raise StopException()
|
raise StopException()
|
||||||
|
|
||||||
def filename_button_clicked(self):
|
def filename_button_clicked(self):
|
||||||
@ -887,5 +887,5 @@ if __name__ == '__main__':
|
|||||||
app = Application([])
|
app = Application([])
|
||||||
from calibre.ebooks.metadata.book.base import field_metadata
|
from calibre.ebooks.metadata.book.base import field_metadata
|
||||||
d = TemplateDialog(None, '{title}', fm=field_metadata)
|
d = TemplateDialog(None, '{title}', fm=field_metadata)
|
||||||
d.exec_()
|
d.exec()
|
||||||
del app
|
del app
|
||||||
|
@ -34,7 +34,7 @@ class TemplateLineEditor(QLineEdit):
|
|||||||
action_clear_field.triggered.connect(self.clear_field)
|
action_clear_field.triggered.connect(self.clear_field)
|
||||||
action_open_editor = menu.addAction(_('Open template editor'))
|
action_open_editor = menu.addAction(_('Open template editor'))
|
||||||
action_open_editor.triggered.connect(self.open_editor)
|
action_open_editor.triggered.connect(self.open_editor)
|
||||||
menu.exec_(event.globalPos())
|
menu.exec(event.globalPos())
|
||||||
|
|
||||||
def clear_field(self):
|
def clear_field(self):
|
||||||
self.setText('')
|
self.setText('')
|
||||||
@ -42,5 +42,5 @@ class TemplateLineEditor(QLineEdit):
|
|||||||
def open_editor(self):
|
def open_editor(self):
|
||||||
t = TemplateDialog(self, self.text(), mi=self.mi)
|
t = TemplateDialog(self, self.text(), mi=self.mi)
|
||||||
t.setWindowTitle(_('Edit template'))
|
t.setWindowTitle(_('Edit template'))
|
||||||
if t.exec_():
|
if t.exec():
|
||||||
self.setText(t.rule[1])
|
self.setText(t.rule[1])
|
||||||
|
@ -119,7 +119,7 @@ if __name__ == '__main__':
|
|||||||
with open(fname, 'rb') as f:
|
with open(fname, 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
d = TrimImage(data)
|
d = TrimImage(data)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted and d.image_data is not None:
|
if d.exec() == QDialog.DialogCode.Accepted and d.image_data is not None:
|
||||||
b, ext = os.path.splitext(fname)
|
b, ext = os.path.splitext(fname)
|
||||||
fname = b + '-trimmed' + ext
|
fname = b + '-trimmed' + ext
|
||||||
with open(fname, 'wb') as f:
|
with open(fname, 'wb') as f:
|
||||||
|
@ -94,7 +94,7 @@ class DownloadDialog(QDialog): # {{{
|
|||||||
def start_download(self):
|
def start_download(self):
|
||||||
self.worker.start()
|
self.worker.start()
|
||||||
QTimer.singleShot(50, self.update)
|
QTimer.singleShot(50, self.update)
|
||||||
self.exec_()
|
self.exec()
|
||||||
if self.worker.err is not None:
|
if self.worker.err is not None:
|
||||||
error_dialog(self.parent(), _('Download failed'),
|
error_dialog(self.parent(), _('Download failed'),
|
||||||
_('Failed to download from %(url)r with error: %(err)s')%dict(
|
_('Failed to download from %(url)r with error: %(err)s')%dict(
|
||||||
|
@ -43,7 +43,7 @@ class DownloadInfo(MessageBox):
|
|||||||
def show_download_info(filename, parent=None):
|
def show_download_info(filename, parent=None):
|
||||||
if not gprefs.get('show_get_books_download_info', True):
|
if not gprefs.get('show_get_books_download_info', True):
|
||||||
return
|
return
|
||||||
DownloadInfo(filename, parent).exec_()
|
DownloadInfo(filename, parent).exec()
|
||||||
|
|
||||||
|
|
||||||
def get_download_filename(response):
|
def get_download_filename(response):
|
||||||
|
@ -306,7 +306,7 @@ class SelectRecipients(QDialog): # {{{
|
|||||||
|
|
||||||
def select_recipients(parent=None):
|
def select_recipients(parent=None):
|
||||||
d = SelectRecipients(parent)
|
d = SelectRecipients(parent)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
return d.ans
|
return d.ans
|
||||||
return ()
|
return ()
|
||||||
# }}}
|
# }}}
|
||||||
@ -469,7 +469,7 @@ class EmailMixin: # {{{
|
|||||||
d = warning_dialog(self, _('No suitable formats'),
|
d = warning_dialog(self, _('No suitable formats'),
|
||||||
_('Could not email the following books '
|
_('Could not email the following books '
|
||||||
'as no suitable formats were found:'), bad)
|
'as no suitable formats were found:'), bad)
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
|
||||||
def email_sent(self, job, remove=[]):
|
def email_sent(self, job, remove=[]):
|
||||||
if job.failed:
|
if job.failed:
|
||||||
|
@ -365,7 +365,7 @@ class FontFamilyChooser(QWidget):
|
|||||||
|
|
||||||
def show_chooser(self):
|
def show_chooser(self):
|
||||||
d = FontFamilyDialog(self.font_family, self)
|
d = FontFamilyDialog(self.font_family, self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self.font_family = d.font_family
|
self.font_family = d.font_family
|
||||||
|
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ def test():
|
|||||||
d.setLayout(QVBoxLayout())
|
d.setLayout(QVBoxLayout())
|
||||||
d.layout().addWidget(FontFamilyChooser(d))
|
d.layout().addWidget(FontFamilyChooser(d))
|
||||||
d.layout().addWidget(QFontComboBox(d))
|
d.layout().addWidget(QFontComboBox(d))
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -375,7 +375,7 @@ if __name__ == '__main__':
|
|||||||
d.rules = [
|
d.rules = [
|
||||||
{'match_type':'xpath', 'query':'//h:h2', 'actions':[{'type': 'remove'}]},
|
{'match_type':'xpath', 'query':'//h:h2', 'actions':[{'type': 'remove'}]},
|
||||||
]
|
]
|
||||||
d.exec_()
|
d.exec()
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
pprint(d.rules)
|
pprint(d.rules)
|
||||||
del d, app
|
del d, app
|
||||||
|
@ -416,11 +416,11 @@ def create_theme(folder=None, parent=None):
|
|||||||
return
|
return
|
||||||
report = read_theme_from_folder(folder)
|
report = read_theme_from_folder(folder)
|
||||||
d = ThemeCreateDialog(parent, report)
|
d = ThemeCreateDialog(parent, report)
|
||||||
if d.exec_() != QDialog.DialogCode.Accepted:
|
if d.exec() != QDialog.DialogCode.Accepted:
|
||||||
return
|
return
|
||||||
d.save_metadata()
|
d.save_metadata()
|
||||||
d = Compress(d.report, parent=parent)
|
d = Compress(d.report, parent=parent)
|
||||||
d.exec_()
|
d.exec()
|
||||||
if d.wasCanceled() or d.raw is None:
|
if d.wasCanceled() or d.raw is None:
|
||||||
return
|
return
|
||||||
raw, prefix = d.raw, d.prefix
|
raw, prefix = d.raw, d.prefix
|
||||||
@ -798,7 +798,7 @@ class ChooseTheme(Dialog):
|
|||||||
t = Thread(name='DownloadIconTheme', target=download)
|
t = Thread(name='DownloadIconTheme', target=download)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
ret = d.exec_()
|
ret = d.exec()
|
||||||
|
|
||||||
if self.downloaded_theme and not isinstance(self.downloaded_theme, BytesIO):
|
if self.downloaded_theme and not isinstance(self.downloaded_theme, BytesIO):
|
||||||
return error_dialog(self, _('Download failed'), _(
|
return error_dialog(self, _('Download failed'), _(
|
||||||
@ -880,6 +880,6 @@ if __name__ == '__main__':
|
|||||||
app = Application([])
|
app = Application([])
|
||||||
# create_theme('.')
|
# create_theme('.')
|
||||||
d = ChooseTheme()
|
d = ChooseTheme()
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted and d.commit_changes is not None:
|
if d.exec() == QDialog.DialogCode.Accepted and d.commit_changes is not None:
|
||||||
d.commit_changes()
|
d.commit_changes()
|
||||||
del app
|
del app
|
||||||
|
@ -256,7 +256,7 @@ class ImageView(QDialog):
|
|||||||
title = _('Image: {name} {resolution}').format(name=self.current_image_name, resolution=reso)
|
title = _('Image: {name} {resolution}').format(name=self.current_image_name, resolution=reso)
|
||||||
self.setWindowTitle(title)
|
self.setWindowTitle(title)
|
||||||
if use_exec:
|
if use_exec:
|
||||||
self.exec_()
|
self.exec()
|
||||||
else:
|
else:
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
@ -314,4 +314,4 @@ if __name__ == '__main__':
|
|||||||
u = QUrl.fromLocalFile(sys.argv[-1])
|
u = QUrl.fromLocalFile(sys.argv[-1])
|
||||||
d = ImageView(None, p, u)
|
d = ImageView(None, p, u)
|
||||||
d()
|
d()
|
||||||
app.exec_()
|
app.exec()
|
||||||
|
@ -541,7 +541,7 @@ class VLTabs(QTabBar): # {{{
|
|||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
m.addAction(_('Edit "%s"') % vln, partial(self.gui.do_create_edit, name=vl))
|
m.addAction(_('Edit "%s"') % vln, partial(self.gui.do_create_edit, name=vl))
|
||||||
m.addAction(_('Delete "%s"') % vln, partial(self.gui.remove_vl_triggered, name=vl))
|
m.addAction(_('Delete "%s"') % vln, partial(self.gui.remove_vl_triggered, name=vl))
|
||||||
m.exec_(ev.globalPos())
|
m.exec(ev.globalPos())
|
||||||
|
|
||||||
def sort_alphabetically(self):
|
def sort_alphabetically(self):
|
||||||
self.current_db.new_api.set_pref('virt_libs_order', ())
|
self.current_db.new_api.set_pref('virt_libs_order', ())
|
||||||
@ -705,7 +705,7 @@ class LayoutMixin: # {{{
|
|||||||
identifiers = db.field_for('identifiers', book_id, default_value={})
|
identifiers = db.field_for('identifiers', book_id, default_value={})
|
||||||
from calibre.gui2.metadata.basic_widgets import Identifiers
|
from calibre.gui2.metadata.basic_widgets import Identifiers
|
||||||
d = Identifiers(identifiers, self)
|
d = Identifiers(identifiers, self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
identifiers = d.get_identifiers()
|
identifiers = d.get_identifiers()
|
||||||
db.set_field('identifiers', {book_id: identifiers})
|
db.set_field('identifiers', {book_id: identifiers})
|
||||||
self.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id})
|
self.iactions['Edit Metadata'].refresh_books_after_metadata_edit({book_id})
|
||||||
|
@ -308,10 +308,10 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{
|
|||||||
def kill_job(self, job, view):
|
def kill_job(self, job, view):
|
||||||
if isinstance(job, DeviceJob):
|
if isinstance(job, DeviceJob):
|
||||||
return error_dialog(view, _('Cannot kill job'),
|
return error_dialog(view, _('Cannot kill job'),
|
||||||
_('Cannot kill jobs that communicate with the device')).exec_()
|
_('Cannot kill jobs that communicate with the device')).exec()
|
||||||
if job.duration is not None:
|
if job.duration is not None:
|
||||||
return error_dialog(view, _('Cannot kill job'),
|
return error_dialog(view, _('Cannot kill job'),
|
||||||
_('Job has already run')).exec_()
|
_('Job has already run')).exec()
|
||||||
if not getattr(job, 'killable', True):
|
if not getattr(job, 'killable', True):
|
||||||
return error_dialog(view, _('Cannot kill job'),
|
return error_dialog(view, _('Cannot kill job'),
|
||||||
_('This job cannot be stopped'), show=True)
|
_('This job cannot be stopped'), show=True)
|
||||||
@ -321,7 +321,7 @@ class JobManager(QAbstractTableModel, AdaptSQP): # {{{
|
|||||||
devjobs = [j for j in jobs if isinstance(j, DeviceJob)]
|
devjobs = [j for j in jobs if isinstance(j, DeviceJob)]
|
||||||
if devjobs:
|
if devjobs:
|
||||||
error_dialog(view, _('Cannot kill job'),
|
error_dialog(view, _('Cannot kill job'),
|
||||||
_('Cannot kill jobs that communicate with the device')).exec_()
|
_('Cannot kill jobs that communicate with the device')).exec()
|
||||||
jobs = [j for j in jobs if not isinstance(j, DeviceJob)]
|
jobs = [j for j in jobs if not isinstance(j, DeviceJob)]
|
||||||
jobs = [j for j in jobs if j.duration is None]
|
jobs = [j for j in jobs if j.duration is None]
|
||||||
unkillable = [j for j in jobs if not getattr(j, 'killable', True)]
|
unkillable = [j for j in jobs if not getattr(j, 'killable', True)]
|
||||||
@ -673,7 +673,7 @@ class JobsDialog(QDialog, Ui_JobsDialog):
|
|||||||
row = index.row()
|
row = index.row()
|
||||||
job = self.model.row_to_job(row)
|
job = self.model.row_to_job(row)
|
||||||
d = DetailView(self, job)
|
d = DetailView(self, job)
|
||||||
d.exec_()
|
d.exec()
|
||||||
d.timer.stop()
|
d.timer.stop()
|
||||||
|
|
||||||
def show_details(self, *args):
|
def show_details(self, *args):
|
||||||
|
@ -683,7 +683,7 @@ class ShortcutConfig(QWidget): # {{{
|
|||||||
menu = QMenu(self)
|
menu = QMenu(self)
|
||||||
menu.addAction(_('Expand all'), self.view.expandAll)
|
menu.addAction(_('Expand all'), self.view.expandAll)
|
||||||
menu.addAction(_('Collapse all'), self.view.collapseAll)
|
menu.addAction(_('Collapse all'), self.view.collapseAll)
|
||||||
menu.exec_(self.view.mapToGlobal(pos))
|
menu.exec(self.view.mapToGlobal(pos))
|
||||||
|
|
||||||
def restore_defaults(self):
|
def restore_defaults(self):
|
||||||
self._model.restore_defaults()
|
self._model.restore_defaults()
|
||||||
|
@ -142,4 +142,4 @@ if __name__ == '__main__':
|
|||||||
app = Application([])
|
app = Application([])
|
||||||
w = LayoutMenu()
|
w = LayoutMenu()
|
||||||
w.show()
|
w.show()
|
||||||
w.exec_()
|
w.exec()
|
||||||
|
@ -208,7 +208,7 @@ def mouseMoveEvent(self, event):
|
|||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
return
|
return
|
||||||
drag = self.drag_data()
|
drag = self.drag_data()
|
||||||
drag.exec_(Qt.DropAction.CopyAction)
|
drag.exec(Qt.DropAction.CopyAction)
|
||||||
self.drag_start_pos = None
|
self.drag_start_pos = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ class ResultsList(QTreeWidget):
|
|||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
m.addAction(_('Expand all'), self.expandAll)
|
m.addAction(_('Expand all'), self.expandAll)
|
||||||
m.addAction(_('Collapse all'), self.collapseAll)
|
m.addAction(_('Collapse all'), self.collapseAll)
|
||||||
m.exec_(self.mapToGlobal(pos))
|
m.exec(self.mapToGlobal(pos))
|
||||||
|
|
||||||
def edit_notes(self, item):
|
def edit_notes(self, item):
|
||||||
r = item.data(0, Qt.ItemDataRole.UserRole)
|
r = item.data(0, Qt.ItemDataRole.UserRole)
|
||||||
@ -998,7 +998,7 @@ class AnnotationsBrowser(Dialog):
|
|||||||
if not annots:
|
if not annots:
|
||||||
return error_dialog(self, _('No selected annotations'), _(
|
return error_dialog(self, _('No selected annotations'), _(
|
||||||
'No annotations have been selected'), show=True)
|
'No annotations have been selected'), show=True)
|
||||||
Export(annots, self).exec_()
|
Export(annots, self).exec()
|
||||||
|
|
||||||
def delete_annotations(self, ids):
|
def delete_annotations(self, ids):
|
||||||
if confirm(ngettext(
|
if confirm(ngettext(
|
||||||
@ -1019,7 +1019,7 @@ class AnnotationsBrowser(Dialog):
|
|||||||
'Editing is only supported for the notes associated with highlights'), show=True)
|
'Editing is only supported for the notes associated with highlights'), show=True)
|
||||||
notes = annot.get('notes')
|
notes = annot.get('notes')
|
||||||
d = EditNotes(notes, self)
|
d = EditNotes(notes, self)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
notes = d.notes
|
notes = d.notes
|
||||||
if notes and notes.strip():
|
if notes and notes.strip():
|
||||||
annot['notes'] = notes.strip()
|
annot['notes'] = notes.strip()
|
||||||
@ -1032,7 +1032,7 @@ class AnnotationsBrowser(Dialog):
|
|||||||
def show_dialog(self, restrict_to_book_ids=None):
|
def show_dialog(self, restrict_to_book_ids=None):
|
||||||
if self.parent() is None:
|
if self.parent() is None:
|
||||||
self.browse_panel.effective_query_changed()
|
self.browse_panel.effective_query_changed()
|
||||||
self.exec_()
|
self.exec()
|
||||||
else:
|
else:
|
||||||
self.reinitialize(restrict_to_book_ids)
|
self.reinitialize(restrict_to_book_ids)
|
||||||
self.show()
|
self.show()
|
||||||
|
@ -353,7 +353,7 @@ class CompleteDelegate(QStyledItemDelegate, UpdateEditorGeometry): # {{{
|
|||||||
if check_key_modifier(Qt.KeyboardModifier.ShiftModifier) and col != 'authors':
|
if check_key_modifier(Qt.KeyboardModifier.ShiftModifier) and col != 'authors':
|
||||||
key = col if m.is_custom_column(col) else None
|
key = col if m.is_custom_column(col) else None
|
||||||
d = TagEditor(parent, self.db, m.id(index.row()), key=key)
|
d = TagEditor(parent, self.db, m.id(index.row()), key=key)
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
m.setData(index, self.sep.join(d.tags), Qt.ItemDataRole.EditRole)
|
m.setData(index, self.sep.join(d.tags), Qt.ItemDataRole.EditRole)
|
||||||
return None
|
return None
|
||||||
editor = EditWithComplete(parent)
|
editor = EditWithComplete(parent)
|
||||||
@ -523,7 +523,7 @@ class CcLongTextDelegate(QStyledItemDelegate): # {{{
|
|||||||
else:
|
else:
|
||||||
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
||||||
d = PlainTextDialog(parent, text, column_name=m.custom_columns[col]['name'])
|
d = PlainTextDialog(parent, text, column_name=m.custom_columns[col]['name'])
|
||||||
if d.exec_() == QDialog.DialogCode.Accepted:
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
m.setData(index, d.text, Qt.ItemDataRole.EditRole)
|
m.setData(index, d.text, Qt.ItemDataRole.EditRole)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ class CcCommentsDelegate(QStyledItemDelegate): # {{{
|
|||||||
else:
|
else:
|
||||||
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
||||||
editor = CommentsDialog(parent, text, column_name=m.custom_columns[col]['name'])
|
editor = CommentsDialog(parent, text, column_name=m.custom_columns[col]['name'])
|
||||||
d = editor.exec_()
|
d = editor.exec()
|
||||||
if d:
|
if d:
|
||||||
m.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole)
|
m.setData(index, (editor.textbox.html), Qt.ItemDataRole.EditRole)
|
||||||
return None
|
return None
|
||||||
@ -758,7 +758,7 @@ class CcTemplateDelegate(QStyledItemDelegate): # {{{
|
|||||||
editor.setWindowTitle(_("Edit template"))
|
editor.setWindowTitle(_("Edit template"))
|
||||||
editor.textbox.setTabChangesFocus(False)
|
editor.textbox.setTabChangesFocus(False)
|
||||||
editor.textbox.setTabStopWidth(20)
|
editor.textbox.setTabStopWidth(20)
|
||||||
d = editor.exec_()
|
d = editor.exec()
|
||||||
if d:
|
if d:
|
||||||
m.setData(index, (editor.rule[1]), Qt.ItemDataRole.EditRole)
|
m.setData(index, (editor.rule[1]), Qt.ItemDataRole.EditRole)
|
||||||
return None
|
return None
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user