Some fixes for pyflake, pylint and remove useless function
This commit is contained in:
parent
25b69fe76a
commit
9eb0a85bae
@ -213,6 +213,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
def _tab_close(self, tab, prev=False, next_=False, opposite=False):
|
def _tab_close(self, tab, prev=False, next_=False, opposite=False):
|
||||||
"""Helper function for tab_close be able to handle message.async.
|
"""Helper function for tab_close be able to handle message.async.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tab: Tab select to be closed.
|
tab: Tab select to be closed.
|
||||||
prev: Force selecting the tab before the current tab.
|
prev: Force selecting the tab before the current tab.
|
||||||
@ -240,6 +241,7 @@ class CommandDispatcher:
|
|||||||
@cmdutils.argument('count', count=True)
|
@cmdutils.argument('count', count=True)
|
||||||
def tab_close(self, prev=False, next_=False, opposite=False, count=None):
|
def tab_close(self, prev=False, next_=False, opposite=False, count=None):
|
||||||
"""Close the current/[count]th tab.
|
"""Close the current/[count]th tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
prev: Force selecting the tab before the current tab.
|
prev: Force selecting the tab before the current tab.
|
||||||
next_: Force selecting the tab after the current tab.
|
next_: Force selecting the tab after the current tab.
|
||||||
@ -251,7 +253,7 @@ class CommandDispatcher:
|
|||||||
if tab is None:
|
if tab is None:
|
||||||
return
|
return
|
||||||
close = functools.partial(self._tab_close, tab, prev,
|
close = functools.partial(self._tab_close, tab, prev,
|
||||||
next_, opposite)
|
next_, opposite)
|
||||||
|
|
||||||
if tab.data.pinned:
|
if tab.data.pinned:
|
||||||
message.confirm_async(title='Pinned Tab',
|
message.confirm_async(title='Pinned Tab',
|
||||||
@ -284,7 +286,8 @@ class CommandDispatcher:
|
|||||||
index = self._count() if index is None else int(index)
|
index = self._count() if index is None else int(index)
|
||||||
|
|
||||||
self.tab_move(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',
|
@cmdutils.register(instance='command-dispatcher', name='open',
|
||||||
maxsplit=0, scope='window')
|
maxsplit=0, scope='window')
|
||||||
|
@ -185,11 +185,6 @@ class TabWidget(QTabWidget):
|
|||||||
for idx in range(self.count()):
|
for idx in range(self.count()):
|
||||||
self.update_tab_title(idx)
|
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):
|
def tabInserted(self, idx):
|
||||||
"""Update titles when a tab was inserted."""
|
"""Update titles when a tab was inserted."""
|
||||||
super().tabInserted(idx)
|
super().tabInserted(idx)
|
||||||
@ -500,14 +495,15 @@ class TabBar(QTabBar):
|
|||||||
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 for
|
# width. Also taken in consideration the reduced space necessary
|
||||||
# the pinned tabs.
|
#for the pinned tabs.
|
||||||
#WORKAROUND: During shutdown the self.count goes down, but the self.pinned not
|
#WORKAROUND: During shutdown the self.count goes down,
|
||||||
#this generates some odd bahavior.
|
#but the self.pinned not this generates some odd bahavior.
|
||||||
#To avoid this we compare self.count against self.pinned.
|
#To avoid this we compare self.count against self.pinned.
|
||||||
if self.pinned > 0 and self.count() > self.pinned:
|
if self.pinned > 0 and self.count() > self.pinned:
|
||||||
pinned_width = tab_width_pinned_conf * 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:
|
else:
|
||||||
width = self.width() / self.count()
|
width = self.width() / self.count()
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ class TestTabWidget:
|
|||||||
'indicator-width': 3,
|
'indicator-width': 3,
|
||||||
'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),
|
'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),
|
||||||
'title-format': '{index}: {title}',
|
'title-format': '{index}: {title}',
|
||||||
|
'title-format-pinned': '{index}',
|
||||||
|
'pinned-width': 43,
|
||||||
'title-alignment': Qt.AlignLeft,
|
'title-alignment': Qt.AlignLeft,
|
||||||
},
|
},
|
||||||
'colors': {
|
'colors': {
|
||||||
|
Loading…
Reference in New Issue
Block a user