Some fixes for pyflake, pylint and remove useless function

This commit is contained in:
thuck 2016-11-11 17:10:46 +01:00
parent 25b69fe76a
commit 9eb0a85bae
3 changed files with 13 additions and 12 deletions

View File

@ -213,6 +213,7 @@ class CommandDispatcher:
def _tab_close(self, tab, prev=False, next_=False, opposite=False):
"""Helper function for tab_close be able to handle message.async.
Args:
tab: Tab select to be closed.
prev: Force selecting the tab before the current tab.
@ -240,6 +241,7 @@ class CommandDispatcher:
@cmdutils.argument('count', count=True)
def tab_close(self, prev=False, next_=False, opposite=False, count=None):
"""Close the current/[count]th tab.
Args:
prev: Force selecting the tab before the current tab.
next_: Force selecting the tab after the current tab.
@ -251,7 +253,7 @@ class CommandDispatcher:
if tab is None:
return
close = functools.partial(self._tab_close, tab, prev,
next_, opposite)
next_, opposite)
if tab.data.pinned:
message.confirm_async(title='Pinned Tab',
@ -284,7 +286,8 @@ class CommandDispatcher:
index = self._count() if index is None else int(index)
self.tab_move(index)
self._tabbed_browser.set_tab_pinned(self._current_index(), tab.data.pinned)
self._tabbed_browser.set_tab_pinned(self._current_index(),
tab.data.pinned)
@cmdutils.register(instance='command-dispatcher', name='open',
maxsplit=0, scope='window')

View File

@ -185,11 +185,6 @@ class TabWidget(QTabWidget):
for idx in range(self.count()):
self.update_tab_title(idx)
@config.change_filter('tabs', 'pinned-width')
def update_tab_pinned_width(self):
"""Refresh bar"""
self.tabBar().refresh()
def tabInserted(self, idx):
"""Update titles when a tab was inserted."""
super().tabInserted(idx)
@ -500,14 +495,15 @@ class TabBar(QTabBar):
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.
# 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 = (self.width() - pinned_width) / (self.count() - self.pinned)
no_pinned_width = self.width() - pinned_width
width = no_pinned_width / (self.count() - self.pinned)
else:
width = self.width() / self.count()

View File

@ -46,6 +46,8 @@ class TestTabWidget:
'indicator-width': 3,
'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),
'title-format': '{index}: {title}',
'title-format-pinned': '{index}',
'pinned-width': 43,
'title-alignment': Qt.AlignLeft,
},
'colors': {