Start of graph view
This commit is contained in:
@@ -96,7 +96,7 @@ class DocumentTreeController(QObject):
|
||||
|
||||
def _on_document_changed(self, model: CoreDocument) -> None:
|
||||
"""Rebuild the tree whenever New/Open replaces the core document."""
|
||||
self._show_equation_component(None)
|
||||
self._show_component(None)
|
||||
self.model.set_document(model)
|
||||
self._components = {}
|
||||
self._collect_components(model.root)
|
||||
@@ -111,15 +111,21 @@ class DocumentTreeController(QObject):
|
||||
def _selection_changed(self, *_args: object) -> None:
|
||||
indexes = self.window.ui.documentTree.selectionModel().selectedRows(0)
|
||||
component = self.model.value(indexes[0]) if len(indexes) == 1 else None
|
||||
self._show_equation_component(component if isinstance(component, Component) else None)
|
||||
self._show_component(component if isinstance(component, Component) else None)
|
||||
|
||||
def _show_equation_component(self, component: Component | None) -> None:
|
||||
def _show_component(self, component: Component | None) -> None:
|
||||
if component is not None and isinstance(component.implementation, EquationImplementation):
|
||||
self.window.equation_editor.set_component(component)
|
||||
self.window.equation_editor.show()
|
||||
else:
|
||||
self.window.equation_editor.set_component(None)
|
||||
self.window.equation_editor.hide()
|
||||
if component is not None and isinstance(component.implementation, GraphImplementation):
|
||||
self.window.graph_editor.set_component(component)
|
||||
self.window.graph_editor.show()
|
||||
else:
|
||||
self.window.graph_editor.set_component(None)
|
||||
self.window.graph_editor.hide()
|
||||
|
||||
def _on_equation_text_changed(self, component: Component, section: str) -> None:
|
||||
if self.window.equation_editor.component() is component:
|
||||
|
||||
Reference in New Issue
Block a user