def build(self): self.l = qt.QGridLayout(self) self.l.setMargin(4) self.l.setSpacing(4) i = 0 j = 0 for header in ['Axis', 'Origin', 'Min', 'Center', 'Max']: label = qt.QLabel(header) self.l.addWidget(label, i, j) if j != 0: self.l.setAlignment(label, qt.Qt.AlignHCenter) j += 1 i = 1 self.buttonGroupList = [] for axis in ['X', 'Y', 'Z']: label = qt.QLabel(axis) self.l.addWidget(label, i, 0) j = 1 buttonGroup = qt.QButtonGroup(self) for position in ['ORIGIN', 'MIN', 'CENTER', 'MAX']: rButton = qt.QRadioButton(self) self.l.addWidget(rButton, i, j) self.l.setAlignment(rButton, qt.Qt.AlignHCenter) buttonGroup.addButton(rButton) buttonGroup.setId(rButton, j - 1) j += 1 self.buttonGroupList.append(buttonGroup) self.connect(buttonGroup, qt.SIGNAL('buttonPressed(QAbstractButton *)'), self._slot) i += 1 """ for header in ['Translation']: label = qt.QLabel(header) self.l.addWidget(label, 0, j+1) self.l.setAlignment(label, qt.Qt.AlignHCenter) i = 1 self.spinBoxList = [] for axis in ['X', 'Y', 'Z']: label = qt.QLabel(axis) self.l.addWidget(label, i, j) slider = qt.QDoubleSpinBox(self) slider.setRange(-1000., 1000.) self.l.addWidget(slider, i, j + 1) self.l.setAlignment(slider, qt.Qt.AlignVCenter) self.spinBoxList.append(slider) #self.connect(slider, # qt.SIGNAL('valueChanged(double)'), # self._slot) i += 1 """ self.l.setRowStretch(0, 0) self.l.setRowStretch(1, 1) self.l.setRowStretch(2, 1) self.l.setRowStretch(3, 1)
def build(self): self.l = qt.QVBoxLayout(self) self.l.setMargin(0) self.l.setSpacing(4) self.buttonGroup = qt.QButtonGroup(self) j = 0 for mode in DRAW_MODES: rButton = qt.QRadioButton(self) rButton.setText(mode) self.l.addWidget(rButton) self.l.setAlignment(rButton, qt.Qt.AlignLeft) self.buttonGroup.addButton(rButton) self.buttonGroup.setId(rButton, j) j += 1 self.connect(self.buttonGroup, qt.SIGNAL('buttonPressed(QAbstractButton *)'), self._slot)
def __init__(self, parent=None): qt.QGroupBox.__init__(self, parent) self.setTitle('Color Filter') self.mainLayout = qt.QVBoxLayout(self) self.buttonGroup = qt.QButtonGroup(self) self.__options = ['None', 'MinMax'] for j in range(len(self.__options)): text = self.__options[j] rButton = qt.QRadioButton(self) rButton.setText(text) if j == 0: rButton.setChecked(True) self.mainLayout.addWidget(rButton) #self.mainLayout.setAlignment(rButton, qt.Qt.AlignHCenter) self.buttonGroup.addButton(rButton) self.buttonGroup.setId(rButton, j) self.mainLayout.addWidget(VerticalSpacer(self)) self.connect(self.buttonGroup, qt.SIGNAL('buttonPressed(QAbstractButton *)'), self._slot)
def build(self): self.mainLayout = qt.QGridLayout(self) self.mainLayout.setMargin(0) self.mainLayout.setSpacing(2) # the ComboBox self.comboBox = qt.QComboBox(self) for colormap in self.colormapList: self.comboBox.addItem(colormap) self.mainLayout.addWidget(self.comboBox, 0, 0) self.connect(self.comboBox, qt.SIGNAL("activated(int)"), self.colormapChanged) # autoscale self.autoScaleButton = qt.QPushButton("Autoscale", self) self.autoScaleButton.setCheckable(True) self.autoScaleButton.setAutoDefault(False) self.connect(self.autoScaleButton, qt.SIGNAL("toggled(bool)"), self.autoscaleChanged) self.mainLayout.addWidget(self.autoScaleButton, 0, 1) # autoscale 90% self.autoScale90Button = qt.QPushButton("Autoscale 90%", self) self.autoScale90Button.setCheckable(True) self.autoScale90Button.setAutoDefault(False) self.connect(self.autoScale90Button, qt.SIGNAL("toggled(bool)"), self.autoscale90Changed) self.mainLayout.addWidget(self.autoScale90Button, 0, 2) #the checkboxes self.buttonGroup = qt.QButtonGroup() g1 = qt.QCheckBox(self) g1.setText("Linear") g2 = qt.QCheckBox(self) g2.setText("Logarithmic") g3 = qt.QCheckBox(self) g3.setText("Gamma") self.buttonGroup.addButton(g1, 0) self.buttonGroup.addButton(g2, 1) self.buttonGroup.addButton(g3, 2) self.buttonGroup.setExclusive(True) if self.colormapType == 1: self.buttonGroup.button(1).setChecked(True) elif self.colormapType == 2: self.buttonGroup.button(2).setChecked(True) else: self.buttonGroup.button(0).setChecked(True) self.mainLayout.addWidget(g1, 1, 0) self.mainLayout.addWidget(g2, 1, 1) self.mainLayout.addWidget(g3, 1, 2) self.connect(self.buttonGroup, qt.SIGNAL("buttonClicked(int)"), self.buttonGroupChanged) # The max line label = qt.QLabel(self) label.setText('Maximum') self.maxText = qt.QLineEdit(self) self.maxText.setText("%f" % self.maxValue) self.maxText.setAlignment(qt.Qt.AlignRight) self.maxText.setFixedWidth( self.maxText.fontMetrics().width('######.#####')) v = qt.QDoubleValidator(self.maxText) self.maxText.setValidator(v) self.mainLayout.addWidget(label, 0, 3) self.mainLayout.addWidget(self.maxText, 0, 4) self.connect(self.maxText, qt.SIGNAL("editingFinished()"), self.textChanged) # The min line label = qt.QLabel(self) label.setText('Minimum') self.minText = qt.QLineEdit(self) self.minText.setFixedWidth( self.minText.fontMetrics().width('######.#####')) self.minText.setAlignment(qt.Qt.AlignRight) self.minText.setText("%f" % self.minValue) v = qt.QDoubleValidator(self.minText) self.minText.setValidator(v) self.mainLayout.addWidget(label, 1, 3) self.mainLayout.addWidget(self.minText, 1, 4) self.connect(self.minText, qt.SIGNAL("editingFinished()"), self.textChanged) # The sliders self.dataMin = -10 self.dataMax = 10 self.minValue = 0 self.maxValue = 1 self.sliderList = [] delta = (self.dataMax - self.dataMin) / 200. for i in [0, 1]: slider = Qwt5.QwtSlider(self, qt.Qt.Horizontal) slider.setRange(self.dataMin, self.dataMax, delta) if i == 0: slider.setValue(self.maxValue) else: slider.setValue(self.minValue) self.mainLayout.addWidget(slider, i, 5) self.connect(slider, qt.SIGNAL("valueChanged(double)"), self.sliderChanged) self.sliderList.append(slider)