"""
Progress Dialog
"""
from PySide6.QtWidgets import (
QApplication,
QDialog,
QLabel,
QProgressBar,
QVBoxLayout,
QWidget,
)
from jdxi_editor.jdxi.style import JDXiStyle
from jdxi_editor.ui.widgets.display.digital import DigitalTitle
[docs]
class ProgressDialog(QDialog):
def __init__(
self,
title: str = "Loading",
message: str = "Please wait...",
maximum: int = 100,
parent: QWidget = None,
):
super().__init__(parent)
"""Initialize the ProgressDialog
:param title: str
:param message: str
:param maximum: int
:param parent: QWidget
"""
self.setWindowTitle(title)
self.setModal(True)
layout = QVBoxLayout()
[docs]
self.label = DigitalTitle(message)
[docs]
self.progress_bar = QProgressBar()
self.progress_bar.setStyleSheet(JDXiStyle.PROGRESS_BAR)
self.progress_bar.setMaximum(maximum)
layout.addWidget(self.label)
layout.addWidget(self.progress_bar)
self.setLayout(layout)
[docs]
def update_progress(self, value):
self.progress_bar.setValue(value)
QApplication.processEvents()