def contextMenuEvent(self, event): menu = ui.QMenu(self) influence = menu.addAction("Select: Influence", partial(cmds.select, self.influence)) influence.setIcon(ui.QIcon(SELECT_ICON)) influence.setEnabled(True if self.influence else False) soft = menu.addAction("Select: Soft Selection", self.selectSoftSelection) soft.setIcon(ui.QIcon(SELECT_ICON)) soft.setEnabled(True if self.ssData else False) menu.exec_(self.mapToGlobal(event.pos()))
def __init__(self, parent): ui.QWidget.__init__(self, parent) # ui self.setParent(parent) self.setWindowFlags(ui.Qt.Window) self.setWindowTitle(WINDOW_TITLE) self.resize(300, 25) # set icon path = ui.findIcon(WINDOW_ICON) if path: self.setWindowIcon(ui.QIcon(path)) # create layout layout = ui.QVBoxLayout(self) layout.setContentsMargins(3, 3, 3, 3) layout.setSpacing(3) # create tweening self.tweening = TweeningOptions(self) layout.addWidget(self.tweening) # create button apply = ui.QPushButton(self) apply.setFont(ui.FONT) apply.setText("Apply") apply.released.connect(self.apply) layout.addWidget(apply)
def __init__(self, parent, icon): ui.QPushButton.__init__(self, parent) icon = ui.QIcon(icon) self.setIcon(icon) self.setIconSize(ui.QSize(24, 24)) self.setFixedSize(ui.QSize(24, 24))
def __init__(self, parent): ui.QWidget.__init__(self, parent) # ui self.setParent(parent) self.setWindowFlags(ui.Qt.Window) self.setWindowTitle(WINDOW_TITLE) self.resize(300, 250) # set icon path = ui.findIcon(WINDOW_ICON) if path: self.setWindowIcon(ui.QIcon(path)) # create layout layout = ui.QVBoxLayout(self) layout.setContentsMargins(3, 3, 3, 3) layout.setSpacing(3) # create add widget title = AddInfluenceWidget(self) title.addInfluence.connect(self.addInfluence) layout.addWidget(title) # create scroll scrollArea = ui.QScrollArea(self) scrollArea.setWidgetResizable(True) self.widget = ui.QWidget(self) self.layout = ui.QVBoxLayout(self.widget) scrollArea.setWidget(self.widget) layout.addWidget(scrollArea) # create filler influence self.filler = FillerInfluenceWidget(self) self.layout.addWidget(self.filler) # create spacer spacer = ui.QSpacerItem(1, 1, ui.QSizePolicy.Minimum, ui.QSizePolicy.Expanding) self.layout.addItem(spacer) self.layout.setContentsMargins(3, 3, 3, 3) self.layout.setSpacing(3) # create button button = ui.QPushButton(self) button.setText("Skin") button.setFont(ui.FONT) button.released.connect(self.skin) layout.addWidget(button) # create button self.progressBar = ui.QProgressBar(self) self.progressBar.setVisible(False) layout.addWidget(self.progressBar)
def __init__(self, parent, influence, value): ui.QWidget.__init__(self, parent) # variables self.influence = influence self.value = value isLocked = cmds.getAttr("{0}.liw".format(influence)) # create layout layout = ui.QHBoxLayout(self) layout.setContentsMargins(3, 3, 3, 3) layout.setSpacing(5) # create lock self.lock = ui.QPushButton(self) self.lock.setFlat(True) self.lock.setCheckable(True) self.lock.setIcon(ui.QIcon(LOCK_ICON.get(isLocked))) self.lock.setFixedSize(ui.QSize(18, 18)) self.lock.released.connect(self.toggleLocked) layout.addWidget(self.lock) # create label name = ui.QLabel(self) name.setText(influence) name.setFont(ui.FONT) name.setMinimumWidth(150) layout.addWidget(name) # create slider self.slider = ui.QSlider(self) self.slider.setInputMethodHints(ui.Qt.ImhNone) self.slider.setMaximum(1000) self.slider.setSingleStep(1) self.slider.setOrientation(ui.Qt.Horizontal) self.slider.valueChanged.connect(self.sliderValueChanged) layout.addWidget(self.slider) # create label self.spinbox = ui.QDoubleSpinBox(self) self.spinbox.setFont(ui.FONT) self.spinbox.setDecimals(3) self.spinbox.setRange(0, 1) self.spinbox.setSingleStep(0.001) self.spinbox.valueChanged.connect(self.spinboxValueChanged) layout.addWidget(self.spinbox) # set ui self.setValue(value) if isLocked: self.lock.setChecked(True) self.spinbox.setEnabled(False) self.slider.setEnabled(False)
def __init__(self, parent): ui.QWidget.__init__(self, parent) # ui self.setParent(parent) self.setWindowFlags(ui.Qt.Window) self.setWindowTitle(WINDOW_TITLE) self.resize(550, 350) # set icon path = ui.findIcon(WINDOW_ICON) if path: self.setWindowIcon(ui.QIcon(path)) # create layout layout = ui.QVBoxLayout(self) layout.setContentsMargins(3, 3, 3, 3) # create scroll scrollArea = ui.QScrollArea(self) scrollArea.setWidgetResizable(True) self.widget = ui.QWidget(self) self.layout = ui.QVBoxLayout(self.widget) scrollArea.setWidget(self.widget) layout.addWidget(scrollArea) # create spacer spacer = ui.QSpacerItem( 1, 1, ui.QSizePolicy.Minimum, ui.QSizePolicy.Expanding ) self.layout.addItem(spacer) self.layout.setContentsMargins(3, 3, 3, 3) self.layout.setSpacing(3) # update self.id_ = None self.registerCallback() self.selectionChanged()