Merge branch 'patch' into update_i18n
This commit is contained in:
+43
-32
@@ -757,32 +757,32 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GuiDocEditFooter</name>
|
<name>GuiDocEditFooter</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2924" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2931" />
|
||||||
<source>Status</source>
|
<source>Status</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="3073" />
|
<location filename="../novelwriter/gui/doceditor.py" line="3080" />
|
||||||
<source>Line: {0} ({1})</source>
|
<source>Line: {0} ({1})</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="3102" />
|
<location filename="../novelwriter/gui/doceditor.py" line="3109" />
|
||||||
<source>Words: {0} ({1})</source>
|
<source>Words: {0} ({1})</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="3107" />
|
<location filename="../novelwriter/gui/doceditor.py" line="3114" />
|
||||||
<source>Document size is {0} bytes</source>
|
<source>Document size is {0} bytes</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="3119" />
|
<location filename="../novelwriter/gui/doceditor.py" line="3126" />
|
||||||
<source>Words: {0} selected</source>
|
<source>Words: {0} selected</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="3122" />
|
<location filename="../novelwriter/gui/doceditor.py" line="3129" />
|
||||||
<source>Character count: {0}</source>
|
<source>Character count: {0}</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
@@ -790,22 +790,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GuiDocEditHeader</name>
|
<name>GuiDocEditHeader</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2694" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2701" />
|
||||||
<source>Edit document label</source>
|
<source>Edit document label</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2703" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2710" />
|
||||||
<source>Search document</source>
|
<source>Search document</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2712" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2719" />
|
||||||
<source>Toggle Focus Mode</source>
|
<source>Toggle Focus Mode</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2721" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2728" />
|
||||||
<source>Close the document</source>
|
<source>Close the document</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
@@ -813,58 +813,58 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GuiDocEditSearch</name>
|
<name>GuiDocEditSearch</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2287" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2294" />
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2274" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2281" />
|
||||||
<source>Search</source>
|
<source>Search</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2279" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2286" />
|
||||||
<source>Replace</source>
|
<source>Replace</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2295" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2302" />
|
||||||
<source>Case Sensitive</source>
|
<source>Case Sensitive</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2301" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2308" />
|
||||||
<source>Whole Words Only</source>
|
<source>Whole Words Only</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2307" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2314" />
|
||||||
<source>RegEx Mode</source>
|
<source>RegEx Mode</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2313" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2320" />
|
||||||
<source>Loop Search</source>
|
<source>Loop Search</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2319" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2326" />
|
||||||
<source>Search Next File</source>
|
<source>Search Next File</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2327" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2334" />
|
||||||
<source>Preserve Case</source>
|
<source>Preserve Case</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2335" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2342" />
|
||||||
<source>Close Search</source>
|
<source>Close Search</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2351" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2358" />
|
||||||
<source>Find in current document</source>
|
<source>Find in current document</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/doceditor.py" line="2356" />
|
<location filename="../novelwriter/gui/doceditor.py" line="2363" />
|
||||||
<source>Find and replace in current document</source>
|
<source>Find and replace in current document</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
@@ -2050,55 +2050,66 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GuiNovelToolBar</name>
|
<name>GuiNovelToolBar</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="207" />
|
<location filename="../novelwriter/gui/noveltree.py" line="216" />
|
||||||
<source>Outline of {0}</source>
|
<source>Outline of {0}</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="215" />
|
<location filename="../novelwriter/gui/noveltree.py" line="224" />
|
||||||
<source>Novel Root</source>
|
<source>Novel Root</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="221" />
|
<location filename="../novelwriter/gui/noveltree.py" line="230" />
|
||||||
<source>Refresh</source>
|
<source>Refresh</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="228" />
|
<location filename="../novelwriter/gui/noveltree.py" line="237" />
|
||||||
<source>Last Column</source>
|
<source>Last Column</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="231" />
|
<location filename="../novelwriter/gui/noveltree.py" line="240" />
|
||||||
<source>Hidden</source>
|
<source>Hidden</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="232" />
|
<location filename="../novelwriter/gui/noveltree.py" line="241" />
|
||||||
<source>Point of View Character</source>
|
<source>Point of View Character</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="233" />
|
<location filename="../novelwriter/gui/noveltree.py" line="242" />
|
||||||
<source>Focus Character</source>
|
<source>Focus Character</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="234" />
|
<location filename="../novelwriter/gui/noveltree.py" line="243" />
|
||||||
<source>Novel Plot</source>
|
<source>Novel Plot</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="237" />
|
<location filename="../novelwriter/gui/noveltree.py" line="361" />
|
||||||
|
<location filename="../novelwriter/gui/noveltree.py" line="246" />
|
||||||
|
<source>Column Size</source>
|
||||||
|
<translation type="unfinished" />
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../novelwriter/gui/noveltree.py" line="250" />
|
||||||
<source>More Options</source>
|
<source>More Options</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../novelwriter/gui/noveltree.py" line="361" />
|
||||||
|
<source>Maximum column size in %</source>
|
||||||
|
<translation type="unfinished" />
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>GuiNovelTree</name>
|
<name>GuiNovelTree</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../novelwriter/gui/noveltree.py" line="778" />
|
<location filename="../novelwriter/gui/noveltree.py" line="815" />
|
||||||
<source>No meta data</source>
|
<source>No meta data</source>
|
||||||
<translation type="unfinished" />
|
<translation type="unfinished" />
|
||||||
</message>
|
</message>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ VALID_MAP = {
|
|||||||
"widthCol3", "widthCol4", "wordsPerPage", "countFrom", "clearDouble",
|
"widthCol3", "widthCol4", "wordsPerPage", "countFrom", "clearDouble",
|
||||||
},
|
},
|
||||||
"GuiWordList": {"winWidth", "winHeight"},
|
"GuiWordList": {"winWidth", "winHeight"},
|
||||||
"GuiNovelView": {"lastCol"},
|
"GuiNovelView": {"lastCol", "lastColSize"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1750,6 +1750,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
|
|
||||||
# Remove existing format first, if any
|
# Remove existing format first, if any
|
||||||
theText = theBlock.text()
|
theText = theBlock.text()
|
||||||
|
hasText = len(theText) > 0
|
||||||
if theText.startswith("@"):
|
if theText.startswith("@"):
|
||||||
logger.error("Cannot apply block format to keyword/value line")
|
logger.error("Cannot apply block format to keyword/value line")
|
||||||
return False
|
return False
|
||||||
@@ -1855,11 +1856,17 @@ class GuiDocEditor(QTextEdit):
|
|||||||
posS = theCursor.selectionStart()
|
posS = theCursor.selectionStart()
|
||||||
theCursor.removeSelectedText()
|
theCursor.removeSelectedText()
|
||||||
theCursor.setPosition(posS)
|
theCursor.setPosition(posS)
|
||||||
if posS > 0:
|
|
||||||
|
if posS > 0 and hasText:
|
||||||
|
# If the block already had text, we must insert a new block
|
||||||
|
# first before we can add back the text to it.
|
||||||
theCursor.insertBlock()
|
theCursor.insertBlock()
|
||||||
|
|
||||||
theCursor.insertText(theText)
|
theCursor.insertText(theText)
|
||||||
|
|
||||||
if posO - cOffset >= 0:
|
if posO - cOffset >= 0:
|
||||||
theCursor.setPosition(posO - cOffset)
|
theCursor.setPosition(posO - cOffset)
|
||||||
|
|
||||||
theCursor.endEditBlock()
|
theCursor.endEditBlock()
|
||||||
self.setTextCursor(theCursor)
|
self.setTextCursor(theCursor)
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,13 @@ from time import time
|
|||||||
from PyQt5.QtGui import QFont, QPalette
|
from PyQt5.QtGui import QFont, QPalette
|
||||||
from PyQt5.QtCore import Qt, QSize, pyqtSlot, pyqtSignal
|
from PyQt5.QtCore import Qt, QSize, pyqtSlot, pyqtSignal
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView, QActionGroup, QFrame, QHBoxLayout, QHeaderView, QMenu,
|
QAbstractItemView, QActionGroup, QFrame, QHBoxLayout, QHeaderView,
|
||||||
QSizePolicy, QToolButton, QToolTip, QTreeWidget, QTreeWidgetItem,
|
QInputDialog, QMenu, QSizePolicy, QToolButton, QToolTip, QTreeWidget,
|
||||||
QVBoxLayout, QWidget
|
QTreeWidgetItem, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter.enum import nwDocMode, nwItemClass, nwOutline
|
from novelwriter.enum import nwDocMode, nwItemClass, nwOutline
|
||||||
|
from novelwriter.common import minmax
|
||||||
from novelwriter.constants import nwHeaders, nwKeyWords, nwLabels, trConst
|
from novelwriter.constants import nwHeaders, nwKeyWords, nwLabels, trConst
|
||||||
from novelwriter.gui.components import NovelSelector
|
from novelwriter.gui.components import NovelSelector
|
||||||
|
|
||||||
@@ -126,20 +127,28 @@ class GuiNovelView(QWidget):
|
|||||||
lastCol = self.theProject.options.getEnum(
|
lastCol = self.theProject.options.getEnum(
|
||||||
"GuiNovelView", "lastCol", NovelTreeColumn, NovelTreeColumn.HIDDEN
|
"GuiNovelView", "lastCol", NovelTreeColumn, NovelTreeColumn.HIDDEN
|
||||||
)
|
)
|
||||||
|
lastColSize = self.theProject.options.getInt(
|
||||||
|
"GuiNovelView", "lastColSize", 25
|
||||||
|
)
|
||||||
|
|
||||||
self.clearProject()
|
self.clearProject()
|
||||||
|
|
||||||
self.novelBar.buildNovelRootMenu()
|
self.novelBar.buildNovelRootMenu()
|
||||||
self.novelBar.setLastColType(lastCol, doRefresh=False)
|
self.novelBar.setLastColType(lastCol, doRefresh=False)
|
||||||
self.novelBar.setCurrentRoot(lastNovel)
|
self.novelBar.setCurrentRoot(lastNovel)
|
||||||
self.novelBar.setEnabled(True)
|
self.novelBar.setEnabled(True)
|
||||||
|
|
||||||
|
self.novelTree.setLastColSize(lastColSize)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def closeProjectTasks(self):
|
def closeProjectTasks(self):
|
||||||
"""Run closing project tasks.
|
"""Run closing project tasks.
|
||||||
"""
|
"""
|
||||||
lastColType = self.novelTree.lastColType
|
lastColType = self.novelTree.lastColType
|
||||||
|
lastColSize = self.novelTree.lastColSize
|
||||||
self.theProject.options.setValue("GuiNovelView", "lastCol", lastColType)
|
self.theProject.options.setValue("GuiNovelView", "lastCol", lastColType)
|
||||||
|
self.theProject.options.setValue("GuiNovelView", "lastColSize", lastColSize)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setTreeFocus(self):
|
def setTreeFocus(self):
|
||||||
@@ -233,6 +242,10 @@ class GuiNovelToolBar(QWidget):
|
|||||||
self._addLastColAction(NovelTreeColumn.FOCUS, self.tr("Focus Character"))
|
self._addLastColAction(NovelTreeColumn.FOCUS, self.tr("Focus Character"))
|
||||||
self._addLastColAction(NovelTreeColumn.PLOT, self.tr("Novel Plot"))
|
self._addLastColAction(NovelTreeColumn.PLOT, self.tr("Novel Plot"))
|
||||||
|
|
||||||
|
self.mLastCol.addSeparator()
|
||||||
|
self.aLastColSize = self.mLastCol.addAction(self.tr("Column Size"))
|
||||||
|
self.aLastColSize.triggered.connect(self._selectLastColumnSize)
|
||||||
|
|
||||||
self.tbMore = QToolButton(self)
|
self.tbMore = QToolButton(self)
|
||||||
self.tbMore.setToolTip(self.tr("More Options"))
|
self.tbMore.setToolTip(self.tr("More Options"))
|
||||||
self.tbMore.setIconSize(QSize(iPx, iPx))
|
self.tbMore.setIconSize(QSize(iPx, iPx))
|
||||||
@@ -339,6 +352,19 @@ class GuiNovelToolBar(QWidget):
|
|||||||
self.novelView.novelTree.refreshTree(rootHandle=rootHandle, overRide=True)
|
self.novelView.novelTree.refreshTree(rootHandle=rootHandle, overRide=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def _selectLastColumnSize(self):
|
||||||
|
"""Set the maximum width for the last column.
|
||||||
|
"""
|
||||||
|
oldSize = self.novelView.novelTree.lastColSize
|
||||||
|
newSize, isOk = QInputDialog.getInt(
|
||||||
|
self, self.tr("Column Size"), self.tr("Maximum column size in %"), oldSize, 15, 75, 5
|
||||||
|
)
|
||||||
|
if isOk:
|
||||||
|
self.novelView.novelTree.setLastColSize(newSize)
|
||||||
|
self._refreshNovelTree()
|
||||||
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Internal Functions
|
# Internal Functions
|
||||||
##
|
##
|
||||||
@@ -379,10 +405,11 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
self.theProject = novelView.mainGui.theProject
|
self.theProject = novelView.mainGui.theProject
|
||||||
|
|
||||||
# Internal Variables
|
# Internal Variables
|
||||||
self._treeMap = {}
|
self._treeMap = {}
|
||||||
self._lastBuild = 0
|
self._lastBuild = 0
|
||||||
self._lastCol = NovelTreeColumn.POV
|
self._lastCol = NovelTreeColumn.POV
|
||||||
self._actHandle = None
|
self._lastColSize = 0.25
|
||||||
|
self._actHandle = None
|
||||||
|
|
||||||
# Cached Strings
|
# Cached Strings
|
||||||
self._povLabel = trConst(nwLabels.KEY_NAME[nwKeyWords.POV_KEY])
|
self._povLabel = trConst(nwLabels.KEY_NAME[nwKeyWords.POV_KEY])
|
||||||
@@ -470,6 +497,10 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
def lastColType(self):
|
def lastColType(self):
|
||||||
return self._lastCol
|
return self._lastCol
|
||||||
|
|
||||||
|
@property
|
||||||
|
def lastColSize(self):
|
||||||
|
return int(self._lastColSize * 100)
|
||||||
|
|
||||||
##
|
##
|
||||||
# Class Methods
|
# Class Methods
|
||||||
##
|
##
|
||||||
@@ -552,6 +583,12 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
self.refreshTree(rootHandle=lastNovel, overRide=True)
|
self.refreshTree(rootHandle=lastNovel, overRide=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def setLastColSize(self, colSize):
|
||||||
|
"""Set the column size in integer values between 15 and 75.
|
||||||
|
"""
|
||||||
|
self._lastColSize = minmax(colSize, 15, 75)/100.0
|
||||||
|
return
|
||||||
|
|
||||||
def setActiveHandle(self, tHandle):
|
def setActiveHandle(self, tHandle):
|
||||||
"""Highlight the rows associated with a given handle.
|
"""Highlight the rows associated with a given handle.
|
||||||
"""
|
"""
|
||||||
@@ -619,7 +656,7 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
newW = event.size().width()
|
newW = event.size().width()
|
||||||
oldW = event.oldSize().width()
|
oldW = event.oldSize().width()
|
||||||
if newW != oldW:
|
if newW != oldW:
|
||||||
eliW = int(0.25 * newW)
|
eliW = int(self._lastColSize * newW)
|
||||||
fMetric = self.fontMetrics()
|
fMetric = self.fontMetrics()
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
trItem = self.topLevelItem(i)
|
trItem = self.topLevelItem(i)
|
||||||
@@ -709,7 +746,7 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
trItem.setData(self.C_MORE, Qt.DecorationRole, self._pMore)
|
trItem.setData(self.C_MORE, Qt.DecorationRole, self._pMore)
|
||||||
|
|
||||||
# Custom column
|
# Custom column
|
||||||
mW = int(0.25 * self.viewport().width())
|
mW = int(self._lastColSize * self.viewport().width())
|
||||||
lastText, toolTip = self._getLastColumnText(tHandle, sTitle)
|
lastText, toolTip = self._getLastColumnText(tHandle, sTitle)
|
||||||
elideText = self.fontMetrics().elidedText(lastText, Qt.ElideRight, mW)
|
elideText = self.fontMetrics().elidedText(lastText, Qt.ElideRight, mW)
|
||||||
trItem.setText(self.C_EXTRA, elideText)
|
trItem.setText(self.C_EXTRA, elideText)
|
||||||
@@ -741,7 +778,7 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
|
|
||||||
if refData:
|
if refData:
|
||||||
toolText = ", ".join(refData)
|
toolText = ", ".join(refData)
|
||||||
return refData[0], f"{refName}: {toolText}"
|
return toolText, f"{refName}: {toolText}"
|
||||||
|
|
||||||
return "", ""
|
return "", ""
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from tools import C, buildTestProject
|
|||||||
|
|
||||||
from PyQt5.QtGui import QFocusEvent
|
from PyQt5.QtGui import QFocusEvent
|
||||||
from PyQt5.QtCore import Qt, QEvent
|
from PyQt5.QtCore import Qt, QEvent
|
||||||
from PyQt5.QtWidgets import QToolTip
|
from PyQt5.QtWidgets import QInputDialog, QToolTip
|
||||||
|
|
||||||
from novelwriter.enum import nwWidget, nwItemType
|
from novelwriter.enum import nwWidget, nwItemType
|
||||||
from novelwriter.gui.noveltree import NovelTreeColumn
|
from novelwriter.gui.noveltree import NovelTreeColumn
|
||||||
@@ -82,6 +82,8 @@ def testGuiNovelTree_TreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
|||||||
# Populate Tree
|
# Populate Tree
|
||||||
# =============
|
# =============
|
||||||
|
|
||||||
|
novelView.setTreeFocus()
|
||||||
|
|
||||||
nwGUI.projStack.setCurrentIndex(nwGUI.idxNovelView)
|
nwGUI.projStack.setCurrentIndex(nwGUI.idxNovelView)
|
||||||
nwGUI.rebuildIndex()
|
nwGUI.rebuildIndex()
|
||||||
novelTree._populateTree(rootHandle=None)
|
novelTree._populateTree(rootHandle=None)
|
||||||
@@ -172,6 +174,11 @@ def testGuiNovelTree_TreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
|||||||
spSize = nwGUI.splitMain.sizes()
|
spSize = nwGUI.splitMain.sizes()
|
||||||
nwGUI.splitMain.setSizes([spSize[0] + 10, spSize[1] - 10])
|
nwGUI.splitMain.setSizes([spSize[0] + 10, spSize[1] - 10])
|
||||||
|
|
||||||
|
# Resize the last column
|
||||||
|
with monkeypatch.context() as mp:
|
||||||
|
mp.setattr(QInputDialog, "getInt", lambda *a, **k: (40, True))
|
||||||
|
novelBar._selectLastColumnSize()
|
||||||
|
|
||||||
# Item Meta
|
# Item Meta
|
||||||
# =========
|
# =========
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user