diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 5964eba9a1..0669391117 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -768,7 +768,8 @@ class Boss(QObject): self.commit_all_editors_to_container() k = {} if allow_revert else {'revert_msg': None} d = self.create_diff_dialog(**k) - d.revert_requested.connect(partial(self.revert_requested, self.global_undo.previous_container)) + previous_container = self.global_undo.previous_container + connect_lambda(d.revert_requested, self, lambda self: self.revert_requested(previous_container)) other = to_container or self.global_undo.previous_container d.container_diff(other, self.global_undo.current_container, names=(self.global_undo.label_for_container(other), self.global_undo.label_for_container(self.global_undo.current_container))) @@ -1608,14 +1609,14 @@ class Boss(QObject): d.l.addWidget(d.bb, 1, 0, 1, 2) d.do_save = None - def endit(x): + def endit(d, x): d.do_save = x d.accept() b = d.bb.addButton(_('&Save and Quit'), QDialogButtonBox.ActionRole) b.setIcon(QIcon(I('save.png'))) - b.clicked.connect(lambda *args: endit(True)) + connect_lambda(b.clicked, d, lambda d: endit(d, True)) b = d.bb.addButton(_('&Quit without saving'), QDialogButtonBox.ActionRole) - b.clicked.connect(lambda *args: endit(False)) + connect_lambda(b.clicked, d, lambda d: endit(d, False)) d.resize(d.sizeHint()) if d.exec_() != d.Accepted or d.do_save is None: return False diff --git a/src/calibre/gui2/tweak_book/widgets.py b/src/calibre/gui2/tweak_book/widgets.py index 20180deaca..550630a6e6 100644 --- a/src/calibre/gui2/tweak_book/widgets.py +++ b/src/calibre/gui2/tweak_book/widgets.py @@ -1082,7 +1082,11 @@ class AddCover(Dialog): ' to the image.'))) p.setChecked(tprefs['add_cover_preserve_aspect_ratio']) p.setVisible(self.container.book_type != 'azw3') - p.stateChanged.connect(lambda s:tprefs.set('add_cover_preserve_aspect_ratio', s == Qt.Checked)) + + def on_state_change(s): + tprefs.set('add_cover_preserve_aspect_ratio', s == Qt.Checked) + + p.stateChanged.connect(on_state_change) self.info_label = il = QLabel('\xa0') h.addWidget(p), h.addStretch(1), h.addWidget(il) l.addLayout(h)