Skip to content

Commit e976719

Browse files
committed
Add title if not None.
1 parent b832d39 commit e976719

File tree

2 files changed

+49
-20
lines changed

2 files changed

+49
-20
lines changed

src/ansys/fluent/visualization/graphics/graphics_windows_manager.py

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,11 @@ def _display_vector(self, obj, obj_dict):
358358
_mesh_dict["kwargs"] = {}
359359
if obj_dict is not None:
360360
clean_field = field.replace("\n", " ")
361+
vect_title = obj_dict.get("title")
361362
_mesh_dict["title"] = (
362-
obj_dict.get("title")
363-
or f"{vectors_of.capitalize()} "
364-
f"vectors colored by {clean_field}."
363+
f"{vectors_of.capitalize()} " f"vectors colored by {clean_field}."
364+
if vect_title is None
365+
else vect_title
365366
)
366367
_mesh_dict["position"] = obj_dict.get("position")
367368
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -377,10 +378,12 @@ def _display_vector(self, obj, obj_dict):
377378
_mesh_dict["kwargs"] = {}
378379
if obj_dict is not None:
379380
clean_field = field.replace("\n", " ")
381+
vect_title = obj_dict.get("title")
380382
_mesh_dict["title"] = (
381-
obj_dict.get("title")
382-
or f"{vectors_of.capitalize()} "
383+
f"{vectors_of.capitalize()} "
383384
f"vectors colored by {clean_field}."
385+
if vect_title is None
386+
else vect_title
384387
)
385388
_mesh_dict["position"] = obj_dict.get("position")
386389
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -423,8 +426,11 @@ def _display_pathlines(self, obj, obj_dict):
423426
_mesh_dict["kwargs"] = {}
424427
if obj_dict is not None:
425428
clean_field = field.replace("\n", " ")
429+
path_title = obj_dict.get("title")
426430
_mesh_dict["title"] = (
427-
obj_dict.get("title") or f"Pathlines colored by {clean_field}."
431+
f"Pathlines colored by {clean_field}."
432+
if path_title is None
433+
else path_title
428434
)
429435
_mesh_dict["position"] = obj_dict.get("position")
430436
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -488,9 +494,11 @@ def _display_contour(self, obj, obj_dict):
488494
_mesh_dict["kwargs"] = {}
489495
if obj_dict is not None:
490496
clean_field = field.replace("\n", " ")
497+
cont_title = obj_dict.get("title")
491498
_mesh_dict["title"] = (
492-
obj_dict.get("title")
493-
or f"Contour of {clean_field}."
499+
f"Contour of {clean_field}."
500+
if cont_title is None
501+
else cont_title
494502
)
495503
_mesh_dict["position"] = obj_dict.get("position")
496504
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -507,9 +515,11 @@ def _display_contour(self, obj, obj_dict):
507515
_mesh_dict["kwargs"] = {}
508516
if obj_dict is not None:
509517
clean_field = field.replace("\n", " ")
518+
cont_title = obj_dict.get("title")
510519
_mesh_dict["title"] = (
511-
obj_dict.get("title")
512-
or f"Contour of {clean_field}."
520+
f"Contour of {clean_field}."
521+
if cont_title is None
522+
else cont_title
513523
)
514524
_mesh_dict["position"] = obj_dict.get("position")
515525
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -530,8 +540,11 @@ def _display_contour(self, obj, obj_dict):
530540
_mesh_dict["kwargs"] = {}
531541
if obj_dict is not None:
532542
clean_field = field.replace("\n", " ")
543+
cont_title = obj_dict.get("title")
533544
_mesh_dict["title"] = (
534-
obj_dict.get("title") or f"Contour of {clean_field}."
545+
f"Contour of {clean_field}."
546+
if cont_title is None
547+
else cont_title
535548
)
536549
_mesh_dict["position"] = obj_dict.get("position")
537550
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -544,8 +557,11 @@ def _display_contour(self, obj, obj_dict):
544557
_mesh_dict["kwargs"] = {}
545558
if obj_dict is not None:
546559
clean_field = field.replace("\n", " ")
560+
cont_title = obj_dict.get("title")
547561
_mesh_dict["title"] = (
548-
obj_dict.get("title") or f"Contour of {clean_field}."
562+
f"Contour of {clean_field}."
563+
if cont_title is None
564+
else cont_title
549565
)
550566
_mesh_dict["position"] = obj_dict.get("position")
551567
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -566,8 +582,11 @@ def _display_contour(self, obj, obj_dict):
566582
_mesh_dict["kwargs"] = {}
567583
if obj_dict is not None:
568584
clean_field = field.replace("\n", " ")
585+
cont_title = obj_dict.get("title")
569586
_mesh_dict["title"] = (
570-
obj_dict.get("title") or f"Contour of {clean_field}."
587+
f"Contour of {clean_field}."
588+
if cont_title is None
589+
else cont_title
571590
)
572591
_mesh_dict["position"] = obj_dict.get("position")
573592
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -580,8 +599,11 @@ def _display_contour(self, obj, obj_dict):
580599
_mesh_dict["kwargs"] = {}
581600
if obj_dict is not None:
582601
clean_field = field.replace("\n", " ")
602+
cont_title = obj_dict.get("title")
583603
_mesh_dict["title"] = (
584-
obj_dict.get("title") or f"Contour of {clean_field}."
604+
f"Contour of {clean_field}."
605+
if cont_title is None
606+
else cont_title
585607
)
586608
_mesh_dict["position"] = obj_dict.get("position")
587609
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -599,8 +621,11 @@ def _display_contour(self, obj, obj_dict):
599621
_mesh_dict["kwargs"] = {}
600622
if obj_dict is not None:
601623
clean_field = field.replace("\n", " ")
624+
cont_title = obj_dict.get("title")
602625
_mesh_dict["title"] = (
603-
obj_dict.get("title") or f"Contour of {clean_field}."
626+
f"Contour of {clean_field}."
627+
if cont_title is None
628+
else cont_title
604629
)
605630
_mesh_dict["position"] = obj_dict.get("position")
606631
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -613,8 +638,11 @@ def _display_contour(self, obj, obj_dict):
613638
_mesh_dict["kwargs"] = {}
614639
if obj_dict is not None:
615640
clean_field = field.replace("\n", " ")
641+
cont_title = obj_dict.get("title")
616642
_mesh_dict["title"] = (
617-
obj_dict.get("title") or f"Contour of {clean_field}."
643+
f"Contour of {clean_field}."
644+
if cont_title is None
645+
else cont_title
618646
)
619647
_mesh_dict["position"] = obj_dict.get("position")
620648
_mesh_dict["opacity"] = obj_dict.get("opacity")
@@ -648,7 +676,8 @@ def _display_mesh(self, obj, obj_dict=None):
648676
_mesh_dict = {"data": mesh, "show_edges": obj.show_edges(), "color": color}
649677
_mesh_dict["kwargs"] = {}
650678
if obj_dict is not None:
651-
_mesh_dict["title"] = obj_dict.get("title") or obj._name
679+
mesh_title = obj_dict.get("title")
680+
_mesh_dict["title"] = obj._name if mesh_title is None else mesh_title
652681
_mesh_dict["position"] = obj_dict.get("position")
653682
_mesh_dict["opacity"] = obj_dict.get("opacity")
654683
_mesh_dict["kwargs"] = obj_dict.get("kwargs")
@@ -661,7 +690,7 @@ def _display_xy_plot(self, obj_dict):
661690
"position": obj_dict.get("position"),
662691
"kwargs": obj_dict.get("kwargs"),
663692
}
664-
if obj_dict.get("title"):
693+
if obj_dict.get("title") is not None:
665694
plot_dict["title"] = obj_dict.get("title")
666695
self._object_list_to_render.append([plot_dict])
667696

@@ -671,7 +700,7 @@ def _display_monitor_plot(self, obj_dict):
671700
"position": obj_dict.get("position"),
672701
"kwargs": obj_dict.get("kwargs"),
673702
}
674-
if obj_dict.get("title"):
703+
if obj_dict.get("title") is not None:
675704
plot_dict["title"] = obj_dict.get("title")
676705
self._object_list_to_render.append([plot_dict])
677706

src/ansys/fluent/visualization/plotter/plotter_windows_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def plot_graphics(self, object_list):
164164
)
165165

166166
plot_data = plot()
167-
if obj_dict.get("title"):
167+
if obj_dict.get("title") is not None:
168168
plot_data[1]["title"] = obj_dict["title"]
169169
self._object_list_to_render.append(
170170
[

0 commit comments

Comments
 (0)