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