Exemple #1
0
    def create_geog_form(self):
        grid = QGridLayout()
        self.geog_dataset_form = QGroupBox('Add Dataset')
        self.geog_dataset_form.setLayout(grid)
        self.geog_dataset_form.hide()

        group_name_validator = StringValidator(lambda s: s and re.fullmatch(r'[a-zA-Z0-9_]+', s))
        # TODO fix validator if empty
        interp_validator = StringValidator(lambda s: ' ' not in s)

        self.geog_dataset_form_group_name = add_grid_lineedit(grid, 0, 'Group Name',
                                                              validator=group_name_validator, required=True)
        self.geog_dataset_form_dataset = add_grid_combobox(grid, 1, 'Dataset')
        self.geog_dataset_form_variable = add_grid_combobox(grid, 2, 'Variable')
        self.geog_dataset_form_interp = add_grid_combobox(grid, 3, 'Interpolation')
        self.geog_dataset_form_custom_interp = add_grid_lineedit(grid, 4, 'Custom Interpolation',
                                                                 validator=interp_validator, required=False)
        
        self.geog_dataset_form_variable.currentIndexChanged.connect(self.geog_dataset_form_variable_changed)

        btn_add = QPushButton('Add')
        btn_cancel = QPushButton('Cancel')
        btn_add.clicked.connect(self.on_add_geog_dataset_form_button_clicked)
        btn_cancel.clicked.connect(self.on_cancel_geog_dataset_form_button_clicked)

        grid.addWidget(btn_cancel, 5, 0)
        grid.addWidget(btn_add, 5, 1)
Exemple #2
0
    def create_interp_input(self) -> None:
        grid = QGridLayout()

        self.interp_vert_selector = add_grid_combobox(grid, 0, 'Vertical Variable')
        self.interp_input = add_grid_lineedit(grid, 1, 'Desired Level', QDoubleValidator(0.0, 10000.0, 50), required=True)       
        self.interp_input.returnPressed.connect(self.on_interp_btn_clicked)

        btn = QPushButton('Interpolate')
        btn.clicked.connect(self.on_interp_btn_clicked)
        grid.addWidget(btn, 2, 1)

        self.interp_container = QGroupBox('Interpolate Vertical Level')
        self.interp_container.setCheckable(True)
        self.interp_container.setChecked(False)
        self.interp_container.toggled.connect(self.on_interp_toggled)
        self.interp_container.setLayout(grid)
        self.interp_container.setHidden(True)
        self.vbox.addWidget(self.interp_container)