Added new and delete component actions
This commit is contained in:
@@ -112,6 +112,11 @@ class DocumentTreeController(QObject):
|
||||
edit_interface = menu.addAction("Edit Interface")
|
||||
edit_params = menu.addAction("Edit Parameters")
|
||||
edit_icon = menu.addAction("Edit Icon")
|
||||
menu.addSeparator()
|
||||
add_graph_component = menu.addAction("Add Graph Component")
|
||||
add_equation_component = menu.addAction("Add Equation Component")
|
||||
menu.addSeparator()
|
||||
delete_component = menu.addAction("Delete Component")
|
||||
selected = menu.exec(
|
||||
self.window.ui.documentTree.viewport().mapToGlobal(position)
|
||||
)
|
||||
@@ -121,6 +126,12 @@ class DocumentTreeController(QObject):
|
||||
self._edit_params(component)
|
||||
elif selected is edit_icon:
|
||||
self._edit_icon(component)
|
||||
elif selected is add_graph_component:
|
||||
self._add_graph_component(component)
|
||||
elif selected is add_equation_component:
|
||||
self._add_equation_component(component)
|
||||
elif selected is delete_component:
|
||||
self._delete_component(component)
|
||||
|
||||
def _edit_interface(self, component: Component) -> None:
|
||||
dialog = self.interface_editor_factory(
|
||||
@@ -149,3 +160,12 @@ class DocumentTreeController(QObject):
|
||||
def _icon_editor_closed(self, editor: IconEditorWindow, *_args: object) -> None:
|
||||
if editor in self._icon_editors:
|
||||
self._icon_editors.remove(editor)
|
||||
|
||||
def _add_graph_component(self, component: Component) -> None:
|
||||
self.document.add_empty_graph_component(component)
|
||||
|
||||
def _add_equation_component(self, component: Component) -> None:
|
||||
self.document.add_empty_equation_component(component)
|
||||
|
||||
def _delete_component(self, component: Component) -> None:
|
||||
self.document.delete_component(component)
|
||||
|
||||
Reference in New Issue
Block a user