(self)
| 476 | msgbox.exec() |
| 477 | |
| 478 | def pb_apply_mask_clicked(self): |
| 479 | map_size = self.gpc.get_dataset_map_size() |
| 480 | map_size = map_size if (map_size is not None) else (0, 0) |
| 481 | |
| 482 | dlg = DialogLoadMask() |
| 483 | dlg.set_image_size(n_rows=map_size[0], n_columns=map_size[1]) |
| 484 | roi = self.gpc.get_preview_spatial_roi() |
| 485 | dlg.set_roi( |
| 486 | row_start=roi["row_start"], |
| 487 | column_start=roi["col_start"], |
| 488 | row_end=roi["row_end"], |
| 489 | column_end=roi["col_end"], |
| 490 | ) |
| 491 | dlg.set_roi_active(self.gpc.is_roi_selection_active()) |
| 492 | |
| 493 | dlg.set_default_directory(self.gpc.get_current_working_directory()) |
| 494 | dlg.set_mask_file_path(self.gpc.get_mask_selection_file_path()) |
| 495 | dlg.set_mask_file_active(self.gpc.is_mask_selection_active()) |
| 496 | |
| 497 | if dlg.exec() == QDialog.Accepted: |
| 498 | roi_keys = ("row_start", "col_start", "row_end", "col_end") |
| 499 | roi_list = dlg.get_roi() |
| 500 | roi_selected = {k: roi_list[n] for n, k in enumerate(roi_keys)} |
| 501 | self.gpc.set_preview_spatial_roi(roi_selected) |
| 502 | |
| 503 | self.gpc.set_roi_selection_active(dlg.get_roi_active()) |
| 504 | |
| 505 | self.gpc.set_mask_selection_file_path(dlg.get_mask_file_path()) |
| 506 | self.gpc.set_mask_selection_active(dlg.get_mask_file_active()) |
| 507 | |
| 508 | def cb(): |
| 509 | try: |
| 510 | # TODO: proper error processing is needed here (exception RuntimeError) |
| 511 | self.gpc.apply_mask_to_datasets() |
| 512 | success = True |
| 513 | msg = "" |
| 514 | except Exception as ex: |
| 515 | success = False |
| 516 | msg = str(ex) |
| 517 | return {"success": success, "msg": msg} |
| 518 | |
| 519 | self._compute_in_background(cb, self.slot_apply_mask_clicked) |
| 520 | |
| 521 | @Slot(object) |
| 522 | def slot_apply_mask_clicked(self, result): |
nothing calls this directly
no test coverage detected