forked from enviPath/enviPy
[Feature] Pathway SVG Export (#102)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#102
This commit is contained in:
@ -1657,8 +1657,8 @@ class Node(EnviPathModel, AliasMixin, ScenarioMixin):
|
||||
"depth": self.depth,
|
||||
"url": self.url,
|
||||
"node_label_id": self.default_node_label.url,
|
||||
"image": self.url + '?image=svg',
|
||||
"imageSize": 490, # TODO
|
||||
"image": f"{self.url}?image=svg",
|
||||
"image_svg": IndigoUtils.mol_to_svg(self.default_node_label.smiles, width=40, height=40),
|
||||
"name": self.default_node_label.name,
|
||||
"smiles": self.default_node_label.smiles,
|
||||
"scenarios": [{'name': s.name, 'url': s.url} for s in self.scenarios.all()],
|
||||
|
||||
@ -1452,6 +1452,22 @@ def package_pathway(request, package_uuid, pathway_uuid):
|
||||
|
||||
return response
|
||||
|
||||
# Pathway d3_json() relies on a lot of related objects (Nodes, Structures, Edges, Reaction, Rules, ...)
|
||||
# we will again fetch the current pathway identified by this url, but this time together with nearly all
|
||||
# related objects
|
||||
|
||||
current_pathway = Pathway.objects.prefetch_related(
|
||||
'node_set',
|
||||
'node_set__out_edges',
|
||||
'node_set__default_node_label',
|
||||
'node_set__scenarios',
|
||||
'edge_set',
|
||||
'edge_set__start_nodes',
|
||||
'edge_set__end_nodes',
|
||||
'edge_set__edge_label',
|
||||
'edge_set__scenarios'
|
||||
).get(uuid=pathway_uuid)
|
||||
|
||||
context = get_base_context(request)
|
||||
context['title'] = f'enviPath - {current_package.name} - {current_pathway.name}'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user