Merge branch 'fix_unlock_tab' of https://github.com/un-pogaz/calibre

This commit is contained in:
Kovid Goyal 2022-10-16 14:01:03 +05:30
commit de01331f98
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -440,12 +440,15 @@ class VLTabs(QTabBar): # {{{
def unlock_tab(self): def unlock_tab(self):
gprefs['vl_tabs_closable'] = True gprefs['vl_tabs_closable'] = True
for idx in range(self.count()):
if not str(self.tabData(idx) or '').strip():
break
self.setTabsClosable(True) self.setTabsClosable(True)
try: try:
self.tabButton(0, QTabBar.ButtonPosition.RightSide).setVisible(False) self.tabButton(idx, QTabBar.ButtonPosition.RightSide).setVisible(False)
except AttributeError: except AttributeError:
try: try:
self.tabButton(0, QTabBar.ButtonPosition.LeftSide).setVisible(False) self.tabButton(idx, QTabBar.ButtonPosition.LeftSide).setVisible(False)
except AttributeError: except AttributeError:
# On some OS X machines (using native style) the tab button is # On some OS X machines (using native style) the tab button is
# on the left # on the left