Modify some of the custom widgets after writing tests

This commit is contained in:
Veronica Berglyd Olsen
2024-01-25 22:59:06 +01:00
parent 4ef40f2c4d
commit 483528b3b2
3 changed files with 8 additions and 23 deletions
+3 -7
View File
@@ -66,14 +66,10 @@ class NovelSelector(QComboBox):
def setHandle(self, tHandle: str | None, blockSignal: bool = True) -> None:
"""Set the currently selected handle."""
self._blockSignal = blockSignal
if tHandle is None:
index = self.count() - 1
else:
index = self.findData(tHandle)
if index >= 0:
if (index := self.findData(tHandle) if tHandle else (self.count() - 1)) >= 0:
self._blockSignal = blockSignal
self.setCurrentIndex(index)
self._blockSignal = False
self._blockSignal = False
return
def setIncludeAll(self, value: bool) -> None:
+2 -4
View File
@@ -45,10 +45,9 @@ class NPagedSideBar(QToolBar):
def __init__(self, parent: QWidget) -> None:
super().__init__(parent=parent)
self._buttons = []
self._actions = []
self._labelCol = None
self._spacerHeight = self.fontMetrics().height() // 2
self._buttons: dict[int, _NPagedToolButton] = {}
self._group = QButtonGroup(self)
self._group.setExclusive(True)
@@ -95,8 +94,7 @@ class NPagedSideBar(QToolBar):
action = self.insertWidget(self._stretchAction, button)
self._group.addButton(button, id=buttonId)
self._buttons.append(button)
self._actions.append(action)
self._buttons[buttonId] = button
return action