Skip to content

Priority group

Priority group item widget

PriorityGroupWidget

PriorityGroupWidget(group, parent=None)

Bases: QWidget, WidgetUi

Widget that provide UI for priority group details.

Source code in src/cplus_plugin/gui/priority_group_widget.py
def __init__(
    self,
    group,
    parent=None,
):
    super().__init__(parent)
    self.setupUi(self)
    self.group = group

    self.initialize_ui()

group_value

group_value()

Returns: name (dict): Priority group value

Source code in src/cplus_plugin/gui/priority_group_widget.py
def group_value(self):
    """
    Returns:
        name (dict): Priority group value
    """
    return self.group_slider.value()

initialize_ui

initialize_ui()

Populate UI inputs when loading the widget

Source code in src/cplus_plugin/gui/priority_group_widget.py
def initialize_ui(self):
    """Populate UI inputs when loading the widget"""

    if self.group is not None:
        self.group_la.setText(self.group.get("name"))
        self.group_slider.setValue(int(self.group.get("value", 0)))
        self.group_spin_box.setValue(int(self.group.get("value", 0)))

    self.group_slider.valueChanged.connect(self.update_spin_box)
    self.group_spin_box.valueChanged.connect(self.update_slider)

name

name()

Returns: name (dict): Priority group name

Source code in src/cplus_plugin/gui/priority_group_widget.py
def name(self):
    """
    Returns:
        name (dict): Priority group name
    """
    return self.group.get("name")

set_group

set_group(group)

Sets the priority layer group and updates the slider and input values

Args: group (dict): Priority group

Source code in src/cplus_plugin/gui/priority_group_widget.py
def set_group(self, group):
    """Sets the priority layer group and updates the slider and
    input values

     Args:
        group (dict): Priority group
    """

    if group is not None:
        self.group = group
        self.group_la.setText(group.get("name"))
        self.group_slider.setValue(int(group["value"]))
        self.group_spin_box.setValue(int(group["value"]))

update_slider

update_slider(value)

Changes the current slider value.

Args: value (int): Value to be set on the slider Note: Emits input_value_changed signal

Source code in src/cplus_plugin/gui/priority_group_widget.py
def update_slider(self, value):
    """Changes the current slider value.

    Args:
        value (int): Value to be set on the slider
    Note:
        Emits input_value_changed signal
    """
    if self.group is not None:
        self.input_value_changed.emit(self.group["name"], value)
        self.group_slider.blockSignals(True)
        self.group_slider.setValue(value)
        self.group_slider.blockSignals(False)

update_spin_box

update_spin_box(value)

Changes the input value of the spin box

Args: value (int): Value to be set on the spin box. Note: Emits slider_value_changed signal

Source code in src/cplus_plugin/gui/priority_group_widget.py
def update_spin_box(self, value):
    """Changes the input value of the spin box

    Args:
        value (int): Value to be set on the spin box.
    Note:
        Emits slider_value_changed signal

    """
    if self.group is not None:
        self.slider_value_changed.emit(self.group["name"], value)
        self.group_spin_box.blockSignals(True)
        self.group_spin_box.setValue(value)
        self.group_spin_box.blockSignals(False)

widgets

widgets()

Returns widget_list (list): List of component widgets for the priority group widget

Source code in src/cplus_plugin/gui/priority_group_widget.py
def widgets(self) -> typing.List[QtWidgets.QWidget]:
    """
    Returns
        widget_list (list): List of component
        widgets for the priority group widget
    """
    return [self.group_la, self.group_slider, self.group_spin_box]

Last update: October 2, 2024
Back to top