mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
more lambda slots
This commit is contained in:
parent
2d0b4c66c9
commit
134d1187e7
@ -760,7 +760,7 @@ class CharSelect(Dialog):
|
||||
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 @@ class DownloadResources(Dialog):
|
||||
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 run_search(
|
||||
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…
x
Reference in New Issue
Block a user