def createUI(self): self.lineEdit = QtWidgets.QLineEdit() self.setButton = QtWidgets.QPushButton("Set") self.setButton.clicked.connect(self.setter) self.lockCheckBox = QtWidgets.QCheckBox("Lock") self.lockCheckBox.stateChanged.connect(self.lock) self.modeRadioGrp = QtWidgets.QButtonGroup() self.vertexMode = QtWidgets.QRadioButton('Vertex') self.normalMode = QtWidgets.QRadioButton('Normal') self.surfaceMode = QtWidgets.QRadioButton('Surface') self.normalMode.setChecked(True) self.modeRadioGrp.addButton(self.vertexMode) self.modeRadioGrp.addButton(self.normalMode) self.modeRadioGrp.addButton(self.surfaceMode) self.modeRadioGrp.setId(self.vertexMode, 1) self.modeRadioGrp.setId(self.normalMode, 2) self.modeRadioGrp.setId(self.surfaceMode, 3) self.distanceLE = QtWidgets.QLineEdit("99999") self.distanceLock = QtWidgets.QCheckBox("Lock") self.distanceLock.stateChanged.connect(self.lockDistance) self.snapButton = QtWidgets.QPushButton("Snap") self.snapButton.setFixedHeight(40) self.snapButton.clicked.connect(self.snap)
def __init__(self, *args, **kwargs): kwargs.setdefault('parent', get_parent()) super(Dialog, self).__init__(*args, **kwargs) self.swatches = Swatches(size=36, parent=self) self.outliner = QtWidgets.QCheckBox('Outliner', parent=self) self.outliner.setChecked(True) self.wireframe = QtWidgets.QCheckBox('Wireframe', parent=self) self.wireframe.setChecked(True) self.smaller = QtWidgets.QPushButton( QtGui.QIcon(util.resource('smaller.png')), '', parent=self, ) self.smaller.setFixedSize(24, 24) self.smaller.clicked.connect(self._on_smaller_clicked) self.bigger = QtWidgets.QPushButton( QtGui.QIcon(util.resource('bigger.png')), '', parent=self, ) self.bigger.setFixedSize(24, 24) self.bigger.clicked.connect(self._on_bigger_clicked) self.tools = QtWidgets.QHBoxLayout() self.tools.setAlignment(QtCore.Qt.AlignLeft) self.tools.setSpacing(0) self.tools.setContentsMargins(0, 0, 0, 0) self.tools.addWidget(self.smaller) self.tools.addWidget(self.bigger) self.form = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight) self.form.addWidget(self.outliner) self.form.addWidget(self.wireframe) self.form.addStretch(1) self.form.addLayout(self.tools) self.layout = QtWidgets.QVBoxLayout() self.layout.setAlignment(QtCore.Qt.AlignTop) self.layout.addLayout(self.form) self.layout.addWidget(self.swatches) self.setLayout(self.layout) self._mouse_pressed = False self._mouse_position = None self.setSizePolicy( QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored, ) self.setMinimumWidth(self.swatches.get_size()) self.setWindowTitle('Colorizer') self.setWindowIcon(QtGui.QIcon(util.resource('colorizer.png'))) self.setStyleSheet(self.style) self._add_swatches() self.resize(376, 150)
def build_ui(self): self.resize(400, 120) self.verticalLayout = QtWidgets.QVBoxLayout(self) self.selection_layout = QtWidgets.QHBoxLayout() self.rules_box = QtWidgets.QComboBox(self) self.selection_layout.addWidget(self.rules_box) self.refresh_button = QtWidgets.QPushButton(self) self.refresh_button.clicked.connect(self.populate_ui) self.refresh_button.setMaximumSize(QtCore.QSize(50, 16777215)) self.selection_layout.addWidget(self.refresh_button) self.verticalLayout.addLayout(self.selection_layout) self.checks_layout = QtWidgets.QHBoxLayout() self.lights_check = QtWidgets.QCheckBox(self) self.lights_check.setChecked(True) self.checks_layout.addWidget(self.lights_check) self.material_check = QtWidgets.QCheckBox(self) self.material_check.setChecked(True) self.checks_layout.addWidget(self.material_check) self.selected_check = QtWidgets.QCheckBox(self) self.checks_layout.addWidget(self.selected_check) self.verticalLayout.addLayout(self.checks_layout) self.in_render_check = QtWidgets.QCheckBox(self) self.in_render_check.setChecked(True) self.verticalLayout.addWidget(self.in_render_check) self.buttons_layout = QtWidgets.QHBoxLayout() self.convert_button = QtWidgets.QPushButton(self) self.convert_button.clicked.connect(self.convert) self.convert_button.setMinimumSize(QtCore.QSize(0, 40)) self.buttons_layout.addWidget(self.convert_button) self.editor_button = QtWidgets.QPushButton(self) self.editor_button.clicked.connect(self.editor) self.editor_button.setMinimumSize(QtCore.QSize(0, 40)) self.buttons_layout.addWidget(self.editor_button) self.verticalLayout.addLayout(self.buttons_layout) self.web_link = QtWidgets.QLabel(self) url_link1 = "<a href=\"https://www.linkedin.com/in/mahmoud-el-ashry-29324020/\" style=\"color: grey;\">'Linkedin'</a>" url_link2 = "<a href=\"https://www.artstation.com/mhdmhd\" style=\"color: grey;\">'Artsation'</a>" self.web_link.setText(url_link1 + '\t\t' + url_link2) self.web_link.setOpenExternalLinks(True) self.web_link.setAlignment(QtCore.Qt.AlignRight) self.verticalLayout.addWidget(self.web_link) self.refresh_button.setText("Refresh") self.lights_check.setText("Lights") self.material_check.setText("Materials") self.selected_check.setText("Selected Only") self.in_render_check.setText("Selected Render Engine Only") self.convert_button.setText("Convert") self.editor_button.setText("Editor")
def load_config(self): # clear asset type item self._clear() # get current project id _project_id = record.current_project_id() if not _project_id: return _project_handle = zfused_api.project.Project(_project_id) # interface _interface = record.Interface() _project_step_id = _interface.get("element_manage_project_step_id") _step_ids = _project_handle.task_step_ids("asset") if _step_ids: for _step_id in _step_ids: _step_handle = zfused_api.step.ProjectStep(_step_id) _name = _step_handle.name_code() self._step_name_id_dict[_name] = _step_id _name_checkbox = QtWidgets.QCheckBox() _name_checkbox.setText(_name) self.asset_step_checkbox_layout.addWidget(_name_checkbox) self.step_group.addButton(_name_checkbox) self._step_checkboxs.append(_name_checkbox) _name_checkbox.stateChanged.connect(self._task_step_id) if _step_id == _project_step_id: _name_checkbox.setChecked(True) self._step_changed.emit(_step_id)
def draw(self): upperLayout = QtWidgets.QHBoxLayout() upperLayout.setContentsMargins(0, 0, 0, 0) # upperLayout.setSpacing(0) self.label = QtWidgets.QLabel(self.label, self) self.label.setMinimumWidth(left_pad) self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) if self.toolTip: self.label.setToolTip(self.toolTip) self.lineEdit = QtWidgets.QCheckBox(self) self.lineEdit.setEnabled(self.enabled) self.lineEdit.setEnabled(not self.readOnly) self.lineEdit.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) upperLayout.addWidget(self.label) upperLayout.addWidget(self.lineEdit) self.setLayout(upperLayout) # Chain signals out with property name and value self.lineEdit.stateChanged.connect(lambda: self.valueChanged.emit( self.label.text(), self.lineEdit.isChecked()))
def __init__(self): super(Core_ColorCode, self).__init__() self.MODE = 0 # 0:Create New Backdrop; 1: Edit Selected Backdrop self.title = QtWidgets.QLabel("<h3>%s</h3>" % __TITLE__) self.label_mode = QtWidgets.QLabel("Create New Backdrop") self.colors = QtWidgets.QComboBox() self.model = self.colors.model() self.headers = QtWidgets.QComboBox() self.headers.addItems(sorted(HEADER_FONT_SIZE.keys())) # self.headers.addItems(sorted(HEADER_FONT_SIZE.keys(), reverse=True)) self.headers.setMaximumWidth(48) self.center = QtWidgets.QCheckBox("Center Label") self.label = QtWidgets.QLineEdit() self.label.returnPressed.connect(self.setColorCode) self.label.setPlaceholderText("Label for Backdrop") self.btn_set = QtWidgets.QPushButton("ColorCode It") self.btn_set.clicked.connect(self.setColorCode) # Add Pixmap for combobox dropdown list # Source: https://stackoverflow.com/questions/22887496/pyqt-how-to-customize-qcombobox-item-appearance for r in sorted(HEX_GROUP.keys()): if r != '*Random': item = QtGui.QStandardItem(r) thisColor = ('#%s' % HEX_GROUP[r][1]) thisPixmap = QtGui.QPixmap(26,26) thisPixmap.fill(thisColor) item.setData(QtGui.QIcon(thisPixmap), QtCore.Qt.DecorationRole) self.model.appendRow(item) rand_item = QtGui.QStandardItem('*Random') rand_thisPixmap = QtGui.QPixmap(26,26) rand_thisPixmap.fill("#222") rand_item.setData(QtGui.QIcon(rand_thisPixmap), QtCore.Qt.DecorationRole) self.model.appendRow(rand_item) self.layout_master = QtWidgets.QVBoxLayout() self.layout_options = QtWidgets.QHBoxLayout() self.setLayout(self.layout_master) self.layout_options.addWidget(self.colors) self.layout_options.addWidget(self.headers) self.layout_options.addWidget(self.center) self.layout_master.addWidget(self.title) self.layout_master.addWidget(self.label_mode) self.layout_master.addLayout(self.layout_options) self.layout_master.addWidget(self.label) self.layout_master.addWidget(self.btn_set) # Set Taborder self.setTabOrder(self.colors, self.label) self.setTabOrder(self.label, self.btn_set) # self.setFixedWidth(150) self.setWindowTitle(__TITLE__) self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.Popup)
def buildUI(self): layout = QtWidgets.QGridLayout(self) self.name = QtWidgets.QCheckBox(str(self.light.getTransform())) self.name.setChecked(self.light.visibility.get()) self.name.toggled.connect(lambda val: self.light.visibility.set(val)) layout.addWidget(self.name, 0, 0) soloBtn = QtWidgets.QPushButton('Solo') soloBtn.setCheckable(True) soloBtn.toggled.connect(lambda val: self.onSolo.emit(val)) layout.addWidget(soloBtn, 0, 1) deleteBtn = QtWidgets.QPushButton('X') deleteBtn.clicked.connect(self.deleteLight) deleteBtn.setMaximumWidth(10) layout.addWidget(deleteBtn, 0, 2) intensity = QtWidgets.QSlider(QtCore.Qt.Horizontal) intensity.setMinimum(1) intensity.setMaximum(1000) intensity.setValue(self.light.intensity.get()) intensity.valueChanged.connect( lambda val: self.light.intensity.set(val)) layout.addWidget(intensity, 1, 0, 1, 2) self.colorBtn = QtWidgets.QPushButton() self.colorBtn.setMaximumWidth(20) self.colorBtn.setMaximumHeight(20) self.setButtonColor() self.colorBtn.clicked.connect(self.setColor) layout.addWidget(self.colorBtn, 1, 2)
def _build(self): _layout = QtWidgets.QVBoxLayout(self) _layout.setSpacing(2) # 操作窗口 self.operation_widget = QtWidgets.QFrame() _layout.addWidget(self.operation_widget) self.operation_widget.setFixedHeight(30) self.operation_widget.setObjectName("operation_widget") self.operation_layout = QtWidgets.QHBoxLayout(self.operation_widget) self.operation_layout.setContentsMargins(0, 0, 0, 0) # show verison self.verison_checkbox = QtWidgets.QCheckBox() self.verison_checkbox.setText("只显示带有版本的") self.verison_checkbox.setChecked(True) self.operation_layout.addWidget(self.verison_checkbox) self.operation_layout.addStretch(True) # refresh button self.refresh_button = button.IconButton( self, resource.get("icons", "refresh.png"), resource.get("icons", "refresh_hover.png"), resource.get("icons", "refresh_pressed.png")) self.refresh_button.setFixedSize(60, 24) self.refresh_button.setText(u"刷新") self.operation_layout.addWidget(self.refresh_button) # 分割窗口 self.splitter = QtWidgets.QSplitter() _layout.addWidget(self.splitter) # 过滤面板 self.filter_widget = filterwidget.FilterWidget(self.splitter) self.filter_widget.setMaximumWidth(200) # 资产列表面板 self.assembly_list_widget = assemblylistwidget.AssemblyListWidget( self.splitter)
def build_ui(self): """Build the Plug-in UI and append it to the main ui as a tab.""" # TODO (eze): add a QtLineEdit where to add the arguments list self.plugin_layout = QtWidgets.QWidget() main_layout = QtWidgets.QVBoxLayout() txmake_layout = QtWidgets.QVBoxLayout() # Create UI widgets # txmake colors self.lbl_txmake = QtWidgets.QLabel( "Convert Textures to .tex renderman format") self.lbl_extension = QtWidgets.QLabel("file extension search") self.line_extension = QtWidgets.QLineEdit(".exr") self.lbl_arguments = QtWidgets.QLabel("comma separated arguments") self.line_arguments = QtWidgets.QLineEdit("") self.cbox_recursive = QtWidgets.QCheckBox("search subdirectories") self.btn_txmake = QtWidgets.QPushButton("Select a folder") # Attach widgets to the main layout main_layout.addWidget(self.lbl_txmake) main_layout.addLayout(txmake_layout) main_layout.setAlignment(QtCore.Qt.AlignTop) txmake_layout.addWidget(self.lbl_extension) txmake_layout.addWidget(self.line_extension) txmake_layout.addWidget(self.lbl_arguments) txmake_layout.addWidget(self.line_arguments) txmake_layout.addWidget(self.cbox_recursive) txmake_layout.addWidget(self.btn_txmake) # Set main layout self.plugin_layout.setLayout(main_layout) # Connect buttons signals self.btn_txmake.clicked.connect(self.run)
def __init__(self, parent=None): super(PropertiesWidget, self).__init__(parent) self.setWindowTitle("Properties view") self.mainLayout = QtWidgets.QVBoxLayout(self) self.mainLayout.setObjectName("propertiesMainLayout") self.mainLayout.setContentsMargins(2, 2, 2, 2) self.searchBox = QtWidgets.QLineEdit(self) self.searchBox.setObjectName("lineEdit") self.searchBox.setPlaceholderText(str("search...")) self.searchBox.textChanged.connect(self.searchTextChanged) self.searchBoxWidget = QtWidgets.QWidget() self.searchBoxLayout = QtWidgets.QHBoxLayout(self.searchBoxWidget) self.searchBoxLayout.setContentsMargins(1, 1, 1, 1) self.searchBoxLayout.addWidget(self.searchBox) self.lockCheckBox = QtWidgets.QCheckBox() self.lockCheckBox.setStyleSheet(lockUnlockCheckboxStyle) self.searchBoxLayout.addWidget(self.lockCheckBox) self.tearOffCopy = QtWidgets.QPushButton() self.tearOffCopy.setStyleSheet("") self.tearOffCopy.setFlat(True) self.tearOffCopy.setIcon(QtGui.QIcon(RESOURCES_DIR + "/tear_off_copy.png")) self.tearOffCopy.clicked.connect(self.spawnDuplicate.emit) self.searchBoxLayout.addWidget(self.tearOffCopy) self.mainLayout.addWidget(self.searchBoxWidget) self.searchBoxWidget.hide() self.contentLayout = QtWidgets.QVBoxLayout() self.contentLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize) self.mainLayout.addLayout(self.contentLayout) self.spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.mainLayout.addItem(self.spacerItem) self.mainLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize) self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding))
def initialize(self): layout = QtWidgets.QVBoxLayout() self.setLayout(layout) self.line = QtWidgets.QLineEdit() self.btn = QtWidgets.QPushButton("change enable") self.label = QtWidgets.QLabel() self.cb = QtWidgets.QCheckBox("disable") self.label2 = QtWidgets.QLabel() self.combo = QtWidgets.QComboBox() self.combo.setModel(self.state.data_list) # self.combo.addItem(self.state.text) layout.addWidget(self.btn) layout.addWidget(self.line) layout.addWidget(self.label) layout.addWidget(self.cb) layout.addWidget(self.combo) layout.addWidget(self.label2) self.line.setText(lambda: self.state.text2) self.label.setText(lambda: "{text2} {enable}".format( text2=self.state.text2, enable=self.state.enable)) self.label2.setText(lambda: str(self.state.data_list)) self.cb.setChecked(lambda: self.state.enable) # self.line.textChanged.connect(self.modify) self.btn.clicked.connect(self.clickEvent)
def preflight_item(self, label, func_check, func_fix, func_c, set_checked=True): widget = QtWidgets.QWidget() horizontal_layout = QtWidgets.QHBoxLayout(widget) widget.setStatusTip('False') self.checkbox_name = QtWidgets.QCheckBox() self.checkbox_name.setText(label) self.checkbox_name.setObjectName(label) self.checkbox_name.setChecked(set_checked) spaceritem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) pushbutton_a = self.create_button(func_check, self.button_a) pushbutton_b = self.create_button(func_fix, self.button_b) pushbutton_c = self.create_button(func_c, self.button_c) horizontal_layout.addWidget(self.checkbox_name) horizontal_layout.addItem(spaceritem) horizontal_layout.addWidget(pushbutton_a) horizontal_layout.addWidget(pushbutton_b) horizontal_layout.addWidget(pushbutton_c) return widget
def __init__(self, *args, **kwargs): super(MatteLoadDialog, self).__init__(*args, **kwargs) self.label = QtWidgets.QLabel('Load selected mattes') self.matte_list = MatteList() self.matte_list.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.ignore_namespaces = QtWidgets.QCheckBox('ignore namespaces') self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Apply | QtWidgets.QDialogButtonBox.Cancel) self.button_box.button( QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.accept) self.button_box.rejected.connect(self.reject) self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.label) self.layout.addWidget(self.matte_list) self.layout.addWidget(self.ignore_namespaces) self.layout.addWidget(self.button_box) self.setLayout(self.layout) self.setWindowTitle('Load Matte AOVS')
def __init__(self, parent=None): super(PublishListWidgetItem, self).__init__(parent) # set label self.allLayout = QtWidgets.QHBoxLayout() self.textLabel = QtWidgets.QLabel() self.descriptionLabel = QtWidgets.QLabel() self.descriptionLabel.setStyleSheet('color: rgb(%s, %s, %s);' % (100, 100, 100)) # checkBox self.checkBox = QtWidgets.QCheckBox() self.checkBox.setCheckState(QtCore.Qt.Checked) # set icon self.iconQLabel = QtWidgets.QLabel() self.spacerItem = QtWidgets.QSpacerItem( 40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.allLayout.addWidget(self.checkBox, 0, 0) self.allLayout.addWidget(self.iconQLabel, 0, 1) self.allLayout.addWidget(self.textLabel, 0, 2) self.allLayout.addWidget(self.descriptionLabel, 2, 3) self.allLayout.addItem(self.spacerItem) self.allLayout.setContentsMargins(2, 2, 2, 2) self.setLayout(self.allLayout) # set font font = QtGui.QFont() font.setPointSize(9) font.setItalic(True) self.descriptionLabel.setFont(font)
def __init__(self): super(RecieptBuddy_BillPreview,self).__init__() self.fileWatcher = QtCore.QFileSystemWatcher() self.recieptParser = RecieptParser.Parser() self.uiScrollArea = QtWidgets.QScrollArea() self.lblBill = QtWidgets.QLabel() self.uiItemized = QtWidgets.QCheckBox('Itemized') # widget settings self.uiScrollArea.setWidgetResizable(True) self.layMain = QtWidgets.QVBoxLayout() self.layBillGroup = QtWidgets.QVBoxLayout() self.layMain.addWidget(self.uiScrollArea) self.layMain.addWidget(self.uiItemized) self.uiScrollArea.setWidget(self.lblBill) self.setLayout(self.layMain) self.uiItemized.stateChanged.connect(self.toggleItimized) self.fileWatcher.fileChanged.connect(self.updatePreview)
def __init__(self, layer, parent=None): ''' Parameters ---------- layer : Sdf.Layer parent : Optional[QtGui.QWidget] ''' super(LayerTextViewDialog, self).__init__(parent=parent) self.layer = layer self.setWindowTitle('Layer: %s' % layer.identifier) layout = QtWidgets.QVBoxLayout(self) self.textArea = QtWidgets.QPlainTextEdit(self) self.editableCheckBox = QtWidgets.QCheckBox('Unlock for Editing') self.editableCheckBox.stateChanged.connect(self.setEditable) layout.addWidget(self.editableCheckBox) layout.addWidget(self.textArea) buttonLayout = QtWidgets.QHBoxLayout() refreshButton = QtWidgets.QPushButton('Reload', parent=self) refreshButton.clicked.connect(self.refresh) buttonLayout.addWidget(refreshButton) self.saveButton = QtWidgets.QPushButton('Apply', parent=self) self.saveButton.clicked.connect(self.save) buttonLayout.addWidget(self.saveButton) layout.addLayout(buttonLayout) self.editableCheckBox.setChecked(False) self.setEditable(False) self.resize(800, 600)
def addOutputFunc(self, name=None, x=None, y=None, hide=False): if not name: name = 'o_pin' + str(self.outputCounter) if x is None: x = '40' if y is None: y = self.outputCounter * 20 outputInstance = QtWidgets.QWidget() outputInstance_layout = QtWidgets.QHBoxLayout() text_name = QtWidgets.QLineEdit(name) font = QtGui.QFont() font.setFamily('Lucida') font.setFixedPitch(True) font.setPointSize(12) text_name.setFont(font) outputInstance_layout.addWidget(text_name) text_x = QtWidgets.QLineEdit(str(x)) font = QtGui.QFont() font.setFamily('Lucida') font.setFixedPitch(True) font.setPointSize(12) text_x.setFont(font) outputInstance_layout.addWidget(text_x) text_y = QtWidgets.QLineEdit(str(y)) font = QtGui.QFont() font.setFamily('Lucida') font.setFixedPitch(True) font.setPointSize(12) text_y.setFont(font) outputInstance_layout.addWidget(text_y) outputHide = QtWidgets.QCheckBox() outputHide.setChecked(hide) outputInstance_layout.addWidget(outputHide) removeButton = QtWidgets.QPushButton('Remove') def getFunction(inputInstance, element): def removeInp(): self.output_layout.removeWidget(outputInstance) self.outputInstances.remove(element) self.outputCounter -= 1 return removeInp removeButton.clicked.connect( getFunction(outputInstance, (text_name, text_x, text_y, outputHide))) outputInstance_layout.addWidget(removeButton) outputInstance.setLayout(outputInstance_layout) self.output_layout.addWidget(outputInstance) self.outputInstances.append((text_name, text_x, text_y, outputHide)) self.outputCounter += 1
def __init__(self): super(CreateAssetsUi, self).__init__() self.msg = Message() # self.screenshots_label = QtWidgets.QLabel(u'截图') self.screenshots_btn = ThumbnailWidget() self.name_label = QtWidgets.QLabel(u'Name') self.name_input = QtWidgets.QLineEdit(u"") self.file_name_label = QtWidgets.QLabel(u'fileName') self.file_name_input = QtWidgets.QLineEdit(u"") self.comment_label = QtWidgets.QLabel(u'Comment') self.comment_edit = QtWidgets.QTextEdit() self.box_export_ma = CheckBox(u'MaYa Export Ma') self.box_export_ma.toggle() self.box_export_ma.setTristate(False) self.box_export_ma.setCheckState(QtCore.Qt.PartiallyChecked) # self.box_export_mb = QtWidgets.QCheckBox(u'MaYa Export Mb', self) self.box_export_fbx = QtWidgets.QCheckBox(u'MaYa Export Fbx', self) self.box_export_abc = QtWidgets.QCheckBox(u'MaYa Export Abc', self) self.box_export_obj = QtWidgets.QCheckBox(u'MaYa Export obj', self) # self.box_export_proxy = QtWidgets.QCheckBox(u'MaYa Export proxy', self) self.create_btn = QtWidgets.QPushButton(u"create") self.create_btn.clicked.connect(self.create_assets) grid = QtWidgets.QGridLayout() grid.addWidget(self.screenshots_btn, 1, 0, 2, 2) grid.addWidget(self.name_label, 3, 0) grid.addWidget(self.name_input, 3, 1) grid.addWidget(self.file_name_label, 4, 0) grid.addWidget(self.file_name_input, 4, 1) grid.addWidget(self.comment_label, 5, 0) grid.addWidget(self.comment_edit, 6, 0, 2, 2) grid.addWidget(self.box_export_ma, 9, 0) # grid.addWidget(self.box_export_mb, 9, 0) grid.addWidget(self.box_export_fbx, 10, 0) grid.addWidget(self.box_export_abc, 11, 0) grid.addWidget(self.box_export_obj, 12, 0) # grid.addWidget(self.box_export_proxy, 13, 0) grid.addWidget(self.create_btn, 14, 0, 1, 3) self.setLayout(grid) self.setWindowTitle('grid layout') self.resize(200, 300)
def setupUi(self, TodoItem): TodoItem.setObjectName("TodoItem") TodoItem.resize(489, 101) TodoItem.setStyleSheet("") TodoItem.setWindowFilePath("") self.horizontalLayout = QtWidgets.QHBoxLayout(TodoItem) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.TodoItemBorder = QtWidgets.QWidget(TodoItem) self.TodoItemBorder.setStyleSheet( "#TodoItemBorder{border-bottom:1px solid lightgray;}") self.TodoItemBorder.setObjectName("TodoItemBorder") self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.TodoItemBorder) self.horizontalLayout_2.setContentsMargins(0, 9, 0, 9) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.horizontalWidget = QtWidgets.QWidget(self.TodoItemBorder) self.horizontalWidget.setObjectName("horizontalWidget") self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.horizontalWidget) self.horizontalLayout_3.setContentsMargins(-1, 0, -1, 0) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.ItemCheck = QtWidgets.QCheckBox(self.horizontalWidget) self.ItemCheck.setStyleSheet("") self.ItemCheck.setText("") self.ItemCheck.setObjectName("ItemCheck") self.horizontalLayout_3.addWidget(self.ItemCheck) self.ItemText = EditableLabel(self.horizontalWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.ItemText.sizePolicy().hasHeightForWidth()) self.ItemText.setSizePolicy(sizePolicy) self.ItemText.setObjectName("ItemText") self.horizontalLayout_3.addWidget(self.ItemText) self.ItemDelete = QtWidgets.QPushButton(self.horizontalWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.ItemDelete.sizePolicy().hasHeightForWidth()) self.ItemDelete.setSizePolicy(sizePolicy) self.ItemDelete.setMaximumSize(QtCore.QSize(15, 15)) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.ItemDelete.setFont(font) self.ItemDelete.setStyleSheet("color:#cc9a9a") self.ItemDelete.setFlat(True) self.ItemDelete.setObjectName("ItemDelete") self.horizontalLayout_3.addWidget(self.ItemDelete) self.horizontalLayout_2.addWidget(self.horizontalWidget) self.horizontalLayout.addWidget(self.TodoItemBorder) self.retranslateUi(TodoItem) QtCore.QMetaObject.connectSlotsByName(TodoItem)
def launch_yes_no_dialog(title, message, show_not_again_checkbox=True, parent=None): ''' Launch a dialog box that has "yes" and "no" buttons. Optionally display a checkbox that asks whether to show this dialog box again. return the result of this dialog (True/False) and whether the user checked on the "Don't ask again" checkbox (True/False). ''' dialog = QtWidgets.QDialog(parent=parent) dialog.setWindowTitle(title) dialog.verticalLayout = QtWidgets.QVBoxLayout(dialog) # Create the dialogs main message (Qlabel) dialog.label = QtWidgets.QLabel(dialog) dialog.label.setAlignment(QtCore.Qt.AlignCenter) dialog.label.setTextInteractionFlags(dialog.label.textInteractionFlags() | QtCore.Qt.TextBrowserInteraction) dialog.label.setTextFormat(QtCore.Qt.RichText) dialog.label.setOpenExternalLinks(True) dialog.label.setText(message) dialog.verticalLayout.addWidget(dialog.label) dialog.widget = QtWidgets.QWidget(dialog) dialog.horizontalLayout = QtWidgets.QHBoxLayout(dialog.widget) dialog.horizontalLayout.setContentsMargins(-1, -1, -1, 0) dialog.horizontalLayout.setObjectName("horizontalLayout") dialog.verticalLayout.addWidget(dialog.widget) # Create the "Don\t ask again" checkbox dialog.checkBox = QtWidgets.QCheckBox(dialog.widget) dialog.checkBox.setText("Don\'t ask again") dialog.horizontalLayout.addWidget(dialog.checkBox) # Create the buttonbox with "yes" and "no buttons" dialog.buttonBox = QtWidgets.QDialogButtonBox(dialog.widget) dialog.buttonBox.setOrientation(QtCore.Qt.Horizontal) dialog.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Yes) dialog.horizontalLayout.addWidget(dialog.buttonBox) # Connect the buttonbox signals dialog.buttonBox.accepted.connect(dialog.accept) dialog.buttonBox.rejected.connect(dialog.reject) QtCore.QMetaObject.connectSlotsByName(dialog) # Hide the checkbox if not desired if not show_not_again_checkbox: dialog.checkBox.hide() # Resize the dialog box to scale to its contents dialog.adjustSize() # Launch the dialog yes = dialog.exec_() dont_notify_again = dialog.checkBox.isChecked() return bool(yes), dont_notify_again
def _build(self): self.resize(600,600) #self.set_title_name("检查场景(check scene)") # scroll widget self.scroll_widget = QtWidgets.QScrollArea() self.scroll_widget.setWidgetResizable(True) self.scroll_widget.setBackgroundRole(QtGui.QPalette.NoRole) self.scroll_widget.setFrameShape(QtWidgets.QFrame.NoFrame) self.bodyWidget = QtWidgets.QFrame() self.scroll_widget.setWidget(self.bodyWidget) layout = QtWidgets.QVBoxLayout(self.bodyWidget) layout.setContentsMargins(4,4,4,4) self.bodyLayout = QtWidgets.QVBoxLayout(self.bodyWidget) self.bodyLayout.setContentsMargins(8,8,8,8) layout.addLayout(self.bodyLayout) layout.addStretch() # auto recheck button self.recheck_widget = QtWidgets.QWidget() self.recheck_layout = QtWidgets.QHBoxLayout(self.recheck_widget) self.recheck_layout.setSpacing(4) self.recheck_layout.setContentsMargins(0,0,0,0) # show all item widget self.show_all_checkbox = QtWidgets.QCheckBox() self.show_all_checkbox.setText(u"显示所有检查面板") self.recheck_layout.addWidget(self.show_all_checkbox) self.recheck_layout.addStretch(True) # auto checkbox self.autoClearCheckBox = QtWidgets.QCheckBox() self.recheck_layout.addWidget(self.autoClearCheckBox) self.autoClearCheckBox.setText(u"自动清理") # recheck button self.recheck_button = QtWidgets.QPushButton() self.recheck_button.setMinimumSize(100,30) self.recheck_layout.addWidget(self.recheck_button) self.recheck_button.setText(u"重新检查") self.set_central_widget(self.scroll_widget) self.set_tail_widget(self.recheck_widget)
def __init__(self, parent, value, *args, **kwargs): super(BoolWidget, self).__init__(parent, value, *args, **kwargs) self.setLayout(QtWidgets.QHBoxLayout(self)) self.layout().setContentsMargins(0, 0, 0, 0) self.checkbox = QtWidgets.QCheckBox(self) self.checkbox.setCheckState( QtCore.Qt.Checked if value else QtCore.Qt.Unchecked) self.layout().addWidget(self.checkbox) if self.plug is not None: self.checkbox.stateChanged.connect(self.set_plug_value)
def __init__(self,**kwargs): super(GroceryItemWidget,self).__init__() self.note = '' # Data self.billingActions = [] # Widget Construction self.lblItemName = QtWidgets.QLabel('Item Name:') self.uiItemName = QtWidgets.QLineEdit() self.lblPrice = QtWidgets.QLabel('Price:') self.uiPrice = QtWidgets.QDoubleSpinBox() self.lblCRV = QtWidgets.QLabel('CRV:') self.uiCRV = QtWidgets.QDoubleSpinBox() self.uiBillTo = QtWidgets.QPushButton('Add Bill Recipient:') self.uiBillToMenu = QtWidgets.QMenu() self.lblBillist = QtWidgets.QLabel() self.uiTaxable = QtWidgets.QCheckBox('Taxable') self.uiEditNote = QtWidgets.QPushButton() # Widget settings self.uiBillTo.setMenu(self.uiBillToMenu) for k in sorted(BillTo.keys()): action = QtWidgets.QAction(BillTo[k],self) action.setCheckable(True) action.triggered.connect(self.updateBillToList) self.uiBillToMenu.addAction(action) self.billingActions.append(action) self.uiEditNote.setIcon(StyleUtils.getIcon('edit')) self.uiEditNote.setToolTip('View/Edit Notes') # Layout Creation self.layMain = QtWidgets.QHBoxLayout() for widge in [ self.lblItemName, self.uiItemName, self.lblPrice, self.uiPrice, self.lblCRV, self.uiCRV, self.uiTaxable, self.uiBillTo, self.lblBillist, self.uiEditNote ]: self.layMain.addWidget(widge) self.setLayout(self.layMain) self.uiItemName.textEdited.connect(self.itemUpdated.emit) self.uiPrice.valueChanged.connect(self.itemUpdated.emit) self.uiCRV.valueChanged.connect(self.itemUpdated.emit) self.uiTaxable.stateChanged.connect(self.itemUpdated.emit) self.uiEditNote.clicked.connect(self.addNote)
def __init__(self, controller, parent=None): '''Create the base window and its child widgets. By default, when the GUI loads, it is set to selection mode. Args: controller (BehaviorControl): A environment controller. Basically, any function that is unique to a particular DCC like "get_selection", "set_info" is put here. parent (:obj:`<QtCore.QObject>`, optional): Qt-based associated object. Default is None. Raises: RuntimeError: If the up-arrow button doesn't exist. ''' super(AssignmentManagerWidget, self).__init__(parent=parent) self.controller = controller self.loaded_object = None self._current_mode = self.selection_mode_label self.setLayout(QtWidgets.QVBoxLayout()) self.autopair_check_box = QtWidgets.QCheckBox('Auto-Pair') self.mode_button = QtWidgets.QPushButton(self.selection_mode_label) self.loaded_object_widget = QtWidgets.QLineEdit() self.loaded_object_label = QtWidgets.QLabel('Loaded object:') self.manager = DirectionPad() self.assignment_info_widget = visibility_widget.ExpandCollapseWidget( 'Assignment Info') self.layout().addWidget(self.mode_button) self.layout().addStretch(1) self.load_widget = QtWidgets.QWidget() self.load_widget.setLayout(QtWidgets.QHBoxLayout()) self.load_widget.layout().addWidget(self.loaded_object_label) self.load_widget.layout().addWidget(self.loaded_object_widget) self.layout().addWidget(self.load_widget) self.layout().addWidget(self.manager) self.layout().addWidget(self.assignment_info_widget) # Put the "Auto-Pair" checkbox widget next to the up-direction button index = self.manager.direction_layout.indexOf( self.manager.directions['up']) if index == -1: raise RuntimeError('No up arrow widget could be found') row, column, _, _ = self.manager.direction_layout.getItemPosition( index) self.manager.direction_layout.addWidget(self.autopair_check_box, row, column + 1) self.init_default_settings() self.init_interactive_settings()
def list_asset(self): assetDict = self.get_assets() self.ui.tableWidget.blockSignals(True) ui_wrapper.clear_table(self.ui.tableWidget) project = str(self.ui.project_comboBox.currentText()) step = str(self.ui.dept_comboBox.currentText()) for row, value in assetDict.iteritems(): baseColor = [255, 255, 255] assetColor = [255, 255, 255] if isMaya: assetColor = [0, 0, 0] baseColor = [0, 0, 0] if value.get('duplicated'): assetColor = [255, 200, 200] if isMaya: assetColor = [100, 0, 0] # asset logger.debug(value.get('type')) logger.debug(value.get('subType')) logger.debug(value.get('asset')) asset = path_info.PathInfo(project=project, entity='asset', entitySub1=value.get('type'), entitySub2=value.get('subType'), name=value.get('asset'), step=step) ui_wrapper.insert_row(self.ui.tableWidget, row, height=20) ui_wrapper.fill_table(self.ui.tableWidget, row, self.columnName.index('Asset Name'), value.get('asset'), iconPath='', color=assetColor) ui_wrapper.fill_table(self.ui.tableWidget, row, self.columnName.index('Type'), value.get('type'), iconPath='', color=baseColor) ui_wrapper.fill_table(self.ui.tableWidget, row, self.columnName.index('SubType'), value.get('subType'), iconPath='', color=baseColor) ui_wrapper.fill_table(self.ui.tableWidget, row, self.columnName.index('Source'), '', iconPath='', color=baseColor) ui_wrapper.fill_table(self.ui.tableWidget, row, self.columnName.index('Status'), '', iconPath='', color=baseColor) # checkBox checkBox = QtWidgets.QCheckBox() self.ui.tableWidget.setCellWidget(row, self.columnName.index('Select'), checkBox) # res comboBox resComboBox = QtWidgets.QComboBox() resComboBox.addItems(self.res) resComboBox.setCurrentIndex(self.res.index(self.resDefault)) self.ui.tableWidget.setCellWidget(row, self.columnName.index('res'), resComboBox) resComboBox.currentIndexChanged.connect(partial(self.set_dst_status, row, asset)) # set file target status self.set_dst_status(row, asset) # resize to fit contents self.ui.tableWidget.resizeColumnToContents(self.columnName.index('Select')) self.ui.tableWidget.resizeColumnToContents(self.columnName.index('res')) self.ui.tableWidget.resizeColumnToContents(self.columnName.index('Target')) self.ui.tableWidget.blockSignals(False)
def create_gui(self): self.chbx_groups = QtWidgets.QCheckBox('Groups') self.chbx_groups.toggle() self.create_items1.append(self.chbx_groups) self.chbx_point_groups = QtWidgets.QCheckBox('Point Groups') self.chbx_point_groups.toggle() self.create_items1.append(self.chbx_point_groups) self.chbx_materials = QtWidgets.QCheckBox('Materials') self.chbx_materials.toggle() self.create_items1.append(self.chbx_materials) self.chbx_smoothing = QtWidgets.QCheckBox('Smoothing') self.chbx_smoothing.toggle() self.create_items2.append(self.chbx_smoothing) self.chbx_normals = QtWidgets.QCheckBox('Constraints') self.chbx_normals.toggle() self.create_items2.append(self.chbx_normals)
def load_project_id(self, project_id): # clear asset type item self._clear() # get current project id if not project_id: return self._project_id = project_id # asset type _project = zfused_api.project.Project(self._project_id) _asset_type_ids = _project.asset_type_ids() if _asset_type_ids: for _asset_type_id in _asset_type_ids: _asset_type_handle = zfused_api.types.Types(_asset_type_id) _name = _asset_type_handle.name_code() self._type_name_id_dict[_name] = _asset_type_id _name_checkbox = QtWidgets.QCheckBox() _name_checkbox.setText(_name) # _name_checkbox.setStyleSheet("color:{}".format(_asset_type_handle.color())) self.filter_type_checkbox_layout.addWidget(_name_checkbox) self._type_checkboxs.append(_name_checkbox) _name_checkbox.stateChanged.connect(self._asset_type_ids) # # interface # _interface = record.Interface() # _project_step_id = _interface.get("asset_manage_project_step_id") # asset task step _step_ids = _project.task_step_ids("asset") if _step_ids: for _step_id in _step_ids: _step_handle = zfused_api.step.ProjectStep(_step_id) _name = _step_handle.name_code() self._step_name_id_dict[_name] = _step_id _name_checkbox = QtWidgets.QCheckBox() _name_checkbox.setText(_name) # _name_checkbox.setStyleSheet("color:{}".format(_step_handle.color())) self.step_checkbox_layout.addWidget(_name_checkbox) self.step_group.addButton(_name_checkbox) self._step_checkboxs.append(_name_checkbox) _name_checkbox.stateChanged.connect(self._asset_task_step_id)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(247, 197) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.line_23 = QtWidgets.QFrame(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_23.sizePolicy().hasHeightForWidth()) self.line_23.setSizePolicy(sizePolicy) self.line_23.setFrameShape(QtWidgets.QFrame.HLine) self.line_23.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_23.setObjectName("line_23") self.horizontalLayout_2.addWidget(self.line_23) self.character_fkik_label = QtWidgets.QLabel(self.centralwidget) self.character_fkik_label.setObjectName("character_fkik_label") self.horizontalLayout_2.addWidget(self.character_fkik_label) self.line_2 = QtWidgets.QFrame(self.centralwidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.line_2.sizePolicy().hasHeightForWidth()) self.line_2.setSizePolicy(sizePolicy) self.line_2.setFrameShape(QtWidgets.QFrame.HLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.horizontalLayout_2.addWidget(self.line_2) self.verticalLayout.addLayout(self.horizontalLayout_2) self.checkBox = QtWidgets.QCheckBox(self.centralwidget) self.checkBox.setChecked(True) self.checkBox.setObjectName("checkBox") self.verticalLayout.addWidget(self.checkBox) self.listWidget = QtWidgets.QListWidget(self.centralwidget) self.listWidget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.listWidget.setObjectName("listWidget") self.verticalLayout.addWidget(self.listWidget) self.pushButton = QtWidgets.QPushButton(self.centralwidget) self.pushButton.setObjectName("pushButton") self.verticalLayout.addWidget(self.pushButton) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent=None, name='', label='', text='', state=False): super(NodeCheckBox, self).__init__(parent, name, label) _cbox = QtWidgets.QCheckBox(text) _cbox.setChecked(state) _cbox.setMinimumWidth(80) font = _cbox.font() font.setPointSize(11) _cbox.setFont(font) _cbox.stateChanged.connect(self.on_value_changed) self.set_custom_widget(_cbox) self.widget().setMaximumWidth(140)
def __init__(self, name, enable=True, abc_option=True, arnold_option=True): super(MotionItem, self).__init__() self.label = QtWidgets.QLabel(name) self.checkbox = QtWidgets.QCheckBox("Export") self.abc_box = QtWidgets.QCheckBox('Abc') self.arnold_box = QtWidgets.QCheckBox('Arnold') for each_box in [self.abc_box, self.arnold_box]: each_box.setDisabled(True) self.abc_option = abc_option self.arnold_option = arnold_option if enable: self.checkbox.setChecked(True) for each_box in [self.abc_box, self.arnold_box]: each_box.setDisabled(False) each_box.setChecked(True) else: self.label.setDisabled(False) self.init_ui()