Make project instance private to main GUI class
This commit is contained in:
@@ -163,10 +163,10 @@ def testGuiEditor_SaveText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumTex
|
||||
assert "Could not save document." in caplog.text
|
||||
|
||||
# Change header level
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc].itemLayout == nwItemLayout.DOCUMENT
|
||||
assert nwGUI.project.tree[C.hSceneDoc].itemLayout == nwItemLayout.DOCUMENT
|
||||
nwGUI.docEditor.replaceText(longText[1:])
|
||||
assert nwGUI.docEditor.saveText() is True
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc].itemLayout == nwItemLayout.DOCUMENT
|
||||
assert nwGUI.project.tree[C.hSceneDoc].itemLayout == nwItemLayout.DOCUMENT
|
||||
|
||||
# Regular save
|
||||
assert nwGUI.docEditor.saveText() is True
|
||||
@@ -203,9 +203,9 @@ def testGuiEditor_MetaData(qtbot, nwGUI, projPath, mockRnd):
|
||||
assert nwGUI.docEditor.setCursorPosition(None) is False
|
||||
assert nwGUI.docEditor.setCursorPosition(10) is True
|
||||
assert nwGUI.docEditor.getCursorPosition() == 10
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc].cursorPos != 10
|
||||
assert nwGUI.project.tree[C.hSceneDoc].cursorPos != 10
|
||||
nwGUI.docEditor.saveCursorPosition()
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc].cursorPos == 10
|
||||
assert nwGUI.project.tree[C.hSceneDoc].cursorPos == 10
|
||||
|
||||
assert nwGUI.docEditor.setCursorLine(None) is False
|
||||
assert nwGUI.docEditor.setCursorLine(3) is True
|
||||
@@ -1067,7 +1067,7 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
|
||||
# Create Character
|
||||
theText = "### Jane Doe\n\n@tag: Jane\n\n" + ipsumText[1] + "\n\n"
|
||||
cHandle = nwGUI.theProject.newFile("Jane Doe", C.hCharRoot)
|
||||
cHandle = nwGUI.project.newFile("Jane Doe", C.hCharRoot)
|
||||
assert nwGUI.openDocument(cHandle) is True
|
||||
assert nwGUI.docEditor.replaceText(theText) is True
|
||||
assert nwGUI.saveDocument() is True
|
||||
@@ -1145,8 +1145,8 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
|
||||
assert nwGUI.docEditor.docFooter.wordsText.text() == "Words: 0 (+0)"
|
||||
|
||||
# Open a document and populate it
|
||||
nwGUI.theProject.tree[C.hSceneDoc]._initCount = 0 # Clear item's count
|
||||
nwGUI.theProject.tree[C.hSceneDoc]._wordCount = 0 # Clear item's count
|
||||
nwGUI.project.tree[C.hSceneDoc]._initCount = 0 # Clear item's count
|
||||
nwGUI.project.tree[C.hSceneDoc]._wordCount = 0 # Clear item's count
|
||||
assert nwGUI.openDocument(C.hSceneDoc) is True
|
||||
|
||||
theText = "\n\n".join(ipsumText)
|
||||
@@ -1170,9 +1170,9 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
|
||||
|
||||
nwGUI.docEditor.wCounterDoc.run()
|
||||
# nwGUI.docEditor._updateDocCounts(cC, wC, pC)
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc]._charCount == cC
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc]._wordCount == wC
|
||||
assert nwGUI.theProject.tree[C.hSceneDoc]._paraCount == pC
|
||||
assert nwGUI.project.tree[C.hSceneDoc]._charCount == cC
|
||||
assert nwGUI.project.tree[C.hSceneDoc]._wordCount == wC
|
||||
assert nwGUI.project.tree[C.hSceneDoc]._paraCount == pC
|
||||
assert nwGUI.docEditor.docFooter.wordsText.text() == f"Words: {wC} (+{wC})"
|
||||
|
||||
# Select all text
|
||||
|
||||
@@ -40,8 +40,8 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
|
||||
# Rebuild the index
|
||||
nwGUI.mainMenu.aRebuildIndex.activate(QAction.Trigger)
|
||||
assert nwGUI.theProject.index._tagsIndex._tags != {}
|
||||
assert nwGUI.theProject.index._itemIndex._items != {}
|
||||
assert nwGUI.project.index._tagsIndex._tags != {}
|
||||
assert nwGUI.project.index._itemIndex._items != {}
|
||||
|
||||
# Select a document in the project tree
|
||||
nwGUI.projView.setSelectedHandle("88243afbe5ed8")
|
||||
@@ -128,7 +128,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
nwGUI.docViewer.reloadText()
|
||||
|
||||
# Change document title
|
||||
nwItem = nwGUI.theProject.tree["4c4f28287af27"]
|
||||
nwItem = nwGUI.project.tree["4c4f28287af27"]
|
||||
nwItem.setName("Test Title")
|
||||
assert nwItem.itemName == "Test Title"
|
||||
nwGUI.docViewer.updateDocInfo("4c4f28287af27")
|
||||
|
||||
@@ -202,14 +202,14 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
assert nwGUI.saveProject()
|
||||
assert nwGUI.closeProject()
|
||||
|
||||
assert len(nwGUI.theProject.tree) == 0
|
||||
assert len(nwGUI.theProject.tree._treeOrder) == 0
|
||||
assert len(nwGUI.theProject.tree._treeRoots) == 0
|
||||
assert nwGUI.theProject.tree.trashRoot() is None
|
||||
assert nwGUI.theProject.data.name == ""
|
||||
assert nwGUI.theProject.data.title == ""
|
||||
assert nwGUI.theProject.data.author == ""
|
||||
assert nwGUI.theProject.data.spellCheck is False
|
||||
assert len(nwGUI.project.tree) == 0
|
||||
assert len(nwGUI.project.tree._treeOrder) == 0
|
||||
assert len(nwGUI.project.tree._treeRoots) == 0
|
||||
assert nwGUI.project.tree.trashRoot() is None
|
||||
assert nwGUI.project.data.name == ""
|
||||
assert nwGUI.project.data.title == ""
|
||||
assert nwGUI.project.data.author == ""
|
||||
assert nwGUI.project.data.spellCheck is False
|
||||
|
||||
# Check the files
|
||||
projFile = projPath / "nwProject.nwx"
|
||||
@@ -222,14 +222,14 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
assert nwGUI.openProject(projPath)
|
||||
|
||||
# Check that we loaded the data
|
||||
assert len(nwGUI.theProject.tree) == 8
|
||||
assert len(nwGUI.theProject.tree._treeOrder) == 8
|
||||
assert len(nwGUI.theProject.tree._treeRoots) == 4
|
||||
assert nwGUI.theProject.tree.trashRoot() is None
|
||||
assert nwGUI.theProject.data.name == "New Project"
|
||||
assert nwGUI.theProject.data.title == "New Novel"
|
||||
assert nwGUI.theProject.data.author == "Jane Doe"
|
||||
assert nwGUI.theProject.data.spellCheck is False
|
||||
assert len(nwGUI.project.tree) == 8
|
||||
assert len(nwGUI.project.tree._treeOrder) == 8
|
||||
assert len(nwGUI.project.tree._treeRoots) == 4
|
||||
assert nwGUI.project.tree.trashRoot() is None
|
||||
assert nwGUI.project.data.name == "New Project"
|
||||
assert nwGUI.project.data.title == "New Novel"
|
||||
assert nwGUI.project.data.author == "Jane Doe"
|
||||
assert nwGUI.project.data.spellCheck is False
|
||||
|
||||
# Check that tree items have been created
|
||||
assert nwGUI.projView.projTree._getTreeItem(C.hNovelRoot) is not None
|
||||
|
||||
@@ -48,7 +48,7 @@ def testGuiNovelTree_TreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
nwGUI.projView.projTree._getTreeItem(C.hCharRoot).setSelected(True)
|
||||
nwGUI.projView.projTree.newTreeItem(nwItemType.FILE)
|
||||
|
||||
contentPath = nwGUI.theProject.storage.contentPath
|
||||
contentPath = nwGUI.project.storage.contentPath
|
||||
assert isinstance(contentPath, Path)
|
||||
|
||||
(contentPath / "0000000000010.nwd").write_text(
|
||||
|
||||
@@ -71,7 +71,7 @@ def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, projPath):
|
||||
|
||||
# Option State
|
||||
# ============
|
||||
pOptions = nwGUI.theProject.options
|
||||
pOptions = nwGUI.project.options
|
||||
colNames = [h.name for h in nwOutline]
|
||||
colItems = [h for h in nwOutline]
|
||||
colWidth = {h: outlineTree.DEF_WIDTH[h] for h in nwOutline}
|
||||
@@ -181,7 +181,7 @@ def testGuiOutline_Content(qtbot, nwGUI, prjLipsum):
|
||||
assert outlineBar.novelValue.itemData(2) == "" # All novels
|
||||
|
||||
# Add a second novel folder
|
||||
newHandle = nwGUI.theProject.newRoot(nwItemClass.NOVEL)
|
||||
newHandle = nwGUI.project.newRoot(nwItemClass.NOVEL)
|
||||
nwGUI.projView.projTree.revealNewTreeItem(newHandle)
|
||||
|
||||
# Check new values in dropdown list
|
||||
@@ -198,7 +198,7 @@ def testGuiOutline_Content(qtbot, nwGUI, prjLipsum):
|
||||
("Section 4", 4),
|
||||
]
|
||||
for dTitle, hLevel in docList:
|
||||
aHandle = nwGUI.theProject.newFile(dTitle, newHandle)
|
||||
aHandle = nwGUI.project.newFile(dTitle, newHandle)
|
||||
hHash = "#"*hLevel
|
||||
writeFile(prjLipsum / "content" / f"{aHandle}.nwd", f"{hHash} {dTitle}\n\n")
|
||||
nwGUI.projView.projTree.revealNewTreeItem(aHandle)
|
||||
|
||||
@@ -46,7 +46,7 @@ def testGuiProjTree_NewItems(qtbot, caplog, monkeypatch, nwGUI, projPath, mockRn
|
||||
|
||||
projView = nwGUI.projView
|
||||
projTree = nwGUI.projView.projTree
|
||||
theProject = nwGUI.theProject
|
||||
theProject = nwGUI.project
|
||||
|
||||
# Try to add item with no project
|
||||
assert projView.projTree.newTreeItem(nwItemType.FILE) is False
|
||||
@@ -260,19 +260,19 @@ def testGuiProjTree_MoveItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
# ===========
|
||||
|
||||
projView.setSelectedHandle(C.hNovelRoot)
|
||||
assert nwGUI.theProject.tree._treeOrder.index(C.hNovelRoot) == 0
|
||||
assert nwGUI.project.tree._treeOrder.index(C.hNovelRoot) == 0
|
||||
|
||||
# Move novel folder up
|
||||
assert projTree.moveTreeItem(-1) is False
|
||||
assert nwGUI.theProject.tree._treeOrder.index(C.hNovelRoot) == 0
|
||||
assert nwGUI.project.tree._treeOrder.index(C.hNovelRoot) == 0
|
||||
|
||||
# Move novel folder down
|
||||
assert projTree.moveTreeItem(1) is True
|
||||
assert nwGUI.theProject.tree._treeOrder.index(C.hNovelRoot) == 1
|
||||
assert nwGUI.project.tree._treeOrder.index(C.hNovelRoot) == 1
|
||||
|
||||
# Move novel folder up again
|
||||
assert projTree.moveTreeItem(-1) is True
|
||||
assert nwGUI.theProject.tree._treeOrder.index(C.hNovelRoot) == 0
|
||||
assert nwGUI.project.tree._treeOrder.index(C.hNovelRoot) == 0
|
||||
|
||||
# Clean up
|
||||
# qtbot.stop()
|
||||
@@ -348,7 +348,7 @@ def testGuiProjTree_RequestDeleteItem(qtbot, caplog, monkeypatch, nwGUI, projPat
|
||||
C.hChapterDir, C.hChapterDoc, C.hSceneDoc,
|
||||
"0000000000010"
|
||||
]
|
||||
trashHandle = nwGUI.theProject.tree.trashRoot()
|
||||
trashHandle = nwGUI.project.tree.trashRoot()
|
||||
assert projTree.getTreeFromHandle(trashHandle) == [
|
||||
trashHandle, "0000000000012", "0000000000011"
|
||||
]
|
||||
@@ -368,7 +368,7 @@ def testGuiProjTree_MoveItemToTrash(qtbot, caplog, monkeypatch, nwGUI, projPath,
|
||||
"""Test moving items to Trash."""
|
||||
monkeypatch.setattr(GuiEditLabel, "getLabel", lambda *a, text: (text, True))
|
||||
|
||||
theProject = nwGUI.theProject
|
||||
theProject = nwGUI.project
|
||||
projTree = nwGUI.projView.projTree
|
||||
|
||||
# Create a project
|
||||
@@ -420,7 +420,7 @@ def testGuiProjTree_PermanentlyDeleteItem(qtbot, caplog, monkeypatch, nwGUI, pro
|
||||
"""Test permanently deleting items."""
|
||||
monkeypatch.setattr(GuiEditLabel, "getLabel", lambda *a, text: (text, True))
|
||||
|
||||
theProject = nwGUI.theProject
|
||||
theProject = nwGUI.project
|
||||
projTree = nwGUI.projView.projTree
|
||||
|
||||
# Create a project
|
||||
@@ -471,7 +471,7 @@ def testGuiProjTree_EmptyTrash(qtbot, caplog, monkeypatch, nwGUI, projPath, mock
|
||||
"""Test emptying Trash."""
|
||||
monkeypatch.setattr(GuiEditLabel, "getLabel", lambda *a, text: (text, True))
|
||||
|
||||
theProject = nwGUI.theProject
|
||||
theProject = nwGUI.project
|
||||
projTree = nwGUI.projView.projTree
|
||||
|
||||
# No project open
|
||||
@@ -541,16 +541,16 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
projTree.setExpandedFromHandle(None, True)
|
||||
|
||||
projTree._addTrashRoot()
|
||||
hTrashRoot = projTree.theProject.tree.trashRoot()
|
||||
hTrashRoot = nwGUI.project.tree.trashRoot()
|
||||
|
||||
projTree.setSelectedHandle(C.hCharRoot)
|
||||
projTree.newTreeItem(nwItemType.FILE)
|
||||
projTree.setSelectedHandle(C.hNovelRoot)
|
||||
projTree.newTreeItem(nwItemType.FILE, isNote=True)
|
||||
|
||||
nwGUI.theProject.newFile("SubNote", hNovelNote)
|
||||
nwGUI.project.newFile("SubNote", hNovelNote)
|
||||
projTree.revealNewTreeItem(hSubNote)
|
||||
assert nwGUI.theProject.tree[hSubNote].itemParent == hNovelNote
|
||||
assert nwGUI.project.tree[hSubNote].itemParent == hNovelNote
|
||||
|
||||
def itemPos(tHandle):
|
||||
return projTree.visualItemRect(projTree._getTreeItem(tHandle)).center()
|
||||
@@ -578,7 +578,7 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
# Direct Edit Functions
|
||||
# =====================
|
||||
# Trigger the dedicated functions the menu entries connect to
|
||||
nwItem = projTree.theProject.tree[hNovelNote]
|
||||
nwItem = nwGUI.project.tree[hNovelNote]
|
||||
|
||||
# Toggle active flag
|
||||
assert nwItem.isActive is True
|
||||
@@ -619,17 +619,17 @@ def testGuiProjTree_ContextMenu(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(QMessageBox, "result", lambda *a: QMessageBox.No)
|
||||
projTree._covertFolderToFile(hNewFolderOne, nwItemLayout.DOCUMENT)
|
||||
assert nwGUI.theProject.tree[hNewFolderOne].isFolderType()
|
||||
assert nwGUI.project.tree[hNewFolderOne].isFolderType()
|
||||
|
||||
# Convert the first folder to a document
|
||||
projTree._covertFolderToFile(hNewFolderOne, nwItemLayout.DOCUMENT)
|
||||
assert nwGUI.theProject.tree[hNewFolderOne].isFileType()
|
||||
assert nwGUI.theProject.tree[hNewFolderOne].isDocumentLayout()
|
||||
assert nwGUI.project.tree[hNewFolderOne].isFileType()
|
||||
assert nwGUI.project.tree[hNewFolderOne].isDocumentLayout()
|
||||
|
||||
# Convert the second folder to a note
|
||||
projTree._covertFolderToFile(hNewFolderTwo, nwItemLayout.NOTE)
|
||||
assert nwGUI.theProject.tree[hNewFolderTwo].isFileType()
|
||||
assert nwGUI.theProject.tree[hNewFolderTwo].isNoteLayout()
|
||||
assert nwGUI.project.tree[hNewFolderTwo].isFileType()
|
||||
assert nwGUI.project.tree[hNewFolderTwo].isNoteLayout()
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
@@ -649,7 +649,7 @@ def testGuiProjTree_MergeDocuments(qtbot, monkeypatch, nwGUI, projPath, mockRnd,
|
||||
# Create a project
|
||||
buildTestProject(nwGUI, projPath)
|
||||
|
||||
theProject = nwGUI.theProject
|
||||
theProject = nwGUI.project
|
||||
projTree = nwGUI.projView.projTree
|
||||
|
||||
mergedDoc1 = "0000000000014"
|
||||
@@ -751,7 +751,7 @@ def testGuiProjTree_SplitDocument(qtbot, monkeypatch, nwGUI, projPath, mockRnd,
|
||||
# Create a project
|
||||
buildTestProject(nwGUI, projPath)
|
||||
|
||||
theProject = nwGUI.theProject
|
||||
theProject = nwGUI.project
|
||||
projTree = nwGUI.projView.projTree
|
||||
|
||||
docText = (
|
||||
@@ -852,7 +852,7 @@ def testGuiProjTree_Duplicate(qtbot, monkeypatch, nwGUI: GuiMain, projPath, mock
|
||||
"""Test the duplicate items function."""
|
||||
# Create a project
|
||||
buildTestProject(nwGUI, projPath)
|
||||
assert len(nwGUI.theProject.tree) == 8
|
||||
assert len(nwGUI.project.tree) == 8
|
||||
|
||||
projTree = nwGUI.projView.projTree
|
||||
projTree._getTreeItem(C.hNovelRoot).setExpanded(True) # type: ignore
|
||||
@@ -860,28 +860,28 @@ def testGuiProjTree_Duplicate(qtbot, monkeypatch, nwGUI: GuiMain, projPath, mock
|
||||
|
||||
# Nothing to do
|
||||
assert projTree._duplicateFromHandle(C.hInvalid) is False
|
||||
assert len(nwGUI.theProject.tree) == 8
|
||||
assert len(nwGUI.project.tree) == 8
|
||||
|
||||
# Duplicate title page, but select no
|
||||
with monkeypatch.context() as mp:
|
||||
mp.setattr(QMessageBox, "result", lambda *a: QMessageBox.No)
|
||||
assert projTree._duplicateFromHandle(C.hTitlePage) is False
|
||||
assert len(nwGUI.theProject.tree) == 8
|
||||
assert len(nwGUI.project.tree) == 8
|
||||
|
||||
# Duplicate title page
|
||||
assert projTree._duplicateFromHandle(C.hTitlePage) is True
|
||||
assert len(nwGUI.theProject.tree) == 9
|
||||
assert len(nwGUI.project.tree) == 9
|
||||
|
||||
# Duplicate folder
|
||||
assert projTree._duplicateFromHandle(C.hChapterDir) is True
|
||||
assert len(nwGUI.theProject.tree) == 12
|
||||
assert len(nwGUI.project.tree) == 12
|
||||
|
||||
# Duplicate novel root
|
||||
assert projTree._duplicateFromHandle(C.hNovelRoot) is True
|
||||
assert len(nwGUI.theProject.tree) == 21
|
||||
assert len(nwGUI.project.tree) == 21
|
||||
|
||||
# Check tree order that all items are next to eachother
|
||||
assert nwGUI.theProject.tree._treeOrder == [
|
||||
assert nwGUI.project.tree._treeOrder == [
|
||||
C.hNovelRoot, C.hTitlePage, "0000000000010", C.hChapterDir, C.hChapterDoc, C.hSceneDoc,
|
||||
"0000000000011", "0000000000012", "0000000000013", "0000000000014", "0000000000015",
|
||||
"0000000000016", "0000000000017", "0000000000018", "0000000000019", "000000000001a",
|
||||
@@ -889,7 +889,7 @@ def testGuiProjTree_Duplicate(qtbot, monkeypatch, nwGUI: GuiMain, projPath, mock
|
||||
]
|
||||
|
||||
# Make the duplicator stop early
|
||||
content = nwGUI.theProject.storage.contentPath
|
||||
content = nwGUI.project.storage.contentPath
|
||||
assert isinstance(content, Path)
|
||||
(content / "000000000001e.nwd").touch()
|
||||
assert (content / "000000000001e.nwd").exists()
|
||||
@@ -897,7 +897,7 @@ def testGuiProjTree_Duplicate(qtbot, monkeypatch, nwGUI: GuiMain, projPath, mock
|
||||
# Should only create the folder, and skip the two files because the
|
||||
# next handle is already a file
|
||||
assert projTree._duplicateFromHandle(C.hChapterDir) is True
|
||||
assert len(nwGUI.theProject.tree) == 22
|
||||
assert len(nwGUI.project.tree) == 22
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
@@ -938,13 +938,13 @@ def testGuiProjTree_Other(qtbot, monkeypatch, nwGUI: GuiMain, projPath, mockRnd)
|
||||
assert projTree.revealNewTreeItem(C.hInvalid) is False
|
||||
|
||||
# Try to add an orphaned file to the tree
|
||||
nHandle = nwGUI.theProject.newFile("Test", C.hNovelRoot)
|
||||
nwGUI.theProject.tree[nHandle].setParent(None) # type: ignore
|
||||
nHandle = nwGUI.project.newFile("Test", C.hNovelRoot)
|
||||
nwGUI.project.tree[nHandle].setParent(None) # type: ignore
|
||||
assert projTree.revealNewTreeItem(nHandle) is False
|
||||
|
||||
# Try to add an item with unknown parent to the tree
|
||||
nHandle = nwGUI.theProject.newFile("Test", C.hNovelRoot)
|
||||
nwGUI.theProject.tree[nHandle].setParent(C.hInvalid) # type: ignore
|
||||
nHandle = nwGUI.project.newFile("Test", C.hNovelRoot)
|
||||
nwGUI.project.tree[nHandle].setParent(C.hInvalid) # type: ignore
|
||||
assert projTree.revealNewTreeItem(nHandle) is False
|
||||
|
||||
# Method: undoLastMove
|
||||
|
||||
@@ -33,8 +33,8 @@ def testGuiStatusBar_Main(qtbot, nwGUI, projPath, mockRnd):
|
||||
"""Test the the various features of the status bar.
|
||||
"""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
cHandle = nwGUI.theProject.newFile("A Note", C.hCharRoot)
|
||||
newDoc = nwGUI.theProject.storage.getDocument(cHandle)
|
||||
cHandle = nwGUI.project.newFile("A Note", C.hCharRoot)
|
||||
newDoc = nwGUI.project.storage.getDocument(cHandle)
|
||||
newDoc.writeDocument("# A Note\n\n")
|
||||
nwGUI.projView.projTree.revealNewTreeItem(cHandle)
|
||||
nwGUI.rebuildIndex(beQuiet=True)
|
||||
|
||||
Reference in New Issue
Block a user