Update extensions (#1634)

This commit is contained in:
Veronica Berglyd Olsen
2023-11-29 22:35:02 +01:00
committed by GitHub
7 changed files with 15 additions and 35 deletions
+2 -14
View File
@@ -59,10 +59,7 @@ class NConfigLayout(QGridLayout):
def setHelpTextStyle(self, color: QColor | list | tuple,
fontScale: float = FONT_SCALE) -> None:
"""Set the text color for the help text."""
if isinstance(color, QColor):
self._helpCol = color
else:
self._helpCol = QColor(*color)
self._helpCol = color if isinstance(color, QColor) else QColor(*color)
self._fontScale = fontScale
return
@@ -74,12 +71,6 @@ class NConfigLayout(QGridLayout):
qHelp.setText(text)
return
def setLabelText(self, row: int, text: str) -> None:
"""Set the text for the main label."""
if row in self._itemMap:
self._itemMap[row](0).setText(text)
return
##
# Class Methods
##
@@ -211,10 +202,7 @@ class NHelpLabel(QLabel):
fontSize: float = FONT_SCALE) -> None:
super().__init__(text)
if isinstance(color, QColor):
qCol = color
else:
qCol = QColor(*color)
qCol = color if isinstance(color, QColor) else QColor(*color)
lblCol = self.palette()
lblCol.setColor(QPalette.WindowText, qCol)
+1 -4
View File
@@ -65,10 +65,7 @@ class NPagedSideBar(QToolBar):
def setLabelColor(self, color: list | QColor) -> None:
"""Set the text color for the labels."""
if isinstance(color, list):
self._labelCol = QColor(*color)
elif isinstance(color, QColor):
self._labelCol = color
self._labelCol = color if isinstance(color, QColor) else QColor(*color)
return
def addSeparator(self) -> None:
+7 -8
View File
@@ -41,14 +41,13 @@ class NProgressSimple(QProgressBar):
def paintEvent(self, event: QPaintEvent) -> None:
"""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())
if (value := self.value()) > 0:
progress = ceil(self.width()*float(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
+3 -3
View File
@@ -134,10 +134,10 @@ class NSwitch(QAbstractButton):
qPaint.setBrush(thumbBrush)
qPaint.drawEllipse(self._offset - self._rR, self._rB, self._rH, self._rH)
theFont = qPaint.font()
theFont.setPixelSize(self._xT)
font = qPaint.font()
font.setPixelSize(self._xT)
qPaint.setPen(textColor)
qPaint.setFont(theFont)
qPaint.setFont(font)
qPaint.drawText(
QRectF(self._offset - self._rR, self._rB, self._rH, self._rH),
Qt.AlignCenter, thumbText
-5
View File
@@ -106,11 +106,6 @@ class NSwitchBox(QScrollArea):
self._bumpIndex()
return
def setInnerContentsMargins(self, left: int, top: int, right: int, bottom: int) -> None:
"""Set the contents margins of the inner layout."""
self._content.setContentsMargins(left, top, right, bottom)
return
##
# Internal Functions
##
+1 -1
View File
@@ -331,7 +331,7 @@ class GuiManuscriptBuild(QDialog):
self._build.setLastBuildName(bName)
self._build.setLastFormat(bFormat)
QTimer.singleShot(1000, self._resetProgress)
QTimer.singleShot(3000, self._resetProgress)
return True
+1
View File
@@ -441,6 +441,7 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockRnd):
assert nwGUI.docEditor.isEmpty
# qtbot.stop()
nwGUI.docEditor.clear()
# Check Menu Entries
nwGUI.mainMenu.aInsENDash.activate(QAction.Trigger)