Skip to content

Commit

Permalink
Change "exec_" to "exec"
Browse files Browse the repository at this point in the history
Qt is deprecating "exec_" in favor of "exec", so let's go ahead and
switch that over.

Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Oct 17, 2023
1 parent bd62712 commit 804ba62
Show file tree
Hide file tree
Showing 58 changed files with 110 additions and 110 deletions.
4 changes: 2 additions & 2 deletions hexrd/ui/async_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
2 changes: 1 addition & 1 deletion hexrd/ui/azimuthal_overlay_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions hexrd/ui/azimuthal_overlay_style_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/beam_marker_style_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/brightness_contrast_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/cal_tree_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions hexrd/ui/calibration/auto/powder_calibration_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions hexrd/ui/calibration/auto/powder_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions hexrd/ui/calibration/calibration_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions hexrd/ui/calibration/hedm/calibration_results_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions hexrd/ui/calibration/hedm/calibration_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions hexrd/ui/calibration/hkl_picks_tree_view_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions hexrd/ui/calibration/laue_auto_picker_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/calibration/structureless/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions hexrd/ui/calibration/wppf_options_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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=}')
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/calibration_crystal_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions hexrd/ui/config_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/image_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/image_load_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/indexing/fit_grains_results_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 2 additions & 2 deletions hexrd/ui/indexing/grains_table_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions hexrd/ui/indexing/indexing_results_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions hexrd/ui/indexing/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/indexing/view_spots_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion hexrd/ui/input_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/instrument_form_view_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion hexrd/ui/list_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion hexrd/ui/llnl_import_tool_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Loading

0 comments on commit 804ba62

Please sign in to comment.