mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add a button to clear the current virtual library easily
This commit is contained in:
parent
afbfa22fe2
commit
9c0a1ca2f3
@ -184,6 +184,14 @@ class SearchBar(QWidget): # {{{
|
|||||||
l.addWidget(x)
|
l.addWidget(x)
|
||||||
parent.virtual_library = x
|
parent.virtual_library = x
|
||||||
|
|
||||||
|
x = QToolButton(self)
|
||||||
|
x.setIcon(QIcon(I('minus.png')))
|
||||||
|
x.setObjectName('clear_vl')
|
||||||
|
l.addWidget(x)
|
||||||
|
x.setVisible(False)
|
||||||
|
x.setToolTip(_('Close the Virtual Library'))
|
||||||
|
parent.clear_vl = x
|
||||||
|
|
||||||
x = QLabel(self)
|
x = QLabel(self)
|
||||||
x.setObjectName("search_count")
|
x.setObjectName("search_count")
|
||||||
l.addWidget(x)
|
l.addWidget(x)
|
||||||
|
@ -316,6 +316,7 @@ class SearchRestrictionMixin(object):
|
|||||||
self.virtual_library_menu = QMenu()
|
self.virtual_library_menu = QMenu()
|
||||||
|
|
||||||
self.virtual_library.clicked.connect(self.virtual_library_clicked)
|
self.virtual_library.clicked.connect(self.virtual_library_clicked)
|
||||||
|
self.clear_vl.clicked.connect(lambda x: (self.apply_virtual_library(), self.clear_additional_restriction()))
|
||||||
|
|
||||||
self.virtual_library_tooltip = \
|
self.virtual_library_tooltip = \
|
||||||
_('Use a "virtual library" to show only a subset of the books present in this library')
|
_('Use a "virtual library" to show only a subset of the books present in this library')
|
||||||
@ -589,10 +590,12 @@ class SearchRestrictionMixin(object):
|
|||||||
self.search_count.setStyleSheet(
|
self.search_count.setStyleSheet(
|
||||||
'QLabel { border-radius: 6px; background-color: %s }' %
|
'QLabel { border-radius: 6px; background-color: %s }' %
|
||||||
tweaks['highlight_virtual_library'])
|
tweaks['highlight_virtual_library'])
|
||||||
|
self.clear_vl.setVisible(True)
|
||||||
else: # No restriction or not library view
|
else: # No restriction or not library view
|
||||||
t = ''
|
t = ''
|
||||||
self.search_count.setStyleSheet(
|
self.search_count.setStyleSheet(
|
||||||
'QLabel { background-color: transparent; }')
|
'QLabel { background-color: transparent; }')
|
||||||
|
self.clear_vl.setVisible(False)
|
||||||
self.search_count.setText(t)
|
self.search_count.setText(t)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user