Skip to content

Commit

Permalink
apply edge label colors to all 3 potential labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesscottbrown committed Nov 7, 2020
1 parent 75e1dde commit 8055c0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions pyyed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,22 +324,22 @@ def convert(self):
ET.SubElement(pl, "y:LineStyle", color=self.color, type=self.line_type,
width=self.width)

if self.label:
args = {}
if self.label_background_color:
args["backgroundColor"] = self.label_background_color
if self.label_border_color:
args["lineColor"] = self.label_border_color
label_color_args = {}
if self.label_background_color:
label_color_args["backgroundColor"] = self.label_background_color
if self.label_border_color:
label_color_args["lineColor"] = self.label_border_color

ET.SubElement(pl, "y:EdgeLabel", **args).text = self.label
if self.label:
ET.SubElement(pl, "y:EdgeLabel", **label_color_args).text = self.label

if self.source_label:
ET.SubElement(pl, "y:EdgeLabel", modelName="six_pos", modelPosition="shead",
preferredPlacement="source_on_edge").text = self.source_label
preferredPlacement="source_on_edge", **label_color_args).text = self.source_label

if self.target_label:
ET.SubElement(pl, "y:EdgeLabel", modelName="six_pos", modelPosition="ttail",
preferredPlacement="target_on_edge").text = self.target_label
preferredPlacement="target_on_edge", **label_color_args).text = self.target_label

return edge

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


setup(name='pyyed',
version='1.4.0',
version='1.4.1',
description='A simple Python library to export graphs to the yEd graph editor',

author='James Scott-Brown',
Expand Down

0 comments on commit 8055c0e

Please sign in to comment.