Fixed some stuff

This commit is contained in:
Joppe Blondel
2026-08-17 12:55:42 +02:00
parent cb9e03a6bf
commit 4591e6b7b0
13 changed files with 397 additions and 92 deletions
@@ -196,7 +196,7 @@ class GraphEditorClipboardHandler(ClipboardHandler):
return self._target() is not None and self.clipboard.has_format(ClipboardService.COMPONENTS_MIME)
def can_delete(self) -> bool:
return self.can_copy()
return bool(self._selected_components() or self.editor.selected_connection_ids())
def copy(self) -> None:
components = self._selected_components()
@@ -225,7 +225,13 @@ class GraphEditorClipboardHandler(ClipboardHandler):
self.document.paste_graph_components(graph_component, components, icons, positions)
def delete(self) -> None:
self.document.delete_components(self._selected_components())
components = self._selected_components()
connection_ids = self.editor.selected_connection_ids()
if components:
self.document.delete_components(components)
graph_component = self.editor.component()
if graph_component is not None and connection_ids:
self.document.delete_graph_connections(graph_component, connection_ids)
def _write_components(self, components: list[Component]) -> None:
payload = export_components(self.document, components)