Esempio n. 1
0
    def initUI(self):
        """Initialize the UI."""
        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        # =====================================================================

        self.group_chooser = QtWidgets.QComboBox()
        layout.addWidget(self.group_chooser)

        # Start menu index.
        start_idx = -1

        # Populate the group chooser with all the existing groups.
        for idx, group in enumerate(sorted(manager.MANAGER.groups.values())):
            label = group.name

            self.group_chooser.addItem(utils.getIconFromGroup(group), label,
                                       group)

            # The group matches our start group so set the start index.
            if group == self.group:
                start_idx = idx

        if start_idx != -1:
            self.group_chooser.setCurrentIndex(start_idx)

        self.group_chooser.currentIndexChanged.connect(self.selectionChanged)

        # =====================================================================

        self.table = widgets.AOVGroupInfoTableWidget(self.group)
        layout.addWidget(self.table)

        # =====================================================================

        self.members = widgets.GroupMemberListWidget(self.group)
        layout.addWidget(self.members)

        # =====================================================================

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok)
        layout.addWidget(self.button_box)

        self.button_box.accepted.connect(self.accept)

        # Button to launch the Edit dialog on the current group.
        self.edit_button = QtWidgets.QPushButton(
            hou.qt.createIcon("BUTTONS_edit"), "Edit")

        self.edit_button.setToolTip("Edit this group.")

        # Use HelpRole to force the button to the left size of the dialog.
        self.button_box.addButton(self.edit_button,
                                  QtWidgets.QDialogButtonBox.HelpRole)
        self.edit_button.clicked.connect(self.edit)

        # =====================================================================

        self.delete_button = QtWidgets.QPushButton(
            hou.qt.createIcon("COMMON_delete"), "Delete")

        self.button_box.addButton(self.delete_button,
                                  QtWidgets.QDialogButtonBox.HelpRole)

        self.delete_button.setToolTip("Delete this group.")
        self.delete_button.clicked.connect(self.delete)

        # =====================================================================

        self.table.resizeColumnToContents(0)
        self.setMinimumSize(self.table.size())
Esempio n. 2
0
    def __init__(self, group, parent=None):
        super(AOVGroupInfoDialog, self).__init__(parent)

        self._group = group
        self._edit_dialog = None

        self.setWindowTitle("View AOV Group Info")

        # Initialize UI

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        # ---------------------------------------------------------------------

        self.group_chooser = widgets.ComboBox()
        layout.addWidget(self.group_chooser)

        # Start menu index.
        start_idx = -1

        # Populate the group chooser with all the existing groups.
        for idx, available_group in enumerate(sorted(manager.MANAGER.groups.values())):
            label = available_group.name

            self.group_chooser.addItem(
                utils.get_icon_for_group(available_group), label, available_group
            )

            # The group matches our start group so set the start index.
            if available_group == self.group:
                start_idx = idx

        if start_idx != -1:
            self.group_chooser.setCurrentIndex(start_idx)

        self.group_chooser.currentIndexChanged.connect(self.group_selection_changed)

        # ---------------------------------------------------------------------

        self.table = widgets.AOVGroupInfoTableWidget(self.group)
        layout.addWidget(self.table)

        # ---------------------------------------------------------------------

        self.members = widgets.GroupMemberListWidget(self.group)
        layout.addWidget(self.members)

        # ---------------------------------------------------------------------

        self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok)
        layout.addWidget(self.button_box)

        self.button_box.accepted.connect(self.accept)

        # Button to launch the Edit dialog on the current group.
        self.edit_button = QtWidgets.QPushButton(
            hou.qt.createIcon("BUTTONS_edit"), "Edit"
        )

        self.edit_button.setToolTip("Edit this group.")

        # Use HelpRole to force the button to the left size of the dialog.
        self.button_box.addButton(self.edit_button, QtWidgets.QDialogButtonBox.HelpRole)
        self.edit_button.clicked.connect(self.edit)

        # ---------------------------------------------------------------------

        self.delete_button = QtWidgets.QPushButton(
            hou.qt.createIcon("COMMON_delete"), "Delete"
        )

        self.button_box.addButton(
            self.delete_button, QtWidgets.QDialogButtonBox.HelpRole
        )

        self.delete_button.setToolTip("Delete this group.")
        self.delete_button.clicked.connect(self.delete)

        # ---------------------------------------------------------------------

        self.table.resizeColumnToContents(0)
        self.setMinimumSize(self.table.size())

        # ---------------------------------------------------------------------

        self.enable_edit(group)