def __init__(self, valueController, parent=None): super(ListViewEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editor = QtWidgets.QListWidget(self) self.__items = valueController.getOption('combo') for item in self.__items: self._editor.addItem(str(item)) self._editor.setMaximumHeight(65) hbox.addWidget(self._editor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() if self.isEditable(): self._editor.itemSelectionChanged.connect( self._setValueToController) else: self._editor.setReadOnly(True)
def __init__(self, valueController, parent=None): super(StringListEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editor = QtWidgets.QListWidget(self) if self._valueController.hasOption('maxHeight'): self._editor.setMaximumHeight( self._valueController.getOption('maxHeight', 65)) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) else: self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) hbox.addWidget(self._editor, 1) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.updateEditorValue() if self.isEditable(): def setSelectionOption(value): self._valueController.setOption('currentItem', value) self._editor.itemSelectionChanged.connect(setSelectionOption) else: self.setEditable(False)
def __init__(self, valueController, parent=None): super(ScalarSliderEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() validator = QtGui.QDoubleValidator(self) validator.setRange(self._range['min'], self._range['max'], 4) self._editEditor.setValidator(validator) self._editEditor.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self._sliderEditor.setMinimum(self._range['min'] * 1000) self._sliderEditor.setMaximum(self._range['max'] * 1000) self._sliderEditor.setSizePolicy( QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self._sliderEditor.setTickInterval(1000) self._editEditor.setMinimumWidth(50) self._editEditor.setMaximumWidth(90) hbox.addWidget(self._editEditor, 1) hbox.addWidget(self._sliderEditor, 1) hbox.addStretch() self.setLayout(hbox) self.layout().setContentsMargins(0, 0, 0, 0) self.updateEditorValue() def __sliderPressed(): self.beginInteraction() def __sliderReleased(): self.endInteraction() def __sliderMoved(value): if self._updatingEditor: return value = float(value) / 1000 self._editEditor.setText(str(round(value, 4))) self._value = value self._setValueToController() def __textEdited(): if self._updatingEditor: return value = self.getEditorValue() # if self._dynamicRange: # self.updateSliderRange(value) self._sliderEditor.setValue(value * 1000) self._setValueToController() self._sliderEditor.sliderPressed.connect(__sliderPressed) self._sliderEditor.sliderReleased.connect(__sliderReleased) self._sliderEditor.valueChanged.connect(__sliderMoved) self._editEditor.editingFinished.connect(__textEdited) self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(LineEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editor = LineEditEditor(valueController, parent=self) hbox.addWidget(self._editor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() # we get lots of 'editingFinished' events, # so filter to only generate undos for important ones. self._value = valueController.getValue() def invokeSetter(): value = self._editor.text() if self._value != value: self._value = value self._setValueToController() self._editor.editingFinished.connect(invokeSetter) self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(IntegerEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editor = QtWidgets.QSpinBox(self) if (self._dataType == 'UInt8' or self._dataType == 'UInt16' or self._dataType == 'UInt32' or self._dataType == 'UInt64' or self._dataType == 'Index' or self._dataType == 'Size' or self._dataType == 'Byte'): self._editor.setMinimum(0) else: self._editor.setMinimum(-100000000) self._editor.setMaximum(100000000) self._editor.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) hbox.addWidget(self._editor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() self._editor.valueChanged.connect(self._setValueToController) self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(Vec2Editor, self).__init__(valueController, parent=parent) self.__editors = [] hbox = QtWidgets.QHBoxLayout() def defineLineEditSubEditor(): widget = LineEdit(self) validator = QtGui.QDoubleValidator(self) validator.setDecimals(3) widget.setValidator(validator) self.__editors.append(widget) return widget self.__editXEditor = defineLineEditSubEditor() self.__editYEditor = defineLineEditSubEditor() hbox.addWidget(self.__editXEditor, 1) hbox.addWidget(self.__editYEditor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() self.__editXEditor.editingFinished.connect(self._setValueToController) self.__editYEditor.editingFinished.connect(self._setValueToController) self.setEditable( valueController.isEditable() )
def createLayout(self): self.menuLayout = QtWidgets.QHBoxLayout() self.menuLayout.setContentsMargins(0, 0, 0, 0) self.menuLayout.setSpacing(0) # Menu self.menuBar = QtWidgets.QMenuBar() # File Menu self.fileMenu = self.menuBar.addMenu('&File') self.newAction = self.fileMenu.addAction('&New') self.newAction.setShortcut('Ctrl+N') self.newAction.setObjectName("newAction") # Edit Menu self.editMenu = self.menuBar.addMenu('&Edit') # Build Menu self.buildMenu = self.menuBar.addMenu('&Build') self.buildGuideAction = self.buildMenu.addAction('Build &Guide') self.buildGuideAction.setShortcut('Ctrl+G') self.buildGuideAction.setObjectName("buildGuideAction") self.buildRigAction = self.buildMenu.addAction('Build &Rig') self.buildRigAction.setShortcut('Ctrl+B') self.buildRigAction.setObjectName("buildRigAction") # Config Widget self.configsParent = QtWidgets.QFrame(self) self.configsParent.setObjectName('configParent') self.configsParent.setFrameStyle(QtWidgets.QFrame.NoFrame) self.configsParent.setMinimumWidth(160) self.configsLayout = QtWidgets.QVBoxLayout() self.configsLayout.setContentsMargins(0, 0, 0, 0) self.configsLayout.setSpacing(0) self.configsWidget = QtWidgets.QComboBox() self.configsWidget.setAutoFillBackground(True) self.configsWidget.setObjectName('configWidget') self.configsWidget.setMinimumWidth(160) self.configsWidget.addItem('Default Config', userData='Default Config') self.configsLayout.addWidget(self.configsWidget) self.configsParent.setLayout(self.configsLayout) configs = BeamSystem.getInstance().getConfigClassNames() for config in configs: self.configsWidget.addItem(config.split('.')[-1], userData=config) self.rigNameLabel = RigNameLabel('Rig Name:') self.menuLayout.addWidget(self.menuBar, 3) self.menuLayout.addWidget(self.configsParent, 0) self.setLayout(self.menuLayout)
def __init__(self, valueController, parent=None): super(FilepathEditor, self).__init__(valueController, parent=parent) self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self._line = QtWidgets.QLineEdit(self) self._browse = QtWidgets.QPushButton(' ... ', self) hbox = QtWidgets.QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self._line) hbox.addWidget(self._browse) self.setLayout(hbox) self.__updateOptions() def localSetter(value): self._setValueToController() self._line.textEdited.connect(localSetter) def __onBrowse(): if self._line.text() == '': initialDir = self._folder else: initialDir = os.path.join(self._folder, self._line.text()) if self._saveFile: (filepath, filter) = QtWidgets.QFileDialog.getSaveFileName( None, caption=self._options['Title'], dir=initialDir, filter=self._options['Filter']) else: (filepath, filter) = QtWidgets.QFileDialog.getOpenFileName( None, caption=self._options['Title'], dir=initialDir, filter=self._options['Filter']) if filepath is None or len(filepath) == 0: return if self._folder != '': filepath = os.path.relpath(filepath, self._folder) self.setEditorValue(filepath) self._setValueToController() self._browse.clicked.connect(__onBrowse) valueController.optionChanged.connect(self.__updateOptions) self.updateEditorValue() self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(ScalarEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editor = QtWidgets.QLineEdit(self) validator = QtGui.QDoubleValidator(self) validator.setDecimals(3) self._editor.setValidator(validator) hbox.addWidget(self._editor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() self._editor.editingFinished.connect(self._setValueToController) self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(BooleanEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editor = QtWidgets.QCheckBox(self) hbox.addWidget(self._editor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() def __stateChanged(value): self._setValueToController() self._editor.stateChanged.connect(__stateChanged) self.setEditable(self.isEditable())
def __init__(self, valueController, parent=None): super(ColorEditor, self).__init__(valueController, parent=parent) hbox = QtWidgets.QHBoxLayout() self._editors = [] self._qgraphcsScene = QtWidgets.QGraphicsScene(self) self._qgraphcsView = QtWidgets.QGraphicsView(self) self._qgraphcsView.setScene(self._qgraphcsScene) self._qgraphcsView.setFixedSize(100, 20) self._qgraphcsView.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) hbox.addWidget(self._qgraphcsView, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(QuatEditor, self).__init__(valueController, parent=parent) self.__editors = [] hbox = QtWidgets.QHBoxLayout() def defineLineEditSubEditor(name): label = QtWidgets.QLabel(name, self) hbox.addWidget(label) widget = LineEdit(self) validator = QtGui.QDoubleValidator(self) validator.setDecimals(2) widget.setValidator(validator) hbox.addWidget(widget, 1) self.__editors.append(widget) return widget defineLineEditSubEditor('v.x') defineLineEditSubEditor('v.y') defineLineEditSubEditor('v.z') defineLineEditSubEditor('w') hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) self.updateEditorValue() for i in range(0, len(self.__editors)): self.__editors[i].editingFinished.connect( self._setValueToController) self.setEditable(valueController.isEditable())
def __init__(self, valueController, parent=None): super(ComboBoxEditor, self).__init__(valueController, parent=parent) self.__name = valueController.getName() self._items = [] hbox = QtWidgets.QHBoxLayout() self._editor = QtWidgets.QComboBox(self) hbox.addWidget(self._editor, 1) hbox.addStretch(0) hbox.setContentsMargins(0, 0, 0, 0) self.setLayout(hbox) self.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) items = valueController.getOption('combo') if items is not None: self.setComboBoxItems(items) self.updateEditorValue() self._editor.currentIndexChanged.connect(self._setValue) self.setEditable(self.isEditable())
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(312, 655) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.groupBox = QtWidgets.QGroupBox(Form) self.groupBox.setObjectName("groupBox") self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_2.setObjectName("gridLayout_2") self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.preCustomStep_checkBox = QtWidgets.QCheckBox(self.groupBox) self.preCustomStep_checkBox.setObjectName("preCustomStep_checkBox") self.verticalLayout.addWidget(self.preCustomStep_checkBox) self.preSearch_lineEdit = QtWidgets.QLineEdit(self.groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.preSearch_lineEdit.sizePolicy().hasHeightForWidth()) self.preSearch_lineEdit.setSizePolicy(sizePolicy) self.preSearch_lineEdit.setObjectName("preSearch_lineEdit") self.verticalLayout.addWidget(self.preSearch_lineEdit) self.preCustomStep_horizontalLayout = QtWidgets.QHBoxLayout() self.preCustomStep_horizontalLayout.setObjectName( "preCustomStep_horizontalLayout") self.preCustomStep_verticalLayout_1 = QtWidgets.QVBoxLayout() self.preCustomStep_verticalLayout_1.setObjectName( "preCustomStep_verticalLayout_1") self.preCustomStep_listWidget = QtWidgets.QListWidget(self.groupBox) self.preCustomStep_listWidget.setDragDropOverwriteMode(True) self.preCustomStep_listWidget.setDragDropMode( QtWidgets.QAbstractItemView.InternalMove) self.preCustomStep_listWidget.setDefaultDropAction( QtCore.Qt.MoveAction) self.preCustomStep_listWidget.setAlternatingRowColors(True) self.preCustomStep_listWidget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.preCustomStep_listWidget.setProperty("isWrapping", False) self.preCustomStep_listWidget.setViewMode(QtWidgets.QListView.ListMode) self.preCustomStep_listWidget.setObjectName("preCustomStep_listWidget") self.preCustomStep_verticalLayout_1.addWidget( self.preCustomStep_listWidget) self.preCustomStep_horizontalLayout.addLayout( self.preCustomStep_verticalLayout_1) self.preCustomStep_verticalLayout_2 = QtWidgets.QVBoxLayout() self.preCustomStep_verticalLayout_2.setObjectName( "preCustomStep_verticalLayout_2") self.preCustomStepAdd_pushButton = QtWidgets.QPushButton(self.groupBox) self.preCustomStepAdd_pushButton.setObjectName( "preCustomStepAdd_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepAdd_pushButton) self.preCustomStepNew_pushButton = QtWidgets.QPushButton(self.groupBox) self.preCustomStepNew_pushButton.setObjectName( "preCustomStepNew_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepNew_pushButton) self.preCustomStepDuplicate_pushButton = QtWidgets.QPushButton( self.groupBox) self.preCustomStepDuplicate_pushButton.setObjectName( "preCustomStepDuplicate_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepDuplicate_pushButton) self.preCustomStepRemove_pushButton = QtWidgets.QPushButton( self.groupBox) self.preCustomStepRemove_pushButton.setObjectName( "preCustomStepRemove_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepRemove_pushButton) self.preCustomStepRun_pushButton = QtWidgets.QPushButton(self.groupBox) self.preCustomStepRun_pushButton.setObjectName( "preCustomStepRun_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepRun_pushButton) self.preCustomStepEdit_pushButton = QtWidgets.QPushButton( self.groupBox) self.preCustomStepEdit_pushButton.setObjectName( "preCustomStepEdit_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepEdit_pushButton) self.preCustomStepExport_pushButton = QtWidgets.QPushButton( self.groupBox) self.preCustomStepExport_pushButton.setObjectName( "preCustomStepExport_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepExport_pushButton) self.preCustomStepImport_pushButton = QtWidgets.QPushButton( self.groupBox) self.preCustomStepImport_pushButton.setObjectName( "preCustomStepImport_pushButton") self.preCustomStep_verticalLayout_2.addWidget( self.preCustomStepImport_pushButton) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.preCustomStep_verticalLayout_2.addItem(spacerItem) self.preCustomStep_horizontalLayout.addLayout( self.preCustomStep_verticalLayout_2) self.verticalLayout.addLayout(self.preCustomStep_horizontalLayout) self.verticalLayout_3.addLayout(self.verticalLayout) self.line = QtWidgets.QFrame(self.groupBox) self.line.setLineWidth(3) self.line.setMidLineWidth(0) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout_3.addWidget(self.line) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.postCustomStep_checkBox = QtWidgets.QCheckBox(self.groupBox) self.postCustomStep_checkBox.setObjectName("postCustomStep_checkBox") self.verticalLayout_2.addWidget(self.postCustomStep_checkBox) self.postSearch_lineEdit = QtWidgets.QLineEdit(self.groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.postSearch_lineEdit.sizePolicy().hasHeightForWidth()) self.postSearch_lineEdit.setSizePolicy(sizePolicy) self.postSearch_lineEdit.setObjectName("postSearch_lineEdit") self.verticalLayout_2.addWidget(self.postSearch_lineEdit) self.preCustomStep_horizontalLayout_2 = QtWidgets.QHBoxLayout() self.preCustomStep_horizontalLayout_2.setObjectName( "preCustomStep_horizontalLayout_2") self.preCustomStep_verticalLayout_3 = QtWidgets.QVBoxLayout() self.preCustomStep_verticalLayout_3.setObjectName( "preCustomStep_verticalLayout_3") self.postCustomStep_listWidget = QtWidgets.QListWidget(self.groupBox) self.postCustomStep_listWidget.setDragDropOverwriteMode(True) self.postCustomStep_listWidget.setDragDropMode( QtWidgets.QAbstractItemView.InternalMove) self.postCustomStep_listWidget.setDefaultDropAction( QtCore.Qt.MoveAction) self.postCustomStep_listWidget.setAlternatingRowColors(True) self.postCustomStep_listWidget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.postCustomStep_listWidget.setViewMode( QtWidgets.QListView.ListMode) self.postCustomStep_listWidget.setWordWrap(False) self.postCustomStep_listWidget.setSelectionRectVisible(False) self.postCustomStep_listWidget.setObjectName( "postCustomStep_listWidget") self.preCustomStep_verticalLayout_3.addWidget( self.postCustomStep_listWidget) self.preCustomStep_horizontalLayout_2.addLayout( self.preCustomStep_verticalLayout_3) self.preCustomStep_verticalLayout_4 = QtWidgets.QVBoxLayout() self.preCustomStep_verticalLayout_4.setObjectName( "preCustomStep_verticalLayout_4") self.postCustomStepAdd_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepAdd_pushButton.setObjectName( "postCustomStepAdd_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepAdd_pushButton) self.postCustomStepNew_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepNew_pushButton.setObjectName( "postCustomStepNew_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepNew_pushButton) self.postCustomStepDuplicate_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepDuplicate_pushButton.setObjectName( "postCustomStepDuplicate_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepDuplicate_pushButton) self.postCustomStepRemove_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepRemove_pushButton.setObjectName( "postCustomStepRemove_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepRemove_pushButton) self.postCustomStepRun_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepRun_pushButton.setObjectName( "postCustomStepRun_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepRun_pushButton) self.postCustomStepEdit_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepEdit_pushButton.setObjectName( "postCustomStepEdit_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepEdit_pushButton) self.postCustomStepExport_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepExport_pushButton.setObjectName( "postCustomStepExport_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepExport_pushButton) self.postCustomStepImport_pushButton = QtWidgets.QPushButton( self.groupBox) self.postCustomStepImport_pushButton.setObjectName( "postCustomStepImport_pushButton") self.preCustomStep_verticalLayout_4.addWidget( self.postCustomStepImport_pushButton) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.preCustomStep_verticalLayout_4.addItem(spacerItem1) self.preCustomStep_horizontalLayout_2.addLayout( self.preCustomStep_verticalLayout_4) self.verticalLayout_2.addLayout(self.preCustomStep_horizontalLayout_2) self.verticalLayout_3.addLayout(self.verticalLayout_2) self.gridLayout_2.addLayout(self.verticalLayout_3, 0, 0, 1, 1) self.gridLayout.addWidget(self.groupBox, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, valueController, parent=None): super(ArrayEditor, self).__init__(valueController, parent=parent) self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) self._enableAddElements = True #valueController.getOption('enableAddElements', valueController.getOption('enableAddRemoveElements', True)) self._enableRemoveElements = True #valueController.getOption('enableRemoveElements', valueController.getOption('enableAddRemoveElements', True)) self._addElementButtonLabel = 'add' #valueController.getOption('addElementButtonLabel', 'add') self._removeElementButtonLabel = 'remove' #valueController.getOption('removeElementButtonLabel', 'remove') self._displayGroupBox = False #self._valueController.getOption('displayArrayLimit', True) self._displayIndex = False #self._valueController.getOption('displayArrayLimit', True) self._displayArrayLimit = False #self._valueController.getOption('displayArrayLimit', True) self._displayNumElements = False #self._valueController.getOption('displayNumElements', True) self._arrayLimit = 3 #self._valueController.getOption('arrayLimit', 3) self._dataType = valueController.getDataType() self._valueArray = self._invokeGetter() self.determineElementType() vbox = QtWidgets.QVBoxLayout() if self._displayArrayLimit or self._displayNumElements: topToolbar = QtWidgets.QWidget(self) topToolbarLayout = QtWidgets.QHBoxLayout() topToolbar.setLayout(topToolbarLayout) vbox.addWidget(topToolbar, 0) if self._displayNumElements: topToolbarLayout.addWidget(QtWidgets.QLabel('Num Elements:'+str(len(self._valueArray)), self)) if self._displayArrayLimit: # display a widget to enable setting the maximum number of displayed elements. label = QtWidgets.QLabel('Max Displayed elements:', self) # label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) topToolbarLayout.addWidget(label, 0) spinBox = QtWidgets.QSpinBox(self) spinBox.setMinimum(0) spinBox.setMaximum(100) # spinBox.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) spinBox.setValue(self._arrayLimit) def setArrayLimit(value): self._arrayLimit = value self.rebuild() spinBox.valueChanged.connect(setArrayLimit) topToolbarLayout.addWidget(spinBox, 0) topToolbarLayout.addStretch(1) self._grid = QtWidgets.QGridLayout() self._grid.setContentsMargins(0, 0, 0, 0) widget = QtWidgets.QWidget(self) widget.setLayout(self._grid) vbox.addWidget(widget) if self._displayGroupBox: groupBox = QtWidgets.QGroupBox(self._valueController.getDataType()) groupBox.setLayout(vbox) groupBox.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) groupBoxLayout = QtWidgets.QVBoxLayout() groupBoxLayout.addWidget(groupBox, 0) self.setLayout(groupBoxLayout) else: self.setLayout(vbox) self.build() if self._elementValueType == 'String': self.setAcceptDrops(self.isEditable())
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(459, 809) self.gridLayout_2 = QtWidgets.QGridLayout(Form) self.gridLayout_2.setObjectName("gridLayout_2") self.groupBox_5 = QtWidgets.QGroupBox(Form) self.groupBox_5.setObjectName("groupBox_5") self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox_5) self.gridLayout_7.setObjectName("gridLayout_7") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(self.groupBox_5) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_2 = QtWidgets.QLabel(self.groupBox_5) self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 0, 1, 1, 1) self.label_3 = QtWidgets.QLabel(self.groupBox_5) self.label_3.setAlignment(QtCore.Qt.AlignCenter) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 0, 2, 1, 1) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.L_color_fk_label = QtWidgets.QLabel(self.groupBox_5) self.L_color_fk_label.setObjectName("L_color_fk_label") self.horizontalLayout_3.addWidget(self.L_color_fk_label) self.L_color_fk_spinBox = QtWidgets.QSpinBox(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.L_color_fk_spinBox.sizePolicy().hasHeightForWidth()) self.L_color_fk_spinBox.setSizePolicy(sizePolicy) self.L_color_fk_spinBox.setMaximum(31) self.L_color_fk_spinBox.setObjectName("L_color_fk_spinBox") self.horizontalLayout_3.addWidget(self.L_color_fk_spinBox) self.gridLayout.addLayout(self.horizontalLayout_3, 1, 0, 1, 1) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.L_color_fk_label_5 = QtWidgets.QLabel(self.groupBox_5) self.L_color_fk_label_5.setObjectName("L_color_fk_label_5") self.horizontalLayout_7.addWidget(self.L_color_fk_label_5) self.C_color_fk_spinBox = QtWidgets.QSpinBox(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.C_color_fk_spinBox.sizePolicy().hasHeightForWidth()) self.C_color_fk_spinBox.setSizePolicy(sizePolicy) self.C_color_fk_spinBox.setMaximum(31) self.C_color_fk_spinBox.setObjectName("C_color_fk_spinBox") self.horizontalLayout_7.addWidget(self.C_color_fk_spinBox) self.gridLayout.addLayout(self.horizontalLayout_7, 1, 1, 1, 1) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.L_color_fk_label_3 = QtWidgets.QLabel(self.groupBox_5) self.L_color_fk_label_3.setObjectName("L_color_fk_label_3") self.horizontalLayout_5.addWidget(self.L_color_fk_label_3) self.R_color_fk_spinBox = QtWidgets.QSpinBox(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.R_color_fk_spinBox.sizePolicy().hasHeightForWidth()) self.R_color_fk_spinBox.setSizePolicy(sizePolicy) self.R_color_fk_spinBox.setMaximum(31) self.R_color_fk_spinBox.setObjectName("R_color_fk_spinBox") self.horizontalLayout_5.addWidget(self.R_color_fk_spinBox) self.gridLayout.addLayout(self.horizontalLayout_5, 1, 2, 1, 1) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.L_color_fk_label_2 = QtWidgets.QLabel(self.groupBox_5) self.L_color_fk_label_2.setObjectName("L_color_fk_label_2") self.horizontalLayout_4.addWidget(self.L_color_fk_label_2) self.L_color_ik_spinBox = QtWidgets.QSpinBox(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.L_color_ik_spinBox.sizePolicy().hasHeightForWidth()) self.L_color_ik_spinBox.setSizePolicy(sizePolicy) self.L_color_ik_spinBox.setMaximum(31) self.L_color_ik_spinBox.setObjectName("L_color_ik_spinBox") self.horizontalLayout_4.addWidget(self.L_color_ik_spinBox) self.gridLayout.addLayout(self.horizontalLayout_4, 2, 0, 1, 1) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.L_color_fk_label_6 = QtWidgets.QLabel(self.groupBox_5) self.L_color_fk_label_6.setObjectName("L_color_fk_label_6") self.horizontalLayout_8.addWidget(self.L_color_fk_label_6) self.C_color_ik_spinBox = QtWidgets.QSpinBox(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.C_color_ik_spinBox.sizePolicy().hasHeightForWidth()) self.C_color_ik_spinBox.setSizePolicy(sizePolicy) self.C_color_ik_spinBox.setMaximum(31) self.C_color_ik_spinBox.setObjectName("C_color_ik_spinBox") self.horizontalLayout_8.addWidget(self.C_color_ik_spinBox) self.gridLayout.addLayout(self.horizontalLayout_8, 2, 1, 1, 1) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.L_color_fk_label_4 = QtWidgets.QLabel(self.groupBox_5) self.L_color_fk_label_4.setObjectName("L_color_fk_label_4") self.horizontalLayout_6.addWidget(self.L_color_fk_label_4) self.R_color_ik_spinBox = QtWidgets.QSpinBox(self.groupBox_5) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.R_color_ik_spinBox.sizePolicy().hasHeightForWidth()) self.R_color_ik_spinBox.setSizePolicy(sizePolicy) self.R_color_ik_spinBox.setMaximum(31) self.R_color_ik_spinBox.setObjectName("R_color_ik_spinBox") self.horizontalLayout_6.addWidget(self.R_color_ik_spinBox) self.gridLayout.addLayout(self.horizontalLayout_6, 2, 2, 1, 1) self.gridLayout_7.addLayout(self.gridLayout, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox_5, 6, 0, 1, 1) self.groupBox = QtWidgets.QGroupBox(Form) self.groupBox.setObjectName("groupBox") self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_3.setObjectName("gridLayout_3") self.formLayout = QtWidgets.QFormLayout() self.formLayout.setObjectName("formLayout") self.rigName_label = QtWidgets.QLabel(self.groupBox) self.rigName_label.setObjectName("rigName_label") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.rigName_label) self.rigName_lineEdit = QtWidgets.QLineEdit(self.groupBox) self.rigName_lineEdit.setObjectName("rigName_lineEdit") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.rigName_lineEdit) self.mode_label = QtWidgets.QLabel(self.groupBox) self.mode_label.setObjectName("mode_label") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.mode_label) self.mode_comboBox = QtWidgets.QComboBox(self.groupBox) self.mode_comboBox.setObjectName("mode_comboBox") self.mode_comboBox.addItem("") self.mode_comboBox.addItem("") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.mode_comboBox) self.step_label = QtWidgets.QLabel(self.groupBox) self.step_label.setObjectName("step_label") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.step_label) self.step_comboBox = QtWidgets.QComboBox(self.groupBox) self.step_comboBox.setObjectName("step_comboBox") self.step_comboBox.addItem("") self.step_comboBox.addItem("") self.step_comboBox.addItem("") self.step_comboBox.addItem("") self.step_comboBox.addItem("") self.step_comboBox.addItem("") self.step_comboBox.addItem("") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.step_comboBox) self.gridLayout_3.addLayout(self.formLayout, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox, 0, 0, 1, 1) self.groupBox_2 = QtWidgets.QGroupBox(Form) self.groupBox_2.setObjectName("groupBox_2") self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout_4.setObjectName("gridLayout_4") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.importSkin_checkBox = QtWidgets.QCheckBox(self.groupBox_2) self.importSkin_checkBox.setObjectName("importSkin_checkBox") self.verticalLayout.addWidget(self.importSkin_checkBox) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.skin_label = QtWidgets.QLabel(self.groupBox_2) self.skin_label.setObjectName("skin_label") self.horizontalLayout.addWidget(self.skin_label) self.skin_lineEdit = QtWidgets.QLineEdit(self.groupBox_2) self.skin_lineEdit.setObjectName("skin_lineEdit") self.horizontalLayout.addWidget(self.skin_lineEdit) self.loadSkinPath_pushButton = QtWidgets.QPushButton(self.groupBox_2) self.loadSkinPath_pushButton.setObjectName("loadSkinPath_pushButton") self.horizontalLayout.addWidget(self.loadSkinPath_pushButton) self.verticalLayout.addLayout(self.horizontalLayout) self.gridLayout_4.addLayout(self.verticalLayout, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox_2, 3, 0, 1, 1) self.groupBox_4 = QtWidgets.QGroupBox(Form) self.groupBox_4.setObjectName("groupBox_4") self.gridLayout_6 = QtWidgets.QGridLayout(self.groupBox_4) self.gridLayout_6.setObjectName("gridLayout_6") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.verticalLayout_3 = QtWidgets.QVBoxLayout() self.verticalLayout_3.setObjectName("verticalLayout_3") self.rigTabs_label = QtWidgets.QLabel(self.groupBox_4) self.rigTabs_label.setObjectName("rigTabs_label") self.verticalLayout_3.addWidget(self.rigTabs_label) self.rigTabs_listWidget = QtWidgets.QListWidget(self.groupBox_4) self.rigTabs_listWidget.setDragDropOverwriteMode(True) self.rigTabs_listWidget.setDragDropMode( QtWidgets.QAbstractItemView.InternalMove) self.rigTabs_listWidget.setDefaultDropAction(QtCore.Qt.MoveAction) self.rigTabs_listWidget.setAlternatingRowColors(True) self.rigTabs_listWidget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.rigTabs_listWidget.setSelectionRectVisible(False) self.rigTabs_listWidget.setObjectName("rigTabs_listWidget") self.verticalLayout_3.addWidget(self.rigTabs_listWidget) self.horizontalLayout_2.addLayout(self.verticalLayout_3) self.verticalLayout_4 = QtWidgets.QVBoxLayout() self.verticalLayout_4.setSizeConstraint( QtWidgets.QLayout.SetDefaultConstraint) self.verticalLayout_4.setObjectName("verticalLayout_4") spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_4.addItem(spacerItem) self.addTab_pushButton = QtWidgets.QPushButton(self.groupBox_4) self.addTab_pushButton.setObjectName("addTab_pushButton") self.verticalLayout_4.addWidget(self.addTab_pushButton) self.removeTab_pushButton = QtWidgets.QPushButton(self.groupBox_4) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.removeTab_pushButton.sizePolicy().hasHeightForWidth()) self.removeTab_pushButton.setSizePolicy(sizePolicy) self.removeTab_pushButton.setObjectName("removeTab_pushButton") self.verticalLayout_4.addWidget(self.removeTab_pushButton) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_4.addItem(spacerItem1) self.horizontalLayout_2.addLayout(self.verticalLayout_4) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.available_label = QtWidgets.QLabel(self.groupBox_4) self.available_label.setObjectName("available_label") self.verticalLayout_2.addWidget(self.available_label) self.available_listWidget = QtWidgets.QListWidget(self.groupBox_4) self.available_listWidget.setDragDropOverwriteMode(True) self.available_listWidget.setDragDropMode( QtWidgets.QAbstractItemView.NoDragDrop) self.available_listWidget.setDefaultDropAction(QtCore.Qt.IgnoreAction) self.available_listWidget.setAlternatingRowColors(True) self.available_listWidget.setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self.available_listWidget.setSelectionRectVisible(False) self.available_listWidget.setObjectName("available_listWidget") self.verticalLayout_2.addWidget(self.available_listWidget) self.horizontalLayout_2.addLayout(self.verticalLayout_2) self.gridLayout_6.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox_4, 5, 0, 1, 1) self.groupBox_3 = QtWidgets.QGroupBox(Form) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.groupBox_3.sizePolicy().hasHeightForWidth()) self.groupBox_3.setSizePolicy(sizePolicy) self.groupBox_3.setObjectName("groupBox_3") self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_3) self.gridLayout_5.setObjectName("gridLayout_5") self.jointRig_checkBox = QtWidgets.QCheckBox(self.groupBox_3) self.jointRig_checkBox.setObjectName("jointRig_checkBox") self.gridLayout_5.addWidget(self.jointRig_checkBox, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox_3, 4, 0, 1, 1) self.groupBox_6 = QtWidgets.QGroupBox(Form) self.groupBox_6.setObjectName("groupBox_6") self.gridLayout_8 = QtWidgets.QGridLayout(self.groupBox_6) self.gridLayout_8.setObjectName("gridLayout_8") self.proxyChannels_checkBox = QtWidgets.QCheckBox(self.groupBox_6) self.proxyChannels_checkBox.setObjectName("proxyChannels_checkBox") self.gridLayout_8.addWidget(self.proxyChannels_checkBox, 0, 0, 1, 1) self.classicChannelNames_checkBox = QtWidgets.QCheckBox( self.groupBox_6) self.classicChannelNames_checkBox.setObjectName( "classicChannelNames_checkBox") self.gridLayout_8.addWidget(self.classicChannelNames_checkBox, 1, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox_6, 1, 0, 1, 1) self.groupBox_7 = QtWidgets.QGroupBox(Form) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.groupBox_7.sizePolicy().hasHeightForWidth()) self.groupBox_7.setSizePolicy(sizePolicy) self.groupBox_7.setObjectName("groupBox_7") self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox_7) self.gridLayout_9.setObjectName("gridLayout_9") self.worldCtl_checkBox = QtWidgets.QCheckBox(self.groupBox_7) self.worldCtl_checkBox.setObjectName("worldCtl_checkBox") self.gridLayout_9.addWidget(self.worldCtl_checkBox, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.groupBox_7, 2, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(286, 527) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName("gridLayout") self.mainSettings_groupBox = QtWidgets.QGroupBox(Form) self.mainSettings_groupBox.setTitle("") self.mainSettings_groupBox.setObjectName("mainSettings_groupBox") self.gridLayout_4 = QtWidgets.QGridLayout(self.mainSettings_groupBox) self.gridLayout_4.setObjectName("gridLayout_4") self.formLayout = QtWidgets.QFormLayout() self.formLayout.setObjectName("formLayout") self.name_label = QtWidgets.QLabel(self.mainSettings_groupBox) self.name_label.setObjectName("name_label") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.name_label) self.name_lineEdit = QtWidgets.QLineEdit(self.mainSettings_groupBox) self.name_lineEdit.setObjectName("name_lineEdit") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.name_lineEdit) self.side_label = QtWidgets.QLabel(self.mainSettings_groupBox) self.side_label.setObjectName("side_label") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.side_label) self.side_comboBox = QtWidgets.QComboBox(self.mainSettings_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.side_comboBox.sizePolicy().hasHeightForWidth()) self.side_comboBox.setSizePolicy(sizePolicy) self.side_comboBox.setObjectName("side_comboBox") self.side_comboBox.addItem("") self.side_comboBox.addItem("") self.side_comboBox.addItem("") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.side_comboBox) self.componentIndex_label = QtWidgets.QLabel( self.mainSettings_groupBox) self.componentIndex_label.setObjectName("componentIndex_label") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.componentIndex_label) self.componentIndex_spinBox = QtWidgets.QSpinBox( self.mainSettings_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.componentIndex_spinBox.sizePolicy().hasHeightForWidth()) self.componentIndex_spinBox.setSizePolicy(sizePolicy) self.componentIndex_spinBox.setObjectName("componentIndex_spinBox") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.componentIndex_spinBox) self.conector_label = QtWidgets.QLabel(self.mainSettings_groupBox) self.conector_label.setObjectName("conector_label") self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.conector_label) self.connector_comboBox = QtWidgets.QComboBox( self.mainSettings_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.connector_comboBox.sizePolicy().hasHeightForWidth()) self.connector_comboBox.setSizePolicy(sizePolicy) self.connector_comboBox.setObjectName("connector_comboBox") self.connector_comboBox.addItem("") self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.connector_comboBox) self.gridLayout_4.addLayout(self.formLayout, 0, 0, 1, 1) self.gridLayout.addWidget(self.mainSettings_groupBox, 0, 0, 1, 1) self.groupBox = QtWidgets.QGroupBox(Form) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.groupBox.sizePolicy().hasHeightForWidth()) self.groupBox.setSizePolicy(sizePolicy) self.groupBox.setObjectName("groupBox") self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox) self.gridLayout_2.setObjectName("gridLayout_2") self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.host_label = QtWidgets.QLabel(self.groupBox) self.host_label.setObjectName("host_label") self.horizontalLayout_2.addWidget(self.host_label) self.host_lineEdit = QtWidgets.QLineEdit(self.groupBox) self.host_lineEdit.setObjectName("host_lineEdit") self.horizontalLayout_2.addWidget(self.host_lineEdit) self.host_pushButton = QtWidgets.QPushButton(self.groupBox) self.host_pushButton.setObjectName("host_pushButton") self.horizontalLayout_2.addWidget(self.host_pushButton) self.gridLayout_2.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) self.gridLayout.addWidget(self.groupBox, 2, 0, 1, 1) self.jointConnexionSettings_groupBox = QtWidgets.QGroupBox(Form) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.jointConnexionSettings_groupBox. sizePolicy().hasHeightForWidth()) self.jointConnexionSettings_groupBox.setSizePolicy(sizePolicy) self.jointConnexionSettings_groupBox.setObjectName( "jointConnexionSettings_groupBox") self.gridLayout_3 = QtWidgets.QGridLayout( self.jointConnexionSettings_groupBox) self.gridLayout_3.setObjectName("gridLayout_3") self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.useJointIndex_checkBox = QtWidgets.QCheckBox( self.jointConnexionSettings_groupBox) self.useJointIndex_checkBox.setObjectName("useJointIndex_checkBox") self.verticalLayout.addWidget(self.useJointIndex_checkBox) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.parentJointIndex_label = QtWidgets.QLabel( self.jointConnexionSettings_groupBox) self.parentJointIndex_label.setObjectName("parentJointIndex_label") self.horizontalLayout.addWidget(self.parentJointIndex_label) self.parentJointIndex_spinBox = QtWidgets.QSpinBox( self.jointConnexionSettings_groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.parentJointIndex_spinBox.sizePolicy().hasHeightForWidth()) self.parentJointIndex_spinBox.setSizePolicy(sizePolicy) self.parentJointIndex_spinBox.setMinimum(-1) self.parentJointIndex_spinBox.setMaximum(999999) self.parentJointIndex_spinBox.setProperty("value", -1) self.parentJointIndex_spinBox.setObjectName("parentJointIndex_spinBox") self.horizontalLayout.addWidget(self.parentJointIndex_spinBox) self.verticalLayout.addLayout(self.horizontalLayout) self.gridLayout_3.addLayout(self.verticalLayout, 0, 0, 1, 1) self.gridLayout.addWidget(self.jointConnexionSettings_groupBox, 1, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 0, 1, 1) self.groupBox_2 = QtWidgets.QGroupBox(Form) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.groupBox_2.sizePolicy().hasHeightForWidth()) self.groupBox_2.setSizePolicy(sizePolicy) self.groupBox_2.setObjectName("groupBox_2") self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout_5.setObjectName("gridLayout_5") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.subGroup_lineEdit = QtWidgets.QLineEdit(self.groupBox_2) self.subGroup_lineEdit.setObjectName("subGroup_lineEdit") self.horizontalLayout_3.addWidget(self.subGroup_lineEdit) self.gridLayout_5.addLayout(self.horizontalLayout_3, 0, 0, 1, 1) self.gridLayout.addWidget(self.groupBox_2, 3, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, valueController, parent=None): super(ComplexTypeEditor, self).__init__(valueController, parent=parent) self.__typeDesc = None try: self.__typeDesc = json.loads( valueController.getValue().type('Type').jsonDesc('String')) except Exception as e: print e if self.__typeDesc is None: raise Exception( "Invalid valuetype specified when constructing ComplexTypeEditor for value '" + valueController.getName() + "' of type '" + str(valueController.getDataType()) + "'") self.expanded = False def showMemberEditors(): for i in range(0, len(self.__typeDesc['members'])): try: memberName = self.__typeDesc['members'][i]['name'] memberType = self.__typeDesc['members'][i]['type'] if str(getattr(self._value, memberName)) != '<RTVal:null>': self.addMemberEditor(memberName, memberType) except Exception as e: print e self.expanded = True def hideMembeEditors(): self.clear() self.expanded = False # self._grid.addWidget(QtWidgets.QLabel(valueController.getDataType()+':', self), self._gridRow, 0) self.expandButton = QtWidgets.QPushButton("+", self) self.expandButton.setCheckable(True) self.expandButton.setMinimumHeight(16) self.expandButton.setMaximumHeight(16) self.expandButton.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) topToolbar = QtWidgets.QWidget(self) topToolbarLayout = QtWidgets.QHBoxLayout() topToolbar.setLayout(topToolbarLayout) topToolbarLayout.addWidget(self.expandButton, 0) topToolbarLayout.addStretch(2) self._grid.addWidget(topToolbar, self._gridRow, 0) self._gridRow += 1 def expandButtonToggled(toggled): if toggled: self.expandButton.setText('-') showMemberEditors() else: self.expandButton.setText('+') hideMembeEditors() self.expandButton.toggled.connect(expandButtonToggled) self._value = valueController.getValue()