Re-enable item rename

This commit is contained in:
Veronica Berglyd Olsen
2024-11-18 00:01:40 +01:00
parent 4f8e898440
commit 337f05f60e
6 changed files with 53 additions and 45 deletions
+16 -1
View File
@@ -55,7 +55,7 @@ class NWItem:
"_project", "_name", "_handle", "_parent", "_root", "_order",
"_type", "_class", "_layout", "_status", "_import", "_active",
"_expanded", "_heading", "_charCount", "_wordCount",
"_paraCount", "_cursorPos", "_initCount",
"_paraCount", "_cursorPos", "_initCount", "_blocked",
)
def __init__(self, project: NWProject, handle: str) -> None:
@@ -82,6 +82,8 @@ class NWItem:
self._cursorPos = 0 # Last cursor position
self._initCount = 0 # Initial word count
self._blocked = True
return
def __repr__(self) -> str:
@@ -257,6 +259,7 @@ class NWItem:
self._cursorPos = 0
self._initCount = self._wordCount
self._blocked = False
return True
@@ -281,6 +284,7 @@ class NWItem:
cls._paraCount = source._paraCount
cls._cursorPos = source._cursorPos
cls._initCount = source._initCount
cls._blocked = source._blocked
return cls
##
@@ -415,6 +419,7 @@ class NWItem:
self._name = simplified(name)
else:
self._name = ""
self._notifyChange()
return
def setParent(self, handle: Any) -> None:
@@ -560,3 +565,13 @@ class NWItem:
"""Save the initial word count."""
self._initCount = self._wordCount
return
##
# Internal Functions
##
def _notifyChange(self) -> None:
"""Notify project tree on user changes to the item."""
if not self._blocked:
self._project.tree.refreshNode(self._handle)
return