Fixed some stuff
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user