1# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: 2 3# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> 4# 5# This file is part of qutebrowser. 6# 7# qutebrowser is free software: you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation, either version 3 of the License, or 10# (at your option) any later version. 11# 12# qutebrowser is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>. 19 20"""TabIndex displayed in the statusbar.""" 21 22from PyQt5.QtCore import pyqtSlot 23 24from qutebrowser.mainwindow.statusbar import textbase 25 26 27class TabIndex(textbase.TextBase): 28 29 """Shows current tab index and number of tabs in the statusbar.""" 30 31 @pyqtSlot(int, int) 32 def on_tab_index_changed(self, current, count): 33 """Update tab index when tab changed.""" 34 self.setText('[{}/{}]'.format(current + 1, count)) 35