From a153603a3c9a590a609624faa26a74f8704a1ec1 Mon Sep 17 00:00:00 2001
From: Lan Dam <lan.dam@earthscope.org>
Date: Wed, 15 May 2024 11:50:24 -0600
Subject: [PATCH] reset tps_t after using to prevent bug when clicking on no
 point area

---
 .../view/plotting/plotting_widget/plotting_widget.py           | 3 +++
 .../plotting/time_power_square/time_power_squared_widget.py    | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
index 4453eab6..f5125b3f 100644
--- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
+++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py
@@ -504,6 +504,9 @@ class PlottingWidget(QtWidgets.QScrollArea):
             if self.tps_t is None:
                 return
             xdata = self.tps_t
+            # Reset tps_t here because the reset in on_pick_event won't be
+            # reach when no point is clicked.
+            self.tps_t = None
         else:
             xdata = self.get_timestamp(event)
 
diff --git a/sohstationviewer/view/plotting/time_power_square/time_power_squared_widget.py b/sohstationviewer/view/plotting/time_power_square/time_power_squared_widget.py
index bfc1a6e4..da583e49 100644
--- a/sohstationviewer/view/plotting/time_power_square/time_power_squared_widget.py
+++ b/sohstationviewer/view/plotting/time_power_square/time_power_squared_widget.py
@@ -69,7 +69,7 @@ class TimePowerSquaredWidget(plotting_widget.PlottingWidget):
         tps_t: float - prompt's time on tps's chart to help rulers on other
             plotting widgets to identify their location
         """
-        self.tps_t = 0
+        self.tps_t = None
         """
         display_top_ticks: flag to display time ticks on top of ax or not
         """
-- 
GitLab