Fix lint.

This commit is contained in:
Florian Bruhin 2015-08-01 21:29:43 +02:00
parent e58735f1d7
commit 6b98158d64
3 changed files with 14 additions and 7 deletions

View File

@ -485,7 +485,8 @@ def data(readonly=False):
('show-switching-delay', ('show-switching-delay',
SettingValue(typ.Int(), '800'), SettingValue(typ.Int(), '800'),
"Time to show the tab bar before hiding it when tabs->show is set to 'switching'."), "Time to show the tab bar before hiding it when tabs->show is "
"set to 'switching'."),
('wrap', ('wrap',
SettingValue(typ.Bool(), 'true'), SettingValue(typ.Bool(), 'true'),

View File

@ -1567,10 +1567,14 @@ class UserAgent(BaseType):
] ]
return out return out
class TabBarShow(BaseType): class TabBarShow(BaseType):
"""When to show the tab bar.""" """When to show the tab bar."""
valid_values = ValidValues(('always', "Always show the tab bar."), valid_values = ValidValues(('always', "Always show the tab bar."),
('never', "Always hide the tab bar."), ('never', "Always hide the tab bar."),
('multiple', "Hide the tab bar if only one tab is open."), ('multiple', "Hide the tab bar if only one tab "
('switching', "Show the tab bar when switching tabs.")) "is open."),
('switching', "Show the tab bar when switching "
"tabs."))

View File

@ -223,14 +223,15 @@ class TabBar(QTabBar):
self.vertical = False self.vertical = False
self._auto_hide_timer = QTimer() self._auto_hide_timer = QTimer()
self._auto_hide_timer.setSingleShot(True) self._auto_hide_timer.setSingleShot(True)
self._auto_hide_timer.setInterval(config.get('tabs', 'show-switching-delay')) self._auto_hide_timer.setInterval(
config.get('tabs', 'show-switching-delay'))
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()
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)
config_obj.changed.connect(self.show_switching_delay) config_obj.changed.connect(self.on_show_switching_delay_changed)
config_obj.changed.connect(self.tabs_show) config_obj.changed.connect(self.tabs_show)
def __repr__(self): def __repr__(self):
@ -242,9 +243,10 @@ class TabBar(QTabBar):
self._tabhide() self._tabhide()
@config.change_filter('tabs', 'show-switching-delay') @config.change_filter('tabs', 'show-switching-delay')
def show_switching_delay(self): def on_show_switching_delay_changed(self):
"""Set timer interval when tabs->show-switching-delay got changed.""" """Set timer interval when tabs->show-switching-delay got changed."""
self._auto_hide_timer.setInterval(config.get('tabs', 'show-switching-delay')) self._auto_hide_timer.setInterval(
config.get('tabs', 'show-switching-delay'))
def on_change(self): def on_change(self):
"""Show tab bar when current tab got changed.""" """Show tab bar when current tab got changed."""