mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-27 14:24:47 +01:00
more lambda slots
This commit is contained in:
parent
2d0b4c66c9
commit
134d1187e7
3 changed files with 7 additions and 4 deletions
|
|
@ -760,7 +760,7 @@ def setup_ui(self):
|
|||
self.match_any = mm = QCheckBox(_('Match any word'))
|
||||
mm.setToolTip(_('When searching return characters whose names match any of the specified words'))
|
||||
mm.setChecked(tprefs.get('char_select_match_any', True))
|
||||
mm.stateChanged.connect(lambda: tprefs.set('char_select_match_any', self.match_any.isChecked()))
|
||||
connect_lambda(mm.stateChanged, self, lambda self: tprefs.set('char_select_match_any', self.match_any.isChecked()))
|
||||
h.addWidget(mm), h.addStretch(), h.addWidget(self.bb)
|
||||
l.addLayout(h, 4, 0, 1, 3)
|
||||
self.char_view.setFocus(Qt.OtherFocusReason)
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ def _replace_done(self, ret, tb):
|
|||
b = self.bb.button(self.bb.Ok)
|
||||
b.setText(_('See what &changed'))
|
||||
b.setIcon(QIcon(I('diff.png')))
|
||||
b.clicked.connect(lambda : setattr(self, 'show_diff', True))
|
||||
connect_lambda(b.clicked, self, lambda self: setattr(self, 'show_diff', True))
|
||||
self.bb.setVisible(True)
|
||||
|
||||
def accept(self):
|
||||
|
|
|
|||
|
|
@ -1474,10 +1474,13 @@ def count_message(replaced, count, show_diff=False, show_dialog=True, count_map=
|
|||
det_msg += _('{0}: {1} occurrences').format(k, count_map[k]) + '\n'
|
||||
if show_diff and count > 0:
|
||||
d = MessageBox(MessageBox.INFO, _('Searching done'), prepare_string_for_xml(msg), parent=gui_parent, show_copy_button=False, det_msg=det_msg)
|
||||
d.diffb = b = d.bb.addButton(_('See what &changed'), d.bb.ActionRole)
|
||||
d.diffb = b = d.bb.addButton(_('See what &changed'), d.bb.AcceptRole)
|
||||
d.show_changes = False
|
||||
b.setIcon(QIcon(I('diff.png'))), b.clicked.connect(d.accept)
|
||||
b.clicked.connect(partial(show_current_diff, allow_revert=True), type=Qt.QueuedConnection)
|
||||
connect_lambda(b.clicked, d, lambda d: setattr(d, 'show_changes', True))
|
||||
d.exec_()
|
||||
if d.show_changes:
|
||||
show_current_diff(allow_revert=True)
|
||||
else:
|
||||
info_dialog(gui_parent, _('Searching done'), prepare_string_for_xml(msg), show=True, det_msg=det_msg)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue