Complete the manuscript build dialog, and the doc builder class

This commit is contained in:
Veronica Berglyd Olsen
2023-06-09 21:07:46 +02:00
parent 8b7aab36a2
commit 5f4b6009ce
10 changed files with 225 additions and 82 deletions
+54
View File
@@ -0,0 +1,54 @@
"""
novelWriter Custom Widget: Progress Simple
============================================
File History:
Created: 2023-06-09 [2.1b1]
This file is a part of novelWriter
Copyright 20182023, Veronica Berglyd Olsen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from __future__ import annotations
from math import ceil
from PyQt5.QtGui import QPaintEvent, QPainter
from PyQt5.QtWidgets import QProgressBar, QWidget
class NProgressSimple(QProgressBar):
"""Extension: Simple Progress Widget
A custom widget that paints a plain bar with no other styling.
"""
def __init__(self, parent: QWidget):
super().__init__(parent=parent)
return
def paintEvent(self, event: QPaintEvent):
"""Custom painter for the progress bar."""
if self.value() == 0:
return
progress = ceil(self.width()*float(self.value())/self.maximum())
qPaint = QPainter(self)
qPaint.setRenderHint(QPainter.Antialiasing, True)
qPaint.setPen(self.palette().highlight().color())
qPaint.setBrush(self.palette().highlight())
qPaint.drawRect(0, 0, progress, self.height())
return
# END Class NProgressSimple