Graph view shows graph
This commit is contained in:
@@ -16,7 +16,7 @@ from bedit_gui.commands.rename_component_command import RenameComponentCommand
|
||||
from bedit_gui.commands.rename_document_command import RenameDocumentCommand
|
||||
from bedit_gui.commands.simulation_database_command import ChangeSimulationDatabaseCommand
|
||||
from bedit_gui.commands.component_command import AddEmptyEquationComponent, AddEmptyGraphComponent, DeleteComponent, PasteComponents
|
||||
from bedit_gui.models import Icon, IconDatabase, Simulation, SimulationDatabase
|
||||
from bedit_gui.models import GraphDatabase, Icon, IconDatabase, Simulation, SimulationDatabase
|
||||
from bedit_gui.services import document_files
|
||||
|
||||
|
||||
@@ -121,6 +121,14 @@ class Document(QObject):
|
||||
def component_icon(self, component_id: ComponentID) -> Icon:
|
||||
return self.stored_component_icon(component_id) or Icon()
|
||||
|
||||
def graph_database(self) -> GraphDatabase:
|
||||
metadata = self.model.metadata
|
||||
value = metadata.get("graph_database") if metadata is not None else None
|
||||
if isinstance(value, dict):
|
||||
value = GraphDatabase.from_data(value)
|
||||
metadata["graph_database"] = value
|
||||
return deepcopy(value) if isinstance(value, GraphDatabase) else GraphDatabase()
|
||||
|
||||
def change_icon(self, component_id: ComponentID, icon: Icon) -> None:
|
||||
self.undo_stack.push(ChangeIconCommand(self, component_id, icon))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user