From e2d27c2dee5e704e9c5d1c78f1d73b5f025a26e5 Mon Sep 17 00:00:00 2001
From: ldam <ldam@passcal.nmt.edu>
Date: Wed, 30 Aug 2023 09:27:25 -0600
Subject: [PATCH] remove deprecation warning by changing exec_() to exec()

---
 sohstationviewer.py                                         | 2 +-
 sohstationviewer/model/data_loader.py                       | 2 +-
 sohstationviewer/view/channel_prefer_dialog.py              | 2 +-
 sohstationviewer/view/date_edit_with_doy.py                 | 2 +-
 sohstationviewer/view/db_config/db_config_dialog.py         | 2 +-
 sohstationviewer/view/file_information/file_info_widget.py  | 2 +-
 sohstationviewer/view/help_view.py                          | 2 +-
 sohstationviewer/view/main_window.py                        | 6 +++---
 sohstationviewer/view/plotting/gps_plot/gps_dialog.py       | 4 ++--
 .../view/plotting/plotting_widget/plotting_widget.py        | 6 +++---
 sohstationviewer/view/save_plot_dialog.py                   | 6 +++---
 .../view/search_message/search_message_dialog.py            | 2 +-
 sohstationviewer/view/select_buttons_dialog.py              | 4 ++--
 13 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/sohstationviewer.py b/sohstationviewer.py
index 9fa480d0c..20ecf79e0 100755
--- a/sohstationviewer.py
+++ b/sohstationviewer.py
@@ -11,7 +11,7 @@ def main():
     app = QtWidgets.QApplication(sys.argv)
     wnd = MainWindow()
     wnd.show()
-    sys.exit(app.exec_())
+    sys.exit(app.exec())
 
 
 if __name__ == '__main__':
diff --git a/sohstationviewer/model/data_loader.py b/sohstationviewer/model/data_loader.py
index 8322d1bf4..ca79bdcd8 100644
--- a/sohstationviewer/model/data_loader.py
+++ b/sohstationviewer/model/data_loader.py
@@ -237,7 +237,7 @@ class DataLoader(QtCore.QObject):
             )
         abort_button = msg_box.addButton(QtWidgets.QMessageBox.Abort)
 
-        msg_box.exec_()
+        msg_box.exec()
 
         if msg_box.clickedButton() == abort_button:
             # The default choice is the first item, so we default to it if the
diff --git a/sohstationviewer/view/channel_prefer_dialog.py b/sohstationviewer/view/channel_prefer_dialog.py
index 3825fa4ca..137683bd2 100755
--- a/sohstationviewer/view/channel_prefer_dialog.py
+++ b/sohstationviewer/view/channel_prefer_dialog.py
@@ -361,7 +361,7 @@ class ChannelPreferDialog(OneWindowAtATimeDialog):
     def edit_soh_list(self, row_idx):
         soh_list_item = self.soh_list_table_widget.item(row_idx, COL['IDs'])
         edit_dialog = InputDialog(text=soh_list_item.text())
-        if edit_dialog.exec_():
+        if edit_dialog.exec():
             soh_list_item.setText(edit_dialog.get_input())
 
     @QtCore.Slot()
diff --git a/sohstationviewer/view/date_edit_with_doy.py b/sohstationviewer/view/date_edit_with_doy.py
index 017ef67ce..a93fa143a 100644
--- a/sohstationviewer/view/date_edit_with_doy.py
+++ b/sohstationviewer/view/date_edit_with_doy.py
@@ -86,7 +86,7 @@ class DayOfYearSupportedDateTextBox(QDateEdit):
 
         menu.addAction(copy_action)
         menu.addAction(select_all_action)
-        menu.exec_(event.globalPos())
+        menu.exec(event.globalPos())
 
     def setDisplayFormat(self, format):
         """
diff --git a/sohstationviewer/view/db_config/db_config_dialog.py b/sohstationviewer/view/db_config/db_config_dialog.py
index 027981fb6..7c6b1fd3c 100755
--- a/sohstationviewer/view/db_config/db_config_dialog.py
+++ b/sohstationviewer/view/db_config/db_config_dialog.py
@@ -268,7 +268,7 @@ class UiDBInfoDialog(OneWindowAtATimeDialog):
             msgbox.setText(msg)
             msgbox.addButton(QtWidgets.QMessageBox.Cancel)
             msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
-            result = msgbox.exec_()
+            result = msgbox.exec()
             if result == QtWidgets.QMessageBox.Cancel:
                 return
         self.close()
diff --git a/sohstationviewer/view/file_information/file_info_widget.py b/sohstationviewer/view/file_information/file_info_widget.py
index b78380f08..e6d155e0e 100644
--- a/sohstationviewer/view/file_information/file_info_widget.py
+++ b/sohstationviewer/view/file_information/file_info_widget.py
@@ -27,7 +27,7 @@ class FileInfoWidget(QListWidget):
 
         menu.addAction(copy_action)
         menu.addAction(select_all_action)
-        menu.exec_(event.globalPos())
+        menu.exec(event.globalPos())
 
     def keyPressEvent(self, event: QKeyEvent) -> None:
         if event.matches(QKeySequence.Copy):
diff --git a/sohstationviewer/view/help_view.py b/sohstationviewer/view/help_view.py
index 5d8fdb778..a8618b050 100644
--- a/sohstationviewer/view/help_view.py
+++ b/sohstationviewer/view/help_view.py
@@ -538,7 +538,7 @@ def main():
 
     wnd = HelpBrowser(home_path='../../')
     wnd.show()
-    sys.exit(app.exec_())
+    sys.exit(app.exec())
 
 
 if __name__ == '__main__':
diff --git a/sohstationviewer/view/main_window.py b/sohstationviewer/view/main_window.py
index 2ed83cbdb..7748b576a 100755
--- a/sohstationviewer/view/main_window.py
+++ b/sohstationviewer/view/main_window.py
@@ -393,7 +393,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
         fd = QtWidgets.QFileDialog(self)
         fd.setFileMode(QtWidgets.QFileDialog.Directory)
         fd.setDirectory(self.curr_dir_line_edit.text())
-        fd.exec_()
+        fd.exec()
         try:
             new_path = fd.selectedFiles()[0]
             self.set_current_directory(new_path)
@@ -609,7 +609,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
                 msgbox.setText(str(e))
                 msgbox.addButton(QtWidgets.QMessageBox.Cancel)
                 msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
-                result = msgbox.exec_()
+                result = msgbox.exec()
                 if result == QtWidgets.QMessageBox.Cancel:
                     self.cancel_loading()
                     return
@@ -634,7 +634,7 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
                                                    QMessageBox.Abort)
             data_too_big_dialog.setDefaultButton(QMessageBox.Abort)
             data_too_big_dialog.setIcon(QMessageBox.Question)
-            ret = data_too_big_dialog.exec_()
+            ret = data_too_big_dialog.exec()
             if ret == QMessageBox.Abort:
                 self.cancel_loading()
                 return
diff --git a/sohstationviewer/view/plotting/gps_plot/gps_dialog.py b/sohstationviewer/view/plotting/gps_plot/gps_dialog.py
index 7526acfff..96e5d1fd5 100644
--- a/sohstationviewer/view/plotting/gps_plot/gps_dialog.py
+++ b/sohstationviewer/view/plotting/gps_plot/gps_dialog.py
@@ -326,7 +326,7 @@ class GPSDialog(QtWidgets.QWidget):
         fd = QtWidgets.QFileDialog(self)
         fd.setFileMode(QtWidgets.QFileDialog.Directory)
         fd.setDirectory(self.export_dir_textbox.text())
-        fd.exec_()
+        fd.exec()
         new_path = fd.selectedFiles()[0]
         self.set_export_directory(new_path)
 
@@ -432,4 +432,4 @@ if __name__ == '__main__':
     wnd.data_path = Path(data_path)
     wnd.show()
 
-    sys.exit(app.exec_())
+    sys.exit(app.exec())
diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
index a307ee3dc..e82f518ce 100755
--- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
+++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
@@ -650,7 +650,7 @@ class PlottingWidget(QtWidgets.QScrollArea):
             msgbox.setText(msg)
             msgbox.addButton(QtWidgets.QMessageBox.Cancel)
             msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
-            result = msgbox.exec_()
+            result = msgbox.exec()
             if result == QtWidgets.QMessageBox.Cancel:
                 return
             self.main_window.color_mode = self.c_mode
@@ -667,12 +667,12 @@ class PlottingWidget(QtWidgets.QScrollArea):
             msgbox.setText(msg)
             msgbox.addButton(QtWidgets.QMessageBox.Cancel)
             msgbox.addButton('Continue', QtWidgets.QMessageBox.YesRole)
-            result = msgbox.exec_()
+            result = msgbox.exec()
             if result == QtWidgets.QMessageBox.Cancel:
                 return
         save_plot_dlg = SavePlotDialog(
             self.parent, self.main_window, default_name)
-        save_plot_dlg.exec_()
+        save_plot_dlg.exec()
         save_file_path = save_plot_dlg.save_file_path
         if save_file_path is None:
             return
diff --git a/sohstationviewer/view/save_plot_dialog.py b/sohstationviewer/view/save_plot_dialog.py
index 0de627299..d5e7a5fc1 100644
--- a/sohstationviewer/view/save_plot_dialog.py
+++ b/sohstationviewer/view/save_plot_dialog.py
@@ -93,7 +93,7 @@ class SavePlotDialog(QDialog):
         fd = QtWidgets.QFileDialog(self)
         fd.setFileMode(QtWidgets.QFileDialog.Directory)
         fd.setDirectory(self.save_dir_textbox.text())
-        fd.exec_()
+        fd.exec()
         new_path = fd.selectedFiles()[0]
         self.save_dir_textbox.setText(new_path)
         self.save_dir_path = new_path
@@ -133,7 +133,7 @@ if __name__ == '__main__':
     save_path = '/Users/ldam/Documents/GIT/sohstationviewer/tests/test_data/Q330-sample'  # noqa: E501
     test = SavePlotDialog(None, 'test_plot')
     test.set_save_directory(save_path)
-    test.exec_()
+    test.exec()
     print("dpi:", test.dpi)
     print("save file path:", test.save_file_path)
-    sys.exit(app.exec_())
+    sys.exit(app.exec())
diff --git a/sohstationviewer/view/search_message/search_message_dialog.py b/sohstationviewer/view/search_message/search_message_dialog.py
index c535f494b..8aeb3f2b7 100644
--- a/sohstationviewer/view/search_message/search_message_dialog.py
+++ b/sohstationviewer/view/search_message/search_message_dialog.py
@@ -705,7 +705,7 @@ def main():
     wnd.show()
     # wnd.show_log_entry_from_data_index(10)
 
-    sys.exit(app.exec_())
+    sys.exit(app.exec())
 
 
 if __name__ == '__main__':
diff --git a/sohstationviewer/view/select_buttons_dialog.py b/sohstationviewer/view/select_buttons_dialog.py
index 4cbf11c6f..f4efebe38 100644
--- a/sohstationviewer/view/select_buttons_dialog.py
+++ b/sohstationviewer/view/select_buttons_dialog.py
@@ -62,7 +62,7 @@ if __name__ == '__main__':
     test = SelectButtonDialog(None, "Testing result from buttons",
                               ['test01', 'test02', 'test03',
                                'test11', 'test12', 'test13'])
-    test.exec_()
+    test.exec()
 
     print("return Code:", test.ret)
-    sys.exit(app.exec_())
+    sys.exit(app.exec())
-- 
GitLab