From 435953999ac957a51822bd56d66e52926bb50997 Mon Sep 17 00:00:00 2001
From: ldam <ldam@passcal.nmt.edu>
Date: Thu, 4 May 2023 09:21:54 -0600
Subject: [PATCH] change main_params/params to main_window

---
 .../multi_threaded_plotting_widget.py             |  2 +-
 .../view/plotting/plotting_widget/plotting.py     |  9 +++++----
 .../plotting/plotting_widget/plotting_axes.py     | 15 ++++++++-------
 .../plotting/plotting_widget/plotting_widget.py   | 10 +++++-----
 .../view/plotting/time_power_squared_dialog.py    |  2 +-
 5 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py
index 9dd714920..229544d77 100644
--- a/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py
+++ b/sohstationviewer/view/plotting/plotting_widget/multi_threaded_plotting_widget.py
@@ -75,7 +75,7 @@ class MultiThreadedPlottingWidget(PlottingWidget):
         self.key = key
         self.processing_log = []  # [(message, type)]
         self.gap_bar = None
-        self.date_mode = self.main_params.date_format.upper()
+        self.date_mode = self.main_window.date_format.upper()
         self.time_ticks_total = time_ticks_total
         self.min_x = max(data_time[0], start_tm)
         self.max_x = min(data_time[1], end_tm)
diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting.py b/sohstationviewer/view/plotting/plotting_widget/plotting.py
index 33f98bb92..ec2ab8e8a 100644
--- a/sohstationviewer/view/plotting/plotting_widget/plotting.py
+++ b/sohstationviewer/view/plotting/plotting_widget/plotting.py
@@ -10,16 +10,17 @@ class Plotting:
     """
     Class that includes different methods to plot channels on a figure.
     """
-    def __init__(self, parent, plotting_axes, main_params):
+    def __init__(self, parent, plotting_axes, main_window):
         """
         :param parent: PlottingWidget - widget to plot channels
         :param plotting_axes: PlottingAxes - widget that includes a figure
             and methods related to create axes
-        :param main_params: Object - object that includes needed parameters
+        :param main_window: QApplication - Main Window to access user's
+            setting parameters
         """
         super().__init__()
         self.parent = parent
-        self.params = main_params
+        self.main_window = main_window
         self.plotting_axes = plotting_axes
 
     def plot_none(self):
@@ -334,7 +335,7 @@ class Plotting:
         :return ax: matplotlib.axes.Axes - axes of the channel
         """
         value_colors = get_masspos_value_colors(
-            self.params.mass_pos_volt_range_opt, chan_id,
+            self.main_window.mass_pos_volt_range_opt, chan_id,
             self.parent.c_mode, self.parent.processing_log,
             ret_type='tupleList')
 
diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py b/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py
index 22d3e07d5..940110dc3 100644
--- a/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py
+++ b/sohstationviewer/view/plotting/plotting_widget/plotting_axes.py
@@ -17,12 +17,13 @@ class PlottingAxes:
     Class that includes a figure to add axes for plotting and all methods
         related to create axes, ruler, title.
     """
-    def __init__(self, parent, main_params):
+    def __init__(self, parent, main_window):
         """
         :param parent: PlottingWidget - widget to plot channels
-        :param main_params: Object - object that includes needed parameters
+        :param main_window: QApplication - Main Window to access user's
+            setting parameters
         """
-        self.params = main_params
+        self.main_window = main_window
         self.parent = parent
         # gaps: list of gaps which is a list of min and max of gaps
         self.gaps: List[List[float]] = []
@@ -275,7 +276,7 @@ class PlottingAxes:
             ax.spines['top'].set_visible(True)
             ax.spines['bottom'].set_visible(True)
             ax.unit_bw = get_unit_bitweight(
-                chan_db_info, self.params.bit_weight_opt
+                chan_db_info, self.main_window.bit_weight_opt
             )
             self.set_axes_ylim(ax, min_y, max_y)
 
@@ -310,15 +311,15 @@ class PlottingAxes:
 
         :param gaps: [[float, float], ] - list of [min, max] of gaps
         """
-        if self.params.min_gap is None:
+        if self.main_window.min_gap is None:
             return
-        self.gaps = gaps = get_gaps(gaps, self.params.min_gap)
+        self.gaps = gaps = get_gaps(gaps, self.main_window.min_gap)
         self.parent.plotting_bot -= 0.003
         self.parent.gap_bar = self.create_axes(self.parent.plotting_bot,
                                                0.001,
                                                has_min_max_lines=False)
 
-        gap_label = f"GAP({self.params.min_gap}min)"
+        gap_label = f"GAP({self.main_window.min_gap}min)"
         h = 0.001  # height of rectangle represent gap
         self.set_axes_info(self.parent.gap_bar, [len(gaps)],
                            label=gap_label)
diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
index 9c6c9e544..ee20d2c43 100755
--- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
+++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
@@ -32,17 +32,17 @@ class PlottingWidget(QtWidgets.QScrollArea):
     def __init__(self, parent: Union[QWidget, QApplication],
                  tracking_box: QTextBrowser,
                  name: str,
-                 main_params: QApplication) -> None:
+                 main_window: QApplication) -> None:
         """
         :param parent: widget that contains this plotting
             widget
         :param tracking_box: widget to display tracking info
         :param name: name of the plotting widget to keep track of what
             widget the program is working on
-        :param main_params: Main window that keep all parameters set by user
+        :param main_window: Main window that keep all parameters set by user
         """
         self.parent = parent
-        self.main_params = main_params
+        self.main_window = main_window
         self.name = name
         self.tracking_box = tracking_box
         # =============== declare attributes =======================
@@ -200,7 +200,7 @@ class PlottingWidget(QtWidgets.QScrollArea):
         """
         plotting_axes: object that helps creating axes for plotting
         """
-        self.plotting_axes = PlottingAxes(self, main_params)
+        self.plotting_axes = PlottingAxes(self, main_window)
         self.plotting_axes.canvas.setParent(self.main_widget)
 
         self.setWidget(self.main_widget)
@@ -208,7 +208,7 @@ class PlottingWidget(QtWidgets.QScrollArea):
         """
         plotting: object that helps with different types of plotting channels
         """
-        self.plotting = Plotting(self, self.plotting_axes, main_params)
+        self.plotting = Plotting(self, self.plotting_axes, main_window)
         """
         new_min_x: store the new minimum time for zooming; used to fix a
         problem where after the first zoom marker is chosen, any ruler that is
diff --git a/sohstationviewer/view/plotting/time_power_squared_dialog.py b/sohstationviewer/view/plotting/time_power_squared_dialog.py
index e443d1bad..2705be48b 100755
--- a/sohstationviewer/view/plotting/time_power_squared_dialog.py
+++ b/sohstationviewer/view/plotting/time_power_squared_dialog.py
@@ -102,7 +102,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
         self.min_x = max(d_obj.data_time[key][0], start_tm)
         self.max_x = min(d_obj.data_time[key][1], end_tm)
 
-        self.date_mode = self.main_params.date_format.upper()
+        self.date_mode = self.main_window.date_format.upper()
         if self.plotting_data1 == {}:
             title = "NO WAVEFORM DATA TO DISPLAY TPS."
             self.processing_log.append(
-- 
GitLab