From 63dae3a8851dfb7d34271d84b56f3c59f9e9cac3 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Sun, 28 Jun 2015 00:03:53 +0200 Subject: [PATCH] Set favicon size to tabbar size. Fixes #119. Also see #754 --- qutebrowser/browser/network/qutescheme.py | 2 +- qutebrowser/mainwindow/tabbedbrowser.py | 3 --- qutebrowser/mainwindow/tabwidget.py | 8 +++++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qutebrowser/browser/network/qutescheme.py b/qutebrowser/browser/network/qutescheme.py index 7a9f3bf8d..71ee16d5c 100644 --- a/qutebrowser/browser/network/qutescheme.py +++ b/qutebrowser/browser/network/qutescheme.py @@ -153,7 +153,7 @@ def qute_help(win_id, request): """Handler for qute:help. Return HTML content as bytes.""" try: utils.read_file('html/doc/index.html') - except FileNotFoundError: + except (FileNotFoundError, NotADirectoryError, OSError, BlockingIOError): html = jinja.env.get_template('error.html').render( title="Error while loading documentation", url=request.url().toDisplayString(), diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 7b4d84b7b..0dcf873df 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -108,9 +108,6 @@ class TabbedBrowser(tabwidget.TabWidget): self._undo_stack = [] self._filter = signalfilter.SignalFilter(win_id, self) self._now_focused = None - # FIXME adjust this to font size - # https://github.com/The-Compiler/qutebrowser/issues/119 - self.setIconSize(QSize(12, 12)) 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) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index a5612a8b5..25c870f9a 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -24,7 +24,7 @@ Module attributes: between items. """ -import functools +import functools, math from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QSize, QRect, QPoint, QTimer from PyQt5.QtWidgets import (QTabWidget, QTabBar, QSizePolicy, QCommonStyle, @@ -296,6 +296,12 @@ class TabBar(QTabBar): """Set the tab bar font.""" self.setFont(config.get('fonts', 'tabbar')) + def resizeEvent(self, s): + height = self.size().height() + if height > 0: + height = math.ceil(height - height / 7) + self.setIconSize(QSize(height, height)) + @config.change_filter('colors', 'tabs.bg.bar') def set_colors(self): """Set the tab bar colors."""