Renaming the document root and components from the tree
This commit is contained in:
@@ -6,8 +6,10 @@ from PySide6.QtCore import QObject, Signal
|
||||
from PySide6.QtGui import QUndoStack
|
||||
|
||||
from bedit_core.models import ID
|
||||
from bedit_core.models import Document as CoreDocument
|
||||
from bedit_core.models import Document as CoreDocument, Component
|
||||
from bedit_gui.services import document_files
|
||||
from bedit_gui.commands.rename_document_command import RenameDocumentCommand
|
||||
from bedit_gui.commands.rename_component_command import RenameComponentCommand
|
||||
|
||||
|
||||
class Document(QObject):
|
||||
@@ -78,3 +80,9 @@ class Document(QObject):
|
||||
name="Untitled",
|
||||
root={},
|
||||
)
|
||||
|
||||
def rename(self, name: str) -> None:
|
||||
self.undo_stack.push(RenameDocumentCommand(self, name))
|
||||
|
||||
def rename_component(self, component: Component, name:str) -> None:
|
||||
self.undo_stack.push(RenameComponentCommand(self, component, name))
|
||||
|
||||
Reference in New Issue
Block a user