def addmodulesBtns(self): uiScriptFile = os.path.realpath(__file__) uiScriptPath, _ = os.path.split(uiScriptFile) modulesPath = uiScriptPath.replace('ui', 'modules') moduleFiles = [ py for py in os.listdir(modulesPath) if py.endswith('.py') and '__init__' not in py ] if moduleFiles: btnWidget = QtGui.QWidget() btnModulesLayout = QtGui.QVBoxLayout() btnModulesLayout.setAlignment(QtCore.Qt.AlignTop) btnModulesLayout.setContentsMargins(5, 3, 5, 0) btnLayout = QtGui.QVBoxLayout() btnLayout.setSpacing(3) btnModulesLayout.addLayout(btnLayout) btnWidget.setLayout(btnModulesLayout) self.mb_splitLayout.addWidget(btnWidget) numBtn = len(moduleFiles) for i in range(numBtn): name = moduleFiles[i][:-3] btn = QtGui.QPushButton(name) btn.setMinimumWidth(100) btnLayout.addWidget(btn) btn.clicked.connect(self.displayModuleWidget)
def ch_addSettingsUi(self): charSettingsLayout = QtGui.QVBoxLayout() charSettingsLayout.setContentsMargins(0, 0, 0, 0) charSidesStrings = QtGui.QLineEdit('Left,Right') charSettingsLayout.addWidget(charSidesStrings) self.characterSettingWidget.setLayout(charSettingsLayout) # PyQt4 self.characterSettingWidget.setFixedHeight(30) self.ch_box.groupBox.setFixedHeight(105)
def skeleton_setupUI(self): layout = QtGui.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.skeleton_box = utils.TitledBox(title='Skeleton', settings=0) self.buildSkeletonBtn = QtGui.QPushButton('Build Skeleton') self.skeleton_box.groupBoxLayout.addWidget(self.buildSkeletonBtn) layout.addWidget(self.skeleton_box) self.skeletonWidget.setLayout(layout) self.buildSkeletonBtn.clicked.connect(self.buildModuleSkeleton)
def rig_setupUI(self): layout = QtGui.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.rig_box = utils.TitledBox(title='Rig', settings=0) layout.addWidget(self.rig_box) self.rigWidget.setLayout(layout)
def setupUI(self): mainLayout = QtGui.QVBoxLayout() self.attrlayout = utils.VertBox() self.moduleNameEdit = utils.LabelEdit(label='Module Name:') separator = QtGui.QFrame() separator.setFrameShape(QtGui.QFrame.HLine) separator.setFrameShadow(QtGui.QFrame.Sunken) self.createModuleBtn = QtGui.QPushButton('Create') self.attrlayout.addWidget(self.moduleNameEdit) mainLayout.addLayout(self.attrlayout) mainLayout.addWidget(separator) mainLayout.addWidget(self.createModuleBtn) # self.createModuleBtn.clicked.connect(self.createModule) self.setLayout(mainLayout)
def ch_setupUI(self): layout = QtGui.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.ch_box = utils.TitledBox(title='Character', settings=1) nameLayout = QtGui.QHBoxLayout() nameLabel = QtGui.QLabel('Character name') nameLabel.setMaximumWidth(80) self.charNameCombo = QtGui.QComboBox() self.charNameCombo.setEditable(1) self.ch_nameBtn = QtGui.QPushButton('Create character') nameLayout.addWidget(nameLabel) nameLayout.addWidget(self.charNameCombo) self.characterSettingWidget = QtGui.QWidget() self.characterSettingWidget.setContentsMargins(0, 0, 0, 0) self.characterSettingWidget.setFixedHeight(0) self.ch_box.groupBoxLayout.addWidget(self.characterSettingWidget) self.ch_box.groupBoxLayout.addLayout(nameLayout) self.ch_box.groupBoxLayout.addWidget(self.ch_nameBtn) layout.addWidget(self.ch_box) self.ch_settingsBtn = self.ch_box.settingsBtn self.charWidget.setLayout(layout) self.ch_nameBtn.clicked.connect(self.ch_create) self.ch_settingsBtn.clicked.connect(self.ch_toggleSettingsUi) self.charNameCombo.activated.connect(self.refreshCharacter)
def mb_setupUI(self): layout = QtGui.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.mb_splitLayout = QtGui.QSplitter(QtCore.Qt.Horizontal) self.mb_box = utils.TitledBox(title='Modules') self.mb_box.groupBoxLayout.addWidget(self.mb_splitLayout) self.addmodulesBtns() self.modulesTree = QtGui.QTreeWidget() self.modulesTree.setColumnCount(1) self.modulesTree.setHeaderHidden(1) self.modulesTree.setDragDropMode(QtGui.QAbstractItemView.InternalMove) # self.moduleAttributes = moduleWidget.ModuleAttrWidget(self) self.moduleAttributes = None self.mb_splitLayout.addWidget(self.modulesTree) # self.mb_splitLayout.addWidget(self.moduleAttributes) # self.moduleAttributes.hide() layout.addWidget(self.mb_box) self.modulesBtnWidget.setLayout(layout)
def setupUI(self): centralWidget = QtGui.QWidget() mainLayout = QtGui.QVBoxLayout() self.attrlayout = QtGui.QVBoxLayout() self.box = utils.TitledBox(title='Attributes', settings=1) self.moduleNameEdit = utils.LabelEdit(label='Module Name:') self.moduleNameEdit.edit.setText(self.moduleName.capitalize()) self.jointNumberWidget = QtGui.QWidget() self.jointNumberLayout = QtGui.QHBoxLayout() self.jointNumberLayout.setContentsMargins(10, 0, 10, 0) jointNumberLabel = QtGui.QLabel('Joint Number: ') self.jointNumberSpin = QtGui.QSpinBox() self.jointNumberSpin.setMinimum(1) self.jointNumberLayout.addWidget(jointNumberLabel) self.jointNumberLayout.addWidget(self.jointNumberSpin) self.jointNumberWidget.setLayout(self.jointNumberLayout) separator = QtGui.QFrame() separator.setFrameShape(QtGui.QFrame.HLine) separator.setFrameShadow(QtGui.QFrame.Sunken) createModuleBtn = QtGui.QPushButton('Create') # self.attrlayout.addLayout(templateNameLayout) self.attrlayout.addWidget(self.moduleNameEdit) self.attrlayout.addWidget(self.jointNumberWidget) self.box.groupBoxLayout.addLayout(self.attrlayout) self.box.groupBoxLayout.addWidget(separator) self.box.groupBoxLayout.addWidget(createModuleBtn) mainLayout.addWidget(self.box) createModuleBtn.clicked.connect(self.createModule) centralWidget.setLayout(mainLayout) self.setCentralWidget(centralWidget)
def setupUI(self): centralWidget = QtGui.QWidget() centralWidget.setMinimumWidth(350) mainLayout = QtGui.QVBoxLayout() mainLayout.setAlignment(QtCore.Qt.AlignTop) # # ----------------------------------Character Widget ----------------------------------# # self.charWidget = QtGui.QWidget() self.ch_setupUI() self.initializeChars() # # ----------------------------------Modules Widget ------------------------------------# # self.modulesBtnWidget = QtGui.QWidget() self.mb_setupUI() self.updateModulesTreeWidget() # # ----------------------------------Skeleton Widget -----------------------------------# # self.skeletonWidget = QtGui.QWidget() self.skeleton_setupUI() # # ----------------------------------Rigging Widget ------------------------------------# # self.rigWidget = QtGui.QWidget() self.rig_setupUI() # -------------------------------------------------------------------------------------# mainLayout.addWidget(self.charWidget) mainLayout.addWidget(self.modulesBtnWidget) mainLayout.addWidget(self.skeletonWidget) mainLayout.addWidget(self.rigWidget) centralWidget.setLayout(mainLayout) self.setCentralWidget(centralWidget)
def mt_appendModulesList(self, moduleName): item = QtGui.QTreeWidgetItem(self.rootItem) item.setText(0, moduleName) self.modulesTree.expandItem(self.rootItem)
def mt_setRoot(self, rootName): self.rootItem = QtGui.QTreeWidgetItem(self.modulesTree) self.rootItem.setText(0, rootName)