Fix #2073441 [[Enhancement] Hide VL tabs while in Device view](https://bugs.launchpad.net/calibre/+bug/2073441)

This commit is contained in:
Kovid Goyal 2024-08-22 20:04:40 +05:30
parent 1c26a6ce17
commit 430cf0f5bc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 2 deletions

View File

@ -343,7 +343,8 @@ class VLTabs(QTabBar): # {{{
self.setCurrentIndex(idx)
def update_visibility(self):
self.setVisible(gprefs['show_vl_tabs'] and self.count() > 1)
cv = self.gui.current_view()
self.setVisible(gprefs['show_vl_tabs'] and self.count() > 1 and (cv is self.gui.library_view or cv is None))
def enable_bar(self):
gprefs['show_vl_tabs'] = True

View File

@ -916,7 +916,10 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
def current_view(self):
'''Convenience method that returns the currently visible view '''
try:
idx = self.stack.currentIndex()
except AttributeError:
return None # happens during startup
if idx == 0:
return self.library_view
if idx == 1:
@ -1038,6 +1041,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
self.book_details.reset_info()
self.layout_container.tag_browser_button.setEnabled(location == 'library')
self.layout_container.cover_browser_button.setEnabled(location == 'library')
self.vl_tabs.update_visibility()
for action in self.iactions.values():
action.location_selected(location)
if location == 'library':