Draft: Small layer improvements

- Added 'Print Line Color' property
- Added 'Add new layer' context menu action to layers group
This commit is contained in:
Yorik van Havre
2020-12-15 16:43:33 +01:00
parent 8e223cdf5d
commit e672aa26b4
4 changed files with 770 additions and 1 deletions

View File

@@ -478,7 +478,12 @@ def get_svg(obj,
else:
stroke = utils.get_rgb(color)
elif App.GuiUp:
if hasattr(obj, "ViewObject"):
# find print color
pc = get_print_color(obj)
if pc:
stroke = utils.get_rgb(pc)
# get line color
elif hasattr(obj, "ViewObject"):
if hasattr(obj.ViewObject, "LineColor"):
stroke = utils.get_rgb(obj.ViewObject.LineColor)
elif hasattr(obj.ViewObject, "TextColor"):
@@ -918,6 +923,17 @@ def get_svg(obj,
return svg
def get_print_color(obj):
"""returns the print color of the parent layer, if available"""
for parent in obj.InListRecursive:
if (hasattr(parent,"ViewObject")
and hasattr(parent.ViewObject,"UsePrintColor")
and parent.ViewObject.UsePrintColor):
if hasattr(parent.ViewObject,"LinePrintColor"):
return parent.ViewObject.LinePrintColor
return None
def getSVG(obj,
scale=1, linewidth=0.35, fontsize=12,
fillstyle="shape color", direction=None,