Sujet précédent

5.12. models — models for openPLM

Sujet suivant

5.14. plmapp_tags — Template tags and filters used by openPLM

Cette page

Autres langues

5.13. navigate — Tools to generate navigation’s graph

This module provides NavigationGraph which is used to generate the navigation’s graph in navigate().

plmapp.navigate.OBJECTS_LIMIT = 100

limit of objects displayed per link category

plmapp.navigate.get_id_card_data(doc_ids, date=None)[source]

Get informations to display in the id-cards of all Document which id is in doc_ids

Paramètres:doc_ids – list of Document ids to treat
Retourne:a Dictionnary which contains the following informations
  • thumbnails
    list of tuple (document,thumbnail)
  • num_files
    list of tuple (document, number of file)
class plmapp.navigate.FrozenAGraph(data)[source]

Bases: pygraphviz.agraph.AGraph

A frozen AGraph

Paramètres:data – representation of the graph in dot format
write(path)[source]
plmapp.navigate.get_path(obj)[source]
plmapp.navigate.is_part(plmobject)[source]
class plmapp.navigate.NavigationGraph(obj, results=())[source]

Bases: object

This object can be used to generate a naviation’s graph from an object.

By default, the graph contains one node: the object given as argument. You can change this behaviour with :meth`set_options`

Usage:

graph = NavigationGraph(a_part_controller)
graph.set_options({'child' : True, "parents" : True })
graph.create_edges()
nodes, edges = graph.render()
Paramètres:
GRAPH_ATTRIBUTES = {'splines': 'false', 'sep': '+.1,.1', 'center': 'true', 'outputorder': 'edgesfirst', 'bgcolor': 'transparent', 'mindist': '.5', 'pad': '0.1', 'overlap': 'false', 'dpi': '96.0', 'mode': 'ipsep'}
NODE_ATTRIBUTES = {'fixedsize': 'true', 'width': 1.6875, 'shape': 'none', 'height': 1.6875, 'bgcolor': 'transparent'}
EDGE_ATTRIBUTES = {'fontcolor': 'transparent', 'fontname': 'Sans bold', 'arrowhead': 'normal', 'minlen': '1.5', 'color': '#373434', 'fontsize': '9', 'len': '1.5'}
set_options(options)[source]

Sets which kind of edges should be inserted.

Options is a dictionary(option_name -> boolean)

The option only_search_results enables results filtering.

If the root is a PartController, valid options are:

Name Description
child If True, adds recursively all children of the root
parents If True, adds recursively all parents of the root
doc If True, adds documents attached to the parts
owner If True, adds the owner of the root
signer If True, adds the signers of the root
notified If True, adds the notified of the root

If the root is a DocumentController, valid options are:

Name Description
parts If True, adds parts attached to the root
owner If True, adds the owner of the root
signer If True, adds the signers of the root
notified If True, adds the notified of the root

If the root is a UserController, valid options are:

Name Description
owned If True, adds all plmobjects owned by the root
to_sign If True, adds all plmobjects signed by the root
request_notification_from If True, adds all plmobjects which notifies the root
create_edges()[source]

Builds the graph (adds all edges and nodes that respected the options)

render()[source]

Renders an image of the graph.

Retourne:a tuple (html content, javascript content)