More lambda slots

This commit is contained in:
Kovid Goyal 2018-07-26 13:39:31 +05:30
parent 9ac2197a69
commit d48e3c0050
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 6 deletions

View File

@ -249,9 +249,11 @@ class ChooseLibraryAction(InterfaceAction):
for i in range(5):
ac = self.create_action(spec=('', None, None, None),
attr='switch_action%d'%i)
ac.setObjectName(str(i))
self.switch_actions.append(ac)
ac.setVisible(False)
ac.triggered.connect(partial(self.qs_requested, i),
connect_lambda(ac.triggered, self, lambda self:
self.switch_requested(self.qs_locations[int(self.gui.sender().objectName())]),
type=Qt.QueuedConnection)
self.choose_menu.addAction(ac)
@ -597,9 +599,6 @@ class ChooseLibraryAction(InterfaceAction):
print
self.dbref = self.before_mem = None
def qs_requested(self, idx, *args):
self.switch_requested(self.qs_locations[idx])
def count_changed(self, new_count):
self.update_tooltip(new_count)

View File

@ -321,7 +321,7 @@ class ChooseLibrary(Dialog): # {{{
b.setIcon(QIcon(I('edit-copy.png')))
b.setToolTip(_('Copy to the specified library'))
b2 = bb.addButton(_('&Move'), bb.AcceptRole)
b2.clicked.connect(lambda: setattr(self, 'delete_after_copy', True))
connect_lambda(b2.clicked, self, lambda self: setattr(self, 'delete_after_copy', True))
b2.setIcon(QIcon(I('edit-cut.png')))
b2.setToolTip(_('Copy to the specified library and delete from the current library'))
b.setDefault(True)

View File

@ -43,7 +43,7 @@ class ChooseFormat(QDialog): # {{{
bb.rejected.connect(self.reject)
l.addWidget(bb, l.rowCount(), 0, 1, -1)
self.resize(self.sizeHint())
self.finished.connect(lambda code:gprefs.set('edit_toc_last_selected_formats', list(self.formats)))
connect_lambda(self.finished, self, lambda self, code:gprefs.set('edit_toc_last_selected_formats', list(self.formats)))
def do_all(self):
for b in self.buttons: