forked from Wobbl/Wobuzz
Added a dock widget that shows background processes.
This commit is contained in:
parent
67c3b9e226
commit
c55c1222f0
7 changed files with 135 additions and 7 deletions
41
wobuzz/ui/process/process.py
Normal file
41
wobuzz/ui/process/process.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QFont
|
||||
from PyQt6.QtWidgets import QSizePolicy, QGroupBox, QLabel, QProgressBar, QVBoxLayout
|
||||
|
||||
|
||||
class BackgroundProcess(QGroupBox):
|
||||
normal_font = QFont()
|
||||
normal_font.setBold(False)
|
||||
bold_font = QFont()
|
||||
bold_font.setBold(True)
|
||||
|
||||
def __init__(self, title: str, parent=None, description: str="", steps: int=0):
|
||||
super().__init__(title, parent)
|
||||
|
||||
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
|
||||
self.setAlignment(Qt.AlignmentFlag.AlignLeading | Qt.AlignmentFlag.AlignVCenter)
|
||||
self.setFont(self.bold_font)
|
||||
|
||||
self.layout = QVBoxLayout(self)
|
||||
|
||||
self.description = QLabel(description, self)
|
||||
self.description.setFont(self.normal_font)
|
||||
self.layout.addWidget(self.description)
|
||||
|
||||
self.progress_bar = QProgressBar(self)
|
||||
self.progress_bar.setMaximum(steps)
|
||||
self.layout.addWidget(self.progress_bar)
|
||||
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def get_progress(self):
|
||||
return 0
|
||||
|
||||
def set_range(self, maximum: int, minimum: int=0):
|
||||
self.progress_bar.setRange(minimum, maximum)
|
||||
|
||||
def update_progress(self):
|
||||
self.progress_bar.setValue(self.get_progress())
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue