示例#1
0
    def createLayout(self):
        mainWidget = QtWidgets.QWidget()

        # Main Layout
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.setContentsMargins(0, 0, 0, 0)

        self.beamUI = BeamUI(self)
        self.mainLayout.addWidget(self.beamUI, 1)
        mainWidget.setLayout(self.mainLayout)
        self.setCentralWidget(mainWidget)
示例#2
0
    def createLayout (self):
        mainWidget = QtWidgets.QWidget ()

        # Main Layout
        self.mainLayout = QtWidgets.QVBoxLayout()
        self.mainLayout.setContentsMargins(0, 0, 0, 0)

        self.beamUI = BeamUI(self)
        self.beamMenu = BeamMenu (self)
        self.beamUI.graphViewWidget.setGuideRigName('MyRig')
        self.beamMenu.updateRigNameLabel()

        self.mainLayout.addWidget (self.beamMenu)
        self.mainLayout.addWidget (self.beamUI, 1)
        mainWidget.setLayout (self.mainLayout)
        self.setCentralWidget (mainWidget)
示例#3
0
    def __init__(self, objectname='inspector', parent=None):

        # constructors of base classes
        super(BaseInspector, self).__init__(parent)

        # Note: we must set the object name before constructing the layout.
        self.setObjectName(objectname)

        # layout
        self.mainLayout = QtWidgets.QVBoxLayout(self)
        self.setLayout(self.mainLayout)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)

        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)

        self.paramsFrame = QtWidgets.QScrollArea(self)
        self.paramsFrame.setWidgetResizable(True)
        self.paramsFrame.setEnabled(True)
        self.paramsFrame.setSizePolicy(sizePolicy)
        # self.paramsFrame.setFrameStyle(QtWidgets.QFrame.NoFrame)
        self.paramsFrame.setFrameStyle(QtWidgets.QFrame.StyledPanel)

        self.paramsGroup = QtWidgets.QWidget(self.paramsFrame)
        self.paramsFrame.setWidget(self.paramsGroup)

        self.paramsLayout = QtWidgets.QGridLayout()
        self.paramsLayout.setAlignment(QtCore.Qt.AlignTop)

        self.paramsGroup.setLayout(self.paramsLayout)

        self.mainLayout.addWidget(self.paramsFrame)
        self.widgets = []
        self.controllers = []
        self.gridRow = 0
示例#4
0
    def __init__(self, valueController, parent=None):
        super(DictEditor, self).__init__(valueController, parent=parent)

        vbox = QtWidgets.QVBoxLayout()
        vbox.setSpacing(2)

        self.setLayout(vbox)

        self._grid = QtWidgets.QGridLayout()
        self._grid.setContentsMargins(0, 0, 0, 0)

        gridEditor = QtWidgets.QWidget(self)
        gridEditor.setLayout(self._grid)

        vbox.addWidget(gridEditor, 1)

        self.setLayout(self._grid)
        self.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                           QtWidgets.QSizePolicy.Preferred)

        self.__enableAddRemoveElements = valueController.getOption(
            'enableAddRemoveElements', True)
        self.__addElementButtonLabel = valueController.getOption(
            'addElementButtonLabel', 'add')
        self.__removeElementButtonLabel = valueController.getOption(
            'removeElementButtonLabel', 'remove')
        self.__defaultKeyValue = valueController.getOption(
            'defaultKeyValue', 'key')

        self._dataType = valueController.getDataType()

        # print valueController.getOwner().getScene().getFabricClient().RT.getAggregateMemberInfo(self._dataType)

        self.determineElementType()
        self.build()
        self.setEditable(valueController.isEditable())
示例#5
0
 def addStretch(self, stretch):
     self.paramsLayout.addWidget(QtWidgets.QWidget(self), self.gridRow, 0,
                                 1, 2)
     self.paramsLayout.setRowStretch(self.gridRow, stretch)
     self.gridRow += 1
示例#6
0
    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 __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()