3232from PySide6 .QtGui import QStandardItem , QStandardItemModel
3333from PySide6 .QtWidgets import QComboBox
3434
35- from ansys .tools .installer .common import get_pkg_versions
35+ from ansys .tools .installer .common import get_pkg_versions , get_targets
3636from ansys .tools .installer .configure_json import ConfigureJson
3737from ansys .tools .installer .constants import PYANSYS_LIBS , SELECT_VENV_MANAGE_TAB
3838from ansys .tools .installer .find_python import (
@@ -300,23 +300,45 @@ def __init__(self, parent=None):
300300 hbox_install_pyansys = QtWidgets .QHBoxLayout ()
301301 pyansys_pkg_manage_box_layout .addLayout (hbox_install_pyansys )
302302
303+ package_layout = QtWidgets .QVBoxLayout ()
304+ package_label = QtWidgets .QLabel ("Package" )
303305 self .model = QStandardItemModel ()
304306 self .packages_combo = QComboBox ()
305307 self .packages_combo .setModel (self .model )
308+ package_layout .addWidget (package_label )
309+ package_layout .addWidget (self .packages_combo )
306310
311+ version_layout = QtWidgets .QVBoxLayout ()
312+ version_label = QtWidgets .QLabel ("Version" )
307313 self .versions_combo = QComboBox ()
314+ version_layout .addWidget (version_label )
315+ version_layout .addWidget (self .versions_combo )
316+
317+ target_layout = QtWidgets .QVBoxLayout ()
318+ target_label = QtWidgets .QLabel ("Target (optional)" )
319+ self .version_target_combo = QComboBox ()
320+ target_layout .addWidget (target_label )
321+ target_layout .addWidget (self .version_target_combo )
322+
323+ install_button_layout = QtWidgets .QVBoxLayout ()
324+ install_button_label = QtWidgets .QLabel (" " )
308325 self .button_launch_cmd = QtWidgets .QPushButton ("Install" )
309- self .button_launch_cmd .clicked .connect (self .install_pyansys_packages )
326+ install_button_layout .addWidget (install_button_label )
327+ install_button_layout .addWidget (self .button_launch_cmd )
310328
329+ self .button_launch_cmd .clicked .connect (self .install_pyansys_packages )
311330 for library in PYANSYS_LIBS :
312331 self .model .appendRow (QStandardItem (library ))
313-
314332 self .packages_combo .currentIndexChanged .connect (self .update_package_combo )
333+ self .versions_combo .currentIndexChanged .connect (
334+ self .update_package_target_combo
335+ )
315336 self .update_package_combo (0 )
316337
317- hbox_install_pyansys .addWidget (self .packages_combo )
318- hbox_install_pyansys .addWidget (self .versions_combo )
319- hbox_install_pyansys .addWidget (self .button_launch_cmd )
338+ hbox_install_pyansys .addLayout (package_layout )
339+ hbox_install_pyansys .addLayout (version_layout )
340+ hbox_install_pyansys .addLayout (target_layout )
341+ hbox_install_pyansys .addLayout (install_button_layout )
320342 layout .addWidget (pyansys_pkg_manage_box )
321343
322344 # ensure the table is always in focus
@@ -391,8 +413,10 @@ def install_pyansys_packages(self):
391413 """Install PyAnsys - chosen packages."""
392414 chosen_pkg = self .packages_combo .currentText ()
393415 chosen_ver = self .versions_combo .currentText ()
416+ chosen_target = self .version_target_combo .currentText ()
417+ fmt_target = "" if not chosen_target else f"[{ chosen_target } ]"
394418 pck_ver = (
395- f"{ PYANSYS_LIBS [chosen_pkg ]} =={ chosen_ver } "
419+ f"{ PYANSYS_LIBS [chosen_pkg ]} { fmt_target } =={ chosen_ver } "
396420 if chosen_ver
397421 else f"{ PYANSYS_LIBS [chosen_pkg ]} "
398422 )
@@ -415,6 +439,24 @@ def update_package_combo(self, index):
415439 self .versions_combo .setModel (versions_model )
416440 self .versions_combo .setCurrentIndex (0 )
417441
442+ def update_package_target_combo (self , index ):
443+ """Depending on the version chosen for a package, update the available list of targets."""
444+ package_name = PYANSYS_LIBS [self .packages_combo .currentText ()]
445+ version = self .versions_combo .currentText ()
446+
447+ # Clear the previous targets
448+ self .version_target_combo .clear ()
449+
450+ # Get the available targets for the selected package version
451+ targets = get_targets (package_name , version )
452+
453+ # Populate the target combo box with the available targets
454+ for target in targets :
455+ self .version_target_combo .addItem (target )
456+
457+ # Set the first target as the current selection
458+ self .version_target_combo .setCurrentIndex (0 )
459+
418460 def list_packages (self ):
419461 """List installed Python packages."""
420462 self .launch_cmd ("uv pip list" )
0 commit comments