mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Do not show the virtual libraries tab bar when no virtual libraries are present. See #1988609 ([Enhancement] VL Toolbar/Menu options)
This commit is contained in:
parent
d4ebabcdd5
commit
b8366228fb
@ -400,7 +400,7 @@ class VLTabs(QTabBar): # {{{
|
||||
self.currentChanged.connect(self.tab_changed)
|
||||
self.tabMoved.connect(self.tab_moved, type=Qt.ConnectionType.QueuedConnection)
|
||||
self.tabCloseRequested.connect(self.tab_close)
|
||||
self.setVisible(gprefs['show_vl_tabs'])
|
||||
self.update_visibility()
|
||||
self.next_action = a = QAction(self)
|
||||
a.triggered.connect(partial(self.next_tab, delta=1)), self.gui.addAction(a)
|
||||
self.previous_action = a = QAction(self)
|
||||
@ -421,14 +421,17 @@ class VLTabs(QTabBar): # {{{
|
||||
idx = (self.currentIndex() + delta) % self.count()
|
||||
self.setCurrentIndex(idx)
|
||||
|
||||
def update_visibility(self):
|
||||
self.setVisible(gprefs['show_vl_tabs'] and self.count() > 1)
|
||||
|
||||
def enable_bar(self):
|
||||
gprefs['show_vl_tabs'] = True
|
||||
self.setVisible(True)
|
||||
self.update_visibility()
|
||||
self.gui.set_number_of_books_shown()
|
||||
|
||||
def disable_bar(self):
|
||||
gprefs['show_vl_tabs'] = False
|
||||
self.setVisible(False)
|
||||
self.update_visibility()
|
||||
self.gui.set_number_of_books_shown()
|
||||
|
||||
def lock_tab(self):
|
||||
@ -515,6 +518,7 @@ class VLTabs(QTabBar): # {{{
|
||||
# On some OS X machines (using native style) the tab button is
|
||||
# on the left
|
||||
pass
|
||||
self.update_visibility()
|
||||
|
||||
def update_current(self):
|
||||
self.rebuild()
|
||||
|
@ -397,11 +397,11 @@ class SearchRestrictionMixin:
|
||||
m.addMenu(a).setIcon(QIcon.ic('minus.png'))
|
||||
m.addAction(QIcon.ic('toc.png'), _('Quick select Virtual library'), self.choose_vl_triggerred)
|
||||
|
||||
if add_tabs_action:
|
||||
if gprefs['show_vl_tabs']:
|
||||
m.addAction(_('Hide Virtual library tabs'), self.vl_tabs.disable_bar)
|
||||
else:
|
||||
m.addAction(_('Show Virtual libraries as tabs'), self.vl_tabs.enable_bar)
|
||||
if add_tabs_action:
|
||||
if gprefs['show_vl_tabs']:
|
||||
m.addAction(_('Hide Virtual library tabs'), self.vl_tabs.disable_bar)
|
||||
else:
|
||||
m.addAction(_('Show Virtual libraries as tabs'), self.vl_tabs.enable_bar)
|
||||
|
||||
m.addSeparator()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user