Modify some of the custom widgets after writing tests
This commit is contained in:
@@ -66,14 +66,10 @@ class NovelSelector(QComboBox):
|
|||||||
|
|
||||||
def setHandle(self, tHandle: str | None, blockSignal: bool = True) -> None:
|
def setHandle(self, tHandle: str | None, blockSignal: bool = True) -> None:
|
||||||
"""Set the currently selected handle."""
|
"""Set the currently selected handle."""
|
||||||
self._blockSignal = blockSignal
|
if (index := self.findData(tHandle) if tHandle else (self.count() - 1)) >= 0:
|
||||||
if tHandle is None:
|
self._blockSignal = blockSignal
|
||||||
index = self.count() - 1
|
|
||||||
else:
|
|
||||||
index = self.findData(tHandle)
|
|
||||||
if index >= 0:
|
|
||||||
self.setCurrentIndex(index)
|
self.setCurrentIndex(index)
|
||||||
self._blockSignal = False
|
self._blockSignal = False
|
||||||
return
|
return
|
||||||
|
|
||||||
def setIncludeAll(self, value: bool) -> None:
|
def setIncludeAll(self, value: bool) -> None:
|
||||||
|
|||||||
@@ -45,10 +45,9 @@ class NPagedSideBar(QToolBar):
|
|||||||
def __init__(self, parent: QWidget) -> None:
|
def __init__(self, parent: QWidget) -> None:
|
||||||
super().__init__(parent=parent)
|
super().__init__(parent=parent)
|
||||||
|
|
||||||
self._buttons = []
|
|
||||||
self._actions = []
|
|
||||||
self._labelCol = None
|
self._labelCol = None
|
||||||
self._spacerHeight = self.fontMetrics().height() // 2
|
self._spacerHeight = self.fontMetrics().height() // 2
|
||||||
|
self._buttons: dict[int, _NPagedToolButton] = {}
|
||||||
|
|
||||||
self._group = QButtonGroup(self)
|
self._group = QButtonGroup(self)
|
||||||
self._group.setExclusive(True)
|
self._group.setExclusive(True)
|
||||||
@@ -95,8 +94,7 @@ class NPagedSideBar(QToolBar):
|
|||||||
action = self.insertWidget(self._stretchAction, button)
|
action = self.insertWidget(self._stretchAction, button)
|
||||||
self._group.addButton(button, id=buttonId)
|
self._group.addButton(button, id=buttonId)
|
||||||
|
|
||||||
self._buttons.append(button)
|
self._buttons[buttonId] = button
|
||||||
self._actions.append(action)
|
|
||||||
|
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,9 @@ class GuiNovelDetails(QDialog):
|
|||||||
# Novel Selector
|
# Novel Selector
|
||||||
self.novelSelector = NovelSelector(self)
|
self.novelSelector = NovelSelector(self)
|
||||||
self.novelSelector.refreshNovelList()
|
self.novelSelector.refreshNovelList()
|
||||||
self.novelSelector.setHandle(options.getString("GuiNovelDetails", "novelRoot", ""))
|
self.novelSelector.setHandle(
|
||||||
|
options.getString("GuiNovelDetails", "novelRoot", self.novelSelector.firstHandle or "")
|
||||||
|
)
|
||||||
|
|
||||||
# SideBar
|
# SideBar
|
||||||
self.sidebar = NPagedSideBar(self)
|
self.sidebar = NPagedSideBar(self)
|
||||||
@@ -424,17 +426,6 @@ class _ContentsPage(QWidget):
|
|||||||
options.setValue("GuiNovelDetails", "clearDouble", self.dblValue.isChecked())
|
options.setValue("GuiNovelDetails", "clearDouble", self.dblValue.isChecked())
|
||||||
return
|
return
|
||||||
|
|
||||||
def getColumnSizes(self) -> list[int]:
|
|
||||||
"""Return the column widths for the tree columns."""
|
|
||||||
retVals = [
|
|
||||||
self.tocTree.columnWidth(0),
|
|
||||||
self.tocTree.columnWidth(1),
|
|
||||||
self.tocTree.columnWidth(2),
|
|
||||||
self.tocTree.columnWidth(3),
|
|
||||||
self.tocTree.columnWidth(4),
|
|
||||||
]
|
|
||||||
return retVals
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Public Slots
|
# Public Slots
|
||||||
##
|
##
|
||||||
|
|||||||
Reference in New Issue
Block a user