More small fixes
Removed unsed variables. Removed some empty lines. Inncluded docstring.
This commit is contained in:
parent
f9b1d998d4
commit
b24ac0ae78
@ -212,7 +212,18 @@ class CommandDispatcher:
|
|||||||
"{!r}!".format(conf_selection))
|
"{!r}!".format(conf_selection))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _tab_close(self, tab, left=False, right=False, opposite=False, count=None):
|
def _tab_close(self, tab, left=False, right=False, opposite=False):
|
||||||
|
"""Helper function for tab_close be able to handle message.async.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tab: Tab select to be closed.
|
||||||
|
left: Force selecting the tab to the left of the current tab.
|
||||||
|
right: Force selecting the tab to the right of the current tab.
|
||||||
|
opposite: Force selecting the tab in the opposite direction of
|
||||||
|
what's configured in 'tabs->select-on-remove'.
|
||||||
|
count: The tab index to close, or None
|
||||||
|
|
||||||
|
"""
|
||||||
tabbar = self._tabbed_browser.tabBar()
|
tabbar = self._tabbed_browser.tabBar()
|
||||||
selection_override = self._get_selection_override(left, right,
|
selection_override = self._get_selection_override(left, right,
|
||||||
opposite)
|
opposite)
|
||||||
@ -224,7 +235,6 @@ class CommandDispatcher:
|
|||||||
self._tabbed_browser.close_tab(tab)
|
self._tabbed_browser.close_tab(tab)
|
||||||
tabbar.setSelectionBehaviorOnRemove(old_selection_behavior)
|
tabbar.setSelectionBehaviorOnRemove(old_selection_behavior)
|
||||||
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
@cmdutils.argument('count', count=True)
|
@cmdutils.argument('count', count=True)
|
||||||
def tab_close(self, left=False, right=False, opposite=False, count=None):
|
def tab_close(self, left=False, right=False, opposite=False, count=None):
|
||||||
@ -238,12 +248,11 @@ class CommandDispatcher:
|
|||||||
count: The tab index to close, or None
|
count: The tab index to close, or None
|
||||||
"""
|
"""
|
||||||
tab = self._cntwidget(count)
|
tab = self._cntwidget(count)
|
||||||
result = True
|
|
||||||
if tab is None:
|
if tab is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
close = functools.partial(self._tab_close, tab, left,
|
close = functools.partial(self._tab_close, tab, left,
|
||||||
right, opposite, count)
|
right, opposite)
|
||||||
|
|
||||||
if tab.data.pinned:
|
if tab.data.pinned:
|
||||||
message.confirm_async(title='Pinned Tab',
|
message.confirm_async(title='Pinned Tab',
|
||||||
@ -252,8 +261,6 @@ class CommandDispatcher:
|
|||||||
else:
|
else:
|
||||||
close()
|
close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
name='tab-pin')
|
name='tab-pin')
|
||||||
@cmdutils.argument('index')
|
@cmdutils.argument('index')
|
||||||
|
Loading…
Reference in New Issue
Block a user