def populate_corrections_table(self, runs: list, groups: list, use_raws: list, start_xs: list, end_xs: list, backgrounds: list, background_errors: list, statuses: list, fixed_rebin: bool, auto_corrections: bool) -> None: """Populates the background corrections table with the provided data.""" self.correction_options_table.blockSignals(True) self.correction_options_table.setRowCount(0) for run, group, use_raw, start_x, end_x, background, background_error, status in zip(runs, groups, use_raws, start_xs, end_xs, backgrounds, background_errors, statuses): row = self.correction_options_table.rowCount() self.correction_options_table.insertRow(row) self.correction_options_table.setItem(row, RUN_COLUMN_INDEX, create_string_table_item(run, False)) self.correction_options_table.setItem(row, GROUP_COLUMN_INDEX, create_string_table_item(group, False)) self.correction_options_table.setItem(row, USE_RAW_COLUMN_INDEX, create_checkbox_table_item(use_raw, tooltip=USE_RAW_TOOLTIP)) self.correction_options_table.setItem(row, START_X_COLUMN_INDEX, create_double_table_item(start_x)) self.correction_options_table.setItem(row, END_X_COLUMN_INDEX, create_double_table_item(end_x)) self.correction_options_table.setItem(row, BG_COLUMN_INDEX, create_double_table_item(background, enabled=not auto_corrections)) self.correction_options_table.setItem(row, BG_ERROR_COLUMN_INDEX, create_double_table_item(background_error, enabled=False)) self.correction_options_table.setItem(row, STATUS_COLUMN_INDEX, create_string_table_item(status, False, alignment=Qt.AlignVCenter)) self.correction_options_table.setCellWidget(row, SHOW_MATRIX_COLUMN_INDEX, self.create_show_fit_output_button_for_row(row)) self.correction_options_table.setColumnHidden(USE_RAW_COLUMN_INDEX, not fixed_rebin or not auto_corrections) self.correction_options_table.blockSignals(False) self.correction_options_table.resizeColumnsToContents()
def _set_selected_value(self, value: float) -> None: """Sets the currently selected cell to the float value provided.""" if self._selected_row is not None and self._selected_column is not None: self.correction_options_table.blockSignals(True) self.correction_options_table.setItem(self._selected_row, self._selected_column, create_double_table_item(value)) self.correction_options_table.blockSignals(False)
def _set_table_item_value_for(self, run: str, group: str, column_index: int, value: float) -> None: """Sets the End X associated with the provided Run and Group.""" row_index = self._table_row_index_of(run, group) self.correction_options_table.blockSignals(True) self.correction_options_table.setItem(row_index, column_index, create_double_table_item(value)) self.correction_options_table.blockSignals(False)