From ab10b55488beeb882ee53d896aa98f5766629f17 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Mon, 25 Apr 2022 16:51:18 +0200
Subject: [PATCH] ENH: to_graphics now has `no_shadow` option.

---
 src/caosdb/utils/plantuml.py | 32 +++++++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/caosdb/utils/plantuml.py b/src/caosdb/utils/plantuml.py
index aee515be..16bd81d9 100644
--- a/src/caosdb/utils/plantuml.py
+++ b/src/caosdb/utils/plantuml.py
@@ -88,6 +88,7 @@ def recordtypes_to_plantuml_string(iterable,
                                    add_properties: bool = True,
                                    add_recordtypes: bool = True,
                                    add_legend: bool = True,
+                                   no_shadow: bool = False,
                                    style: str = "default"):
     """Converts RecordTypes into a string for PlantUML.
 
@@ -109,6 +110,20 @@ def recordtypes_to_plantuml_string(iterable,
       either the "type" attribute is None or
       type(element) == RecordType.
     - Inheritance of Properties is not rendered nicely at the moment.
+
+    Parameters
+    ----------
+    iterable: iterable of caosdb.Entity
+      The objects to be rendered with plantuml.
+
+    no_shadow : bool, optional
+      If true, tell plantuml to use a skin without blurred shadows.
+
+
+    Returns
+    -------
+    out : str
+      The plantuml string for the given container.
     """
 
     # TODO: This function needs a review of python type hints.
@@ -158,6 +173,9 @@ def recordtypes_to_plantuml_string(iterable,
 
     result = "@startuml\n\n"
 
+    if no_shadow:
+        result += "skinparam shadowing false\n"
+
     if style == "default":
         result += "skinparam classAttributeIconSize 0\n"
     elif style == "salexan":
@@ -330,6 +348,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str,
                 add_properties: bool = True,
                 add_recordtypes: bool = True,
                 add_legend: bool = True,
+                no_shadow: bool = False,
                 style: str = "default"):
     """Calls recordtypes_to_plantuml_string(), saves result to file and
     creates an svg image
@@ -352,12 +371,15 @@ def to_graphics(recordtypes: list[db.Entity], filename: str,
               list of target formats as defined by the -t"..." options by plantuml, e.g. "tsvg"
     silent : bool
              Don't output messages.
+    no_shadow : bool, optional
+      If true, tell plantuml to use a skin without blurred shadows.
     """
-    pu = recordtypes_to_plantuml_string(recordtypes,
-                                        add_properties,
-                                        add_recordtypes,
-                                        add_legend,
-                                        style)
+    pu = recordtypes_to_plantuml_string(iterable=recordtypes,
+                                        add_properties=add_properties,
+                                        add_recordtypes=add_recordtypes,
+                                        add_legend=add_legend,
+                                        no_shadow=no_shadow,
+                                        style=style)
 
     if output_dirname is None:
         output_dirname = os.getcwd()
-- 
GitLab