mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More lambda slots
This commit is contained in:
parent
9ac2197a69
commit
d48e3c0050
@ -249,9 +249,11 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
for i in range(5):
|
for i in range(5):
|
||||||
ac = self.create_action(spec=('', None, None, None),
|
ac = self.create_action(spec=('', None, None, None),
|
||||||
attr='switch_action%d'%i)
|
attr='switch_action%d'%i)
|
||||||
|
ac.setObjectName(str(i))
|
||||||
self.switch_actions.append(ac)
|
self.switch_actions.append(ac)
|
||||||
ac.setVisible(False)
|
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)
|
type=Qt.QueuedConnection)
|
||||||
self.choose_menu.addAction(ac)
|
self.choose_menu.addAction(ac)
|
||||||
|
|
||||||
@ -597,9 +599,6 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
print
|
print
|
||||||
self.dbref = self.before_mem = None
|
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):
|
def count_changed(self, new_count):
|
||||||
self.update_tooltip(new_count)
|
self.update_tooltip(new_count)
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ class ChooseLibrary(Dialog): # {{{
|
|||||||
b.setIcon(QIcon(I('edit-copy.png')))
|
b.setIcon(QIcon(I('edit-copy.png')))
|
||||||
b.setToolTip(_('Copy to the specified library'))
|
b.setToolTip(_('Copy to the specified library'))
|
||||||
b2 = bb.addButton(_('&Move'), bb.AcceptRole)
|
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.setIcon(QIcon(I('edit-cut.png')))
|
||||||
b2.setToolTip(_('Copy to the specified library and delete from the current library'))
|
b2.setToolTip(_('Copy to the specified library and delete from the current library'))
|
||||||
b.setDefault(True)
|
b.setDefault(True)
|
||||||
|
@ -43,7 +43,7 @@ class ChooseFormat(QDialog): # {{{
|
|||||||
bb.rejected.connect(self.reject)
|
bb.rejected.connect(self.reject)
|
||||||
l.addWidget(bb, l.rowCount(), 0, 1, -1)
|
l.addWidget(bb, l.rowCount(), 0, 1, -1)
|
||||||
self.resize(self.sizeHint())
|
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):
|
def do_all(self):
|
||||||
for b in self.buttons:
|
for b in self.buttons:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user