Items can now be renamed.
This commit is contained in:
+13
-1
@@ -16,7 +16,7 @@ import nw
|
||||
from os import path
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QAbstractItemView
|
||||
from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QAbstractItemView, QInputDialog, QLineEdit
|
||||
|
||||
from nw.enum import nwItemType, nwItemClass
|
||||
from nw.project.item import NWItem
|
||||
@@ -87,6 +87,18 @@ class GuiDocTree(QTreeWidget):
|
||||
pItem.insertChild(nIndex, cItem)
|
||||
return
|
||||
|
||||
def renameTreeItem(self, tHandle):
|
||||
tItem = self.theMap[tHandle]
|
||||
oldName = tItem.text(0)
|
||||
newName, isOk = QInputDialog.getText(self, "Rename Item", "New Name", QLineEdit.Normal,oldName)
|
||||
if isOk:
|
||||
newName = newName.strip()
|
||||
if newName == "":
|
||||
newName = oldName
|
||||
tItem.setText(0,newName)
|
||||
self.theProject.setItemName(tHandle, newName)
|
||||
return
|
||||
|
||||
def saveTreeOrder(self):
|
||||
theList = []
|
||||
for i in range(self.topLevelItemCount()):
|
||||
|
||||
Reference in New Issue
Block a user