Beispiel #1
0
    def __init__(self, active_labels=()):

        # Master list. Static list, since this popup is "modal"
        # it only exists has long as it has focus.
        self.all_scene_labels = Method.get_scene_labels()

        QtGui.QWidget.__init__(self)
        layout = QtGui.QVBoxLayout(self)
        layout.setSpacing(7)

        for o in self.all_scene_labels:
            c = QtGui.QCheckBox(o)
            c.setChecked(o in active_labels)
            c.stateChanged.connect(self._change_labels)
            layout.addWidget(c)

        self.led_new = QtGui.QLineEdit()
        self.led_new.focusOutEvent = self.focusOutEvent
        self.led_new.setPlaceholderText("New label...")
        self.led_new.returnPressed.connect(self._add_label)
        layout.addWidget(self.led_new)

        # Final Tweaks
        self.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        self.move(QtGui.QCursor.pos())
        self.setWindowTitle("Handle Labels")
        self.led_new.setFocus()
        self.show()
Beispiel #2
0
    def reload_ui(self):
        """Reloads the main list entirely."""

        # Remove all label tabs
        while self.main_tabs.count() > 2:
            self.main_tabs.removeTab(2)

        # Populate tab widget
        for label in Method.get_scene_labels():
            self.main_tabs.addTab(label)

        # Remove all current scriptjobs
        for widget in self._get_sol_widgets():
            widget.close()

        # Clear list (don't remove the bottom stretch !)
        for i in xrange(self.main_list.count(), 1, -1):
            self.main_list.itemAt(i).widget().setParent(None)

        # Show boot progress bar
        all_sol_handles = pmc.ls(type=Vars.PLUGIN_NAME)
        prg = Dialogs.ProgressDialog(len(all_sol_handles), "Sol is starting...")

        # Add existing sols to listWidget
        for o in all_sol_handles:
            self._new_handle(
                sol_data=Vars.HANDLE_DATA(
                    handle=o.getParent(),
                    node=o,
                    camera=(o.cameraMatrix.listConnections() or [None])[0],
                    light=(o.outTranslate.listConnections() or [None])[0],
                    geometry=None
                )
            )
            prg.make_progress()

        # Update all items
        self.main_stack.setCurrentIndex(int(bool(all_sol_handles)))
        self._update_combobox()
        self._update_colors()