Skip to content
Snippets Groups Projects
Commit 6472e020 authored by Daniel Meißner's avatar Daniel Meißner Committed by Daniel Meißner
Browse files

gui: added running time to status bar

parent 457a3816
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,10 @@ class SuGui(QtWidgets.QMainWindow): ...@@ -98,7 +98,10 @@ class SuGui(QtWidgets.QMainWindow):
# Thread stuff # Thread stuff
# progress_bar # progress_bar
self.progress_bar_thread.set_measure_time(options['capture_time']) self.progress_bar_thread.set_measure_time(options['capture_time'])
self.progress_bar_thread.progress.connect(self.update_progress_bar, QtCore.Qt.QueuedConnection) self.progress_bar_thread.progress.connect(self.update_progress_bar, \
QtCore.Qt.QueuedConnection)
self.progress_bar_thread.run_time.connect(self.update_run_time, \
QtCore.Qt.QueuedConnection)
self.progress_bar_thread.start() self.progress_bar_thread.start()
self._set_setEnabled(False) self._set_setEnabled(False)
...@@ -115,6 +118,11 @@ class SuGui(QtWidgets.QMainWindow): ...@@ -115,6 +118,11 @@ class SuGui(QtWidgets.QMainWindow):
""" """
self.progressBar.setValue(text) self.progressBar.setValue(text)
def update_run_time(self, run_time):
capture_time = self._extract_options()['capture_time']
self.label_status. \
setText("Time: %ss of %ss" % (run_time, capture_time))
def stop_button(self): def stop_button(self):
""" """
Stop button action in main window. Stop button action in main window.
......
...@@ -6,6 +6,7 @@ from PyQt5.QtCore import QThread, pyqtSignal, QObject ...@@ -6,6 +6,7 @@ from PyQt5.QtCore import QThread, pyqtSignal, QObject
class UpdateProgressBar(QThread): class UpdateProgressBar(QThread):
progress = pyqtSignal(int) progress = pyqtSignal(int)
run_time = pyqtSignal(int)
def __init__(self): def __init__(self):
""" """
...@@ -25,6 +26,7 @@ class UpdateProgressBar(QThread): ...@@ -25,6 +26,7 @@ class UpdateProgressBar(QThread):
while True: while True:
running_time_in_percent = self.time_to_percent() running_time_in_percent = self.time_to_percent()
self.progress.emit(running_time_in_percent) self.progress.emit(running_time_in_percent)
self.run_time.emit(float(time.time())-self.start_time)
if running_time_in_percent >= 100: if running_time_in_percent >= 100:
# kill thread if 100 % is reached # kill thread if 100 % is reached
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment