Simplify the status class

This commit is contained in:
Veronica Berglyd Olsen
2024-04-10 17:57:39 +02:00
parent 478db63b30
commit 63d2f5c57d
9 changed files with 123 additions and 174 deletions
+5 -15
View File
@@ -25,7 +25,7 @@ from __future__ import annotations
import logging import logging
from typing import TYPE_CHECKING, Any, Literal, overload from typing import TYPE_CHECKING, Any
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
@@ -308,25 +308,15 @@ class NWItem:
return trConst(nwLabels.ITEM_DESCRIPTION.get(descKey, "")) return trConst(nwLabels.ITEM_DESCRIPTION.get(descKey, ""))
@overload # pragma: no cover def getImportStatus(self) -> tuple[str, QIcon]:
def getImportStatus(self, incIcon: Literal[True] = True) -> tuple[str, QIcon]:
pass
@overload # pragma: no cover
def getImportStatus(self, incIcon: Literal[False]) -> tuple[str, None]:
pass
def getImportStatus(self, incIcon=True):
"""Return the relevant importance or status label and icon for """Return the relevant importance or status label and icon for
the current item based on its class. the current item based on its class.
""" """
if self.isNovelLike(): if self.isNovelLike():
stName = self._project.data.itemStatus.name(self._status) entry = self._project.data.itemStatus[self._status]
stIcon = self._project.data.itemStatus.icon(self._status) if incIcon else None
else: else:
stName = self._project.data.itemImport.name(self._import) entry = self._project.data.itemImport[self._import]
stIcon = self._project.data.itemImport.icon(self._import) if incIcon else None return entry.name, entry.icon
return stName, stIcon
## ##
# Checker Methods # Checker Methods
+22 -33
View File
@@ -36,7 +36,8 @@ from collections.abc import Iterable
from PyQt5.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication
from novelwriter import CONFIG, SHARED, __version__, __hexversion__ from novelwriter import CONFIG, SHARED, __version__, __hexversion__
from novelwriter.enum import nwItemType, nwItemClass, nwItemLayout, nwStatusShape from novelwriter.core.status import StatusEntry
from novelwriter.enum import nwItemType, nwItemClass, nwItemLayout
from novelwriter.error import logException from novelwriter.error import logException
from novelwriter.constants import trConst, nwLabels from novelwriter.constants import trConst, nwLabels
from novelwriter.core.tree import NWTree from novelwriter.core.tree import NWTree
@@ -461,15 +462,14 @@ class NWProject:
def setDefaultStatusImport(self) -> None: def setDefaultStatusImport(self) -> None:
"""Set the default status and importance values.""" """Set the default status and importance values."""
square = nwStatusShape.SQUARE self._data.itemStatus.write(None, self.tr("New"), (100, 100, 100), "SQUARE")
self._data.itemStatus.write(None, self.tr("New"), (100, 100, 100), square) self._data.itemStatus.write(None, self.tr("Note"), (200, 50, 0), "SQUARE")
self._data.itemStatus.write(None, self.tr("Note"), (200, 50, 0), square) self._data.itemStatus.write(None, self.tr("Draft"), (200, 150, 0), "SQUARE")
self._data.itemStatus.write(None, self.tr("Draft"), (200, 150, 0), square) self._data.itemStatus.write(None, self.tr("Finished"), (50, 200, 0), "SQUARE")
self._data.itemStatus.write(None, self.tr("Finished"), (50, 200, 0), square) self._data.itemImport.write(None, self.tr("New"), (100, 100, 100), "SQUARE")
self._data.itemImport.write(None, self.tr("New"), (100, 100, 100), square) self._data.itemImport.write(None, self.tr("Minor"), (200, 50, 0), "SQUARE")
self._data.itemImport.write(None, self.tr("Minor"), (200, 50, 0), square) self._data.itemImport.write(None, self.tr("Major"), (200, 150, 0), "SQUARE")
self._data.itemImport.write(None, self.tr("Major"), (200, 150, 0), square) self._data.itemImport.write(None, self.tr("Main"), (50, 200, 0), "SQUARE")
self._data.itemImport.write(None, self.tr("Main"), (50, 200, 0), square)
return return
def setProjectLang(self, language: str | None) -> None: def setProjectLang(self, language: str | None) -> None:
@@ -492,13 +492,13 @@ class NWProject:
self.setProjectChanged(True) self.setProjectChanged(True)
return return
def setStatusColours(self, new: list[dict], deleted: list[str]) -> bool: def setStatus(self, update: list[tuple[str | None, StatusEntry]], remove: list[str]) -> None:
"""Update the list of novel file status flags.""" """Update the list of novel file status flags."""
return self._setStatusImport(new, deleted, self._data.itemStatus) return self._setStatusImport(update, remove, self._data.itemStatus)
def setImportColours(self, new: list[dict], deleted: list[str]) -> bool: def setImport(self, update: list[tuple[str | None, StatusEntry]], remove: list[str]) -> None:
"""Update the list of note file importance flags.""" """Update the list of note file importance flags."""
return self._setStatusImport(new, deleted, self._data.itemImport) return self._setStatusImport(update, remove, self._data.itemImport)
def setProjectChanged(self, status: bool) -> bool: def setProjectChanged(self, status: bool) -> bool:
"""Toggle the project changed flag, and propagate the """Toggle the project changed flag, and propagate the
@@ -585,28 +585,17 @@ class NWProject:
# Internal Functions # Internal Functions
## ##
def _setStatusImport(self, new: list[dict], delete: list[str], target: NWStatus) -> bool: def _setStatusImport(self, update: list[tuple[str | None, StatusEntry]],
remove: list[str], target: NWStatus) -> None:
"""Update the list of novel file status or importance flags, and """Update the list of novel file status or importance flags, and
delete those that have been requested deleted. delete those that have been requested deleted.
""" """
if not (new or delete): if update or remove:
return False order = [target.write(k, e.name, e.color, e.shape) for k, e in update]
for key in remove:
order = [] target.remove(key)
for entry in new: target.reorder(order)
key = entry.get("key", None) return
name = entry.get("name", "")
cols = entry.get("cols", (100, 100, 100))
shape = entry.get("shape", nwStatusShape.SQUARE)
if name:
order.append(target.write(key, name, cols, shape))
for key in delete:
target.remove(key)
target.reorder(order)
return True
def _loadProjectLocalisation(self) -> bool: def _loadProjectLocalisation(self) -> bool:
"""Load the language data for the current project language.""" """Load the language data for the current project language."""
+37 -57
View File
@@ -24,11 +24,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """
from __future__ import annotations from __future__ import annotations
import dataclasses
import logging import logging
import random import random
from collections.abc import Iterable from collections.abc import Iterable
from dataclasses import dataclass
from math import cos, pi, sin from math import cos, pi, sin
from typing import TYPE_CHECKING, Literal from typing import TYPE_CHECKING, Literal
@@ -46,18 +46,26 @@ if TYPE_CHECKING: # pragma: no cover
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@dataclass @dataclasses.dataclass
class StatusEntry: class StatusEntry:
name: str name: str
colour: QColor color: QColor
shape: nwStatusShape shape: nwStatusShape
icon: QIcon icon: QIcon
count: int = 0 count: int = 0
@classmethod
def duplicate(cls, source: StatusEntry) -> StatusEntry:
"""Create a shallow copy of the source object."""
return dataclasses.replace(source)
# END Class StatusEntry # END Class StatusEntry
NO_ENTRY = StatusEntry("", QColor(0, 0, 0), nwStatusShape.SQUARE, QIcon(), 0)
class NWStatus: class NWStatus:
STATUS = 1 STATUS = 1
@@ -70,9 +78,6 @@ class NWStatus:
self._default = None self._default = None
self._iPX = CONFIG.pxInt(24) self._iPX = CONFIG.pxInt(24)
self._defaultIcon = self.createIcon(
self._iPX, QColor(100, 100, 100), nwStatusShape.SQUARE
)
if self._type == self.STATUS: if self._type == self.STATUS:
self._prefix = "s" self._prefix = "s"
@@ -86,44 +91,51 @@ class NWStatus:
def __len__(self) -> int: def __len__(self) -> int:
return len(self._store) return len(self._store)
def __getitem__(self, key: str) -> StatusEntry: def __getitem__(self, key: str | None) -> StatusEntry:
return self._store[key] """Return the entry associated with a given key."""
if key and key in self._store:
return self._store[key]
elif self._default is not None:
return self._store[self._default]
return NO_ENTRY
## ##
# Methods # Methods
## ##
def write(self, key: str | None, name: str, col: tuple[int, int, int], def write(self, key: str | None, name: str, color: tuple[int, int, int] | QColor,
shape: nwStatusShape | str, count: int | None = None) -> str: shape: nwStatusShape | str, count: int = 0) -> str:
"""Add or update a status entry. If the key is invalid, a new """Add or update a status entry. If the key is invalid, a new
key is generated. key is generated.
""" """
if not self._isKey(key): if not self._isKey(key):
key = self._newKey() key = self._newKey()
if not isinstance(col, tuple):
col = (100, 100, 100)
if len(col) != 3:
col = (100, 100, 100)
name = simplified(name) if isinstance(color, QColor):
colour = QColor(*col) qColor = color
elif isinstance(color, tuple) and len(color) == 3:
qColor = QColor(*color)
else:
qColor = QColor(100, 100, 100)
if not isinstance(shape, nwStatusShape): if not isinstance(shape, nwStatusShape):
if shape in nwStatusShape.__members__: try:
shape = nwStatusShape[shape] shape = nwStatusShape[shape]
else: except KeyError:
shape = nwStatusShape.SQUARE shape = nwStatusShape.SQUARE
icon = self.createIcon(self._iPX, colour, shape) name = simplified(name)
icon = self.createIcon(self._iPX, qColor, shape)
if key and key in self._store: if key and key in self._store:
entry = self._store[key] entry = self._store[key]
entry.name = name entry.name = name
entry.colour = colour entry.color = qColor
entry.shape = shape entry.shape = shape
entry.icon = icon entry.icon = icon
entry.count = count or 0 entry.count = count
else: else:
self._store[key] = StatusEntry(name, colour, shape, icon, count or 0) self._store[key] = StatusEntry(name, qColor, shape, icon, count)
if self._default is None: if self._default is None:
self._default = key self._default = key
@@ -156,38 +168,6 @@ class NWStatus:
return self._default return self._default
return "" return ""
def name(self, key: str | None) -> str:
"""Return the name associated with a given key."""
if key and key in self._store:
return self._store[key].name
elif self._default is not None:
return self._store[self._default].name
return ""
def cols(self, key: str | None) -> QColor:
"""Return the colours associated with a given key."""
if key and key in self._store:
return self._store[key].colour
elif self._default is not None:
return self._store[self._default].colour
return QColor(100, 100, 100)
def count(self, key: str | None) -> int:
"""Return the count associated with a given key."""
if key and key in self._store:
return self._store[key].count
elif self._default is not None:
return self._store[self._default].count
return 0
def icon(self, key: str | None) -> QIcon:
"""Return the icon associated with a given key."""
if key and key in self._store:
return self._store[key].icon
elif self._default is not None:
return self._store[self._default].icon
return self._defaultIcon
def reorder(self, order: list[str]) -> bool: def reorder(self, order: list[str]) -> bool:
"""Reorder the items according to list.""" """Reorder the items according to list."""
if len(order) != len(self._store): if len(order) != len(self._store):
@@ -227,9 +207,9 @@ class NWStatus:
yield (entry.name, { yield (entry.name, {
"key": key, "key": key,
"count": str(entry.count), "count": str(entry.count),
"red": str(entry.colour.red()), "red": str(entry.color.red()),
"green": str(entry.colour.green()), "green": str(entry.color.green()),
"blue": str(entry.colour.blue()), "blue": str(entry.color.blue()),
"shape": entry.shape.name, "shape": entry.shape.name,
}) })
return return
+54 -64
View File
@@ -36,7 +36,7 @@ from PyQt5.QtWidgets import (
from novelwriter import CONFIG, SHARED from novelwriter import CONFIG, SHARED
from novelwriter.common import simplified from novelwriter.common import simplified
from novelwriter.core.status import NWStatus from novelwriter.core.status import NWStatus, StatusEntry
from novelwriter.enum import nwStatusShape from novelwriter.enum import nwStatusShape
from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrollableForm from novelwriter.extensions.configlayout import NColourLabel, NFixedPage, NScrollableForm
from novelwriter.extensions.modified import NComboBox, NIconToolButton from novelwriter.extensions.modified import NComboBox, NIconToolButton
@@ -182,18 +182,18 @@ class GuiProjectSettings(QDialog):
rebuildTrees = False rebuildTrees = False
if self.statusPage.wasChanged: if self.statusPage.wasChanged:
newList, delList = self.statusPage.getNewList() update, remove = self.statusPage.getNewList()
project.setStatusColours(newList, delList) project.setStatus(update, remove)
rebuildTrees = True rebuildTrees = True
if self.importPage.wasChanged: if self.importPage.wasChanged:
newList, delList = self.importPage.getNewList() update, remove = self.importPage.getNewList()
project.setImportColours(newList, delList) project.setImport(update, remove)
rebuildTrees = True rebuildTrees = True
if self.replacePage.wasChanged: if self.replacePage.wasChanged:
newList = self.replacePage.getNewList() update = self.replacePage.getNewList()
project.data.setAutoReplace(newList) project.data.setAutoReplace(update)
self.newProjectSettingsReady.emit(rebuildTrees) self.newProjectSettingsReady.emit(rebuildTrees)
QApplication.processEvents() QApplication.processEvents()
@@ -308,9 +308,7 @@ class _StatusPage(NFixedPage):
C_USAGE = 1 C_USAGE = 1
D_KEY = QtUserRole D_KEY = QtUserRole
D_COLOR = QtUserRole + 1 D_ENTRY = QtUserRole + 1
D_SHAPE = QtUserRole + 2
D_COUNT = QtUserRole + 3
def __init__(self, parent: QWidget, isStatus: bool) -> None: def __init__(self, parent: QWidget, isStatus: bool) -> None:
super().__init__(parent=parent) super().__init__(parent=parent)
@@ -329,10 +327,10 @@ class _StatusPage(NFixedPage):
) )
self._changed = False self._changed = False
self._colDeleted = [] self._colDeleted: list[str] = []
self._selColour = QColor(100, 100, 100) self._selColour = QColor(100, 100, 100)
self.iPx = SHARED.theme.baseIconHeight self._iPx = SHARED.theme.baseIconHeight
iSz = SHARED.theme.baseIconSize iSz = SHARED.theme.baseIconSize
bSz = SHARED.theme.buttonIconSize bSz = SHARED.theme.buttonIconSize
@@ -355,7 +353,7 @@ class _StatusPage(NFixedPage):
self.listBox.setIndentation(0) self.listBox.setIndentation(0)
for key, entry in status.iterItems(): for key, entry in status.iterItems():
self._addItem(key, entry.name, entry.colour, entry.shape, entry.icon, entry.count) self._addItem(key, StatusEntry.duplicate(entry))
# List Controls # List Controls
self.addButton = NIconToolButton(self, iSz, "add") self.addButton = NIconToolButton(self, iSz, "add")
@@ -376,7 +374,7 @@ class _StatusPage(NFixedPage):
self.editName.setPlaceholderText(self.tr("Select item to edit")) self.editName.setPlaceholderText(self.tr("Select item to edit"))
self.editName.setEnabled(False) self.editName.setEnabled(False)
self.colPixmap = QPixmap(self.iPx, self.iPx) self.colPixmap = QPixmap(self._iPx, self._iPx)
self.colPixmap.fill(QColor(100, 100, 100)) self.colPixmap.fill(QColor(100, 100, 100))
self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"), self) self.colButton = QPushButton(QIcon(self.colPixmap), self.tr("Colour"), self)
self.colButton.setIconSize(bSz) self.colButton.setIconSize(bSz)
@@ -425,20 +423,16 @@ class _StatusPage(NFixedPage):
# Methods # Methods
## ##
def getNewList(self) -> tuple[list, list]: def getNewList(self) -> tuple[list[tuple[str | None, StatusEntry]], list[str]]:
"""Return list of entries.""" """Return list of entries."""
if self._changed: if self._changed:
newList = [] update = []
for n in range(self.listBox.topLevelItemCount()): for n in range(self.listBox.topLevelItemCount()):
item = self.listBox.topLevelItem(n) if item := self.listBox.topLevelItem(n):
if item is not None: key = item.data(self.C_DATA, self.D_KEY)
newList.append({ entry = item.data(self.C_DATA, self.D_ENTRY)
"key": item.data(self.C_DATA, self.D_KEY), update.append((key, entry))
"name": item.text(self.C_DATA), return update, self._colDeleted
"cols": item.data(self.C_DATA, self.D_COLOR),
"shape": item.data(self.C_DATA, self.D_SHAPE),
})
return newList, self._colDeleted
return [], [] return [], []
def columnWidth(self) -> int: def columnWidth(self) -> int:
@@ -458,7 +452,7 @@ class _StatusPage(NFixedPage):
) )
if newCol.isValid(): if newCol.isValid():
self._selColour = newCol self._selColour = newCol
pixmap = QPixmap(self.iPx, self.iPx) pixmap = QPixmap(self._iPx, self._iPx)
pixmap.fill(newCol) pixmap.fill(newCol)
self.colButton.setIcon(QIcon(pixmap)) self.colButton.setIcon(QIcon(pixmap))
self.colButton.setIconSize(pixmap.rect().size()) self.colButton.setIconSize(pixmap.rect().size())
@@ -467,34 +461,43 @@ class _StatusPage(NFixedPage):
@pyqtSlot() @pyqtSlot()
def _newItem(self) -> None: def _newItem(self) -> None:
"""Create a new status item.""" """Create a new status item."""
# self._addItem(None, self.tr("New Item"), (100, 100, 100), 0) color = QColor(100, 100, 100)
shape = nwStatusShape.SQUARE
icon = NWStatus.createIcon(self._iPx, color, shape)
self._addItem(None, StatusEntry(self.tr("New Item"), color, shape, icon, 0))
self._changed = True self._changed = True
return return
@pyqtSlot() @pyqtSlot()
def _delItem(self) -> None: def _delItem(self) -> None:
"""Delete a status item.""" """Delete a status item."""
selItem = self._getSelectedItem() if item := self._getSelectedItem():
if isinstance(selItem, QTreeWidgetItem): iRow = self.listBox.indexOfTopLevelItem(item)
iRow = self.listBox.indexOfTopLevelItem(selItem) entry: StatusEntry = item.data(self.C_DATA, self.D_ENTRY)
if selItem.data(self.C_LABEL, self.D_COUNT) > 0: if entry.count > 0:
SHARED.error(self.tr("Cannot delete a status item that is in use.")) SHARED.error(self.tr("Cannot delete a status item that is in use."))
else: else:
self.listBox.takeTopLevelItem(iRow) self.listBox.takeTopLevelItem(iRow)
self._colDeleted.append(selItem.data(self.C_DATA, self.D_KEY)) self._colDeleted.append(item.data(self.C_DATA, self.D_KEY))
self._changed = True self._changed = True
return return
@pyqtSlot() @pyqtSlot()
def _saveItem(self) -> None: def _saveItem(self) -> None:
"""Save changes made to a status item.""" """Save changes made to a status item."""
selItem = self._getSelectedItem() if item := self._getSelectedItem():
if isinstance(selItem, QTreeWidgetItem): entry: StatusEntry = item.data(self.C_DATA, self.D_ENTRY)
selItem.setText(self.C_LABEL, simplified(self.editName.text()))
selItem.setIcon(self.C_LABEL, self.colButton.icon()) name = simplified(self.editName.text())
selItem.setData(self.C_DATA, self.D_COLOR, ( shape = nwStatusShape.SQUARE
self._selColour.red(), self._selColour.green(), self._selColour.blue() icon = NWStatus.createIcon(self._iPx, self._selColour, shape)
)) entry.name = name
entry.shape = shape
entry.color = self._selColour
entry.icon = icon
item.setText(self.C_LABEL, name)
item.setIcon(self.C_LABEL, icon)
self._changed = True self._changed = True
return return
@@ -503,26 +506,21 @@ class _StatusPage(NFixedPage):
"""Extract the info of a selected item and populate the settings """Extract the info of a selected item and populate the settings
boxes and button. If no item is selected, clear the form. boxes and button. If no item is selected, clear the form.
""" """
selItem = self._getSelectedItem() if item := self._getSelectedItem():
if isinstance(selItem, QTreeWidgetItem): entry: StatusEntry = item.data(self.C_DATA, self.D_ENTRY)
cols = selItem.data(self.C_DATA, self.D_COLOR) self._selColour = entry.color
name = selItem.text(self.C_LABEL) self.editName.setText(entry.name)
pixmap = QPixmap(self.iPx, self.iPx) self.colButton.setIcon(entry.icon)
pixmap.fill(cols)
self._selColour = cols
self.editName.setText(name)
self.colButton.setIcon(QIcon(pixmap))
self.editName.selectAll() self.editName.selectAll()
self.editName.setFocus() self.editName.setFocus()
self.editName.setEnabled(True) self.editName.setEnabled(True)
self.colButton.setEnabled(True) self.colButton.setEnabled(True)
self.saveButton.setEnabled(True) self.saveButton.setEnabled(True)
else: else:
pixmap = QPixmap(self.iPx, self.iPx)
pixmap.fill(QColor(100, 100, 100))
self._selColour = QColor(100, 100, 100) self._selColour = QColor(100, 100, 100)
icon = NWStatus.createIcon(self._iPx, self._selColour, nwStatusShape.SQUARE)
self.editName.setText("") self.editName.setText("")
self.colButton.setIcon(QIcon(pixmap)) self.colButton.setIcon(icon)
self.editName.setEnabled(False) self.editName.setEnabled(False)
self.colButton.setEnabled(False) self.colButton.setEnabled(False)
self.saveButton.setEnabled(False) self.saveButton.setEnabled(False)
@@ -532,23 +530,15 @@ class _StatusPage(NFixedPage):
# Internal Functions # Internal Functions
## ##
def _addItem(self, key: str | None, name: str, colour: QColor, def _addItem(self, key: str | None, entry: StatusEntry) -> None:
shape: nwStatusShape, icon: QIcon | None, count: int) -> None:
"""Add a status item to the list.""" """Add a status item to the list."""
if icon is None:
icon = NWStatus.createIcon(SHARED.theme.baseIconHeight, colour, shape)
item = QTreeWidgetItem() item = QTreeWidgetItem()
item.setText(self.C_LABEL, name) item.setText(self.C_LABEL, entry.name)
item.setIcon(self.C_LABEL, icon) item.setIcon(self.C_LABEL, entry.icon)
item.setText(self.C_USAGE, self._usageString(count)) item.setText(self.C_USAGE, self._usageString(entry.count))
item.setData(self.C_DATA, self.D_KEY, key) item.setData(self.C_DATA, self.D_KEY, key)
item.setData(self.C_DATA, self.D_COLOR, colour) item.setData(self.C_DATA, self.D_ENTRY, entry)
item.setData(self.C_DATA, self.D_SHAPE, shape)
item.setData(self.C_DATA, self.D_COUNT, count)
self.listBox.addTopLevelItem(item) self.listBox.addTopLevelItem(item)
return return
def _moveItem(self, step: int) -> None: def _moveItem(self, step: int) -> None:
+1 -1
View File
@@ -3135,7 +3135,7 @@ class GuiDocEditFooter(QWidget):
sText = "" sText = ""
else: else:
iPx = round(0.9*SHARED.theme.baseIconHeight) iPx = round(0.9*SHARED.theme.baseIconHeight)
status, icon = self._tItem.getImportStatus(incIcon=True) status, icon = self._tItem.getImportStatus()
sIcon = icon.pixmap(iPx, iPx) sIcon = icon.pixmap(iPx, iPx)
sText = f"{status} / {self._tItem.describeMe()}" sText = f"{status} / {self._tItem.describeMe()}"
+1 -1
View File
@@ -450,7 +450,7 @@ class _ViewPanelKeyWords(QTreeWidget):
nwItem.itemType, nwItem.itemClass, nwItem.itemType, nwItem.itemClass,
nwItem.itemLayout, nwItem.mainHeading nwItem.itemLayout, nwItem.mainHeading
) )
impLabel, impIcon = nwItem.getImportStatus(incIcon=True) impLabel, impIcon = nwItem.getImportStatus()
iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0) if nwItem.isDocumentLayout() else 5 iLevel = nwHeaders.H_LEVEL.get(hItem.level, 0) if nwItem.isDocumentLayout() else 5
hDec = SHARED.theme.getHeaderDecorationNarrow(iLevel) hDec = SHARED.theme.getHeaderDecorationNarrow(iLevel)
+1 -1
View File
@@ -253,7 +253,7 @@ class GuiItemDetails(QWidget):
# Status # Status
# ====== # ======
status, icon = nwItem.getImportStatus(incIcon=True) status, icon = nwItem.getImportStatus()
self.statusIcon.setPixmap(icon.pixmap(iPx, iPx)) self.statusIcon.setPixmap(icon.pixmap(iPx, iPx))
self.statusData.setText(status) self.statusData.setText(status)
+1 -1
View File
@@ -1048,7 +1048,7 @@ class GuiOutlineDetails(QScrollArea):
self.titleLabel.setText(self.tr(self.LVL_MAP.get(novIdx.level, "H1"))) self.titleLabel.setText(self.tr(self.LVL_MAP.get(novIdx.level, "H1")))
self.titleValue.setText(novIdx.title) self.titleValue.setText(novIdx.title)
itemStatus, _ = nwItem.getImportStatus(incIcon=False) itemStatus, _ = nwItem.getImportStatus()
self.fileValue.setText(nwItem.itemName) self.fileValue.setText(nwItem.itemName)
self.itemValue.setText(itemStatus) self.itemValue.setText(itemStatus)
+1 -1
View File
@@ -1033,7 +1033,7 @@ class GuiProjectTree(QTreeWidget):
if trItem is None or nwItem is None: if trItem is None or nwItem is None:
return return
itemStatus, statusIcon = nwItem.getImportStatus(incIcon=True) itemStatus, statusIcon = nwItem.getImportStatus()
hLevel = nwItem.mainHeading hLevel = nwItem.mainHeading
itemIcon = SHARED.theme.getItemIcon( itemIcon = SHARED.theme.getItemIcon(
nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel