def __init__(self): # Init widget QtGui.QWidget.__init__(self) layout = QtGui.QGridLayout(self) layout.setSpacing(7) # Add color buttons for i, c in enumerate(Method.get_maya_colors(css=True)): b = QtGui.QPushButton("" if i else "R") b.setStyleSheet(c) b.setFixedSize(20, 20) b.clicked.connect(lambda index=i: self.colorPicked.emit(index)) b.clicked.connect(self.close) layout.addWidget(b, i/8, i % 8) # UI Tweaks self.setStyleSheet(Vars.POPUP_STYLSHEET) self.setWindowTitle("Handle Color") self.setWindowFlags(QtCore.Qt.CustomizeWindowHint) # Show at position and focus self.move(QtGui.QCursor.pos()) self.show() self.setFocus()
def update_ui_buttons(self): """Updates this widgets' buttons icons and enable statuses.""" # Color button index = ( self.node_master.overrideEnabled.get() and self.node_master.overrideColor.get() ) self.ui_btn_color.setStyleSheet(Method.get_maya_colors(index, css=True)) self.ui_btn_color.setText("" if index else "*") # Dynamic icons self.ui_btn_lock.setIcon(Vars.ICON_LOCK[self.lock]) self.ui_btn_solo.setIcon(Vars.ICON_SOLO[self.solo]) self.ui_btn_visi.setIcon(Vars.ICON_SHOW[self.visibility]) self.ui_btn_draw.setIcon(Vars.ICON_DRAW[self.draw]) # Buttons enable self.ui_btn_sel_l.setEnabled(self.node_light is not None) self.ui_btn_solo.setEnabled(self.node_light is not None) self.ui_btn_visi.setEnabled(self.node_light is not None)