Skip to content

Commit

Permalink
fix deprecated function name and add scalarbar3d
Browse files Browse the repository at this point in the history
  • Loading branch information
j042 committed Sep 7, 2023
1 parent 792c907 commit 7e3f27c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions gustaf/helpers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ def __repr__(self):
"label_format: str}. Setting bool will add a default scalarbar",
(bool, dict),
),
Option(
"vedo",
"scalarbar3d",
"3D scalarbar describing cmap. At least an empty dict or "
"dict with following items are accepted: "
"{title: str, pos: tuple, size: list, title_font: str, "
"title_xoffset: float, title_yoffset: float, title_size: float, "
"title_rotation: float, nlabels: int, label_font:str, "
"label_size: float, label_offset: float, label_rotation: int, "
"label_format: str, draw_box: bool, above_text: str, below_text: str, "
"nan_text: str, categories: list}",
(bool, dict),
),
Option(
"vedo",
"arrow_data",
Expand Down
10 changes: 8 additions & 2 deletions gustaf/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,17 @@ def _vedo_showable(obj, as_dict=False, **kwargs):
vedo_obj.cmap(cmap_kwargs.pop("input_cmap"), **cmap_kwargs)

# at last, scalarbar
# deprecated function name, keep it for now for backward compat
sb_kwargs = obj.show_options.get("scalarbar", None)
if sb_kwargs is not None and sb_kwargs is not False:
sb_kwargs = dict() if isinstance(sb_kwargs, bool) else sb_kwargs
vedo_obj.addScalarBar(**sb_kwargs)
vedo_obj.add_scalarbar(**sb_kwargs)

sb3d_kwargs = obj.show_options.get("scalarbar3d", None)
if sb3d_kwargs is not None and sb3d_kwargs is not False:
sb3d_kwargs = (
dict() if isinstance(sb3d_kwargs, bool) else sb3d_kwargs
)
vedo_obj.add_scalarbar3d(**sb3d_kwargs)

elif data_name is not None and vertex_data is None:
utils.log.debug(
Expand Down

0 comments on commit 7e3f27c

Please sign in to comment.