From 4d87d055e267b7afc0c8d5bcb6fa958bbdc83fd2 Mon Sep 17 00:00:00 2001 From: ldam <ldam@passcal.nmt.edu> Date: Thu, 2 Nov 2023 16:43:28 -0600 Subject: [PATCH] change back conversion widget to QLineEdit because conversion can go down to 1.0e-06 --- .../db_config/add_edit_single_channel_dialog.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sohstationviewer/view/db_config/add_edit_single_channel_dialog.py b/sohstationviewer/view/db_config/add_edit_single_channel_dialog.py index 4f0cff00b..8a760224e 100755 --- a/sohstationviewer/view/db_config/add_edit_single_channel_dialog.py +++ b/sohstationviewer/view/db_config/add_edit_single_channel_dialog.py @@ -3,7 +3,7 @@ import platform import os from typing import Optional, Dict -from PySide2 import QtWidgets +from PySide2 import QtWidgets, QtGui from PySide2.QtWidgets import QWidget, QDialog, QLineEdit from sohstationviewer.view.util.plot_func_names import plot_functions @@ -72,13 +72,14 @@ class AddEditSingleChannelDialog(QDialog): "added to channel name to be displayed") # convert factor to change from count to actual value - self.conversion_lnedit = QtWidgets.QSpinBox() - self.conversion_lnedit.setMinimum(0) - self.conversion_lnedit.setMaximum(5) - self.conversion_lnedit.setToolTip( + self.convesion_lnedit = QtWidgets.QLineEdit(self) + self.convesion_lnedit.setPlaceholderText( "to convert from count to actual value" ) - self.conversion_lnedit.setValue(1) + validator = QtGui.QDoubleValidator(0.0, 5.0, 6) + validator.setNotation(QtGui.QDoubleValidator.StandardNotation) + self.convesion_lnedit.setValidator(validator) + self.convesion_lnedit.setText('1') # channel's unit self.unit_lnedit = QtWidgets.QLineEdit(self) @@ -223,8 +224,8 @@ class AddEditSingleChannelDialog(QDialog): self.label_lnedit.setText(self.channel_info['label']) - self.conversion_lnedit.setValue( - float(self.channel_info['convertFactor'])) + self.convesion_lnedit.setText( + str(float(self.channel_info['convertFactor']))) self.unit_lnedit.setText(self.channel_info['unit']) -- GitLab