Move some variables around
This commit is contained in:
@@ -64,6 +64,11 @@ T_NodeData = str | QIcon | Qt.AlignmentFlag | None
|
|||||||
|
|
||||||
class ProjectNode:
|
class ProjectNode:
|
||||||
|
|
||||||
|
C_NAME = 0
|
||||||
|
C_COUNT = 1
|
||||||
|
C_ACTIVE = 2
|
||||||
|
C_STATUS = 3
|
||||||
|
|
||||||
__slots__ = ("_item", "_children", "_parent", "_row", "_cache", "_flags", "_count")
|
__slots__ = ("_item", "_children", "_parent", "_row", "_cache", "_flags", "_count")
|
||||||
|
|
||||||
def __init__(self, item: NWItem) -> None:
|
def __init__(self, item: NWItem) -> None:
|
||||||
@@ -126,10 +131,10 @@ class ProjectNode:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def updateCount(self) -> None:
|
def updateCount(self, propagate: bool = True) -> None:
|
||||||
self._count = self._item.wordCount + sum(c._count for c in self._children)
|
self._count = self._item.wordCount + sum(c._count for c in self._children)
|
||||||
self._cache[C_COUNT_TEXT] = f"{self._count:n}"
|
self._cache[C_COUNT_TEXT] = f"{self._count:n}"
|
||||||
if parent := self._parent:
|
if propagate and (parent := self._parent):
|
||||||
parent.updateCount()
|
parent.updateCount()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ from enum import Enum
|
|||||||
|
|
||||||
from PyQt5.QtCore import QModelIndex, Qt, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import QModelIndex, Qt, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView, QFrame, QHeaderView, QMenu, QTabWidget, QToolButton,
|
QAbstractItemView, QFrame, QMenu, QTabWidget, QToolButton, QTreeWidget,
|
||||||
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
QTreeWidgetItem, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
@@ -40,7 +40,7 @@ from novelwriter.core.index import IndexHeading, IndexItem
|
|||||||
from novelwriter.enum import nwDocMode, nwItemClass
|
from novelwriter.enum import nwDocMode, nwItemClass
|
||||||
from novelwriter.extensions.modified import NIconToolButton
|
from novelwriter.extensions.modified import NIconToolButton
|
||||||
from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON
|
from novelwriter.gui.theme import STYLES_FLAT_TABS, STYLES_MIN_TOOLBUTTON
|
||||||
from novelwriter.types import QtDecoration, QtUserRole
|
from novelwriter.types import QtDecoration, QtHeaderFixed, QtHeaderToContents, QtUserRole
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -259,10 +259,10 @@ class _ViewPanelBackRefs(QTreeWidget):
|
|||||||
treeHeader = self.header()
|
treeHeader = self.header()
|
||||||
treeHeader.setStretchLastSection(True)
|
treeHeader.setStretchLastSection(True)
|
||||||
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1627
|
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1627
|
||||||
treeHeader.setSectionResizeMode(self.C_DOC, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(self.C_DOC, QtHeaderToContents)
|
||||||
treeHeader.setSectionResizeMode(self.C_EDIT, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(self.C_EDIT, QtHeaderFixed)
|
||||||
treeHeader.setSectionResizeMode(self.C_VIEW, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(self.C_VIEW, QtHeaderFixed)
|
||||||
treeHeader.setSectionResizeMode(self.C_TITLE, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(self.C_TITLE, QtHeaderToContents)
|
||||||
treeHeader.resizeSection(self.C_EDIT, iPx + cMg)
|
treeHeader.resizeSection(self.C_EDIT, iPx + cMg)
|
||||||
treeHeader.resizeSection(self.C_VIEW, iPx + cMg)
|
treeHeader.resizeSection(self.C_VIEW, iPx + cMg)
|
||||||
treeHeader.setSectionsMovable(False)
|
treeHeader.setSectionsMovable(False)
|
||||||
@@ -407,8 +407,8 @@ class _ViewPanelKeyWords(QTreeWidget):
|
|||||||
treeHeader = self.header()
|
treeHeader = self.header()
|
||||||
treeHeader.setStretchLastSection(True)
|
treeHeader.setStretchLastSection(True)
|
||||||
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1627
|
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1627
|
||||||
treeHeader.setSectionResizeMode(self.C_EDIT, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(self.C_EDIT, QtHeaderFixed)
|
||||||
treeHeader.setSectionResizeMode(self.C_VIEW, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(self.C_VIEW, QtHeaderFixed)
|
||||||
treeHeader.resizeSection(self.C_EDIT, iPx + cMg)
|
treeHeader.resizeSection(self.C_EDIT, iPx + cMg)
|
||||||
treeHeader.resizeSection(self.C_VIEW, iPx + cMg)
|
treeHeader.resizeSection(self.C_VIEW, iPx + cMg)
|
||||||
treeHeader.setSectionsMovable(False)
|
treeHeader.setSectionsMovable(False)
|
||||||
|
|||||||
@@ -33,9 +33,8 @@ from time import time
|
|||||||
from PyQt5.QtCore import QModelIndex, QPoint, Qt, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import QModelIndex, QPoint, Qt, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtGui import QFocusEvent, QFont, QMouseEvent, QPalette, QResizeEvent
|
from PyQt5.QtGui import QFocusEvent, QFont, QMouseEvent, QPalette, QResizeEvent
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView, QActionGroup, QFrame, QHBoxLayout, QHeaderView,
|
QAbstractItemView, QActionGroup, QFrame, QHBoxLayout, QInputDialog, QMenu,
|
||||||
QInputDialog, QMenu, QToolTip, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
|
QToolTip, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
||||||
QWidget
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
@@ -47,8 +46,9 @@ from novelwriter.extensions.modified import NIconToolButton
|
|||||||
from novelwriter.extensions.novelselector import NovelSelector
|
from novelwriter.extensions.novelselector import NovelSelector
|
||||||
from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
|
from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
QtAlignRight, QtDecoration, QtMouseLeft, QtMouseMiddle, QtScrollAlwaysOff,
|
QtAlignRight, QtDecoration, QtHeaderStretch, QtHeaderToContents,
|
||||||
QtScrollAsNeeded, QtSizeExpanding, QtUserRole
|
QtMouseLeft, QtMouseMiddle, QtScrollAlwaysOff, QtScrollAsNeeded,
|
||||||
|
QtSizeExpanding, QtUserRole
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -406,10 +406,10 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
treeHeader = self.header()
|
treeHeader = self.header()
|
||||||
treeHeader.setStretchLastSection(False)
|
treeHeader.setStretchLastSection(False)
|
||||||
treeHeader.setMinimumSectionSize(iPx + cMg)
|
treeHeader.setMinimumSectionSize(iPx + cMg)
|
||||||
treeHeader.setSectionResizeMode(self.C_TITLE, QHeaderView.ResizeMode.Stretch)
|
treeHeader.setSectionResizeMode(self.C_TITLE, QtHeaderStretch)
|
||||||
treeHeader.setSectionResizeMode(self.C_WORDS, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(self.C_WORDS, QtHeaderToContents)
|
||||||
treeHeader.setSectionResizeMode(self.C_EXTRA, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(self.C_EXTRA, QtHeaderToContents)
|
||||||
treeHeader.setSectionResizeMode(self.C_MORE, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(self.C_MORE, QtHeaderToContents)
|
||||||
|
|
||||||
# Pre-Generate Tree Formatting
|
# Pre-Generate Tree Formatting
|
||||||
fH1 = self.font()
|
fH1 = self.font()
|
||||||
|
|||||||
+12
-58
@@ -34,8 +34,8 @@ from enum import Enum
|
|||||||
from PyQt5.QtCore import QModelIndex, QPoint, Qt, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import QModelIndex, QPoint, Qt, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtGui import QIcon, QMouseEvent, QPalette
|
from PyQt5.QtGui import QIcon, QMouseEvent, QPalette
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView, QAction, QFrame, QHBoxLayout, QHeaderView, QLabel,
|
QAbstractItemView, QAction, QFrame, QHBoxLayout, QLabel, QMenu, QShortcut,
|
||||||
QMenu, QShortcut, QTreeView, QVBoxLayout, QWidget
|
QTreeView, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
@@ -48,8 +48,8 @@ from novelwriter.enum import nwDocMode, nwItemClass, nwItemType
|
|||||||
from novelwriter.extensions.modified import NIconToolButton
|
from novelwriter.extensions.modified import NIconToolButton
|
||||||
from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
|
from novelwriter.gui.theme import STYLES_MIN_TOOLBUTTON
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
QtMouseLeft, QtMouseMiddle, QtScrollAlwaysOff, QtScrollAsNeeded,
|
QtHeaderFixed, QtHeaderStretch, QtHeaderToContents, QtMouseLeft,
|
||||||
QtSizeExpanding
|
QtMouseMiddle, QtScrollAlwaysOff, QtScrollAsNeeded, QtSizeExpanding
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -226,8 +226,8 @@ class GuiProjectView(QWidget):
|
|||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def updateItemValues(self, tHandle: str) -> None:
|
def updateItemValues(self, tHandle: str) -> None:
|
||||||
"""Update tree item."""
|
"""Update tree item."""
|
||||||
if nwItem := SHARED.project.tree[tHandle]:
|
# if nwItem := SHARED.project.tree[tHandle]:
|
||||||
self.projTree.setTreeItemValues(nwItem)
|
# self.projTree.setTreeItemValues(nwItem)
|
||||||
return
|
return
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
@@ -496,15 +496,6 @@ class GuiProjectToolBar(QWidget):
|
|||||||
|
|
||||||
class GuiProjectTree(QTreeView):
|
class GuiProjectTree(QTreeView):
|
||||||
|
|
||||||
# C_DATA = 0
|
|
||||||
C_NAME = 0
|
|
||||||
C_COUNT = 1
|
|
||||||
C_ACTIVE = 2
|
|
||||||
C_STATUS = 3
|
|
||||||
|
|
||||||
# D_HANDLE = QtUserRole
|
|
||||||
# D_WORDS = QtUserRole + 1
|
|
||||||
|
|
||||||
itemRefreshed = pyqtSignal(str, NWItem, QIcon)
|
itemRefreshed = pyqtSignal(str, NWItem, QIcon)
|
||||||
|
|
||||||
def __init__(self, projView: GuiProjectView) -> None:
|
def __init__(self, projView: GuiProjectView) -> None:
|
||||||
@@ -612,12 +603,12 @@ class GuiProjectTree(QTreeView):
|
|||||||
treeHeader = self.header()
|
treeHeader = self.header()
|
||||||
treeHeader.setStretchLastSection(False)
|
treeHeader.setStretchLastSection(False)
|
||||||
treeHeader.setMinimumSectionSize(iPx + cMg)
|
treeHeader.setMinimumSectionSize(iPx + cMg)
|
||||||
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.ResizeMode.Stretch)
|
treeHeader.setSectionResizeMode(ProjectNode.C_NAME, QtHeaderStretch)
|
||||||
treeHeader.setSectionResizeMode(self.C_COUNT, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(ProjectNode.C_COUNT, QtHeaderToContents)
|
||||||
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(ProjectNode.C_ACTIVE, QtHeaderFixed)
|
||||||
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(ProjectNode.C_STATUS, QtHeaderFixed)
|
||||||
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
|
treeHeader.resizeSection(ProjectNode.C_ACTIVE, iPx + cMg)
|
||||||
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
|
treeHeader.resizeSection(ProjectNode.C_STATUS, iPx + cMg)
|
||||||
|
|
||||||
self.restoreExpandedState()
|
self.restoreExpandedState()
|
||||||
|
|
||||||
@@ -955,43 +946,6 @@ class GuiProjectTree(QTreeView):
|
|||||||
# self.setTreeItemValues(nwItem)
|
# self.setTreeItemValues(nwItem)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setTreeItemValues(self, nwItem: NWItem | None) -> None:
|
|
||||||
"""Set the name and flag values for a tree item in the project
|
|
||||||
tree. Does not trigger a tree change as the data is already
|
|
||||||
coming from project data.
|
|
||||||
"""
|
|
||||||
# if isinstance(nwItem, NWItem) and (trItem := self._getTreeItem(nwItem.itemHandle)):
|
|
||||||
# itemStatus, statusIcon = nwItem.getImportStatus()
|
|
||||||
# hLevel = nwItem.mainHeading
|
|
||||||
# itemIcon = SHARED.theme.getItemIcon(
|
|
||||||
# nwItem.itemType, nwItem.itemClass, nwItem.itemLayout, hLevel
|
|
||||||
# )
|
|
||||||
|
|
||||||
# trItem.setIcon(self.C_NAME, itemIcon)
|
|
||||||
# trItem.setText(self.C_NAME, nwItem.itemName)
|
|
||||||
# trItem.setIcon(self.C_STATUS, statusIcon)
|
|
||||||
# trItem.setToolTip(self.C_STATUS, itemStatus)
|
|
||||||
|
|
||||||
# if nwItem.isFileType():
|
|
||||||
# iconName = "checked" if nwItem.isActive else "unchecked"
|
|
||||||
# toolTip = self.trActive if nwItem.isActive else self.trInactive
|
|
||||||
# trItem.setToolTip(self.C_ACTIVE, toolTip)
|
|
||||||
# else:
|
|
||||||
# iconName = "noncheckable"
|
|
||||||
|
|
||||||
# trItem.setIcon(self.C_ACTIVE, SHARED.theme.getIcon(iconName))
|
|
||||||
|
|
||||||
# if CONFIG.emphLabels and nwItem.isDocumentLayout():
|
|
||||||
# trFont = trItem.font(self.C_NAME)
|
|
||||||
# trFont.setBold(hLevel == "H1" or hLevel == "H2")
|
|
||||||
# trFont.setUnderline(hLevel == "H1")
|
|
||||||
# trItem.setFont(self.C_NAME, trFont)
|
|
||||||
|
|
||||||
# # Emit Refresh Signal
|
|
||||||
# self.itemRefreshed.emit(nwItem.itemHandle, nwItem, itemIcon)
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def propagateCount(self, tHandle: str, newCount: int, countChildren: bool = False) -> None:
|
def propagateCount(self, tHandle: str, newCount: int, countChildren: bool = False) -> None:
|
||||||
"""Recursive function setting the word count for a given item,
|
"""Recursive function setting the word count for a given item,
|
||||||
and propagating that count upwards in the tree until reaching a
|
and propagating that count upwards in the tree until reaching a
|
||||||
|
|||||||
@@ -30,15 +30,18 @@ from time import time
|
|||||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtGui import QCursor, QKeyEvent
|
from PyQt5.QtGui import QCursor, QKeyEvent
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication, QFrame, QHBoxLayout, QHeaderView, QLabel, QLineEdit,
|
QApplication, QFrame, QHBoxLayout, QLabel, QLineEdit, QToolBar,
|
||||||
QToolBar, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.common import checkInt, cssCol
|
from novelwriter.common import checkInt, cssCol
|
||||||
from novelwriter.core.coretools import DocSearch
|
from novelwriter.core.coretools import DocSearch
|
||||||
from novelwriter.core.item import NWItem
|
from novelwriter.core.item import NWItem
|
||||||
from novelwriter.types import QtAlignMiddle, QtAlignRight, QtUserRole
|
from novelwriter.types import (
|
||||||
|
QtAlignMiddle, QtAlignRight, QtHeaderStretch, QtHeaderToContents,
|
||||||
|
QtUserRole
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -120,8 +123,8 @@ class GuiProjectSearch(QWidget):
|
|||||||
|
|
||||||
treeHeader = self.searchResult.header()
|
treeHeader = self.searchResult.header()
|
||||||
treeHeader.setStretchLastSection(False)
|
treeHeader.setStretchLastSection(False)
|
||||||
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.ResizeMode.Stretch)
|
treeHeader.setSectionResizeMode(self.C_NAME, QtHeaderStretch)
|
||||||
treeHeader.setSectionResizeMode(self.C_COUNT, QHeaderView.ResizeMode.ResizeToContents)
|
treeHeader.setSectionResizeMode(self.C_COUNT, QtHeaderToContents)
|
||||||
|
|
||||||
# Assemble
|
# Assemble
|
||||||
self.headerBox = QHBoxLayout()
|
self.headerBox = QHBoxLayout()
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ from PyQt5.QtCore import QEvent, pyqtSignal, pyqtSlot
|
|||||||
from PyQt5.QtGui import QFont, QIcon, QSyntaxHighlighter, QTextCharFormat, QTextDocument
|
from PyQt5.QtGui import QFont, QIcon, QSyntaxHighlighter, QTextCharFormat, QTextDocument
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractButton, QAbstractItemView, QDialogButtonBox, QFrame, QGridLayout,
|
QAbstractButton, QAbstractItemView, QDialogButtonBox, QFrame, QGridLayout,
|
||||||
QHBoxLayout, QHeaderView, QLabel, QLineEdit, QMenu, QPlainTextEdit,
|
QHBoxLayout, QLabel, QLineEdit, QMenu, QPlainTextEdit, QPushButton,
|
||||||
QPushButton, QSplitter, QStackedWidget, QTreeWidget, QTreeWidgetItem,
|
QSplitter, QStackedWidget, QTreeWidget, QTreeWidgetItem, QVBoxLayout,
|
||||||
QVBoxLayout, QWidget
|
QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
@@ -51,7 +51,8 @@ from novelwriter.extensions.switch import NSwitch
|
|||||||
from novelwriter.extensions.switchbox import NSwitchBox
|
from novelwriter.extensions.switchbox import NSwitchBox
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
QtAlignCenter, QtAlignLeft, QtDialogApply, QtDialogClose, QtDialogSave,
|
QtAlignCenter, QtAlignLeft, QtDialogApply, QtDialogClose, QtDialogSave,
|
||||||
QtRoleAccept, QtRoleApply, QtRoleReject, QtUserRole
|
QtHeaderFixed, QtHeaderStretch, QtRoleAccept, QtRoleApply, QtRoleReject,
|
||||||
|
QtUserRole
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
@@ -313,9 +314,9 @@ class _FilterTab(NFixedPage):
|
|||||||
treeHeader = self.optTree.header()
|
treeHeader = self.optTree.header()
|
||||||
treeHeader.setStretchLastSection(False)
|
treeHeader.setStretchLastSection(False)
|
||||||
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1551
|
treeHeader.setMinimumSectionSize(iPx + cMg) # See Issue #1551
|
||||||
treeHeader.setSectionResizeMode(self.C_NAME, QHeaderView.ResizeMode.Stretch)
|
treeHeader.setSectionResizeMode(self.C_NAME, QtHeaderStretch)
|
||||||
treeHeader.setSectionResizeMode(self.C_ACTIVE, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(self.C_ACTIVE, QtHeaderFixed)
|
||||||
treeHeader.setSectionResizeMode(self.C_STATUS, QHeaderView.ResizeMode.Fixed)
|
treeHeader.setSectionResizeMode(self.C_STATUS, QtHeaderFixed)
|
||||||
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
|
treeHeader.resizeSection(self.C_ACTIVE, iPx + cMg)
|
||||||
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
|
treeHeader.resizeSection(self.C_STATUS, iPx + cMg)
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ from PyQt5.QtGui import (
|
|||||||
QColor, QFont, QPainter, QTextBlockFormat, QTextCharFormat, QTextCursor,
|
QColor, QFont, QPainter, QTextBlockFormat, QTextCharFormat, QTextCursor,
|
||||||
QTextFormat
|
QTextFormat
|
||||||
)
|
)
|
||||||
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QSizePolicy, QStyle
|
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QHeaderView, QSizePolicy, QStyle
|
||||||
|
|
||||||
# Qt Alignment Flags
|
# Qt Alignment Flags
|
||||||
|
|
||||||
@@ -119,6 +119,12 @@ QtSizeIgnored = QSizePolicy.Policy.Ignored
|
|||||||
QtSizeMinimum = QSizePolicy.Policy.Minimum
|
QtSizeMinimum = QSizePolicy.Policy.Minimum
|
||||||
QtSizeMinimumExpanding = QSizePolicy.Policy.MinimumExpanding
|
QtSizeMinimumExpanding = QSizePolicy.Policy.MinimumExpanding
|
||||||
|
|
||||||
|
# Resize Mode
|
||||||
|
|
||||||
|
QtHeaderStretch = QHeaderView.ResizeMode.Stretch
|
||||||
|
QtHeaderToContents = QHeaderView.ResizeMode.ResizeToContents
|
||||||
|
QtHeaderFixed = QHeaderView.ResizeMode.Fixed
|
||||||
|
|
||||||
# Scroll Bar Policy
|
# Scroll Bar Policy
|
||||||
|
|
||||||
QtScrollAlwaysOff = Qt.ScrollBarPolicy.ScrollBarAlwaysOff
|
QtScrollAlwaysOff = Qt.ScrollBarPolicy.ScrollBarAlwaysOff
|
||||||
|
|||||||
Reference in New Issue
Block a user