def setupUI(self): centralWidget = qt_handlers.qWidget() mainLayout = UI.VertBox() mainBox = UI.TitledBox(title='Controllers Util') nameLayout = UI.HorBox() self.ctrlNameEdit = UI.LabelEditWidget(label='Name') pickNameBtn = UI.ButtonB('<<') self.ctrlTargetPicker = UI.ObjectPickerWidget(label='Target') ctrlLayout = UI.HorBox() ctrlLayout.setAlignment(QtCore.Qt.AlignLeft) shapes = ['circle', 'box', 'square', 'joint'] self.ctrlShape = UI.LabelComboWidget(label='Shape') # self.ctrlShape.setMaximumWidth(140) self.ctrlShape.combo.addItems(shapes) attrSeparator = UI.Separator(d=1) self.ctrlScaleSlider = UI.FloatSpinWidget(label='Scale') self.ctrlScaleSlider.spin.setValue(1.0) ctrlLayout.addWidget(self.ctrlShape) ctrlLayout.addWidget(attrSeparator) ctrlLayout.addWidget(self.ctrlScaleSlider) separator = UI.Separator() btnLayout = UI.HorBox() newBtn = UI.ButtonB('create') exportBtn = UI.ButtonB('export') importBtn = UI.ButtonB('import') btnLayout.addWidget(exportBtn) btnLayout.addWidget(importBtn) separator1 = UI.Separator() titleBar = UI.TitleBar(title='Library') separator2 = UI.Separator() nameLayout.addWidget(self.ctrlNameEdit) nameLayout.addWidget(pickNameBtn) mainBox.layout.addLayout(nameLayout) mainBox.layout.addWidget(self.ctrlTargetPicker) mainBox.layout.addLayout(ctrlLayout) mainBox.layout.addWidget(separator) mainBox.layout.addWidget(newBtn) mainBox.layout.addWidget(separator1) mainBox.layout.addWidget(titleBar) mainBox.layout.addWidget(separator2) mainBox.layout.addLayout(btnLayout) newBtn.released.connect(self.createCtrl) pickNameBtn.released.connect(self.setCtrlName) exportBtn.released.connect(self.exportShape) importBtn.released.connect(self.importShape) mainLayout.addWidget(mainBox) centralWidget.setLayout(mainLayout) self.setCentralWidget(centralWidget)
def setupUI(self): mainLayout = UI.VertBox() mainBox = UI.TitledBox(title='Mappings') mainBoxLayout = UI.HorBox() unmappedLayout = UI.VertBox() separator = UI.Separator(d=1) mapBtnLayout = UI.VertBox() mapBtnLayout.setAlignment(QtCore.Qt.AlignVCenter) separator1 = UI.Separator(d=1) importedLayout = UI.VertBox() mainBoxLayout.addLayout(unmappedLayout) mainBoxLayout.addWidget(separator) mainBoxLayout.addLayout(mapBtnLayout) mainBoxLayout.addWidget(separator1) mainBoxLayout.addLayout(importedLayout) ######### label = QtWidgets.QLabel('Unmapped influences') label.setAlignment(QtCore.Qt.AlignHCenter) self.existingInfluences = QtWidgets.QListWidget() unmappedLayout.addWidget(label) unmappedLayout.addWidget(self.existingInfluences) ############### mapBtn = QtWidgets.QPushButton('>>>') mapBtn.setFixedWidth(30) mapBtn.released.connect(self.setInfluenceMapping) mapBtnLayout.addWidget(mapBtn) unmapBtn = QtWidgets.QPushButton('<<<') unmapBtn.setFixedWidth(30) unmapBtn.released.connect(self.resetInfluenceMapping) mapBtnLayout.addWidget(unmapBtn) ############# label = QtWidgets.QLabel('Available imported influences') label.setAlignment(QtCore.Qt.AlignHCenter) self.importedInfluences = QtWidgets.QListWidget() importedLayout.addWidget(label) importedLayout.addWidget(self.importedInfluences) ################ okBtn = QtWidgets.QPushButton('Ok') okBtn.clicked.connect(self.accept) mainBox.layout.addLayout(mainBoxLayout) mainLayout.addWidget(mainBox) mainLayout.addWidget(okBtn) self.setLayout(mainLayout)
def add_blueprints_ui(self): """ Sets up the Blueprint tab UI Dynamically creates the UI for the creation of the blueprints by getting a list of python files holding the blueprints from modules/blueprint Currently each blueprint module gets a button """ blueprints_layout = UI.VertBox() self.bp_box = UI.TitledBox(title='Blueprints') bp_ui_layout = QGridLayout() blueprints_list = self.get_bp_files_list() if blueprints_list: num_bp = len(blueprints_list) for i in range(num_bp): if blueprints_list[ i] != 'blueprint': # we dont need to create an UI for the blueprint base class python_module = self.import_python_module( blueprints_list[i]) if python_module: module_ui = self.create_bp_ui( mod_name=python_module.BLUEPRINT_TYPE, index=i) self.bp_modules_ui.append(module_ui) for i, m in enumerate(self.bp_modules_ui): bp_ui_layout.addWidget(m, i / 3, i % 3) btn_layout = UI.HorBox() btn_layout.setAlignment(Qt.AlignRight) edit_bp_btn = UI.ButtonB('Edit') delete_bp_btn = UI.ButtonB('Delete') delete_bp_btn.setStyleSheet( "background-color: rgb(250,10,20); font-weight: bold") btn_layout.addWidget(edit_bp_btn) btn_layout.addWidget(delete_bp_btn) self.bp_settings_ui_layout = UI.HorBox() self.bp_box.layout.addLayout(bp_ui_layout) self.bp_box.layout.addLayout(self.bp_settings_ui_layout) separator = UI.Separator() self.bp_box.layout.addWidget(separator) self.bp_box.layout.addWidget(self.bp_list) self.bp_box.layout.addLayout(btn_layout) blueprints_layout.addWidget(self.bp_box) self.bp_widget.setLayout(blueprints_layout) edit_bp_btn.released.connect(self.editSelectedBlueprint) self.bp_list.doubleClicked.connect(self.deselect_bp)
def add_char_ui(self): """ Sets up the UI for the character. Important: char_box.layout - the layout where all the widgets should be added """ char_layout = UI.VertBox() char_box = UI.TitledBox(title='Character') # self.char_settings = char_settings.CharSettingsWidget() # name_layout = UI.HorBox() self.char_name = UI.LabelEditWidget(label='Character name:', label_size=85) self.char_name.edit.setReadOnly(1) self.char_name.hide() # # name_layout.addWidget(self.char_name) # name_layout.addWidget(self.char_name_suffix) # # title = UI.TitleBar(title='Name') btn_layout = UI.HorBox() new_char_btn = UI.ButtonB('NEW') new_char_btn.setStyleSheet( "background-color: rgb(0,100,200); font-weight: bold") delete_char_btn = UI.ButtonB('Rename') btn_layout.addWidget(new_char_btn) btn_layout.addWidget(delete_char_btn) separator = UI.Separator() # char_box.layout.addWidget(self.char_settings) # char_box.layout.addWidget(title) # char_box.layout.addLayout(name_layout) char_box.layout.addWidget(self.char_name) char_box.layout.addWidget(separator) char_box.layout.addLayout(btn_layout) char_layout.addWidget(char_box) new_char_btn.clicked.connect(self.open_char_dialog) self.char_widget.setLayout(char_layout)
def setupRiggingTab(self): self.rigFunctionsInfo = self.getFunctions(rig_utils) print self.rigFunctionsInfo self.riggingWidget = QtWidgets.QWidget() layout = UI.VertBox() layout.setContentsMargins(5, 5, 5, 5) for category in self.rigFunctionsInfo.keys(): categoryWidget = QtWidgets.QWidget() categoryLayout = UI.VertBox() categoryWidget.setLayout(categoryLayout) label = QtWidgets.QLabel(category) label.setAlignment(QtCore.Qt.AlignRight) separator = UI.Separator() gridLayout = QtWidgets.QGridLayout() gridLayout.setAlignment(QtCore.Qt.AlignLeft) label.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignCenter) for item in self.rigFunctionsInfo[category]: btnName = self.niceName(item[0]) btn = QtWidgets.QPushButton(btnName) # btn.setFixedHeight(20) btn.clicked.connect( functools.partial(self.executeTool, item[1])) i = self.rigFunctionsInfo[category].index(item) gridLayout.addWidget(btn, i / 4, i % 4) categoryLayout.addWidget(label) categoryLayout.addWidget(separator) categoryLayout.addLayout(gridLayout) categoryWidget.setFixedHeight(categoryWidget.sizeHint().height()) layout.addWidget(categoryWidget) self.riggingWidget.setLayout(layout) self.riggingWidget.setFixedHeight( self.riggingWidget.sizeHint().height()) self.tabs.addTab(self.riggingWidget, 'Rigging')
def add_char_ui(self): """ Sets up the UI for the character. Important: char_box.layout - the layout where all the widgets should be added """ char_layout = UI.VertBox() char_box = UI.TitledBox(title='Character') self.char_settings = char_settings.CharSettingsWidget() name_layout = UI.HorBox() self.char_name = UI.LabelEditWidget(label='Character name:', label_size=85, edit_size=80) self.char_name_suffix = UI.LabelEditWidget(label='+', label_size=10, edit_size=40) self.char_name_suffix.edit.setText('_' + MRIGLOBALS.CHAR) name_layout.addWidget(self.char_name) name_layout.addWidget(self.char_name_suffix) title = UI.TitleBar(title='Name') btn_layout = UI.HorBox() new_char_btn = UI.ButtonB('NEW') new_char_btn.setStyleSheet("background-color: rgb(0,100,200); font-weight: bold") delete_char_btn = UI.ButtonB('Rename') btn_layout.addWidget(new_char_btn) btn_layout.addWidget(delete_char_btn) separator = UI.Separator() char_box.layout.addWidget(self.char_settings) char_box.layout.addWidget(title) char_box.layout.addLayout(name_layout) char_box.layout.addWidget(separator) char_box.layout.addLayout(btn_layout) char_layout.addWidget(char_box) new_char_btn.clicked.connect(self.create_character) self.char_widget.setLayout(char_layout)
def setupUI(self): central_widget = QtWidgets.QWidget() main_layout = UI.VertBox() main_box = UI.TitledBox(title='Browse') if len(self.char_list) > 0: self.char_combo.addItems(self.char_list) self.char_combo.activated[str].connect(self.char_combo_changed) separator = UI.Separator() char_browser_layout = UI.HorBox() self.char_browser.hide() self.char_browser.itemDoubleClicked.connect( self.char_browser_double_clicked) char_browser_layout.addWidget(self.char_browser) self.char_layout.addWidget(self.char_combo) # self.char_layout.addWidget(self.main_dir) self.char_layout.addWidget(separator) self.char_layout.addLayout(self.back_folders_layout) self.char_layout.addLayout(char_browser_layout) self.set_project_btn.clicked.connect(self.set_project_clicked) self.open_file_btn.clicked.connect(self.open_file_clicked) self.save_file_btn.clicked.connect(self.save_file_clicked) self.action_btn_layout.addWidget(self.set_project_btn) self.action_btn_layout.addWidget(self.open_file_btn) self.action_btn_layout.addWidget(self.save_file_btn) main_box.layout.addLayout(self.char_layout) main_box.layout.addLayout(self.action_btn_layout) main_layout.addWidget(main_box) central_widget.setLayout(main_layout) self.setCentralWidget(central_widget) self.char_combo_changed(self.char_combo.currentText())