From af0d578555298258942f2e1c9e5c17f36320fea0 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Tue, 1 Sep 2020 23:33:13 +0200 Subject: [PATCH] Also have the merge tool preserve item status of the source item --- nw/gui/docmerge.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nw/gui/docmerge.py b/nw/gui/docmerge.py index 547cbd44..06eb226a 100644 --- a/nw/gui/docmerge.py +++ b/nw/gui/docmerge.py @@ -109,15 +109,24 @@ class GuiDocMerge(QDialog): if self.sourceItem is None: self.theParent.makeAlert(( - "Cannot parse source item." + "No source document selected. Nothing to do." ), nwAlert.ERROR) return srcItem = self.theProject.projTree[self.sourceItem] + if srcItem is None: + self.theParent.makeAlert(( + "Could not parse source document." + ), nwAlert.ERROR) + return + nHandle = self.theProject.newFile(srcItem.itemName, srcItem.itemClass, srcItem.parHandle) - self.theParent.treeView.revealTreeItem(nHandle) + newItem = self.theProject.projTree[nHandle] + newItem.setStatus(srcItem.itemStatus) + theDoc.openDocument(nHandle, False) theDoc.saveDocument(theText) + self.theParent.treeView.revealTreeItem(nHandle) self.theParent.openDocument(nHandle, doScroll=True) self.close()