mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
more lambda slots
This commit is contained in:
parent
df45da3bb4
commit
2d0b4c66c9
@ -434,7 +434,8 @@ def register_keyboard_shortcuts(gui=None, finalize=False):
|
||||
name = _('Open {0} files with {1}').format(t, text)
|
||||
ac = QAction(gui)
|
||||
unique_name = application['uuid']
|
||||
ac.triggered.connect(partial(gui.open_with_action_triggerred, filetype, application))
|
||||
func = partial(gui.open_with_action_triggerred, filetype, application)
|
||||
ac.triggered.connect(func)
|
||||
gui.keyboard.register_shortcut(unique_name, name, action=ac, group=_('Open With'))
|
||||
gui.addAction(ac)
|
||||
registered_shortcuts[unique_name] = ac
|
||||
|
@ -91,10 +91,11 @@ def show_report(changed, title, report, parent, show_current_diff):
|
||||
d.l.addWidget(d.e)
|
||||
d.e.setHtml(report)
|
||||
d.bb = QDialogButtonBox(QDialogButtonBox.Close)
|
||||
d.show_changes = False
|
||||
if changed:
|
||||
b = d.b = d.bb.addButton(_('See what &changed'), d.bb.AcceptRole)
|
||||
b.setIcon(QIcon(I('diff.png'))), b.setAutoDefault(False)
|
||||
b.clicked.connect(lambda : show_current_diff(allow_revert=True), type=Qt.QueuedConnection)
|
||||
connect_lambda(b.clicked, d, lambda d: setattr(d, 'show_changes', True))
|
||||
b = d.bb.addButton(_('&Copy to clipboard'), d.bb.ActionRole)
|
||||
b.setIcon(QIcon(I('edit-copy.png'))), b.setAutoDefault(False)
|
||||
|
||||
@ -112,6 +113,8 @@ def show_report(changed, title, report, parent, show_current_diff):
|
||||
d.resize(600, 400)
|
||||
d.exec_()
|
||||
b.clicked.disconnect()
|
||||
if d.show_changes:
|
||||
show_current_diff(allow_revert=True)
|
||||
|
||||
# CompressImages {{{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user