Fix statusbar sizing
This commit is contained in:
parent
a8b64d6971
commit
c6b21b27b5
@ -1,7 +1,7 @@
|
|||||||
"""Several widgets in the statusbar."""
|
"""Several widgets in the statusbar."""
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal
|
from PyQt5.QtCore import pyqtSignal
|
||||||
from PyQt5.QtWidgets import QHBoxLayout, QWidget
|
from PyQt5.QtWidgets import QHBoxLayout, QWidget, QSizePolicy
|
||||||
|
|
||||||
import qutebrowser.utils.config as config
|
import qutebrowser.utils.config as config
|
||||||
from qutebrowser.widgets.statusbar.command import Command
|
from qutebrowser.widgets.statusbar.command import Command
|
||||||
@ -23,6 +23,8 @@ class StatusBar(QWidget):
|
|||||||
{color[statusbar.bg.__cur__]}
|
{color[statusbar.bg.__cur__]}
|
||||||
{color[statusbar.fg.__cur__]}
|
{color[statusbar.fg.__cur__]}
|
||||||
font-family: {monospace};
|
font-family: {monospace};
|
||||||
|
font-size: 8pt;
|
||||||
|
height: 13px;
|
||||||
}}
|
}}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -43,6 +45,8 @@ class StatusBar(QWidget):
|
|||||||
self.bgcolor = config.colordict.getraw('statusbar.bg')
|
self.bgcolor = config.colordict.getraw('statusbar.bg')
|
||||||
self.setStyleSheet(config.get_stylesheet(self._stylesheet))
|
self.setStyleSheet(config.get_stylesheet(self._stylesheet))
|
||||||
|
|
||||||
|
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||||
|
|
||||||
self.hbox = QHBoxLayout(self)
|
self.hbox = QHBoxLayout(self)
|
||||||
self.hbox.setContentsMargins(0, 0, 0, 0)
|
self.hbox.setContentsMargins(0, 0, 0, 0)
|
||||||
self.hbox.setSpacing(0)
|
self.hbox.setSpacing(0)
|
||||||
@ -69,7 +73,7 @@ class StatusBar(QWidget):
|
|||||||
self.txt.error = ''
|
self.txt.error = ''
|
||||||
|
|
||||||
def resizeEvent(self, e):
|
def resizeEvent(self, e):
|
||||||
"""Override resizeEvent of QWidget to emit a resized signal afterwards.
|
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.
|
||||||
|
|
||||||
e -- The QResizeEvent.
|
e -- The QResizeEvent.
|
||||||
"""
|
"""
|
||||||
|
@ -31,7 +31,7 @@ class Command(QLineEdit):
|
|||||||
super().__init__(statusbar)
|
super().__init__(statusbar)
|
||||||
# FIXME
|
# FIXME
|
||||||
self.statusbar = statusbar
|
self.statusbar = statusbar
|
||||||
self.setStyleSheet("border: 0px; padding-left: 1px")
|
self.setStyleSheet("border: 0px; padding-left: 1px;")
|
||||||
self.setValidator(Validator())
|
self.setValidator(Validator())
|
||||||
self.returnPressed.connect(self.process_cmdline)
|
self.returnPressed.connect(self.process_cmdline)
|
||||||
self.textEdited.connect(self._histbrowse_stop)
|
self.textEdited.connect(self._histbrowse_stop)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import qutebrowser.utils.config as config
|
import qutebrowser.utils.config as config
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QProgressBar, QSizePolicy
|
from PyQt5.QtWidgets import QProgressBar, QSizePolicy
|
||||||
from PyQt5.QtCore import QSize
|
|
||||||
|
|
||||||
|
|
||||||
class Progress(QProgressBar):
|
class Progress(QProgressBar):
|
||||||
@ -26,7 +25,7 @@ class Progress(QProgressBar):
|
|||||||
self.statusbar = statusbar
|
self.statusbar = statusbar
|
||||||
super().__init__(statusbar)
|
super().__init__(statusbar)
|
||||||
|
|
||||||
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
|
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Ignored)
|
||||||
self.setTextVisible(False)
|
self.setTextVisible(False)
|
||||||
self.color = config.colordict.getraw('statusbar.progress.bg')
|
self.color = config.colordict.getraw('statusbar.progress.bg')
|
||||||
self.hide()
|
self.hide()
|
||||||
@ -38,20 +37,6 @@ class Progress(QProgressBar):
|
|||||||
config.colordict['statusbar.progress.bg.__cur__'] = value
|
config.colordict['statusbar.progress.bg.__cur__'] = value
|
||||||
self.setStyleSheet(config.get_stylesheet(self._stylesheet))
|
self.setStyleSheet(config.get_stylesheet(self._stylesheet))
|
||||||
|
|
||||||
def minimumSizeHint(self):
|
|
||||||
"""Return the size of the progress widget."""
|
|
||||||
status_size = self.statusbar.size()
|
|
||||||
return QSize(100, status_size.height())
|
|
||||||
|
|
||||||
def sizeHint(self):
|
|
||||||
|
|
||||||
"""Return the size of the progress widget.
|
|
||||||
|
|
||||||
Simply copied from minimumSizeHint because the SizePolicy is fixed.
|
|
||||||
"""
|
|
||||||
|
|
||||||
return self.minimumSizeHint()
|
|
||||||
|
|
||||||
def set_progress(self, prog):
|
def set_progress(self, prog):
|
||||||
"""Set the progress of the bar and show/hide it if necessary."""
|
"""Set the progress of the bar and show/hide it if necessary."""
|
||||||
# TODO display failed loading in some meaningful way?
|
# TODO display failed loading in some meaningful way?
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""The text part of the statusbar."""
|
"""The text part of the statusbar."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from PyQt5.QtWidgets import QLabel
|
from PyQt5.QtWidgets import QLabel, QSizePolicy
|
||||||
|
|
||||||
|
|
||||||
class Text(QLabel):
|
class Text(QLabel):
|
||||||
@ -18,7 +18,8 @@ class Text(QLabel):
|
|||||||
|
|
||||||
def __init__(self, bar):
|
def __init__(self, bar):
|
||||||
super().__init__(bar)
|
super().__init__(bar)
|
||||||
self.setStyleSheet("padding-right: 1px")
|
self.setStyleSheet("padding-right: 1px;")
|
||||||
|
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Ignored)
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
super().__setattr__(name, value)
|
super().__setattr__(name, value)
|
||||||
|
Loading…
Reference in New Issue
Block a user