Fix comments and change self.pinned to self.pinned_count
This commit is contained in:
parent
e9c79e9be3
commit
8d4b55bb80
@ -282,7 +282,7 @@ class CommandDispatcher:
|
||||
|
||||
tab.data.pinned = not tab.data.pinned
|
||||
if tab.data.pinned:
|
||||
index = tabbar.pinned + 1 if index is None else int(index)
|
||||
index = tabbar.pinned_count + 1 if index is None else int(index)
|
||||
else:
|
||||
index = self._count() if index is None else int(index)
|
||||
|
||||
|
@ -103,9 +103,9 @@ class TabWidget(QTabWidget):
|
||||
bar.update(bar.tabRect(idx))
|
||||
|
||||
if pinned:
|
||||
bar.pinned += 1
|
||||
bar.pinned_count += 1
|
||||
else:
|
||||
bar.pinned -= 1
|
||||
bar.pinned_count -= 1
|
||||
|
||||
bar.refresh()
|
||||
|
||||
@ -306,7 +306,7 @@ class TabBar(QTabBar):
|
||||
self._auto_hide_timer.timeout.connect(self._tabhide)
|
||||
self.setAutoFillBackground(True)
|
||||
self.set_colors()
|
||||
self.pinned = 0
|
||||
self.pinned_count = 0
|
||||
config_obj.changed.connect(self.set_colors)
|
||||
QTimer.singleShot(0, self._tabhide)
|
||||
config_obj.changed.connect(self.on_tab_colors_changed)
|
||||
@ -488,28 +488,28 @@ class TabBar(QTabBar):
|
||||
try:
|
||||
pinned = self.tab_data(index, 'pinned')
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
pinned = False
|
||||
|
||||
if pinned:
|
||||
size = QSize(tab_width_pinned_conf, height)
|
||||
qtutils.ensure_valid(size)
|
||||
return size
|
||||
|
||||
# If we *do* have enough space, tabs should occupy the whole window
|
||||
# width. Also taken in consideration the reduced space necessary
|
||||
#for the pinned tabs.
|
||||
#WORKAROUND: During shutdown the self.count goes down,
|
||||
#but the self.pinned not this generates some odd bahavior.
|
||||
#To avoid this we compare self.count against self.pinned.
|
||||
if self.pinned > 0 and self.count() > self.pinned:
|
||||
pinned_width = tab_width_pinned_conf * self.pinned
|
||||
# width. If there is pinned tabs their size will be substracted from
|
||||
# the total window width.
|
||||
# During shutdown the self.count goes down,
|
||||
# but the self.pinned_count not - this generates some odd behavior.
|
||||
# To avoid this we compare self.count against self.pinned_count.
|
||||
if self.pinned_count > 0 and self.count() > self.pinned_count:
|
||||
pinned_width = tab_width_pinned_conf * self.pinned_count
|
||||
no_pinned_width = self.width() - pinned_width
|
||||
width = no_pinned_width / (self.count() - self.pinned)
|
||||
width = no_pinned_width / (self.count() - self.pinned_count)
|
||||
else:
|
||||
width = self.width() / self.count()
|
||||
|
||||
## If width is not divisible by count, add a pixel to some tabs so
|
||||
## that there is no ugly leftover space.
|
||||
# If width is not divisible by count, add a pixel to some tabs so
|
||||
# that there is no ugly leftover space.
|
||||
if index < self.width() % self.count():
|
||||
width += 1
|
||||
size = QSize(width, height)
|
||||
|
Loading…
Reference in New Issue
Block a user