def setup_horizontal(self, slider_style=2, show_write_widget=False):
        logger.debug("QTangoAttributeSlider.setupLayout")
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        self.valueLabel = QTangoReadAttributeLabel(self.sizes, self.attrColors)
        if show_write_widget is True:
            logger.debug("Adding write widgets")
            self.writeValueEdit = QTangoWriteAttributeLineEdit(
                self.sizes, self.attrColors)
            self.writeValueEdit.newValueSignal.connect(self.updateWriteValue)
            self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
            self.writeLabel.current_attr_color = self.attrColors.backgroundColor
            self.writeLabel.setupLayout()
            self.newValueSignal = self.writeValueEdit.newValueSignal

        # Select slider style:
        if slider_style == 1:
            self.valueSlider = QTangoHSliderBase(self.sizes, self.attrColors)
        elif slider_style == 3:
            self.valueSlider = QTangoHSliderBaseCompact(
                self.sizes, self.attrColors)
        else:
            self.valueSlider = QTangoHSliderBase2(self.sizes, self.attrColors)

        logger.debug("QTangoAttributeSlider.setupLayout widget")

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(self.sizes.barWidth / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.setHorizontalSpacing(self.sizes.barWidth / 4)
        self.layoutGrid.setVerticalSpacing(0)
        self.layoutGrid.addWidget(self.nameLabel, 0, 0)
        self.layoutGrid.addWidget(self.unitLabel, 0, 1)
        self.layoutGrid.addWidget(self.valueSlider, 1, 0, 1, 2)
        self.layoutGrid.addWidget(self.valueLabel, 0, 3, QtCore.Qt.AlignRight)
        if show_write_widget is True:
            self.layoutGrid.addWidget(self.writeLabel, 1, 2)
            self.layoutGrid.addWidget(self.writeValueEdit, 1, 3,
                                      QtCore.Qt.AlignRight)

        logger.debug("QTangoAttributeSlider.setupLayout: layoutGrid")

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth * 1.2)
        self.setMinimumWidth(self.sizes.readAttributeWidth * 1.2)
        self.setMaximumHeight(self.sizes.barHeight * 2.2)
        self.setMaximumHeight(self.sizes.barHeight * 3.0)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)

        logger.debug("QTangoAttributeSlider.setupLayout: exit")
Exemple #2
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        sizesValue = copy.copy(self.sizes)
        sizesValue.barHeight *= 1.25
        self.valueSpinbox = QTangoReadAttributeSpinBox(sizesValue,
                                                       self.attrColors)
        s = str(self.valueSpinbox.styleSheet())
        if s != '':
            i0 = s.find('\nmax-width')
            i1 = s[i0:].find(':')
            i2 = s[i0:].find(';')
            sNew = ''.join((s[0:i0 + i1 + 1], ' ',
                            str(self.sizes.readAttributeWidth), s[i0 + i2:]))
            self.valueSpinbox.setStyleSheet(sNew)
        self.valueSpinbox.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                        QtWidgets.QSizePolicy.Minimum)

        self.valueSlider = QTangoHSliderBase2(self.sizes, self.attrColors)
        self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.writeLabel.current_attr_color = self.attrColors.backgroundColor
        self.writeLabel.setupLayout()

        self.vSpacer = QtWidgets.QSpacerItem(
            20, self.sizes.barHeight, QtWidgets.QSizePolicy.Minimum,
            QtWidgets.QSizePolicy.MinimumExpanding)

        self.layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        self.layout.setContentsMargins(margin, margin, margin, margin)
        self.layout.setSpacing(self.sizes.barHeight / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.addWidget(self.nameLabel, 0, 0, 1, 2)
        self.layoutGrid.addWidget(self.valueSpinbox, 1, 1)
        self.layoutGrid.addItem(self.vSpacer, 2, 0)
        self.layoutGrid.addWidget(self.valueSlider, 2, 0, 1, 2)

        self.layoutGrid.setHorizontalSpacing(self.sizes.barHeight / 4)
        self.layoutGrid.setVerticalSpacing(self.sizes.barHeight / 10)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 4)
        self.setMinimumHeight(self.sizes.barHeight * 4)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #3
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.nameLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                     QtWidgets.QSizePolicy.Minimum)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        self.valueSpinbox = QTangoReadAttributeLabel(self.sizes,
                                                     self.attrColors)
        self.unitLabel.setAlignment(QtCore.Qt.AlignLeft
                                    | QtCore.Qt.AlignBottom)

        layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        layout.setContentsMargins(margin, margin, margin, margin)

        layout.addWidget(self.startLabel)
        layout.addWidget(self.nameLabel)
        layout.addWidget(self.valueSpinbox)
        layout.addWidget(self.unitLabel)
        layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Minimum)
Exemple #4
0
    def setupLayout(self):
        read_value_width = self.sizes.barWidth

        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.writeValueComboBox = QTangoComboBoxBase(self.sizes,
                                                     self.attrColors)

        layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        layout.setContentsMargins(margin, margin, margin, margin)

        layout_grid = QtWidgets.QHBoxLayout()
        layout_grid.setContentsMargins(0, 0, 0, 0)
        margin = int(self.sizes.barHeight / 10)
        layout_grid.setContentsMargins(margin, margin, margin, margin)
        layout_grid.addWidget(self.nameLabel)
        layout_grid.addWidget(self.writeValueComboBox)

        layout.addWidget(self.startLabel)
        layout.addLayout(layout_grid)
        layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Minimum)

        self.writeValueComboBox.activated[str].connect(self.onActivated)
Exemple #5
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.valueBoolean = QTangoBooleanLabel(self.sizes, self.attrColors)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(self.sizes.barWidth / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.addWidget(
            self.nameLabel,
            0,
            0,
        )
        self.layoutGrid.addWidget(self.valueBoolean, 0, 1)
        self.layoutGrid.setHorizontalSpacing(self.sizes.barWidth / 4)
        self.layoutGrid.setVerticalSpacing(0)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight)
        self.setMinimumHeight(self.sizes.barHeight)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
    def setup_vertical(self, slider_style=3):
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        sizes_value = copy.copy(self.sizes)
        sizes_value.barHeight *= 1.25

        self.valueSlider = QTangoVSliderBase2(self.sizes, self.attrColors)
        self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.writeLabel.current_attr_color = self.attrColors.backgroundColor
        self.writeLabel.setupLayout()

        self.unitLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)

        self.vSpacer = QtWidgets.QSpacerItem(
            20, self.sizes.barHeight, QtWidgets.QSizePolicy.Minimum,
            QtWidgets.QSizePolicy.MinimumExpanding)

        self.layout = QtWidgets.QVBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        self.layout.setContentsMargins(margin, margin, margin, margin)
        self.layout.setSpacing(self.sizes.barHeight / 10)

        self.layout.addWidget(self.valueSlider)
        self.layout.addWidget(self.nameLabel)
        self.layout.addWidget(self.unitLabel)

        self.setMaximumWidth(self.sizes.barWidth * 4)
        self.setMinimumWidth(self.sizes.barWidth * 4)
        self.setMaximumHeight(self.sizes.readAttributeHeight)
        self.setMinimumHeight(self.sizes.readAttributeHeight)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #7
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.imageWidget = QTangoImageWithHistBase(self.sizes, self.attrColors)

        self.layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        self.layout.setContentsMargins(margin, margin, margin, margin)
        self.layout.setSpacing(self.sizes.barWidth / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.addWidget(self.nameLabel, 0, 0)
        self.layoutGrid.addWidget(self.imageWidget, 1, 0, 1, 2)
        self.layoutGrid.setHorizontalSpacing(self.sizes.barWidth / 4)
        self.layoutGrid.setVerticalSpacing(0)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMinimumHeight(self.sizes.barHeight * 6)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #8
0
    def setupLayout(self):
        #		QTangoReadAttributeSlider2.setupLayout(self)
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        self.valueSpinbox = QTangoReadAttributeSpinBox(self.sizes,
                                                       self.attrColors)
        self.valueSlider = QTangoHSliderBase2(self.sizes, self.attrColors)
        self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.writeLabel.current_attr_color = self.attrColors.backgroundColor
        self.writeLabel.setupLayout()

        self.layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        self.layout.setContentsMargins(margin, margin, margin, margin)
        self.layout.setSpacing(self.sizes.barHeight / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.addWidget(self.nameLabel, 0, 0)
        self.layoutGrid.addWidget(self.unitLabel, 0, 1)
        self.layoutGrid.addWidget(self.valueSlider, 1, 0, 1, 2)
        # 		self.layoutGrid.addWidget(self.valueSpinbox, 0, 3)
        # 		self.layoutGrid.addWidget(self.writeLabel, 1, 2)

        self.layoutGrid.setHorizontalSpacing(self.sizes.barHeight / 4)
        self.layoutGrid.setVerticalSpacing(0)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 2.2)
        self.setMinimumHeight(self.sizes.barHeight * 2.2)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
        # 		self.layoutGrid.removeWidget(self.valueSpinbox)
        # 		self.valueSpinbox = None
        # 		self.layoutGrid.removeWidget(self.writeLabel)
        self.valueLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.layoutGrid.addWidget(self.valueLabel, 0, 3)
Exemple #9
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.nameLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                     QtWidgets.QSizePolicy.Minimum)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        self.valueSpinbox = QTangoReadAttributeLabel(self.sizes,
                                                     self.attrColors)
        self.writeValueLineEdit = QTangoWriteAttributeLineEdit(
            self.sizes, self.attrColors)
        self.writeValueLineEdit.setLayoutDirection(QtCore.Qt.RightToLeft)
        self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.writeLabel.current_attr_color = self.attrColors.backgroundColor
        self.writeLabel.setupLayout()

        layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        layout.setContentsMargins(margin, margin, margin, margin)

        layout_grid = QtWidgets.QGridLayout()
        margin = int(self.sizes.barHeight / 10)
        layout_grid.setContentsMargins(margin, margin, margin, margin)
        layout_grid.addWidget(self.nameLabel, 0, 0)
        layout_grid.addWidget(self.valueSpinbox, 0, 2)
        layout_grid.addWidget(self.unitLabel, 0, 3)
        layout_grid.addWidget(self.writeLabel, 1, 1)
        layout_grid.addWidget(self.writeValueLineEdit, 1, 2)

        layout.addWidget(self.startLabel)
        layout.addLayout(layout_grid)
        layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Minimum)
    def setupLayout(self, name=None):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.unitLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.curveNameLabel = QTangoAttributeNameLabel(self.sizes,
                                                       self.attrColors)
        if name is not None:
            self.curveNameLabel.setText(name)
        else:
            self.curveNameLabel.setText("curve 0")
        self.valueSpinbox = QTangoReadAttributeLabel(self.sizes,
                                                     self.attrColors)
        self.nameLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                     QtWidgets.QSizePolicy.Fixed)
        self.valueSlider = QTangoVSliderBase2(self.sizes, self.attrColors)

        self.valueTrend = QTangoTrendBase(name=name,
                                          sizes=self.sizes,
                                          colors=self.attrColors)
        self.valueTrend.valueTrendCurves[-1].sigClicked.connect(
            self.setCurveFocus)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(self.sizes.barWidth / 3)

        layout2 = QtWidgets.QVBoxLayout()
        layout3 = QtWidgets.QHBoxLayout()
        layout2.addLayout(layout3)
        layout2.addWidget(self.valueTrend)
        layout3.addWidget(self.nameLabel)
        layout3.addWidget(self.curveNameLabel)
        layout3.addWidget(self.valueSpinbox)
        layout3.addWidget(self.unitLabel)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(layout2)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 4)
        self.setMinimumHeight(self.sizes.barHeight * 4)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
    def setupLayout(self):
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        sizes_value = copy.copy(self.sizes)
        sizes_value.barHeight *= 1.25

        self.valueSlider = QTangoVSliderBase2(self.sizes, self.attrColors)
        self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.writeLabel.current_attr_color = self.attrColors.backgroundColor
        self.writeLabel.setupLayout()
        self.writeValueLineEdit = QTangoWriteAttributeLineEdit(
            self.sizes, self.attrColors)
        self.writeValueLineEdit.editingFinished.connect(self.updateWriteValue)
        self.writeValueLineEdit.setLayoutDirection(QtCore.Qt.RightToLeft)

        self.vSpacer = QtWidgets.QSpacerItem(
            20, self.sizes.barHeight, QtWidgets.QSizePolicy.Minimum,
            QtWidgets.QSizePolicy.MinimumExpanding)

        self.layout = QtWidgets.QVBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        self.layout.setContentsMargins(margin, margin, margin, margin)
        self.layout.setSpacing(self.sizes.barHeight / 6.0)

        layout2 = QtWidgets.QHBoxLayout()
        margin = int(self.sizes.barHeight / 10)
        layout2.setContentsMargins(margin, margin, margin, margin)
        layout2.setSpacing(self.sizes.barHeight / 6.0)
        layout2.addWidget(self.writeLabel)
        layout2.addWidget(self.writeValueLineEdit)

        self.layout.addWidget(self.valueSlider)
        self.layout.addLayout(layout2)
        self.layout.addWidget(self.nameLabel)

        self.setMaximumWidth(self.sizes.barWidth * 4)
        self.setMinimumWidth(self.sizes.barWidth * 4)
        self.setMaximumHeight(self.sizes.readAttributeHeight)
        self.setMinimumHeight(self.sizes.readAttributeHeight)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #12
0
    def setupLayout(self):
        read_value_width = self.sizes.barWidth
        read_width = self.sizes.readAttributeWidth - self.sizes.barHeight / 6 - self.sizes.barHeight / 2

        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.valueSpinbox = QTangoReadAttributeSpinBox(self.sizes,
                                                       self.attrColors)
        self.valueSlider = QTangoHSliderBase(self.sizes, self.attrColors)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(self.sizes.barHeight / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        margin = int(self.sizes.barHeight / 10)
        self.layoutGrid.setContentsMargins(margin, margin, margin, margin)
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.addWidget(
            self.nameLabel,
            0,
            0,
        )
        self.layoutGrid.addWidget(self.valueSlider, 1, 0)
        self.layoutGrid.addWidget(self.valueSpinbox, 0, 1)
        self.layoutGrid.setHorizontalSpacing(self.sizes.barHeight / 4)
        self.layoutGrid.setVerticalSpacing(0)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 2.2)
        self.setMinimumHeight(self.sizes.barHeight * 2.2)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #13
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        self.valueSpinbox = QTangoReadAttributeSpinBox(self.sizes,
                                                       self.attrColors)
        self.valueSpinbox.setAlignment(QtCore.Qt.AlignRight)
        self.valueSlider = QTangoHSliderBaseCompact(self.sizes,
                                                    self.attrColors)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(self.sizes.barWidth / 3)

        self.layoutAttr = QtWidgets.QVBoxLayout()
        self.layoutAttr.setContentsMargins(0, 0, 0, 0)
        self.layoutAttr.setSpacing(0)
        self.layoutAttr.setContentsMargins(0, 0, 0, 0)
        self.layoutData = QtWidgets.QHBoxLayout()
        self.layoutData.setContentsMargins(0, 0, 0, 0)
        self.layoutData.setContentsMargins(0, 0, 0, 0)
        self.layoutData.addWidget(self.nameLabel)
        self.layoutData.addWidget(self.valueSpinbox)
        self.layoutAttr.addLayout(self.layoutData)
        self.layoutAttr.addWidget(self.valueSlider)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutAttr)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 1.6)
        self.setMinimumHeight(self.sizes.barHeight * 1.6)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #14
0
    def setupLayout(self):

        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.startLabel.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                      QtWidgets.QSizePolicy.Fixed)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.endLabel.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                    QtWidgets.QSizePolicy.Fixed)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.nameLabel.setAlignment(QtCore.Qt.AlignLeft
                                    | QtCore.Qt.AlignBottom)
        self.nameLabel.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                     QtWidgets.QSizePolicy.Fixed)

        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.startLabel)
        layout.addWidget(self.nameLabel)
        layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #15
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.unitLabel = QTangoAttributeUnitLabel(self.sizes, self.attrColors)
        sizesValue = copy.copy(self.sizes)
        sizesValue.barHeight *= 1.0
        self.valueSpinbox = QTangoReadAttributeSpinBox(sizesValue,
                                                       self.attrColors)
        s = str(self.valueSpinbox.styleSheet())
        if s != '':
            i0 = s.find('\nmax-width')
            i1 = s[i0:].find(':')
            i2 = s[i0:].find(';')
            sNew = ''.join((s[0:i0 + i1 + 1], ' ',
                            str(self.sizes.readAttributeWidth), s[i0 + i2:]))
            self.valueSpinbox.setStyleSheet(sNew)
        self.valueSpinbox.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                        QtWidgets.QSizePolicy.Minimum)

        self.valueSlider = QTangoHSliderBase2(self.sizes, self.attrColors)
        # 		self.writeValueSpinbox = QTangoWriteAttributeSpinBox2(sizesValue, self.attrColors)
        # 		self.writeValueSpinbox.editingFinished.connect(self.editingFinished)
        self.writeValueLineEdit = QTangoWriteAttributeLineEdit(
            self.sizes, self.attrColors)
        self.writeValueLineEdit.editingFinished.connect(self.updateWriteValue)
        self.writeValueLineEdit.setLayoutDirection(QtCore.Qt.RightToLeft)

        self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.writeLabel.current_attr_color = self.attrColors.backgroundColor
        self.writeLabel.setupLayout()

        self.vSpacer = QtWidgets.QSpacerItem(
            20, self.sizes.barHeight, QtWidgets.QSizePolicy.Minimum,
            QtWidgets.QSizePolicy.MinimumExpanding)

        self.layout = QtWidgets.QHBoxLayout(self)
        margin = int(self.sizes.barHeight / 10)
        self.layout.setContentsMargins(margin, margin, margin, margin)
        self.layout.setSpacing(self.sizes.barHeight / 3)

        layoutV = QtWidgets.QVBoxLayout()
        layoutH1 = QtWidgets.QHBoxLayout()
        layoutH1.addWidget(self.nameLabel)
        layoutH1.addWidget(self.valueSpinbox)
        layoutH2 = QtWidgets.QHBoxLayout()
        spacerItemH = QtWidgets.QSpacerItem(
            5, 5, QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.Minimum)
        layoutH2.addSpacerItem(spacerItemH)
        layoutH2.addWidget(self.writeLabel)
        layoutH2.addWidget(self.writeValueLineEdit)
        layoutV.addLayout(layoutH1)
        layoutV.addLayout(layoutH2)
        layoutV.addWidget(self.valueSlider)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(layoutV)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 4)
        self.setMinimumHeight(self.sizes.barHeight * 4)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #16
0
    def setupLayout(self):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.startLabel.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                      QtWidgets.QSizePolicy.Expanding)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.endLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                    QtWidgets.QSizePolicy.Expanding)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)
        self.nameLabel.setAlignment(QtCore.Qt.AlignLeft
                                    | QtCore.Qt.AlignBottom)
        self.nameLabel.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                     QtWidgets.QSizePolicy.Fixed)
        self.nameLabel.setText("Status")
        self.stateLabel = QTangoStateLabel(self.sizes, self.attrColors)
        self.stateLabel.setAlignment(QtCore.Qt.AlignLeft
                                     | QtCore.Qt.AlignBottom)
        self.stateLabel.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                      QtWidgets.QSizePolicy.Fixed)
        self.statusLabel = QTangoAttributeNameLabel(self.sizes,
                                                    self.attrColors)
        self.statusLabel.setAlignment(QtCore.Qt.AlignLeft
                                      | QtCore.Qt.AlignBottom)
        self.statusLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Expanding)
        self.statusLabel.setWordWrap(True)

        s = ''.join(
            ('QLabel {min-height: ', str(self.sizes.barHeight), 'px; \n',
             'background-color: ', self.attrColors.backgroundColor, '; \n',
             'color: ', self.current_attr_color, ';}'))
        self.statusLabel.setStyleSheet(s)
        font = self.font()
        font.setPointSize(int(self.sizes.barHeight * 0.3))
        font.setStyleStrategy(QtGui.QFont.PreferAntialias)
        self.statusLabel.setFont(font)

        spacer_item = QtWidgets.QSpacerItem(
            0, 0, QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.MinimumExpanding)

        layout = QtWidgets.QHBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout_top = QtWidgets.QHBoxLayout()
        layout_top.setContentsMargins(0, 0, 0, 0)
        layout2 = QtWidgets.QVBoxLayout()
        layout2.setContentsMargins(0, 0, 0, 0)
        layout2.setSpacing(0)
        layout2.setContentsMargins(0, 0, 0, 3)

        layout.addWidget(self.startLabel)
        layout.addLayout(layout2)
        layout2.addLayout(layout_top)
        layout_top.addWidget(self.nameLabel)
        layout_top.addWidget(self.stateLabel)
        layout2.addSpacerItem(spacer_item)
        layout2.addWidget(self.statusLabel)
        layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)
Exemple #17
0
    def setupLayout(self):
        # Init layouts once
        if self.layout is None:
            self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
            self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
            self.nameLabel = QTangoAttributeNameLabel(self.sizes,
                                                      self.attrColors)
            self.nameLabel.setText(self.title)
            self.nameLabel.setAlignment(QtCore.Qt.AlignLeft
                                        | QtCore.Qt.AlignVCenter)
            self.nameLabel.setMinimumWidth(0)
            self.statusLabel = QTangoAttributeNameLabel(
                self.sizes, self.attrColors)
            self.statusLabel.setSizePolicy(
                QtWidgets.QSizePolicy.MinimumExpanding,
                QtWidgets.QSizePolicy.Fixed)
            self.statusLabel.setAlignment(QtCore.Qt.AlignRight
                                          | QtCore.Qt.AlignVCenter)
            self.statusLabel.setText('')

            self.layout = QtWidgets.QHBoxLayout(self)
            self.layout.setContentsMargins(0, 0, 0, 0)
            self.layout.setContentsMargins(0, 0, 0, 0)
            self.layout.setSpacing(self.sizes.barWidth / 3)

            self.layout2 = QtWidgets.QVBoxLayout()
            self.layout2.setContentsMargins(0, 0, 0, 0)
            self.layout2.setContentsMargins(0, 0, 0, 0)

            self.layoutInfo = QtWidgets.QHBoxLayout()
            self.layoutInfo.setContentsMargins(0, 0, 0, 0)
            self.layoutInfo.setContentsMargins(0, 0, 0, 0)
            self.layoutInfo.setSpacing(int(self.sizes.barWidth / 6))
            self.layoutInfo.addWidget(self.nameLabel)
            self.layoutInfo.addWidget(self.statusLabel)
            self.layoutButtons = QtWidgets.QHBoxLayout()
            self.layoutButtons.setContentsMargins(0, 0, 0, 0)
            self.layoutButtons.setContentsMargins(0, 0, 0, 0)
            self.layoutButtons.setSpacing(int(self.sizes.barHeight / 3))
            self.layout2.addLayout(self.layoutInfo)
            self.layout2.addLayout(self.layoutButtons)

            self.layout.addWidget(self.startLabel)
            self.layout.addLayout(self.layout2)
            self.layout.addWidget(self.endLabel)

        # Clear out old layout
        if self.cmdButtons.keys().__len__() > 0:
            for i in reversed(range(self.layoutButtons.count())):
                self.layoutButtons.itemAt(i).widget().setParent(None)

            # Add buttons
        for cmdButton in self.cmdButtons.itervalues():
            self.layoutButtons.addWidget(cmdButton)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)

        self.update()
    def setup_horizontal(self, slider_style=2, show_write_label=False):
        self.startLabel = QTangoStartLabel(self.sizes, self.attrColors)
        self.endLabel = QTangoEndLabel(self.sizes, self.attrColors)
        self.nameLabel = QTangoAttributeNameLabel(self.sizes, self.attrColors)

        # Create read_attribute_spinbox and modify max_width
        sizes_value = copy.copy(self.sizes)
        sizes_value.barHeight *= 1.25
        self.valueSpinbox = QTangoReadAttributeLabel(sizes_value,
                                                     self.attrColors)
        s = str(self.valueSpinbox.styleSheet())
        # if s != '':
        #     i0 = s.find('\nmax-width')
        #     i1 = s[i0:].find(':')
        #     i2 = s[i0:].find(';')
        #     s_new = ''.join((s[0:i0 + i1 + 1], ' ', str(self.sizes.readAttributeWidth), s[i0 + i2:]))
        #     self.valueSpinbox.setStyleSheet(s_new)
        self.valueSpinbox.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
                                        QtWidgets.QSizePolicy.Minimum)

        # Select slider style:
        if slider_style == 1:
            self.valueSlider = QTangoHSliderBase(self.sizes, self.attrColors)
        elif slider_style == 3:
            self.valueSlider = QTangoHSliderBaseCompact(
                self.sizes, self.attrColors)
        else:
            self.valueSlider = QTangoHSliderBase2(self.sizes, self.attrColors)

        # Create write_label if needed
        if show_write_label is True:
            self.writeLabel = QTangoStartLabel(self.sizes, self.attrColors)
            self.writeLabel.current_attr_color = self.attrColors.backgroundColor
            self.writeLabel.setupLayout()

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(self.sizes.barWidth / 3)

        self.layoutGrid = QtWidgets.QGridLayout()
        self.layoutGrid.setContentsMargins(0, 0, 0, 0)
        self.layoutGrid.addWidget(self.nameLabel, 0, 0)
        self.layoutGrid.addWidget(self.valueSlider, 1, 0, 1, 2)
        self.layoutGrid.addWidget(self.valueSpinbox, 0, 3)
        if show_write_label is True:
            self.layoutGrid.addWidget(self.writeLabel, 1, 2)

        self.layoutGrid.addWidget(self.nameLabel, 0, 0, 1, 2)
        self.layoutGrid.addWidget(self.valueSpinbox, 1, 1)
        #        self.layoutGrid.addItem(self.vSpacer, 2, 0)
        self.layoutGrid.addWidget(self.valueSlider, 2, 0, 1, 2)

        self.layoutGrid.setHorizontalSpacing(self.sizes.barHeight / 4)
        # self.layoutGrid.setVerticalSpacing(0)

        self.layout.addWidget(self.startLabel)
        self.layout.addLayout(self.layoutGrid)
        self.layout.addWidget(self.endLabel)

        self.setMaximumWidth(self.sizes.readAttributeWidth)
        self.setMinimumWidth(self.sizes.readAttributeWidth)
        self.setMaximumHeight(self.sizes.barHeight * 2.2)
        self.setMinimumHeight(self.sizes.barHeight * 2.2)
        self.setSizePolicy(QtWidgets.QSizePolicy.Fixed,
                           QtWidgets.QSizePolicy.Fixed)