Add tooltip to active status icons and update build tool

This commit is contained in:
Veronica Berglyd Olsen
2022-10-20 22:37:42 +02:00
parent 6b16b7c3b7
commit 871cef8af9
3 changed files with 17 additions and 12 deletions
+14 -9
View File
@@ -384,7 +384,7 @@ class GuiProjectTree(QTreeWidget):
C_NAME = 0
C_COUNT = 1
C_EXPORT = 2
C_ACTIVE = 2
C_STATUS = 3
def __init__(self, projView):
@@ -430,9 +430,9 @@ class GuiProjectTree(QTreeWidget):
treeHeader.setMinimumSectionSize(iPx + cMg)
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.Stretch)
treeHeader.setSectionResizeMode(self.C_COUNT, QHeaderView.ResizeToContents)
treeHeader.setSectionResizeMode(self.C_EXPORT, QHeaderView.Fixed)
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.Fixed)
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.Fixed)
treeHeader.resizeSection(self.C_EXPORT, iPx + cMg)
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
# Allow Move by Drag & Drop
@@ -443,6 +443,10 @@ class GuiProjectTree(QTreeWidget):
trRoot = self.invisibleRootItem()
trRoot.setFlags(trRoot.flags() ^ Qt.ItemIsDropEnabled)
# Cached values
self._lblActive = self.tr("Active")
self._lblInactive = self.tr("Inactive")
# Set selection options
self.setSelectionMode(QAbstractItemView.SingleSelection)
self.setSelectionBehavior(QAbstractItemView.SelectRows)
@@ -908,9 +912,10 @@ class GuiProjectTree(QTreeWidget):
trItem.setToolTip(self.C_STATUS, itemStatus)
if nwItem.isFileType():
trItem.setIcon(
self.C_EXPORT, self.mainTheme.getIcon("check" if nwItem.isActive else "cross")
)
iconName = "check" if nwItem.isActive else "cross"
toolTip = self._lblActive if nwItem.isActive else self._lblInactive
trItem.setIcon(self.C_ACTIVE, self.mainTheme.getIcon(iconName))
trItem.setToolTip(self.C_ACTIVE, toolTip)
if self.mainConf.emphLabels and nwItem.isDocumentLayout():
trFont = trItem.font(self.C_NAME)
@@ -1157,7 +1162,7 @@ class GuiProjectTree(QTreeWidget):
if isFile:
ctxMenu.addAction(
self.tr("Toggle Exported"), lambda: self._toggleItemActive(tHandle)
self.tr("Toggle Active"), lambda: self._toggleItemActive(tHandle)
)
if tItem.isNovelLike():
@@ -1605,12 +1610,12 @@ class GuiProjectTree(QTreeWidget):
newItem.setText(self.C_NAME, "")
newItem.setText(self.C_COUNT, "0")
newItem.setText(self.C_EXPORT, "")
newItem.setText(self.C_ACTIVE, "")
newItem.setText(self.C_STATUS, "")
newItem.setTextAlignment(self.C_NAME, Qt.AlignLeft)
newItem.setTextAlignment(self.C_COUNT, Qt.AlignRight)
newItem.setTextAlignment(self.C_EXPORT, Qt.AlignLeft)
newItem.setTextAlignment(self.C_ACTIVE, Qt.AlignLeft)
newItem.setTextAlignment(self.C_STATUS, Qt.AlignLeft)
newItem.setData(self.C_NAME, Qt.UserRole, tHandle)
+2 -2
View File
@@ -405,13 +405,13 @@ class GuiBuildNovel(QDialog):
novelLabel = QLabel(self.tr("Include novel files"))
notesLabel = QLabel(self.tr("Include note files"))
exportLabel = QLabel(self.tr("Ignore export flag"))
activeLabel = QLabel(self.tr("Include inactive files"))
self.fileForm.addWidget(novelLabel, 0, 0, 1, 1, Qt.AlignLeft)
self.fileForm.addWidget(self.novelFiles, 0, 1, 1, 1, Qt.AlignRight)
self.fileForm.addWidget(notesLabel, 1, 0, 1, 1, Qt.AlignLeft)
self.fileForm.addWidget(self.noteFiles, 1, 1, 1, 1, Qt.AlignRight)
self.fileForm.addWidget(exportLabel, 2, 0, 1, 1, Qt.AlignLeft)
self.fileForm.addWidget(activeLabel, 2, 0, 1, 1, Qt.AlignLeft)
self.fileForm.addWidget(self.ignoreFlag, 2, 1, 1, 1, Qt.AlignRight)
self.fileForm.setColumnStretch(0, 1)
+1 -1
View File
@@ -620,7 +620,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, fncDir, mockRnd):
# Trigger the dedicated functions the menu entries connect to
nwItem = projTree.theProject.tree[hNovelNote]
# Toggle exported flag
# Toggle active flag
assert nwItem.isActive is True
projTree._toggleItemActive(hNovelNote)
assert nwItem.isActive is False