Skip to content

Commit

Permalink
node padding in style config
Browse files Browse the repository at this point in the history
  • Loading branch information
FloSch62 committed Dec 20, 2024
1 parent aa0b24a commit 80bc372
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions clab2drawio.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def main(

diagram = CustomDrawioDiagram()
diagram.layout = layout
diagram.styles = styles

nodes_from_clab = containerlab_data["topology"]["nodes"]
# Determine the prefix
Expand Down
5 changes: 4 additions & 1 deletion core/layout/horizontal_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ def _calculate_positions(self):
nodes = self.diagram.nodes
nodes = sorted(nodes.values(), key=lambda node: (node.graph_level, node.name))

# Get padding from styles
padding_x = self.diagram.styles['padding_x']
padding_y = self.diagram.styles['padding_y']

x_start, y_start = 100, 100
padding_x, padding_y = 150, 175

logger.debug("Nodes before calculate_positions:", nodes)

Expand Down
5 changes: 4 additions & 1 deletion core/layout/vertical_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ def _calculate_positions(self):
nodes = self.diagram.nodes
nodes = sorted(nodes.values(), key=lambda node: (node.graph_level, node.name))

# Get padding from styles
padding_x = self.diagram.styles['padding_x']
padding_y = self.diagram.styles['padding_y']

x_start, y_start = 100, 100
padding_x, padding_y = 150, 175

logger.debug("Nodes before calculate_positions:", nodes)

Expand Down
3 changes: 3 additions & 0 deletions styles/grafana_dark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pageh: "auto"
node_width: 75
node_height: 75

padding_x: 150
padding_y: 175

# Base style for nodes; defines the general appearance for all nodes.
base_style: "shape=image;imageAlign=center;imageVerticalAlign=middle;labelPosition=left;align=right;verticalLabelPosition=top;spacingLeft=0;verticalAlign=bottom;spacingTop=0;spacing=0;fontColor=#F0F0F0;"

Expand Down
3 changes: 3 additions & 0 deletions styles/nokia_bright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pageh: "auto"
node_width: 75
node_height: 75

padding_x: 150
padding_y: 175

# Base style for nodes; defines the general appearance for all nodes.
base_style: "shape=image;imageAlign=center;imageVerticalAlign=middle;labelPosition=left;align=right;verticalLabelPosition=top;spacingLeft=0;verticalAlign=bottom;spacingTop=0;spacing=0;"

Expand Down
3 changes: 3 additions & 0 deletions styles/nokia_dark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pageh: "auto"
node_width: 75
node_height: 75

padding_x: 150
padding_y: 175

# Base style for nodes; defines the general appearance for all nodes.
base_style: "shape=image;imageAlign=center;imageVerticalAlign=middle;labelPosition=left;align=right;verticalLabelPosition=top;spacingLeft=0;verticalAlign=bottom;spacingTop=0;spacing=0;fontColor=#F0F0F0;"

Expand Down
3 changes: 3 additions & 0 deletions styles/nokia_modern_bright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pageh: "auto"
node_width: 75
node_height: 75

padding_x: 150
padding_y: 175

# Base style for nodes; defines the general appearance for all nodes.
base_style: "shape=image;imageAlign=center;imageVerticalAlign=middle;labelPosition=left;align=right;verticalLabelPosition=top;spacingLeft=0;verticalAlign=bottom;spacingTop=0;spacing=0;"

Expand Down
3 changes: 3 additions & 0 deletions styles/nokia_modern_dark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pageh: "auto"
node_width: 75
node_height: 75

padding_x: 150
padding_y: 175

# Base style for nodes; defines the general appearance for all nodes.
base_style: "shape=image;imageAlign=center;imageVerticalAlign=middle;labelPosition=left;align=right;verticalLabelPosition=top;spacingLeft=0;verticalAlign=bottom;spacingTop=0;spacing=0;fontColor=#F0F0F0;"

Expand Down

0 comments on commit 80bc372

Please sign in to comment.