Skip to content
Snippets Groups Projects
Commit a9220368 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

Merge branch 'f-plantuml-without-shadow' into 'dev'

ENH: to_graphics now has `no_shadow` option.

See merge request !56
parents b8ab8db6 70dbf6c9
Branches
Tags
2 merge requests!57RELEASE 0.7.3,!56ENH: to_graphics now has `no_shadow` option.
Pipeline #22400 passed
...@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New function in apiutils that copies an Entity. - New function in apiutils that copies an Entity.
- New EXPERIMENTAL module `high_level_api` which is a completely refactored version of - New EXPERIMENTAL module `high_level_api` which is a completely refactored version of
the old `high_level_api` from apiutils. Please see the included documentation for details. the old `high_level_api` from apiutils. Please see the included documentation for details.
- `to_graphics` now has `no_shadow` option.
### Changed ### ### Changed ###
......
...@@ -88,6 +88,7 @@ def recordtypes_to_plantuml_string(iterable, ...@@ -88,6 +88,7 @@ def recordtypes_to_plantuml_string(iterable,
add_properties: bool = True, add_properties: bool = True,
add_recordtypes: bool = True, add_recordtypes: bool = True,
add_legend: bool = True, add_legend: bool = True,
no_shadow: bool = False,
style: str = "default"): style: str = "default"):
"""Converts RecordTypes into a string for PlantUML. """Converts RecordTypes into a string for PlantUML.
...@@ -109,6 +110,20 @@ def recordtypes_to_plantuml_string(iterable, ...@@ -109,6 +110,20 @@ def recordtypes_to_plantuml_string(iterable,
either the "type" attribute is None or either the "type" attribute is None or
type(element) == RecordType. type(element) == RecordType.
- Inheritance of Properties is not rendered nicely at the moment. - 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. # TODO: This function needs a review of python type hints.
...@@ -158,6 +173,9 @@ def recordtypes_to_plantuml_string(iterable, ...@@ -158,6 +173,9 @@ def recordtypes_to_plantuml_string(iterable,
result = "@startuml\n\n" result = "@startuml\n\n"
if no_shadow:
result += "skinparam shadowing false\n"
if style == "default": if style == "default":
result += "skinparam classAttributeIconSize 0\n" result += "skinparam classAttributeIconSize 0\n"
elif style == "salexan": elif style == "salexan":
...@@ -330,6 +348,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str, ...@@ -330,6 +348,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str,
add_properties: bool = True, add_properties: bool = True,
add_recordtypes: bool = True, add_recordtypes: bool = True,
add_legend: bool = True, add_legend: bool = True,
no_shadow: bool = False,
style: str = "default"): style: str = "default"):
"""Calls recordtypes_to_plantuml_string(), saves result to file and """Calls recordtypes_to_plantuml_string(), saves result to file and
creates an svg image creates an svg image
...@@ -352,12 +371,15 @@ def to_graphics(recordtypes: list[db.Entity], filename: str, ...@@ -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" list of target formats as defined by the -t"..." options by plantuml, e.g. "tsvg"
silent : bool silent : bool
Don't output messages. 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, pu = recordtypes_to_plantuml_string(iterable=recordtypes,
add_properties, add_properties=add_properties,
add_recordtypes, add_recordtypes=add_recordtypes,
add_legend, add_legend=add_legend,
style) no_shadow=no_shadow,
style=style)
if output_dirname is None: if output_dirname is None:
output_dirname = os.getcwd() output_dirname = os.getcwd()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment