def initialize(self): # add validators self.data['lineedit']['x'].setValidator(QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['y'].setValidator(QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['z'].setValidator(QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['insertJoints'].setValidator(QtGui.QIntValidator(1, 100)) # set button id in buttongroups self.data['rbg']['aimAxis'].setId(self.data['radio']['aimAxisX'], 1) self.data['rbg']['aimAxis'].setId(self.data['radio']['aimAxisY'], 2) self.data['rbg']['aimAxis'].setId(self.data['radio']['aimAxisZ'], 3) self.data['rbg']['upAxis'].setId(self.data['radio']['upAxisX'], 4) self.data['rbg']['upAxis'].setId(self.data['radio']['upAxisY'], 5) self.data['rbg']['upAxis'].setId(self.data['radio']['upAxisZ'], 6) self.data['rbg']['worldUpAxis'].setId(self.data['radio']['worldUpAxisX'], 1) self.data['rbg']['worldUpAxis'].setId(self.data['radio']['worldUpAxisY'], 2) self.data['rbg']['worldUpAxis'].setId(self.data['radio']['worldUpAxisZ'], 3)
def initialize(self): # add validators self.data['lineedit']['x'].setValidator( QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['y'].setValidator( QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['z'].setValidator( QtGui.QDoubleValidator(0, 180, 2)) self.data['lineedit']['minScale'].setValidator( QtGui.QDoubleValidator(1.0, 100, 2)) self.data['lineedit']['maxScale'].setValidator( QtGui.QDoubleValidator(1.0, 100, 2)) # add buttons - add control curve dirs = os.listdir(ctrls.CONTROLS_DIRECTORY) col = 6 row = 0 count = 0 self.mapperAddCurve = QtCore.QSignalMapper() for fileName in dirs: if fileName.endswith('.json'): if count == 6: count = 0 row += 1 btn = QtWidgets.QPushButton() btn.setToolTip(fileName) iconName = fileName.replace('.json', '.png') if iconName in dirs: iconPath = os.path.join(ctrls.CONTROLS_DIRECTORY, iconName) btn.setIcon(QtGui.QIcon(iconPath)) btn.setIconSize(QtCore.QSize(30, 30)) self.data['layouts']['addCurve'].addWidget(btn, row, count) count += 1 self.mapperAddCurve.setMapping(btn, fileName) btn.clicked.connect(self.mapperAddCurve.map) self.mapperAddCurve.mapped['QString'].connect(self.addCtrlShape) # add buttons - color self.mapperColor = QtCore.QSignalMapper() col = 8 row = 0 count = 4 for i in xrange(1, 32): if count == col: count = 0 row += 1 rgb = cmds.colorIndex(i, q=True) r, g, b = rgb[0], rgb[1], rgb[2] btn = QtWidgets.QPushButton() btn.btnIndex = count btn.setAutoFillBackground(True) values = "{r}, {g}, {b}, {a}".format(r=r * 255, g=g * 255, b=b * 255, a=255) btn.setStyleSheet("QPushButton { background-color: rgba(" + values + "); }") self.data['layouts']['color'].addWidget(btn, row, count) count += 1 self.mapperColor.setMapping(btn, i) btn.clicked.connect(self.mapperColor.map) self.mapperColor.mapped['int'].connect(self.colorShapes)