MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / set_image_size

Method set_image_size

pyxrf/gui_module/dlg_load_mask.py:283–316  ·  view source on GitHub ↗

Set the image size. Image size is used to for input validation. When image size is set, the selection is reset to cover the whole image. Parameters ---------- n_rows: int The number of rows in the image: (1..) n_columns: int T

(self, *, n_rows, n_columns)

Source from the content-addressed store, hash-verified

281 self.button_ok.setEnabled(flag_valid)
282
283 def set_image_size(self, *, n_rows, n_columns):
284 """
285 Set the image size. Image size is used to for input validation. When image
286 size is set, the selection is reset to cover the whole image.
287
288 Parameters
289 ----------
290 n_rows: int
291 The number of rows in the image: (1..)
292 n_columns: int
293 The number of columns in the image: (1..)
294 """
295 if n_rows < 1 or n_columns < 1:
296 raise ValueError(
297 "DialogLoadMask: image size have zero rows or zero columns: "
298 f"n_rows={n_rows} n_columns={n_columns}. "
299 "Report the error to the development team."
300 )
301
302 self._n_rows = n_rows
303 self._n_columns = n_columns
304
305 self._row_start = 0
306 self._row_end = n_rows
307 self._column_start = 0
308 self._column_end = n_columns
309
310 self._show_selection(True)
311 self._validate_all_widgets()
312
313 self.validator_rows.setTop(n_rows)
314 self.validator_cols.setTop(n_columns)
315 # Set label
316 self.label_map_size.setText(f"{self._text_map_size_base}{self._n_rows} rows, {self._n_columns} columns.")
317
318 def _show_selection(self, visible):
319 """visible: True - show values, False - hide values"""

Callers 7

pb_apply_mask_clickedMethod · 0.95
test_DialogLoadMask_1Function · 0.95
test_DialogLoadMask_2Function · 0.95
test_DialogLoadMask_3Function · 0.95
test_DialogLoadMask_4Function · 0.95
test_DialogLoadMask_5Function · 0.95
test_DialogLoadMask_6Function · 0.95

Calls 3

_show_selectionMethod · 0.95
_validate_all_widgetsMethod · 0.95
setTextMethod · 0.80

Tested by 6

test_DialogLoadMask_1Function · 0.76
test_DialogLoadMask_2Function · 0.76
test_DialogLoadMask_3Function · 0.76
test_DialogLoadMask_4Function · 0.76
test_DialogLoadMask_5Function · 0.76
test_DialogLoadMask_6Function · 0.76