Misc cleanup and fixes
This commit is contained in:
parent
b526c9a2a9
commit
17169812be
@ -94,7 +94,7 @@ class TabData:
|
||||
viewing_source: Set if we're currently showing a source view.
|
||||
override_target: Override for open_target for fake clicks (like hints).
|
||||
Only used for QtWebKit.
|
||||
pinned: Flag to pin the tab
|
||||
pinned: Flag to pin the tab.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -201,7 +201,7 @@ class CommandDispatcher:
|
||||
"""Helper function for tab_close be able to handle message.async.
|
||||
|
||||
Args:
|
||||
tab: Tab select to be closed.
|
||||
tab: Tab object to select be closed.
|
||||
prev: Force selecting the tab before the current tab.
|
||||
next_: Force selecting the tab after the current tab.
|
||||
opposite: Force selecting the tab in the opposite direction of
|
||||
|
@ -121,7 +121,6 @@ class TabbedBrowser(tabwidget.TabWidget):
|
||||
objreg.get('config').changed.connect(self.update_favicons)
|
||||
objreg.get('config').changed.connect(self.update_window_title)
|
||||
objreg.get('config').changed.connect(self.update_tab_titles)
|
||||
objreg.get('config').changed.connect(self.update_tab_titles_pinned)
|
||||
|
||||
def __repr__(self):
|
||||
return utils.get_repr(self, count=self.count())
|
||||
|
@ -104,7 +104,6 @@ class TabWidget(QTabWidget):
|
||||
bar = self.tabBar()
|
||||
bar.set_tab_data(idx, 'pinned', pinned)
|
||||
self.update_tab_title(idx)
|
||||
bar.update(bar.tabRect(idx))
|
||||
|
||||
if pinned:
|
||||
bar.pinned_count += 1
|
||||
@ -181,16 +180,12 @@ class TabWidget(QTabWidget):
|
||||
fields['scroll_pos'] = scroll_pos
|
||||
return fields
|
||||
|
||||
@config.change_filter('tabs', 'title-format')
|
||||
def update_tab_titles(self):
|
||||
def update_tab_titles(self, section='tabs', option='title-format'):
|
||||
"""Update all texts."""
|
||||
for idx in range(self.count()):
|
||||
self.update_tab_title(idx)
|
||||
|
||||
@config.change_filter('tabs', 'title-format-pinned')
|
||||
def update_tab_titles_pinned(self):
|
||||
"""Update all texts."""
|
||||
self.update_tab_titles()
|
||||
if section == 'tabs' and option in ['title-format',
|
||||
'title-format-pinned']:
|
||||
for idx in range(self.count()):
|
||||
self.update_tab_title(idx)
|
||||
|
||||
def tabInserted(self, idx):
|
||||
"""Update titles when a tab was inserted."""
|
||||
@ -517,7 +512,7 @@ class TabBar(QTabBar):
|
||||
return size
|
||||
|
||||
# If we *do* have enough space, tabs should occupy the whole window
|
||||
# width. If there is pinned tabs their size will be substracted
|
||||
# width. If there are pinned tabs their size will be subtracted
|
||||
# from the total window width.
|
||||
# During shutdown the self.count goes down,
|
||||
# but the self.pinned_count not - this generates some odd behavior.
|
||||
|
@ -369,13 +369,13 @@ Feature: Saving and loading sessions
|
||||
Then the error "Session inexistent_session not found!" should be shown
|
||||
|
||||
|
||||
# Test load/save of pinned tabs
|
||||
# Test load/save of pinned tabs
|
||||
|
||||
Scenario: Saving/Loading a session with pinned tabs
|
||||
When I open data/numbers/1.txt
|
||||
And I open data/numbers/2.txt in a new tab
|
||||
And I open data/numbers/3.txt in a new tab
|
||||
And I run :run-with-count 2 :tab-pin
|
||||
And I run :tab-pin with count 2
|
||||
And I run :session-save pin_session
|
||||
And I run :tab-only --force
|
||||
And I run :tab-close --force
|
||||
|
@ -1054,7 +1054,7 @@ Feature: Tab management
|
||||
When I open data/numbers/1.txt
|
||||
And I open data/numbers/2.txt in a new tab
|
||||
And I open data/numbers/3.txt in a new tab
|
||||
And I run :run-with-count 2 :tab-pin
|
||||
And I run :tab-pin with count 2
|
||||
Then the following tabs should be open:
|
||||
- data/numbers/1.txt
|
||||
- data/numbers/2.txt
|
||||
@ -1119,7 +1119,7 @@ Feature: Tab management
|
||||
Scenario: :tab-pin open url
|
||||
When I open data/numbers/1.txt
|
||||
And I run :tab-pin
|
||||
And I run :open data/numbers/2.txt
|
||||
And I open data/numbers/2.txt without waiting
|
||||
Then the message "Tab is pinned!" should be shown
|
||||
And the following tabs should be open:
|
||||
- data/numbers/1.txt (active)
|
||||
|
Loading…
Reference in New Issue
Block a user