From 1838e0ffd1135df39bd3b9f69d0b7c1b9460a90a Mon Sep 17 00:00:00 2001 From: Faraphel Date: Sat, 23 Dec 2023 22:43:22 +0100 Subject: [PATCH] added progress bar for the surveys --- source/widget/FrameSurvey.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/widget/FrameSurvey.py b/source/widget/FrameSurvey.py index ee9f75c..68cd2f7 100644 --- a/source/widget/FrameSurvey.py +++ b/source/widget/FrameSurvey.py @@ -4,7 +4,7 @@ import uuid from pathlib import Path from PyQt6.QtCore import pyqtSignal -from PyQt6.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QPushButton +from PyQt6.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QPushButton, QProgressBar from source.survey.base import BaseSurvey from source.survey import Empty, survey_get @@ -66,6 +66,10 @@ class FrameSurvey(QFrame): self.button_forward.setText("Suivant") self.button_forward.clicked.connect(self.next_survey) # NOQA: connect exist + # progress bar + self.progress = QProgressBar() + self._layout.addWidget(self.progress) + # load the survey configuration file self.load_file(survey_path) @@ -105,6 +109,11 @@ class FrameSurvey(QFrame): ] self.current_survey_index = 0 + # update the progress bar + self.progress.setMaximum(len(surveys_data["surveys"])) + self.progress.setTextVisible(False) + self.progress.setFixedHeight(8) + def next_survey(self): # get the collected data from the survey collected_data = self.frame_survey.get_collected_data() @@ -115,6 +124,7 @@ class FrameSurvey(QFrame): self.collected_datas["surveys"][survey_id] = collected_data self.current_survey_index += 1 + self.progress.setValue(self.current_survey_index) if self.current_survey_index < len(self.survey_screens): self.update_survey()