Don't color progress bar anymore.

This commit is contained in:
Florian Bruhin 2014-02-13 07:05:36 +01:00
parent 6538dbbdf1
commit 0326a66758
3 changed files with 3 additions and 36 deletions

View File

@ -98,7 +98,6 @@ completion.item.selected.border.top = #f2f2c0
completion.item.selected.border.bottom = #e6e680 completion.item.selected.border.bottom = #e6e680
completion.match.fg = red completion.match.fg = red
statusbar.progress.bg = white statusbar.progress.bg = white
statusbar.progress.bg.error = red
statusbar.bg = black statusbar.bg = black
statusbar.fg = white statusbar.fg = white
statusbar.bg.error = red statusbar.bg.error = red

View File

@ -59,7 +59,8 @@ class MainWindow(QWidget):
self.status.resized.connect(self.completion.resize_to_bar) self.status.resized.connect(self.completion.resize_to_bar)
self.status.moved.connect(self.completion.move_to_bar) self.status.moved.connect(self.completion.move_to_bar)
self.tabs.cur_progress.connect(self.status.prog.setValue) self.tabs.cur_progress.connect(self.status.prog.setValue)
self.tabs.cur_load_finished.connect(self.status.prog.load_finished) self.tabs.cur_load_finished.connect(lambda *args:
self.status.prog.hide())
self.tabs.cur_load_finished.connect( self.tabs.cur_load_finished.connect(
self.status.url.on_loading_finished) self.status.url.on_loading_finished)
self.tabs.cur_load_started.connect(self.status.prog.on_load_started) self.tabs.cur_load_started.connect(self.status.prog.on_load_started)

View File

@ -304,7 +304,6 @@ class Progress(QProgressBar):
"""The progress bar part of the status bar.""" """The progress bar part of the status bar."""
statusbar = None statusbar = None
_error = False
# FIXME for some reason, margin-left is not shown # FIXME for some reason, margin-left is not shown
_stylesheet = """ _stylesheet = """
QProgressBar {{ QProgressBar {{
@ -314,13 +313,9 @@ class Progress(QProgressBar):
background-color: transparent; background-color: transparent;
}} }}
QProgressBar[error="false"]::chunk {{ QProgressBar::chunk {{
{color[statusbar.progress.bg]} {color[statusbar.progress.bg]}
}} }}
QProgressBar[error="true"]::chunk {{
{color[statusbar.progress.bg.error]}
}}
""" """
def __init__(self, statusbar): def __init__(self, statusbar):
@ -331,39 +326,11 @@ class Progress(QProgressBar):
self.setTextVisible(False) self.setTextVisible(False)
self.hide() self.hide()
@pyqtProperty(bool)
def error(self):
"""Getter for self.error, so it can be used as Qt property."""
# pylint: disable=method-hidden
return self._error
@error.setter
def error(self, val):
"""Setter for self.error, so it can be used as Qt property.
Re-sets the stylesheet after setting the value, so everything gets
updated by Qt properly.
"""
self._error = val
self.setStyleSheet(config.get_stylesheet(self._stylesheet))
def on_load_started(self): def on_load_started(self):
"""Clear old error and show progress, used as slot to loadStarted.""" """Clear old error and show progress, used as slot to loadStarted."""
self.setValue(0) self.setValue(0)
self.error = False
self.show() self.show()
def load_finished(self, ok):
"""Hide the progress bar or color it red, depending on ok.
Slot for the loadFinished signal of a QWebView.
"""
self.error = not ok
if ok:
self.hide()
class TextBase(QLabel): class TextBase(QLabel):