Renaming the document root and components from the tree

This commit is contained in:
2026-07-26 16:14:51 +02:00
parent a96bde9642
commit d9304ba2e0
6 changed files with 98 additions and 30 deletions

View File

@@ -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))