@@ -84,6 +84,12 @@ class PyVistaBackendInterface(BaseBackend):
8484 allow_hovering : Optional[bool], default: False
8585 Whether to allow hovering capabilities in the window. Incompatible with picking.
8686 Picking will take precedence over hovering.
87+ plot_picked_names : Optional[bool], default: False
88+ Whether to plot the names of the picked objects.
89+ show_plane : Optional[bool], default: False
90+ Whether to show the plane in the plotter.
91+ use_qt : Optional[bool], default: False
92+ Whether to use the Qt backend for the plotter.
8793 """
8894
8995 def __init__ (
@@ -93,13 +99,14 @@ def __init__(
9399 allow_hovering : Optional [bool ] = False ,
94100 plot_picked_names : Optional [bool ] = False ,
95101 show_plane : Optional [bool ] = False ,
102+ use_qt : Optional [bool ] = False ,
96103 ** plotter_kwargs ,
97104 ) -> None :
98105 """Initialize the ``use_trame`` parameter and save the current ``pv.OFF_SCREEN`` value."""
99106 # Check if the use of trame was requested
100107 if use_trame is None :
101108 use_trame = ansys .tools .visualization_interface .USE_TRAME
102-
109+ self . _use_qt = use_qt
103110 self ._use_trame = use_trame
104111 self ._allow_picking = allow_picking
105112 self ._allow_hovering = allow_hovering
@@ -146,7 +153,7 @@ def __init__(
146153 logger .warning (warn_msg )
147154 self ._pl = PyVistaInterface (show_plane = show_plane )
148155 else :
149- self ._pl = PyVistaInterface (show_plane = show_plane )
156+ self ._pl = PyVistaInterface (show_plane = show_plane , use_qt = use_qt , ** plotter_kwargs )
150157
151158 self ._enable_widgets = self ._pl ._enable_widgets
152159
@@ -175,7 +182,8 @@ def enable_widgets(self):
175182 ]
176183 self ._widgets .append (MeasureWidget (self ))
177184 self ._widgets .append (ScreenshotButton (self ))
178- self ._widgets .append (MeshSliderWidget (self ))
185+ if not self ._use_qt :
186+ self ._widgets .append (MeshSliderWidget (self ))
179187 self ._widgets .append (HideButton (self ))
180188
181189 def add_widget (self , widget : Union [PlotterWidget , List [PlotterWidget ]]):
@@ -541,10 +549,11 @@ def __init__(
541549 use_trame : Optional [bool ] = None ,
542550 allow_picking : Optional [bool ] = False ,
543551 allow_hovering : Optional [bool ] = False ,
544- plot_picked_names : Optional [bool ] = True
552+ plot_picked_names : Optional [bool ] = True ,
553+ use_qt : Optional [bool ] = False
545554 ) -> None :
546555 """Initialize the generic plotter."""
547- super ().__init__ (use_trame , allow_picking , allow_hovering , plot_picked_names )
556+ super ().__init__ (use_trame , allow_picking , allow_hovering , plot_picked_names , use_qt = use_qt )
548557
549558 def plot_iter (
550559 self ,
@@ -591,3 +600,7 @@ def plot(self, plottable_object: Any, name_filter: str = None, **plotting_option
591600 else :
592601 self .pv_interface .plot (plottable_object , name_filter , ** plotting_options )
593602
603+ def close (self ):
604+ """Close the plotter for PyVistaQT."""
605+ if self ._use_qt :
606+ self .pv_interface .scene .close ()
0 commit comments