more lambda slots

This commit is contained in:
Kovid Goyal 2018-07-26 16:24:56 +05:30
parent df45da3bb4
commit 2d0b4c66c9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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 {{{