Fix progress bar being red hopefully.

This commit is contained in:
Florian Bruhin 2014-02-12 17:13:31 +01:00
parent 5342b88519
commit f893b11f1b
3 changed files with 7 additions and 10 deletions

1
TODO
View File

@ -1,7 +1,6 @@
Bugs Bugs
==== ====
progress bar is often red
All kind of FIXMEs All kind of FIXMEs
Weird font rendering Weird font rendering
https://bugreports.qt-project.org/browse/QTBUG-20973 https://bugreports.qt-project.org/browse/QTBUG-20973

View File

@ -62,10 +62,9 @@ class MainWindow(QMainWindow):
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.set_progress) 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(self.status.prog.load_finished)
self.tabs.cur_load_started.connect(lambda: self.tabs.cur_load_started.connect(self.status.prog.on_load_started)
self.status.prog.set_progress(0))
self.tabs.cur_scroll_perc_changed.connect( self.tabs.cur_scroll_perc_changed.connect(
self.status.percentage.set_perc) self.status.percentage.set_perc)
self.tabs.cur_statusbar_message.connect(self.status.txt.setText) self.tabs.cur_statusbar_message.connect(self.status.txt.setText)

View File

@ -348,12 +348,11 @@ class Progress(QProgressBar):
self._error = val self._error = val
self.setStyleSheet(config.get_stylesheet(self._stylesheet)) self.setStyleSheet(config.get_stylesheet(self._stylesheet))
def set_progress(self, prog): def on_load_started(self):
"""Set the progress of the bar and show/hide it if necessary.""" """Clear old error and show progress, used as slot to loadStarted."""
self.setValue(prog) self.setValue(0)
if prog != 100: self.error = False
self.error = False self.show()
self.show()
def load_finished(self, ok): def load_finished(self, ok):
"""Hide the progress bar or color it red, depending on ok. """Hide the progress bar or color it red, depending on ok.