From 021f4720b878ca58794d9070214ab230988a1e9c Mon Sep 17 00:00:00 2001 From: Rune Broberg Date: Tue, 5 Nov 2019 15:29:04 +0100 Subject: [PATCH] Even more correctly load and save positive/negative return loss setting. Allow more decimals when setting min/max values for charts. --- NanoVNASaver/Chart.py | 18 ++++++++++++------ NanoVNASaver/NanoVNASaver.py | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NanoVNASaver/Chart.py b/NanoVNASaver/Chart.py index c38114d..2d0409c 100644 --- a/NanoVNASaver/Chart.py +++ b/NanoVNASaver/Chart.py @@ -418,7 +418,8 @@ class FrequencyChart(Chart): def setMinimumValue(self): min_val, selected = QtWidgets.QInputDialog.getDouble(self, "Minimum value", - "Set minimum value", value=self.minDisplayValue) + "Set minimum value", value=self.minDisplayValue, + decimals=3) if not selected: return if not (self.fixedValues and min_val >= self.maxDisplayValue): @@ -428,7 +429,8 @@ class FrequencyChart(Chart): def setMaximumValue(self): max_val, selected = QtWidgets.QInputDialog.getDouble(self, "Maximum value", - "Set maximum value", value=self.maxDisplayValue) + "Set maximum value", value=self.maxDisplayValue, + decimals=3) if not selected: return if not (self.fixedValues and max_val <= self.minDisplayValue): @@ -2438,7 +2440,8 @@ class RealImaginaryChart(FrequencyChart): def setMinimumRealValue(self): min_val, selected = QtWidgets.QInputDialog.getDouble(self, "Minimum real value", - "Set minimum real value", value=self.minDisplayReal) + "Set minimum real value", value=self.minDisplayReal, + decimals=2) if not selected: return if not (self.fixedValues and min_val >= self.maxDisplayReal): @@ -2448,7 +2451,8 @@ class RealImaginaryChart(FrequencyChart): def setMaximumRealValue(self): max_val, selected = QtWidgets.QInputDialog.getDouble(self, "Maximum real value", - "Set maximum real value", value=self.maxDisplayReal) + "Set maximum real value", value=self.maxDisplayReal, + decimals=2) if not selected: return if not (self.fixedValues and max_val <= self.minDisplayReal): @@ -2458,7 +2462,8 @@ class RealImaginaryChart(FrequencyChart): def setMinimumImagValue(self): min_val, selected = QtWidgets.QInputDialog.getDouble(self, "Minimum imaginary value", - "Set minimum imaginary value", value=self.minDisplayImag) + "Set minimum imaginary value", value=self.minDisplayImag, + decimals=2) if not selected: return if not (self.fixedValues and min_val >= self.maxDisplayImag): @@ -2468,7 +2473,8 @@ class RealImaginaryChart(FrequencyChart): def setMaximumImagValue(self): max_val, selected = QtWidgets.QInputDialog.getDouble(self, "Maximum imaginary value", - "Set maximum imaginary value", value=self.maxDisplayImag) + "Set maximum imaginary value", value=self.maxDisplayImag, + decimals=2) if not selected: return if not (self.fixedValues and max_val <= self.minDisplayImag): diff --git a/NanoVNASaver/NanoVNASaver.py b/NanoVNASaver/NanoVNASaver.py index a5151b0..2e118ef 100644 --- a/NanoVNASaver/NanoVNASaver.py +++ b/NanoVNASaver/NanoVNASaver.py @@ -1002,9 +1002,9 @@ class DisplaySettingsWindow(QtWidgets.QWidget): display_options_layout.addRow("", self.returnloss_is_positive) if self.app.settings.value("ReturnLossPositive", False, bool): - self.returnloss_is_negative.setChecked(True) - else: self.returnloss_is_positive.setChecked(True) + else: + self.returnloss_is_negative.setChecked(True) self.returnloss_is_positive.toggled.connect(self.changeReturnLoss) self.changeReturnLoss()