示例#1
0
    def _setupWidgets(self):
        self.layout = QtWidgets.QVBoxLayout()
        self.controlLayout = QtWidgets.QHBoxLayout()
        self.buttonLayout = QtWidgets.QHBoxLayout()
        self.minSlider = QtWidgets.QDoubleSpinBox()
        self.maxSlider = QtWidgets.QDoubleSpinBox()
        self.cancelButton = QtWidgets.QPushButton('Cancel')
        self.setButton = QtWidgets.QPushButton('Set')

        self._addWidgets()
        self._editWidgets()
示例#2
0
    def _setupWindow(self):
        super(AttributeControl, self)._setupWindow()

        self.baseLayout = QtWidgets.QVBoxLayout()
        self.objectList = ListWidget()
        self.objectBox = QtWidgets.QGroupBox('Objects')
        self.objectBoxLayout = QtWidgets.QHBoxLayout()
        self.objectBoxControlLayout = QtWidgets.QVBoxLayout()
        self.controlBox = QtWidgets.QGroupBox('Control')
        self.controlBoxLayout = QtWidgets.QVBoxLayout()
        self.closeButton = QtWidgets.QPushButton('Close')
        self.tab = QtWidgets.QTabWidget()
        self.addObjectButton = QtWidgets.QPushButton(u'\u271A')
        self.removeObjectButton = QtWidgets.QPushButton(u'\u2716')
        self.refreshObjectButton = QtWidgets.QPushButton(u'\u267B')
        self.recursiveObjectButton = QtWidgets.QPushButton(u'\u272A')
示例#3
0
 def _setupWindow(self):
     super(LightControl, self)._setupWindow()
     self.baseLayout = QtWidgets.QHBoxLayout()
     self.controlLayout = QtWidgets.QVBoxLayout()
     self.lightList = QtWidgets.QListWidget()
     self.lightBox = QtWidgets.QGroupBox('Lights')
     self.lightBoxLayout = QtWidgets.QVBoxLayout()
     self.controlBox = QtWidgets.QGroupBox('Control')
     self.controlBoxLayout = QtWidgets.QVBoxLayout(self.controlBox)
     self.cameraBox = QtWidgets.QGroupBox('View')
     self.cameraBoxLayout = QtWidgets.QVBoxLayout(self.cameraBox)
     self.checkBoxLayout = QtWidgets.QHBoxLayout()
     self.lightEnableCheckbox = QtWidgets.QCheckBox('Enabled')
     self.useKelvinCheckbox = QtWidgets.QCheckBox('Kelvin')
     self.selectLightCheckbox = QtWidgets.QCheckBox('Select')
     self.lookThroughLightCheckbox = QtWidgets.QCheckBox('Look Through')
     self.lightCheckboxLayout = QtWidgets.QHBoxLayout()
     self.refreshButton = QtWidgets.QPushButton('Refresh')
示例#4
0
    def addControl(self, name, control, attribute, default=None):
        buttonHeight = 18
        widget = QtWidgets.QWidget()
        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(2)
        widget.setLayout(layout)
        label = QtWidgets.QLabel(name)
        incrementButton = QtWidgets.QPushButton('Increment')
        randomButton = QtWidgets.QPushButton('Random')
        setButton = QtWidgets.QPushButton('Set')
        incrementButton.setFixedSize(self.controlButtonWidth / 3, buttonHeight)
        randomButton.setFixedSize(self.controlButtonWidth / 3, buttonHeight)
        setButton.setFixedSize(self.controlButtonWidth / 3, buttonHeight)
        # Adding Widgets
        layout.addWidget(label)

        if control == 'intSlider':
            control = QtWidgets.QDoubleSpinBox()
        elif control == 'floatSlider':
            control = QtWidgets.QDoubleSpinBox()
        elif control == 'colorSlider':
            control = QtWidgets.QPushButton()

        if control and isinstance(control, dict):
            incrementButton.setVisible(False)
            randomButton.setVisible(False)
            setButton.setVisible(False)
            count = len(control)
            for key, value in control.iteritems():
                button = QtWidgets.QPushButton(key)
                button.setFixedSize(self.controlButtonWidth / count,
                                    buttonHeight)
                button.setProperty('attribute', attribute)
                button.setProperty('value', value)

                self.Signal.addSignal(button, 'clicked',
                                      self.controlSignalEvent)
                layout.addWidget(button)
        elif control == 'custom':
            if attribute == 'aiSssSetname' or attribute == 'aiAov':
                incrementButton.setVisible(False)
                randomButton.setVisible(False)
                control = QtWidgets.QLineEdit()
                control.setFixedSize(self.controlButtonWidth / 2, buttonHeight)
                setButton.setFixedSize(self.controlButtonWidth / 2,
                                       buttonHeight)
                setButton.setProperty('control', control)
                setButton.setProperty('attribute', attribute)
                self.Signal.addSignal(setButton, 'clicked',
                                      self.controlSignalEvent)
                layout.addWidget(control)
        elif attribute == 'color' or attribute == 'lightColor':
            incrementButton.setVisible(False)
            randomButton.setVisible(False)
            control.setFixedWidth(70)
            layout.addItem(
                QtWidgets.QSpacerItem(73, 0, QtWidgets.QSizePolicy.Minimum,
                                      QtWidgets.QSizePolicy.Minimum))
            layout.addWidget(control)
            layout.addItem(
                QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding,
                                      QtWidgets.QSizePolicy.Minimum))
            control.setStyleSheet('QPushButton {background-color: white}')
            control.setProperty('red', 1)
            control.setProperty('green', 1)
            control.setProperty('blue', 1)
            self.Signal.addSignal(control, 'clicked', self.colorPickerEvent)
            self.Signal.addSignal(setButton, 'clicked',
                                  self.controlSignalEvent)
            setButton.setProperty('control', control)
            setButton.setProperty('attribute', attribute)

        elif control:
            if attribute == 'renderSmoothLevel':
                self._setupControlWidgetDefaults(control,
                                                 default,
                                                 precision=0,
                                                 minV=0,
                                                 maxV=7)
            elif attribute in [
                    'aiSubdivIterations', 'aiSamples', 'aiColorTemperature',
                    'aiVolumeSamples', 'temperature', 'fixedSampleCount'
            ]:
                defaultValue = 1
                if attribute == 'aiColorTemperature' or attribute == 'temperature':
                    defaultValue = 6500
                self._setupControlWidgetDefaults(control,
                                                 defaultValue,
                                                 precision=0,
                                                 minV=0)
            elif attribute in [
                    'aiDispHeight', 'intensity', 'aiDiffuse', 'aiSpecular',
                    'aiSss', 'aiIndirect', 'aiVolume', 'aiSpread', 'diffuse',
                    'specular'
            ]:
                self._setupControlWidgetDefaults(control, 1)
            else:
                self._setupControlWidgetDefaults(control, default)

            self.Signal.addSignal(incrementButton, 'clicked',
                                  self.controlSignalEvent)
            self.Signal.addSignal(randomButton, 'clicked',
                                  self.controlSignalEvent)
            self.Signal.addSignal(setButton, 'clicked',
                                  self.controlSignalEvent)
            incrementButton.setProperty('attribute', attribute)
            randomButton.setProperty('attribute', attribute)
            setButton.setProperty('attribute', attribute)
            incrementButton.setProperty('control', control)
            setButton.setProperty('control', control)
            layout.addWidget(control)

        layout.addWidget(incrementButton)
        layout.addWidget(randomButton)
        layout.addWidget(setButton)
        return widget