def __init__(self, parent=None): super(DlgCalculateSOC, self).__init__(parent) self.setupUi(self) self.regimes = [('Temperate dry (Fl = 0.80)', .80), ('Temperate moist (Fl = 0.69)', .69), ('Tropical dry (Fl = 0.58)', .58), ('Tropical moist (Fl = 0.48)', .48), ('Tropical montane (Fl = 0.64)', .64)] self.fl_chooseRegime_comboBox.addItems([r[0] for r in self.regimes]) self.fl_chooseRegime_comboBox.setEnabled(False) self.fl_custom_lineEdit.setEnabled(False) # Setup validator for lineedit entries validator = QDoubleValidator() validator.setBottom(0) validator.setDecimals(3) self.fl_custom_lineEdit.setValidator(validator) self.fl_radio_default.toggled.connect(self.fl_radios_toggled) self.fl_radio_chooseRegime.toggled.connect(self.fl_radios_toggled) self.fl_radio_custom.toggled.connect(self.fl_radios_toggled)
def __init__(self): QDialog.__init__(self) self.setWindowTitle(tr('DMS Point Tool')) self.lat_D = QLineEdit() self.lat_M = QLineEdit() self.lat_S = QLineEdit() self.lat_DM = QLineEdit() self.lon_D = QLineEdit() self.lon_M = QLineEdit() self.lon_S = QLineEdit() self.lon_DM = QLineEdit() self.lat_M.textEdited.connect(self.lat_MS_edited) self.lat_S.textEdited.connect(self.lat_MS_edited) self.lat_DM.textEdited.connect(self.lat_DM_edited) self.lon_M.textEdited.connect(self.lon_MS_edited) self.lon_S.textEdited.connect(self.lon_MS_edited) self.lon_DM.textEdited.connect(self.lon_DM_edited) int_val = QIntValidator() int_val.setBottom(0) float_val = QDoubleValidator() float_val.setBottom(0) self.lat_D.setValidator(int_val) self.lat_M.setValidator(int_val) self.lat_S.setValidator(float_val) self.lat_DM.setValidator(float_val) self.lon_D.setValidator(int_val) self.lon_M.setValidator(int_val) self.lon_S.setValidator(float_val) self.lon_DM.setValidator(float_val) self.lat_NS = QComboBox() self.lat_NS.addItem("N") self.lat_NS.addItem("S") self.lon_EW = QComboBox() self.lon_EW.addItem("E") self.lon_EW.addItem("W") buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) lat_grp = QGroupBox(tr("Latitude"), self) lat_grp.setStyleSheet( "QGroupBox { font-weight: bold; color: #3c3c3c; } ") lat_grid = QGridLayout() lat_grid.addWidget(QLabel(tr("Degrees")), 0, 0) lat_grid.addWidget(QLabel(tr("Minutes")), 0, 1) lat_grid.addWidget(QLabel(tr("Seconds")), 0, 2) lat_grid.addWidget(QLabel(tr("Direction")), 0, 3) lat_grid.addWidget(self.lat_D, 1, 0) lat_grid.addWidget(self.lat_M, 1, 1) lat_grid.addWidget(self.lat_S, 1, 2) lat_grid.addWidget(self.lat_NS, 1, 3) lat_grid.addWidget(QLabel(tr("Decimal minutes")), 2, 1) lat_grid.addWidget(self.lat_DM, 3, 1, 1, 2) lat_grp.setLayout(lat_grid) lon_grp = QGroupBox(tr("Longitude"), self) lon_grp.setStyleSheet( "QGroupBox { font-weight: bold; color: #3c3c3c; } ") lon_grid = QGridLayout() lon_grid.addWidget(QLabel(tr("Degrees")), 0, 0) lon_grid.addWidget(QLabel(tr("Minutes")), 0, 1) lon_grid.addWidget(QLabel(tr("Seconds")), 0, 2) lon_grid.addWidget(QLabel(tr("Direction")), 0, 3) lon_grid.addWidget(self.lon_D, 1, 0) lon_grid.addWidget(self.lon_M, 1, 1) lon_grid.addWidget(self.lon_S, 1, 2) lon_grid.addWidget(self.lon_EW, 1, 3) lon_grid.addWidget(QLabel(tr("Decimal minutes")), 2, 1) lon_grid.addWidget(self.lon_DM, 3, 1, 1, 2) lon_grp.setLayout(lon_grid) vbox = QVBoxLayout() vbox.addWidget(lat_grp) vbox.addWidget(lon_grp) vbox.addWidget(buttons) self.setLayout(vbox)