From 6472e020ca5ff48b3ee56e61389d3265c3a4604a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mei=C3=9Fner?= <daniel.meissner@inf.h-brs.de> Date: Tue, 26 Jan 2016 21:24:55 +0100 Subject: [PATCH] gui: added running time to status bar --- lib/gui/gui.py | 10 +++++++++- lib/gui/update_progress_bar.py | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/gui/gui.py b/lib/gui/gui.py index 62fa4da..17d8fe5 100644 --- a/lib/gui/gui.py +++ b/lib/gui/gui.py @@ -98,7 +98,10 @@ class SuGui(QtWidgets.QMainWindow): # Thread stuff # progress_bar 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._set_setEnabled(False) @@ -115,6 +118,11 @@ class SuGui(QtWidgets.QMainWindow): """ 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): """ Stop button action in main window. diff --git a/lib/gui/update_progress_bar.py b/lib/gui/update_progress_bar.py index 76352e9..02a3396 100644 --- a/lib/gui/update_progress_bar.py +++ b/lib/gui/update_progress_bar.py @@ -6,6 +6,7 @@ from PyQt5.QtCore import QThread, pyqtSignal, QObject class UpdateProgressBar(QThread): progress = pyqtSignal(int) + run_time = pyqtSignal(int) def __init__(self): """ @@ -25,6 +26,7 @@ class UpdateProgressBar(QThread): while True: running_time_in_percent = self.time_to_percent() self.progress.emit(running_time_in_percent) + self.run_time.emit(float(time.time())-self.start_time) if running_time_in_percent >= 100: # kill thread if 100 % is reached -- GitLab