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
b6f63e8221
commit
9ac2197a69
@ -298,7 +298,10 @@ class ChooseLibrary(Dialog): # {{{
|
|||||||
v.addWidget(sa)
|
v.addWidget(sa)
|
||||||
sa.setChecked(bool(gprefs.get('copy_to_library_choose_library_sort_alphabetically', True)))
|
sa.setChecked(bool(gprefs.get('copy_to_library_choose_library_sort_alphabetically', True)))
|
||||||
sa.stateChanged.connect(self.resort)
|
sa.stateChanged.connect(self.resort)
|
||||||
sa.stateChanged.connect(lambda: gprefs.set('copy_to_library_choose_library_sort_alphabetically', bool(self.sort_alphabetically.isChecked())))
|
|
||||||
|
connect_lambda(sa.stateChanged, self, lambda self:
|
||||||
|
gprefs.set('copy_to_library_choose_library_sort_alphabetically',
|
||||||
|
bool(self.sort_alphabetically.isChecked())))
|
||||||
la = self.la = QLabel(_('Library &path:'))
|
la = self.la = QLabel(_('Library &path:'))
|
||||||
v.addWidget(la)
|
v.addWidget(la)
|
||||||
le = self.le = QLineEdit(self)
|
le = self.le = QLineEdit(self)
|
||||||
|
@ -61,14 +61,14 @@ class MarkBooksAction(InterfaceAction):
|
|||||||
a.triggered.connect(self.clear_all_marked)
|
a.triggered.connect(self.clear_all_marked)
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
self.mark_author_action = a = ma('mark-author', _('Mark all books by selected author(s)'), icon='plus.png')
|
self.mark_author_action = a = ma('mark-author', _('Mark all books by selected author(s)'), icon='plus.png')
|
||||||
a.triggered.connect(partial(self.mark_field, 'authors', True))
|
connect_lambda(a.triggered, self, lambda self: self.mark_field('authors', True))
|
||||||
self.mark_series_action = a = ma('mark-series', _('Mark all books in the selected series'), icon='plus.png')
|
self.mark_series_action = a = ma('mark-series', _('Mark all books in the selected series'), icon='plus.png')
|
||||||
a.triggered.connect(partial(self.mark_field, 'series', True))
|
connect_lambda(a.triggered, self, lambda self: self.mark_field('series', True))
|
||||||
m.addSeparator()
|
m.addSeparator()
|
||||||
self.unmark_author_action = a = ma('unmark-author', _('Clear all books by selected author(s)'), icon='minus.png')
|
self.unmark_author_action = a = ma('unmark-author', _('Clear all books by selected author(s)'), icon='minus.png')
|
||||||
a.triggered.connect(partial(self.mark_field, 'authors', False))
|
connect_lambda(a.triggered, self, lambda self: self.mark_field('authors', False))
|
||||||
self.unmark_series_action = a = ma('unmark-series', _('Clear all books in the selected series'), icon='minus.png')
|
self.unmark_series_action = a = ma('unmark-series', _('Clear all books in the selected series'), icon='minus.png')
|
||||||
a.triggered.connect(partial(self.mark_field, 'series', False))
|
connect_lambda(a.triggered, self, lambda self: self.mark_field('series', False))
|
||||||
|
|
||||||
def gui_layout_complete(self):
|
def gui_layout_complete(self):
|
||||||
for x in self.gui.bars_manager.main_bars + self.gui.bars_manager.child_bars:
|
for x in self.gui.bars_manager.main_bars + self.gui.bars_manager.child_bars:
|
||||||
@ -138,4 +138,3 @@ class MarkBooksAction(InterfaceAction):
|
|||||||
else:
|
else:
|
||||||
mids.pop(book_id, None)
|
mids.pop(book_id, None)
|
||||||
db.data.set_marked_ids(mids)
|
db.data.set_marked_ids(mids)
|
||||||
|
|
||||||
|
@ -239,14 +239,14 @@ class Diff(Dialog):
|
|||||||
r = l.rowCount()
|
r = l.rowCount()
|
||||||
self.bp = b = QToolButton(self)
|
self.bp = b = QToolButton(self)
|
||||||
b.setIcon(QIcon(I('back.png')))
|
b.setIcon(QIcon(I('back.png')))
|
||||||
b.clicked.connect(partial(self.view.next_change, -1))
|
connect_lambda(b.clicked, self, lambda self: self.view.next_change(-1))
|
||||||
b.setToolTip(_('Go to previous change') + ' [p]')
|
b.setToolTip(_('Go to previous change') + ' [p]')
|
||||||
b.setText(_('&Previous change')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
b.setText(_('&Previous change')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
l.addWidget(b, r, 0)
|
l.addWidget(b, r, 0)
|
||||||
|
|
||||||
self.bn = b = QToolButton(self)
|
self.bn = b = QToolButton(self)
|
||||||
b.setIcon(QIcon(I('forward.png')))
|
b.setIcon(QIcon(I('forward.png')))
|
||||||
b.clicked.connect(partial(self.view.next_change, 1))
|
connect_lambda(b.clicked, self, lambda self: self.view.next_change(1))
|
||||||
b.setToolTip(_('Go to next change') + ' [n]')
|
b.setToolTip(_('Go to next change') + ' [n]')
|
||||||
b.setText(_('&Next change')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
b.setText(_('&Next change')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
l.addWidget(b, r, 1)
|
l.addWidget(b, r, 1)
|
||||||
@ -255,16 +255,16 @@ class Diff(Dialog):
|
|||||||
s.initialize('diff_search_history')
|
s.initialize('diff_search_history')
|
||||||
l.addWidget(s, r, 2)
|
l.addWidget(s, r, 2)
|
||||||
s.setPlaceholderText(_('Search for text'))
|
s.setPlaceholderText(_('Search for text'))
|
||||||
s.returnPressed.connect(partial(self.do_search, False))
|
connect_lambda(s.returnPressed, self, lambda self: self.do_search(False))
|
||||||
self.sbn = b = QToolButton(self)
|
self.sbn = b = QToolButton(self)
|
||||||
b.setIcon(QIcon(I('arrow-down.png')))
|
b.setIcon(QIcon(I('arrow-down.png')))
|
||||||
b.clicked.connect(partial(self.do_search, False))
|
connect_lambda(b.clicked, self, lambda self: self.do_search(False))
|
||||||
b.setToolTip(_('Find next match'))
|
b.setToolTip(_('Find next match'))
|
||||||
b.setText(_('Next &match')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
b.setText(_('Next &match')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
l.addWidget(b, r, 3)
|
l.addWidget(b, r, 3)
|
||||||
self.sbp = b = QToolButton(self)
|
self.sbp = b = QToolButton(self)
|
||||||
b.setIcon(QIcon(I('arrow-up.png')))
|
b.setIcon(QIcon(I('arrow-up.png')))
|
||||||
b.clicked.connect(partial(self.do_search, True))
|
connect_lambda(b.clicked, self, lambda self: self.do_search(True))
|
||||||
b.setToolTip(_('Find previous match'))
|
b.setToolTip(_('Find previous match'))
|
||||||
b.setText(_('P&revious match')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
b.setText(_('P&revious match')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
|
||||||
l.addWidget(b, r, 4)
|
l.addWidget(b, r, 4)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user