From 804ba62aeae47fd76716b054c2ed31c42d26b0ca Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Tue, 17 Oct 2023 16:50:06 -0500 Subject: [PATCH] Change "exec_" to "exec" Qt is deprecating "exec_" in favor of "exec", so let's go ahead and switch that over. Signed-off-by: Patrick Avery --- hexrd/ui/async_runner.py | 4 ++-- hexrd/ui/azimuthal_overlay_manager.py | 2 +- hexrd/ui/azimuthal_overlay_style_picker.py | 6 +++--- hexrd/ui/beam_marker_style_editor.py | 2 +- hexrd/ui/brightness_contrast_editor.py | 2 +- hexrd/ui/cal_tree_view.py | 2 +- .../auto/powder_calibration_dialog.py | 4 ++-- hexrd/ui/calibration/auto/powder_runner.py | 4 ++-- hexrd/ui/calibration/calibration_runner.py | 6 +++--- .../hedm/calibration_results_dialog.py | 4 ++-- hexrd/ui/calibration/hedm/calibration_runner.py | 8 ++++---- .../ui/calibration/hkl_picks_tree_view_dialog.py | 8 ++++---- hexrd/ui/calibration/laue_auto_picker_dialog.py | 4 ++-- hexrd/ui/calibration/structureless/runner.py | 2 +- hexrd/ui/calibration/wppf_options_dialog.py | 6 +++--- hexrd/ui/calibration_crystal_editor.py | 2 +- hexrd/ui/config_dialog.py | 4 ++-- hexrd/ui/image_file_manager.py | 2 +- hexrd/ui/image_load_manager.py | 2 +- hexrd/ui/indexing/fit_grains_results_dialog.py | 2 +- hexrd/ui/indexing/grains_table_view.py | 4 ++-- hexrd/ui/indexing/indexing_results_dialog.py | 4 ++-- hexrd/ui/indexing/run.py | 8 ++++---- hexrd/ui/indexing/view_spots_dialog.py | 2 +- hexrd/ui/input_dialog.py | 2 +- hexrd/ui/instrument_form_view_widget.py | 2 +- hexrd/ui/list_editor.py | 2 +- hexrd/ui/llnl_import_tool_dialog.py | 2 +- hexrd/ui/load_images_dialog.py | 4 ++-- hexrd/ui/main.py | 2 +- hexrd/ui/main_window.py | 16 ++++++++-------- hexrd/ui/mask_manager_dialog.py | 4 ++-- hexrd/ui/material_list_editor.py | 2 +- hexrd/ui/material_site_editor.py | 4 ++-- hexrd/ui/matrix_editor.py | 2 +- hexrd/ui/message_box.py | 6 +++--- hexrd/ui/overlay_manager.py | 2 +- hexrd/ui/overlay_style_picker.py | 6 +++--- hexrd/ui/periodic_table_dialog.py | 2 +- hexrd/ui/plot_grains.py | 2 +- hexrd/ui/polarization_options_dialog.py | 4 ++-- hexrd/ui/progress_dialog.py | 8 ++++---- hexrd/ui/reorder_pairs_widget.py | 2 +- hexrd/ui/rerun_clustering_dialog.py | 8 ++++---- hexrd/ui/save_images_dialog.py | 6 +++--- hexrd/ui/select_grains_dialog.py | 4 ++-- hexrd/ui/select_item_dialog.py | 4 ++-- hexrd/ui/select_items_dialog.py | 2 +- hexrd/ui/simple_image_series_dialog.py | 4 ++-- hexrd/ui/table_selector_widget.py | 2 +- hexrd/ui/thermal_factor_editor.py | 4 ++-- hexrd/ui/transform_dialog.py | 4 ++-- hexrd/ui/tree_views/base_dict_tree_item_model.py | 2 +- hexrd/ui/tree_views/generic_picks_tree_view.py | 2 +- hexrd/ui/tree_views/hkl_picks_tree_view.py | 2 +- .../ui/tree_views/multi_column_dict_tree_view.py | 4 ++-- hexrd/ui/wppf_style_picker.py | 2 +- hexrd/ui/xray_energy_selection_dialog.py | 2 +- 58 files changed, 110 insertions(+), 110 deletions(-) diff --git a/hexrd/ui/async_runner.py b/hexrd/ui/async_runner.py index 1496856f2..31e6e9927 100644 --- a/hexrd/ui/async_runner.py +++ b/hexrd/ui/async_runner.py @@ -41,7 +41,7 @@ def run(self, f, *args, **kwargs): # have a segmentation fault. self.thread_pool.start(worker) - self.progress_dialog.exec_() + self.progress_dialog.exec() def on_worker_finished(self): self.reset_callbacks() @@ -67,4 +67,4 @@ def on_async_error(self, t): msg = f'An ERROR occurred: {exctype}: {value}.' msg_box = QMessageBox(QMessageBox.Critical, 'Error', msg) msg_box.setDetailedText(traceback) - msg_box.exec_() + msg_box.exec() diff --git a/hexrd/ui/azimuthal_overlay_manager.py b/hexrd/ui/azimuthal_overlay_manager.py index 481f48aa6..ae999d6a0 100644 --- a/hexrd/ui/azimuthal_overlay_manager.py +++ b/hexrd/ui/azimuthal_overlay_manager.py @@ -272,7 +272,7 @@ def remove(self): def edit_style(self): self._style_picker = AzimuthalOverlayStylePicker(self.active_overlay, self.ui) - self._style_picker.exec_() + self._style_picker.exec() def show_legend(self, value): HexrdConfig().show_azimuthal_legend = value diff --git a/hexrd/ui/azimuthal_overlay_style_picker.py b/hexrd/ui/azimuthal_overlay_style_picker.py index bf47fe985..b085ff1a4 100644 --- a/hexrd/ui/azimuthal_overlay_style_picker.py +++ b/hexrd/ui/azimuthal_overlay_style_picker.py @@ -23,9 +23,9 @@ def __init__(self, overlay, parent=None): self.setup_connections() self.update_gui() - def exec_(self): + def exec(self): self.ui.adjustSize() - return self.ui.exec_() + return self.ui.exec() def setup_connections(self): self.ui.color.pressed.connect(self.pick_color) @@ -72,7 +72,7 @@ def pick_color(self): color = sender.text() dialog = QColorDialog(QColor(color), self.ui) - if dialog.exec_(): + if dialog.exec(): sender.setText(dialog.selectedColor().name()) self.update_button_colors() self.update_config() diff --git a/hexrd/ui/beam_marker_style_editor.py b/hexrd/ui/beam_marker_style_editor.py index c4bbaccf3..41d7811c5 100644 --- a/hexrd/ui/beam_marker_style_editor.py +++ b/hexrd/ui/beam_marker_style_editor.py @@ -80,7 +80,7 @@ def pick_color(self): color = w.text() dialog = QColorDialog(QColor(color), self.ui) - if dialog.exec_(): + if dialog.exec(): w.setText(dialog.selectedColor().name()) self.update_button_colors() self.update_config() diff --git a/hexrd/ui/brightness_contrast_editor.py b/hexrd/ui/brightness_contrast_editor.py index 12774b962..cd0b71c28 100644 --- a/hexrd/ui/brightness_contrast_editor.py +++ b/hexrd/ui/brightness_contrast_editor.py @@ -397,7 +397,7 @@ def select_data_range(self): UiLoader().install_dialog_enter_key_filters(dialog) - if not dialog.exec_(): + if not dialog.exec(): # User canceled return diff --git a/hexrd/ui/cal_tree_view.py b/hexrd/ui/cal_tree_view.py index a2e8ebc27..735506237 100644 --- a/hexrd/ui/cal_tree_view.py +++ b/hexrd/ui/cal_tree_view.py @@ -305,7 +305,7 @@ def contextMenuEvent(self, event): menu.addSeparator() check = menu.addAction('Check All') uncheck = menu.addAction('Uncheck All') - action = menu.exec_(QCursor.pos()) + action = menu.exec(QCursor.pos()) if action == collapse: self.collapse_selection(item, index) diff --git a/hexrd/ui/calibration/auto/powder_calibration_dialog.py b/hexrd/ui/calibration/auto/powder_calibration_dialog.py index 574602edf..7d1038c6d 100644 --- a/hexrd/ui/calibration/auto/powder_calibration_dialog.py +++ b/hexrd/ui/calibration/auto/powder_calibration_dialog.py @@ -71,8 +71,8 @@ def update_config(self): options['pk_type'] = self.peak_fit_type options['bg_type'] = self.background_type - def exec_(self): - if not self.ui.exec_(): + def exec(self): + if not self.ui.exec(): return False self.update_config() diff --git a/hexrd/ui/calibration/auto/powder_runner.py b/hexrd/ui/calibration/auto/powder_runner.py index 6ac04765b..deff141e6 100644 --- a/hexrd/ui/calibration/auto/powder_runner.py +++ b/hexrd/ui/calibration/auto/powder_runner.py @@ -52,7 +52,7 @@ def validate(self): def _run(self): # First, have the user pick some options - if not PowderCalibrationDialog(self.material, self.parent).exec_(): + if not PowderCalibrationDialog(self.material, self.parent).exec(): # User canceled... return @@ -196,7 +196,7 @@ def update_config(self): msg = 'Optimization successful!' msg_box = QMessageBox(QMessageBox.Information, 'HEXRD', msg) msg_box.setDetailedText(self.results_message) - msg_box.exec_() + msg_box.exec() output_dict = instr_to_internal_dict(self.instr) diff --git a/hexrd/ui/calibration/calibration_runner.py b/hexrd/ui/calibration/calibration_runner.py index 6e07de8c6..3070dd56d 100644 --- a/hexrd/ui/calibration/calibration_runner.py +++ b/hexrd/ui/calibration/calibration_runner.py @@ -142,7 +142,7 @@ def pick_this_line(self): 'parent': self.canvas, } dialog = SelectItemDialog(**kwargs) - if not dialog.exec_(): + if not dialog.exec(): # User canceled self.restore_state() return @@ -744,7 +744,7 @@ def auto_pick_powder_points(self): material = overlay.material dialog = PowderCalibrationDialog(material, self.canvas) dialog.show_optimization_parameters(False) - if not dialog.exec_(): + if not dialog.exec(): # User canceled self.restore_state() return @@ -806,7 +806,7 @@ def auto_powder_pick_finished(self, auto_picks): def auto_pick_laue_points(self): overlay = self.active_overlay dialog = LaueAutoPickerDialog(overlay, self.canvas) - if not dialog.exec_(): + if not dialog.exec(): # User canceled self.restore_state() return diff --git a/hexrd/ui/calibration/hedm/calibration_results_dialog.py b/hexrd/ui/calibration/hedm/calibration_results_dialog.py index aeefeb212..0e1b4b176 100644 --- a/hexrd/ui/calibration/hedm/calibration_results_dialog.py +++ b/hexrd/ui/calibration/hedm/calibration_results_dialog.py @@ -102,8 +102,8 @@ def setup_canvas(self): self.ax = ax self.canvas = canvas - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() @property def selected_detector_key(self): diff --git a/hexrd/ui/calibration/hedm/calibration_runner.py b/hexrd/ui/calibration/hedm/calibration_runner.py index 6baf76e42..799bd7e4c 100644 --- a/hexrd/ui/calibration/hedm/calibration_runner.py +++ b/hexrd/ui/calibration/hedm/calibration_runner.py @@ -164,7 +164,7 @@ def on_pull_spots_finished(self, spots_data_dict): 'parent': self.parent, } dialog = HEDMCalibrationResultsDialog(**kwargs) - if not dialog.exec_(): + if not dialog.exec(): return # Run optimization @@ -195,7 +195,7 @@ def on_pull_spots_finished(self, spots_data_dict): 'parent': self.parent, } dialog = HEDMCalibrationResultsDialog(**kwargs) - if not dialog.exec_(): + if not dialog.exec(): return # All done! Update the results. @@ -278,7 +278,7 @@ def on_pull_spots_finished(self, spots_data_dict): 'parent': self.parent, } dialog = HEDMCalibrationResultsDialog(**kwargs) - if not dialog.exec_(): + if not dialog.exec(): return # update calibration crystal params @@ -372,7 +372,7 @@ def update_config(self): 'parent': self.parent, } msg_box = MessageBox(**kwargs) - msg_box.exec_() + msg_box.exec() # Update rotation series parameters from the results for results, overlay in zip(self.results, self.active_overlays): diff --git a/hexrd/ui/calibration/hkl_picks_tree_view_dialog.py b/hexrd/ui/calibration/hkl_picks_tree_view_dialog.py index 2183a141b..d69f2ceab 100644 --- a/hexrd/ui/calibration/hkl_picks_tree_view_dialog.py +++ b/hexrd/ui/calibration/hkl_picks_tree_view_dialog.py @@ -53,11 +53,11 @@ def update_gui(self): def on_finished(self): self.tree_view.clear_artists() - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() - def exec_later(self): - QTimer.singleShot(0, lambda: self.exec_()) + def execlater(self): + QTimer.singleShot(0, lambda: self.exec()) def export_picks_clicked(self): selected_file, selected_filter = QFileDialog.getSaveFileName( diff --git a/hexrd/ui/calibration/laue_auto_picker_dialog.py b/hexrd/ui/calibration/laue_auto_picker_dialog.py index b6c311fdf..c98722c26 100644 --- a/hexrd/ui/calibration/laue_auto_picker_dialog.py +++ b/hexrd/ui/calibration/laue_auto_picker_dialog.py @@ -57,8 +57,8 @@ def update_config(self): options['use_blob_detection'] = self.ui.use_blob_detection.isChecked() options['blob_threshold'] = self.ui.blob_threshold.value() - def exec_(self): - if not self.ui.exec_(): + def exec(self): + if not self.ui.exec(): return False self.update_config() diff --git a/hexrd/ui/calibration/structureless/runner.py b/hexrd/ui/calibration/structureless/runner.py index 7a3f9bb82..718d014ae 100644 --- a/hexrd/ui/calibration/structureless/runner.py +++ b/hexrd/ui/calibration/structureless/runner.py @@ -117,7 +117,7 @@ def choose_pick_method(self): 'parent': self.canvas, } dialog = SelectItemDialog(**kwargs) - if not dialog.exec_(): + if not dialog.exec(): # User canceled return diff --git a/hexrd/ui/calibration/wppf_options_dialog.py b/hexrd/ui/calibration/wppf_options_dialog.py index 26be1199d..20970711f 100644 --- a/hexrd/ui/calibration/wppf_options_dialog.py +++ b/hexrd/ui/calibration/wppf_options_dialog.py @@ -286,7 +286,7 @@ def select_materials(self): selected = self.selected_materials items = [(name, name in selected) for name in materials] dialog = SelectItemsDialog(items, self.ui) - if dialog.exec_() and self.selected_materials != dialog.selected_items: + if dialog.exec() and self.selected_materials != dialog.selected_items: self.selected_materials = dialog.selected_items self.update_params() @@ -531,7 +531,7 @@ def display_wppf_plot_toggled(self): def edit_plot_style(self): dialog = WppfStylePicker(self.ui) - dialog.ui.exec_() + dialog.ui.exec() def create_label(self, v): w = QTableWidgetItem(v) @@ -926,7 +926,7 @@ def dict_to_param(d): app = QApplication() dialog = WppfOptionsDialog() - dialog.ui.exec_() + dialog.ui.exec() print(f'{dialog.method=}') print(f'{dialog.background_method=}') diff --git a/hexrd/ui/calibration_crystal_editor.py b/hexrd/ui/calibration_crystal_editor.py index 8ab4490ad..af485d199 100644 --- a/hexrd/ui/calibration_crystal_editor.py +++ b/hexrd/ui/calibration_crystal_editor.py @@ -281,7 +281,7 @@ def update_tab_gui(self): def load(self): dialog = SelectGrainsDialog(1, self.ui) - if not dialog.exec_(): + if not dialog.exec(): return self.load_from_grain(dialog.selected_grain) diff --git a/hexrd/ui/config_dialog.py b/hexrd/ui/config_dialog.py index bcb7ab1db..f5d4cd649 100644 --- a/hexrd/ui/config_dialog.py +++ b/hexrd/ui/config_dialog.py @@ -14,9 +14,9 @@ def __init__(self, parent=None): def setup_connections(self): self.ui.accepted.connect(self.on_accepted) - def exec_(self): + def exec(self): self.update_gui() - self.ui.exec_() + self.ui.exec() def update_gui(self): self.max_cpus_ui = self.max_cpus_config diff --git a/hexrd/ui/image_file_manager.py b/hexrd/ui/image_file_manager.py index 1a8172058..7bb46492d 100644 --- a/hexrd/ui/image_file_manager.py +++ b/hexrd/ui/image_file_manager.py @@ -172,7 +172,7 @@ def hdf5_path_exists(self, f): def path_prompt(self, f): path_dialog = LoadHDF5Dialog(f) if path_dialog.paths: - path_dialog.ui.exec_() + path_dialog.ui.exec() group, data, remember = path_dialog.results() self.path = [group, data] self.remember = remember diff --git a/hexrd/ui/image_load_manager.py b/hexrd/ui/image_load_manager.py index 5413fef62..1cb10c3ae 100644 --- a/hexrd/ui/image_load_manager.py +++ b/hexrd/ui/image_load_manager.py @@ -157,7 +157,7 @@ def begin_processing(self, postprocess=False): # On completion load imageseries nd close loading dialog worker.signals.result.connect(self.finish_processing_ims) worker.signals.finished.connect(progress_dialog.accept) - progress_dialog.exec_() + progress_dialog.exec() def set_state(self, state=None): if state is None: diff --git a/hexrd/ui/indexing/fit_grains_results_dialog.py b/hexrd/ui/indexing/fit_grains_results_dialog.py index 721caa75a..a4a2a10e8 100644 --- a/hexrd/ui/indexing/fit_grains_results_dialog.py +++ b/hexrd/ui/indexing/fit_grains_results_dialog.py @@ -778,4 +778,4 @@ def on_export_workflow_clicked(self): dialog.ui.resize(1200, 800) dialog.finished.connect(app.quit) dialog.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/indexing/grains_table_view.py b/hexrd/ui/indexing/grains_table_view.py index 07b847505..a544abd5e 100644 --- a/hexrd/ui/indexing/grains_table_view.py +++ b/hexrd/ui/indexing/grains_table_view.py @@ -55,7 +55,7 @@ def add_actions(d): if not actions: return super().contextMenuEvent(event) - action_chosen = menu.exec_(QCursor.pos()) + action_chosen = menu.exec(QCursor.pos()) if action_chosen is None: # No action chosen @@ -157,7 +157,7 @@ def select_tolerance_id(self): dialog.table.horizontal_headers = headers dialog.setWindowTitle('Select tolerances to use') - if not dialog.exec_(): + if not dialog.exec(): return False self.selected_tol_id = dialog.selected_row diff --git a/hexrd/ui/indexing/indexing_results_dialog.py b/hexrd/ui/indexing/indexing_results_dialog.py index 4ccf0896f..c9d028be8 100644 --- a/hexrd/ui/indexing/indexing_results_dialog.py +++ b/hexrd/ui/indexing/indexing_results_dialog.py @@ -78,9 +78,9 @@ def show_all_grains_toggled(self): self.update_enable_states() self.update_spots() - def exec_(self): + def exec(self): self.update_plot() - self.ui.exec_() + self.ui.exec() def show(self): self.update_plot() diff --git a/hexrd/ui/indexing/run.py b/hexrd/ui/indexing/run.py index 9801593ed..4db52da9b 100644 --- a/hexrd/ui/indexing/run.py +++ b/hexrd/ui/indexing/run.py @@ -67,7 +67,7 @@ def on_async_error(self, t): msg = f'An ERROR occurred: {exctype}: {value}.' msg_box = QMessageBox(QMessageBox.Critical, 'Error', msg) msg_box.setDetailedText(traceback) - msg_box.exec_() + msg_box.exec() def reset_cancel_tracker(self): self.cancel_tracker = CancelTracker() @@ -178,7 +178,7 @@ def ome_maps_selected(self): worker.signals.result.connect(self.ome_maps_loaded) worker.signals.error.connect(self.on_async_error) worker.signals.finished.connect(self.accept_progress) - self.progress_dialog.exec_() + self.progress_dialog.exec() def run_eta_ome_maps(self, config): self.ome_maps = generate_eta_ome_maps(config, save=False) @@ -239,7 +239,7 @@ def ome_maps_viewed(self): worker.signals.result.connect(self.orientation_fibers_generated) worker.signals.error.connect(self.on_async_error) - self.progress_dialog.exec_() + self.progress_dialog.exec() def generate_orientation_fibers(self, config): # Generate the orientation fibers @@ -524,7 +524,7 @@ def fit_grains_options_accepted(self): self.progress_dialog.cancel_visible = True self.progress_dialog.cancel_clicked.connect(self.on_cancel_clicked) - self.progress_dialog.exec_() + self.progress_dialog.exec() def run_fit_grains(self): cfg = create_indexing_config() diff --git a/hexrd/ui/indexing/view_spots_dialog.py b/hexrd/ui/indexing/view_spots_dialog.py index 052d48540..5c8c30cc1 100644 --- a/hexrd/ui/indexing/view_spots_dialog.py +++ b/hexrd/ui/indexing/view_spots_dialog.py @@ -339,4 +339,4 @@ def _find_data(all_spots, grain_id, det_key, gvec_id, peak_id): dialog.ui.finished.connect(app.quit) dialog.ui.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/input_dialog.py b/hexrd/ui/input_dialog.py index d1e2c6e22..c66aa5651 100644 --- a/hexrd/ui/input_dialog.py +++ b/hexrd/ui/input_dialog.py @@ -35,7 +35,7 @@ def getItem(cls, parent, title, label, items, current=0, editable=True, if help_url: add_help_url(button_box, help_url) - if not dialog.exec_(): + if not dialog.exec(): return None, False name = combo_box.currentText() diff --git a/hexrd/ui/instrument_form_view_widget.py b/hexrd/ui/instrument_form_view_widget.py index f0c3f1cff..11f88c382 100644 --- a/hexrd/ui/instrument_form_view_widget.py +++ b/hexrd/ui/instrument_form_view_widget.py @@ -118,7 +118,7 @@ def on_energy_wavelength_changed(self): def open_xray_energies_dialog(self): dialog = XRayEnergySelectionDialog(self.ui) - if not dialog.exec_(): + if not dialog.exec(): return # The table has units in eV. Convert to keV. diff --git a/hexrd/ui/list_editor.py b/hexrd/ui/list_editor.py index 4577427dc..faf79eb81 100644 --- a/hexrd/ui/list_editor.py +++ b/hexrd/ui/list_editor.py @@ -263,4 +263,4 @@ def item_renamed(old_name, new_name): dialog.finished.connect(dialog_finished) dialog.finished.connect(app.quit) dialog.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/llnl_import_tool_dialog.py b/hexrd/ui/llnl_import_tool_dialog.py index 800ddec18..8554b2a39 100644 --- a/hexrd/ui/llnl_import_tool_dialog.py +++ b/hexrd/ui/llnl_import_tool_dialog.py @@ -369,7 +369,7 @@ def pick_line_color(self): color = sender.text() dialog = QColorDialog(QColor(color), self.ui) - if dialog.exec_(): + if dialog.exec(): sender.setText(dialog.selectedColor().name()) lc = self.ui.line_color lc.setStyleSheet('QPushButton {background-color: %s}' % lc.text()) diff --git a/hexrd/ui/load_images_dialog.py b/hexrd/ui/load_images_dialog.py index d1aa1f2bb..dd1f5fa90 100644 --- a/hexrd/ui/load_images_dialog.py +++ b/hexrd/ui/load_images_dialog.py @@ -39,10 +39,10 @@ def setup_connections(self): self.ui.regex_line_edit.textChanged.connect(self.update_combo_state) self.ui.regex_line_edit.textChanged.connect(self.update_table) - def exec_(self): + def exec(self): # Loop until canceled or validation succeeds while True: - if self.ui.exec_(): + if self.ui.exec(): # Perform some validation before returning detectors, image_files = self.results() if Counter(detectors) != Counter(self.detectors): diff --git a/hexrd/ui/main.py b/hexrd/ui/main.py index 3f3b9ae9c..3b66ac81a 100644 --- a/hexrd/ui/main.py +++ b/hexrd/ui/main.py @@ -46,7 +46,7 @@ def main(): # Load the entrypoint file window.load_entrypoint_file(parsed_args.state_file) - sys.exit(app.exec_()) + sys.exit(app.exec()) def apply_parsed_args_to_hexrd_config(parsed_args): diff --git a/hexrd/ui/main_window.py b/hexrd/ui/main_window.py index 79b266f82..b61a8270d 100644 --- a/hexrd/ui/main_window.py +++ b/hexrd/ui/main_window.py @@ -518,7 +518,7 @@ def open_image_files(self): dialog = LoadImagesDialog(files, manual, self.ui) - if dialog.exec_(): + if dialog.exec(): detector_names, image_files = dialog.results() image_files = [img for f in files for img in f] files = [[] for det in HexrdConfig().detector_names] @@ -550,7 +550,7 @@ def on_action_save_imageseries_triggered(self): QMessageBox.warning(self.ui, 'HEXRD', msg) return - SaveImagesDialog(self.ui).exec_() + SaveImagesDialog(self.ui).exec() def on_action_save_materials_triggered(self): selected_file, selected_filter = QFileDialog.getSaveFileName( @@ -670,7 +670,7 @@ def on_action_run_indexing_triggered(self): self._indexing_runner.run() def on_action_rerun_clustering(self): - RerunClusteringDialog(self._indexing_runner, self.ui).exec_() + RerunClusteringDialog(self._indexing_runner, self.ui).exec() def on_action_run_fit_grains_triggered(self): kwargs = { @@ -908,7 +908,7 @@ def on_action_edit_reset_instrument_config(self): def edit_refinements(self): w = self._refinements_editor = RefinementsEditor(self.ui) - if not w.ui.exec_(): + if not w.ui.exec(): return # Update the UI in case settings have changed @@ -1220,7 +1220,7 @@ def polar_mouse_info_labels(self, info): return labels def on_action_transform_detectors_triggered(self): - _ = TransformDialog(self.ui).exec_() + _ = TransformDialog(self.ui).exec() def open_image_calculator(self): if dialog := getattr(self, '_image_calculator_dialog', None): @@ -1242,7 +1242,7 @@ def on_accepted(): dialog.accepted.connect(on_accepted) def on_action_edit_config_triggered(self): - ConfigDialog(self.ui).exec_() + ConfigDialog(self.ui).exec() def update_enable_states(self): has_images = HexrdConfig().has_images @@ -1474,7 +1474,7 @@ def apply_polarization_correction_toggled(self, b): # Get the user to first select the Lorentz polarization options d = PolarizationOptionsDialog(self.ui) - if not d.exec_(): + if not d.exec(): # Canceled... uncheck the action. action = self.ui.action_apply_polarization_correction action.setChecked(False) @@ -1503,7 +1503,7 @@ def on_image_view_loaded(self, images): def on_action_about_triggered(self): dialog = AboutDialog(self.ui) - dialog.ui.exec_() + dialog.ui.exec() def on_action_documentation_triggered(self): QDesktopServices.openUrl(QUrl(DOCUMENTATION_URL)) diff --git a/hexrd/ui/mask_manager_dialog.py b/hexrd/ui/mask_manager_dialog.py index 2a2499c31..3b7c912d0 100644 --- a/hexrd/ui/mask_manager_dialog.py +++ b/hexrd/ui/mask_manager_dialog.py @@ -210,7 +210,7 @@ def context_menu_event(self, event): if index.row() >= 0: menu = QMenu(self.ui.masks_table) export = menu.addAction('Export Mask') - action = menu.exec_(QCursor.pos()) + action = menu.exec(QCursor.pos()) if action == export: selection = self.ui.masks_table.item(index.row(), 0).text() data = HexrdConfig().raw_mask_coords[selection] @@ -354,7 +354,7 @@ def masks_to_panel_buffer(self): button_box.rejected.connect(dialog.reject) layout.addWidget(button_box) - if not dialog.exec_(): + if not dialog.exec(): # canceled return diff --git a/hexrd/ui/material_list_editor.py b/hexrd/ui/material_list_editor.py index ce665ea93..c30335077 100644 --- a/hexrd/ui/material_list_editor.py +++ b/hexrd/ui/material_list_editor.py @@ -113,4 +113,4 @@ def import_from_defaults(self): dialog.ui.finished.connect(app.quit) dialog.ui.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/material_site_editor.py b/hexrd/ui/material_site_editor.py index 385486ae4..983bf2c8f 100644 --- a/hexrd/ui/material_site_editor.py +++ b/hexrd/ui/material_site_editor.py @@ -70,7 +70,7 @@ def setup_connections(self): def select_atom_types(self): dialog = PeriodicTableDialog(self.atom_types, self.ui) - if not dialog.exec_(): + if not dialog.exec(): return self.atom_types = dialog.selected_atoms @@ -452,7 +452,7 @@ def textFromValue(self, value): def open_editor(self): original = copy.deepcopy(self.editor.value) - if not self.editor.exec_(): + if not self.editor.exec(): self.editor.value = original return diff --git a/hexrd/ui/matrix_editor.py b/hexrd/ui/matrix_editor.py index 1716a7792..3ee08982f 100644 --- a/hexrd/ui/matrix_editor.py +++ b/hexrd/ui/matrix_editor.py @@ -240,4 +240,4 @@ def on_data_modified(): dialog.finished.connect(app.quit) dialog.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/message_box.py b/hexrd/ui/message_box.py index ac6894e56..41fffae17 100644 --- a/hexrd/ui/message_box.py +++ b/hexrd/ui/message_box.py @@ -15,8 +15,8 @@ def __init__(self, title, message, details='', parent=None): self.message = message self.details = details - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() def show(self): return self.ui.show() @@ -86,4 +86,4 @@ def align_details_hcenter(self): dialog = MessageBox(**kwargs) dialog.align_details_hcenter() dialog.ui.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/overlay_manager.py b/hexrd/ui/overlay_manager.py index 7e22ec33e..a96166860 100644 --- a/hexrd/ui/overlay_manager.py +++ b/hexrd/ui/overlay_manager.py @@ -292,4 +292,4 @@ def remove(self): def edit_style(self): self._style_picker = OverlayStylePicker(self.active_overlay, self.ui) - self._style_picker.exec_() + self._style_picker.exec() diff --git a/hexrd/ui/overlay_style_picker.py b/hexrd/ui/overlay_style_picker.py index c41d03d98..7cafd6ebf 100644 --- a/hexrd/ui/overlay_style_picker.py +++ b/hexrd/ui/overlay_style_picker.py @@ -31,9 +31,9 @@ def __init__(self, overlay, parent=None): self.setup_connections() self.update_gui() - def exec_(self): + def exec(self): self.ui.adjustSize() - return self.ui.exec_() + return self.ui.exec() def setup_connections(self): self.ui.data_color.pressed.connect(self.pick_color) @@ -168,7 +168,7 @@ def pick_color(self): color = sender.text() dialog = QColorDialog(QColor(color), self.ui) - if dialog.exec_(): + if dialog.exec(): sender.setText(dialog.selectedColor().name()) self.update_button_colors() self.update_config() diff --git a/hexrd/ui/periodic_table_dialog.py b/hexrd/ui/periodic_table_dialog.py index 95fa924a3..c1d79056b 100644 --- a/hexrd/ui/periodic_table_dialog.py +++ b/hexrd/ui/periodic_table_dialog.py @@ -60,6 +60,6 @@ def clear_selection(self): app = QApplication() dialog = PeriodicTableDialog(['H', 'Ni', 'Ta']) - dialog.exec_() + dialog.exec() print(f'{dialog.selected_atoms=}') diff --git a/hexrd/ui/plot_grains.py b/hexrd/ui/plot_grains.py index b98cb86b5..66f8da277 100644 --- a/hexrd/ui/plot_grains.py +++ b/hexrd/ui/plot_grains.py @@ -21,4 +21,4 @@ def plot_grains(grains_table, ome_maps=None, parent=None): dialog = IndexingResultsDialog(ome_maps, grains_table, parent) dialog.plot_grains_mode = True - dialog.exec_() + dialog.exec() diff --git a/hexrd/ui/polarization_options_dialog.py b/hexrd/ui/polarization_options_dialog.py index 275710491..6e215f446 100644 --- a/hexrd/ui/polarization_options_dialog.py +++ b/hexrd/ui/polarization_options_dialog.py @@ -18,8 +18,8 @@ def setup_connections(self): self.ui.horizontal.valueChanged.connect(self.horizontal_modified) self.ui.vertical.valueChanged.connect(self.vertical_modified) - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() def accept(self): # When the dialog is accepted, save the settings in HexrdConfig. diff --git a/hexrd/ui/progress_dialog.py b/hexrd/ui/progress_dialog.py index cae02d51b..285571dea 100644 --- a/hexrd/ui/progress_dialog.py +++ b/hexrd/ui/progress_dialog.py @@ -86,12 +86,12 @@ def reset_messages(self): # Shrink the dialog to the size of the contents self.shrink_later() - def exec_(self): + def exec(self): self.reset_messages() - self.ui.exec_() + self.ui.exec() - def exec_later(self): - QTimer.singleShot(0, lambda: self.exec_()) + def execlater(self): + QTimer.singleShot(0, lambda: self.exec()) @property def cancel_visible(self): diff --git a/hexrd/ui/reorder_pairs_widget.py b/hexrd/ui/reorder_pairs_widget.py index 9821f5ab1..3963bc80d 100644 --- a/hexrd/ui/reorder_pairs_widget.py +++ b/hexrd/ui/reorder_pairs_widget.py @@ -124,4 +124,4 @@ def items_reordered(): print(f'Items reordered: {widget.items}') widget.items_reordered.connect(items_reordered) - dialog.exec_() + dialog.exec() diff --git a/hexrd/ui/rerun_clustering_dialog.py b/hexrd/ui/rerun_clustering_dialog.py index 5eab84d82..7b46d340b 100644 --- a/hexrd/ui/rerun_clustering_dialog.py +++ b/hexrd/ui/rerun_clustering_dialog.py @@ -92,16 +92,16 @@ def on_finished(): def on_rejected(): # Since this is a QueuedConnection, we need to accept progress here runner.accept_progress() - self.exec_() + self.exec() worker.signals.result.connect(on_finished, Qt.QueuedConnection) runner.indexing_results_rejected.connect(on_rejected, Qt.QueuedConnection) worker.signals.error.connect(runner.on_async_error) - runner.progress_dialog.exec_() + runner.progress_dialog.exec() super().accept() - def exec_(self): + def exec(self): self.setup_gui() - self.ui.exec_() + self.ui.exec() diff --git a/hexrd/ui/save_images_dialog.py b/hexrd/ui/save_images_dialog.py index ebc619099..2562291f3 100644 --- a/hexrd/ui/save_images_dialog.py +++ b/hexrd/ui/save_images_dialog.py @@ -87,8 +87,8 @@ def save_images(self): self.progress_dialog.setWindowTitle(f'Saving {filename}') self.progress_dialog.setRange(0, 0) worker.signals.finished.connect(self.progress_dialog.accept) - self.progress_dialog.exec_() + self.progress_dialog.exec() - def exec_(self): - if self.ui.exec_(): + def exec(self): + if self.ui.exec(): self.save_images() diff --git a/hexrd/ui/select_grains_dialog.py b/hexrd/ui/select_grains_dialog.py index 5c10b7a06..a4bfa0d23 100644 --- a/hexrd/ui/select_grains_dialog.py +++ b/hexrd/ui/select_grains_dialog.py @@ -90,8 +90,8 @@ def setup_methods(self): enable_list = list(methods_and_enable.values()) set_combobox_enabled_items(self.ui.method, enable_list) - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() def on_accepted(self): self.update_config() diff --git a/hexrd/ui/select_item_dialog.py b/hexrd/ui/select_item_dialog.py index d27602d0c..1bcce1f07 100644 --- a/hexrd/ui/select_item_dialog.py +++ b/hexrd/ui/select_item_dialog.py @@ -26,8 +26,8 @@ def __init__(self, options, disable_list=None, window_title=None, self.setup_connections() - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() def setup_connections(self): self.ui.button_box.accepted.connect(self.on_accepted) diff --git a/hexrd/ui/select_items_dialog.py b/hexrd/ui/select_items_dialog.py index 9915d23b5..b0582102d 100644 --- a/hexrd/ui/select_items_dialog.py +++ b/hexrd/ui/select_items_dialog.py @@ -48,5 +48,5 @@ def selection_changed(): print(f'Selection changed: {dialog.selected_items}') dialog.select_items_widget.selection_changed.connect(selection_changed) - if dialog.exec_(): + if dialog.exec(): print(f'{dialog.selected_items=}') diff --git a/hexrd/ui/simple_image_series_dialog.py b/hexrd/ui/simple_image_series_dialog.py index 052c5b7e3..596ee3ac8 100644 --- a/hexrd/ui/simple_image_series_dialog.py +++ b/hexrd/ui/simple_image_series_dialog.py @@ -362,7 +362,7 @@ def find_images(self, fnames): if manual: dialog = LoadImagesDialog(self.files, manual, self.ui.parent()) - if not dialog.exec_(): + if not dialog.exec(): self.reset_data() return @@ -456,7 +456,7 @@ def contextMenuEvent(self, event): # Allow user to delete selected file(s) menu = QMenu(self.ui) remove = menu.addAction('Remove Selected Files') - action = menu.exec_(QCursor.pos()) + action = menu.exec(QCursor.pos()) # Re-selects the current row if context menu is called on disabled cell i = self.ui.file_options.indexAt(event) diff --git a/hexrd/ui/table_selector_widget.py b/hexrd/ui/table_selector_widget.py index 4def84216..9c62702c2 100644 --- a/hexrd/ui/table_selector_widget.py +++ b/hexrd/ui/table_selector_widget.py @@ -185,4 +185,4 @@ def selected_rows(): dialog.finished.connect(selected_rows) dialog.finished.connect(app.quit) dialog.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/thermal_factor_editor.py b/hexrd/ui/thermal_factor_editor.py index 66d7c8a02..90b70aba3 100644 --- a/hexrd/ui/thermal_factor_editor.py +++ b/hexrd/ui/thermal_factor_editor.py @@ -29,8 +29,8 @@ def update_tab_widget(self): tab = getattr(self.ui, f'{prefix}_tab') self.ui.tab_widget.setCurrentWidget(tab) - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() @property def value(self): diff --git a/hexrd/ui/transform_dialog.py b/hexrd/ui/transform_dialog.py index debbb317d..ef359fca7 100644 --- a/hexrd/ui/transform_dialog.py +++ b/hexrd/ui/transform_dialog.py @@ -42,8 +42,8 @@ def setup_connections(self): self.ui.update_each.clicked.connect(self.toggle_options) self.ui.accepted.connect(self.apply_transforms) - def exec_(self): - return self.ui.exec_() + def exec(self): + return self.ui.exec() def toggle_options(self): enabled = self.ui.update_all.isChecked() diff --git a/hexrd/ui/tree_views/base_dict_tree_item_model.py b/hexrd/ui/tree_views/base_dict_tree_item_model.py index 903b7e9ef..120b8b0c1 100644 --- a/hexrd/ui/tree_views/base_dict_tree_item_model.py +++ b/hexrd/ui/tree_views/base_dict_tree_item_model.py @@ -390,7 +390,7 @@ def change_combo_item(old, new, value): return super().contextMenuEvent(event) # Open up the context menu - action_chosen = menu.exec_(QCursor.pos()) + action_chosen = menu.exec(QCursor.pos()) if action_chosen is None: # No action chosen diff --git a/hexrd/ui/tree_views/generic_picks_tree_view.py b/hexrd/ui/tree_views/generic_picks_tree_view.py index 636f9f47d..ac5930090 100644 --- a/hexrd/ui/tree_views/generic_picks_tree_view.py +++ b/hexrd/ui/tree_views/generic_picks_tree_view.py @@ -387,7 +387,7 @@ def hand_pick_item(): return # Open up the context menu - action_chosen = menu.exec_(QCursor.pos()) + action_chosen = menu.exec(QCursor.pos()) if action_chosen is None: # No action chosen diff --git a/hexrd/ui/tree_views/hkl_picks_tree_view.py b/hexrd/ui/tree_views/hkl_picks_tree_view.py index 94caf3e7f..314c801a9 100644 --- a/hexrd/ui/tree_views/hkl_picks_tree_view.py +++ b/hexrd/ui/tree_views/hkl_picks_tree_view.py @@ -133,7 +133,7 @@ def hand_pick_item(): return # Open up the context menu - action_chosen = menu.exec_(QCursor.pos()) + action_chosen = menu.exec(QCursor.pos()) if action_chosen is None: # No action chosen diff --git a/hexrd/ui/tree_views/multi_column_dict_tree_view.py b/hexrd/ui/tree_views/multi_column_dict_tree_view.py index c38e62ab6..f26843ad6 100644 --- a/hexrd/ui/tree_views/multi_column_dict_tree_view.py +++ b/hexrd/ui/tree_views/multi_column_dict_tree_view.py @@ -170,7 +170,7 @@ def uncheck_selection(): return # Open up the context menu - action_chosen = menu.exec_(QCursor.pos()) + action_chosen = menu.exec(QCursor.pos()) if action_chosen is None: # No action chosen @@ -350,4 +350,4 @@ def utype(w): dialog.finished.connect(app.quit) dialog.show() - app.exec_() + app.exec() diff --git a/hexrd/ui/wppf_style_picker.py b/hexrd/ui/wppf_style_picker.py index 6c15ab9e6..effcf633c 100644 --- a/hexrd/ui/wppf_style_picker.py +++ b/hexrd/ui/wppf_style_picker.py @@ -93,7 +93,7 @@ def pick_color(self): color = sender.text() dialog = QColorDialog(QColor(color), self.ui) - if dialog.exec_(): + if dialog.exec(): sender.setText(dialog.selectedColor().name()) self.update_button_colors() self.update_config() diff --git a/hexrd/ui/xray_energy_selection_dialog.py b/hexrd/ui/xray_energy_selection_dialog.py index c3c312fc7..cfb953a5b 100644 --- a/hexrd/ui/xray_energy_selection_dialog.py +++ b/hexrd/ui/xray_energy_selection_dialog.py @@ -140,4 +140,4 @@ def finished(): dialog.accepted.connect(finished) dialog.show() - app.exec_() + app.exec()