GUI and code tweaks and fixes (#852)

* Improve format menu header descriptions
* Ensure that item status is parsed after item class from XML
* Fix column alignment in ToC.txt file
* Rename test variable and fix outdated docstring
* Fix ToC.txt underline
* Rename the Layout label on the item details panel
* Add option to emphasise H1 and H2 labels in the project tree
* Rename the main column of the novel tree to match project tree
* Use the same document icons in the outline as the project tree
* Move project tree settings to Project section of config file
This commit is contained in:
Veronica Berglyd Olsen
2021-08-17 21:45:18 +02:00
committed by GitHub
parent f7c768bb91
commit a9368904e5
16 changed files with 120 additions and 81 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
[Main]
timestamp = 2021-02-15 16:31:24
timestamp = 2021-08-17 20:59:39
theme = default
syntax = default_light
icons = typicons_colour_light
@@ -10,7 +10,6 @@ lastnotes = 0x0
guilang = en_GB
hidevscroll = False
hidehscroll = False
fullstatus = True
[Sizes]
geometry = 1200, 650
@@ -27,6 +26,8 @@ fullscreen = False
[Project]
autosaveproject = 60
autosavedoc = 30
fullstatus = True
emphlabels = True
[Editor]
textfont = None
@@ -1,5 +1,5 @@
[Main]
timestamp = 2021-02-09 21:07:17
timestamp = 2021-08-17 20:59:42
theme = default
syntax = default_light
icons = typicons_colour_light
@@ -10,7 +10,6 @@ lastnotes = 0x0
guilang = en_GB
hidevscroll = True
hidehscroll = True
fullstatus = True
[Sizes]
geometry = 1200, 650
@@ -27,6 +26,8 @@ fullscreen = False
[Project]
autosaveproject = 40
autosavedoc = 20
fullstatus = True
emphlabels = True
[Editor]
textfont = None
+10 -10
View File
@@ -47,10 +47,10 @@ def testCoreOptions_LoadSave(monkeypatch, mockGUI, tmpDir):
"addNovel": True,
"addNotes": False,
"textFont": "Cantarell",
"dummyItem": None,
"mockItem": None,
},
"DummyGroup": {
"dummyItem": None,
"MockGroup": {
"mockItem": None,
},
}))
@@ -109,8 +109,8 @@ def testCoreOptions_SetGet(mockGUI):
theOpts = OptionState(theProject)
# Set invalid values
assert not theOpts.setValue("DummyGroup", "dummyItem", None)
assert not theOpts.setValue("GuiBuildNovel", "dummyItem", None)
assert not theOpts.setValue("MockGroup", "mockItem", None)
assert not theOpts.setValue("GuiBuildNovel", "mockItem", None)
# Set valid value
assert theOpts.setValue("GuiBuildNovel", "winWidth", 100)
@@ -126,19 +126,19 @@ def testCoreOptions_SetGet(mockGUI):
assert theOpts.getValue("GuiBuildNovel", "winHeight", None) == 12.34
assert theOpts.getValue("GuiBuildNovel", "addNovel", None) is True
assert theOpts.getValue("GuiBuildNovel", "textFont", None) == "Cantarell"
assert theOpts.getValue("GuiBuildNovel", "dummyItem", None) is None
assert theOpts.getValue("GuiBuildNovel", "mockItem", None) is None
# Get type-specific
assert theOpts.getString("GuiBuildNovel", "winWidth", None) == "100"
assert theOpts.getString("GuiBuildNovel", "dummyItem", None) is None
assert theOpts.getString("GuiBuildNovel", "mockItem", None) is None
assert theOpts.getInt("GuiBuildNovel", "winWidth", None) == 100
assert theOpts.getInt("GuiBuildNovel", "textFont", None) is None
assert theOpts.getInt("GuiBuildNovel", "dummyItem", None) is None
assert theOpts.getInt("GuiBuildNovel", "mockItem", None) is None
assert theOpts.getFloat("GuiBuildNovel", "winWidth", None) == 100.0
assert theOpts.getFloat("GuiBuildNovel", "textFont", None) is None
assert theOpts.getFloat("GuiBuildNovel", "dummyItem", None) is None
assert theOpts.getFloat("GuiBuildNovel", "mockItem", None) is None
assert theOpts.getBool("GuiBuildNovel", "addNovel", None) is True
assert theOpts.getBool("GuiBuildNovel", "dummyItem", None) is None
assert theOpts.getBool("GuiBuildNovel", "mockItem", None) is None
# Check integer validators
assert theOpts.validIntRange(5, 0, 9, 3) == 5
+7 -7
View File
@@ -434,7 +434,7 @@ def testCoreTree_ToCFile(monkeypatch, mockGUI, mockItems, tmpDir):
assert len(theTree) == len(mockItems)
theTree._treeOrder.append("stuff")
def dummyIsFile(fileName):
def mockIsFile(fileName):
"""Return True for items that are files in novelWriter and
should thus also be files in the project folder structure.
"""
@@ -442,7 +442,7 @@ def testCoreTree_ToCFile(monkeypatch, mockGUI, mockItems, tmpDir):
assert dItem is not None
return dItem.itemType == nwItemType.FILE
monkeypatch.setattr("os.path.isfile", dummyIsFile)
monkeypatch.setattr("os.path.isfile", mockIsFile)
theProject.projContent = "content"
theProject.projPath = None
@@ -460,11 +460,11 @@ def testCoreTree_ToCFile(monkeypatch, mockGUI, mockItems, tmpDir):
"Table of Contents\n"
"=================\n"
"\n"
"File Name Class Layout Document Label\n"
"-------------------------------------------------------------\n"
f"{pathA} NOVEL DOCUMENT Chapter One\n"
f"{pathB} NOVEL DOCUMENT Scene One\n"
f"{pathC} CHARACTER NOTE Jane Doe\n"
"File Name Class Layout Document Label\n"
"--------------------------------------------------------------\n"
f"{pathA} NOVEL DOCUMENT Chapter One\n"
f"{pathB} NOVEL DOCUMENT Scene One\n"
f"{pathC} CHARACTER NOTE Jane Doe\n"
)
# END Test testCoreTree_ToCFile
+1 -1
View File
@@ -249,7 +249,7 @@ def testDlgPreferences_Main(qtbot, monkeypatch, fncDir, outDir, refDir):
testFile = os.path.join(outDir, "guiPreferences_novelwriter.conf")
compFile = os.path.join(refDir, "guiPreferences_novelwriter.conf")
copyfile(projFile, testFile)
ignoreLines = [2, 7, 9, 10, 16, 17, 18, 19, 20, 21, 22, 23, 24, 32, 33]
ignoreLines = [2, 7, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 23, 33, 34]
assert cmpFiles(testFile, compFile, ignoreLines)
# Clean up