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:
committed by
GitHub
parent
f7c768bb91
commit
a9368904e5
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user