Skip to content

Commit 6d11cc3

Browse files
zielaskowskizarath
authored andcommitted
TDR:prevent zooming if no data
1 parent 3b96c65 commit 6d11cc3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/NanoVNASaver/Charts/TDR.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
)
3838
from PySide6.QtWidgets import QDialog, QInputDialog, QMenu, QSizePolicy
3939

40-
from ..RFTools import Datapoint
4140
from .Chart import Chart, ChartPosition
4241

4342
logger = logging.getLogger(__name__)
@@ -343,10 +342,6 @@ def copy(self) -> "TDRChart":
343342

344343
def wheelEvent(self, a0: QWheelEvent) -> None:
345344
a0.accept()
346-
self.data = [
347-
Datapoint(0, 0.0, 0.0)
348-
] # A bit of cheating otherwise the super().wheelEvent() exits
349-
# without doing anything.
350345
super().wheelEvent(a0)
351346

352347
def mouseMoveEvent(self, a0: QMouseEvent) -> None:

src/NanoVNASaver/Windows/TDR.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from scipy.constants import speed_of_light # type: ignore
2929
from scipy.signal import convolve # type: ignore
3030

31+
from ..RFTools import Datapoint
3132
from .Defaults import make_scrollable
3233
from .ui import get_window_icon
3334

@@ -292,6 +293,10 @@ def updateTDR(self):
292293
self.tdr_result_label.setText(f"{cable_len}m ({feet}ft {inches}in)")
293294
self.app.tdr_result_label.setText(f"{cable_len}m")
294295
self.td = list(td)
296+
self.app.tdr_chart.data = [
297+
Datapoint(0, 0.0, 0.0)
298+
] # A bit of cheating otherwise the super().wheelEvent() exits
299+
# without doing anything.
295300
self.updated.emit()
296301

297302
def _tdr_lowpass(self, tdr_format, s11, tdr_window) -> np.ndarray:

0 commit comments

Comments
 (0)