Open poloskeipeter opened 4 years ago
Only STFT parameters are being checked currently, checking if they are numerical or not.
This is a great idea! Two suggestions for modifications:
I can try to change the trigger of the check to the box modification event. Messages are just placeholders at the moment with the aim of giving some visual feedback that something happened. They will be revised once we will be around the brink of any public release.
Should check the relevant property in QT Designer.
So there are two parts to answer this topic: 1.) StackOverflow says that it is not possible to set up an input validator directly from QtDesigner, it should not be handled in QtDesigner, but in the GUI main.py. https://stackoverflow.com/questions/38701996/inputmethodhints-qt-imhdigitsonly-not-working 2.) a separate validator has to be created in order to check specific input fields. https://stackoverflow.com/questions/41087993/user-input-validation-in-pyqt5-and-python
from PyQt5.Qt import QApplication
from PyQt5.QtCore import QRegExp
from PyQt5.QtGui import QRegExpValidator
from PyQt5.QtWidgets import QWidget, QLineEdit
import sys
class MyWidget(QWidget):
def __init__(self, parent=None):
super(QWidget, self).__init__(parent)
self.le_input = QLineEdit(self)
reg_ex = QRegExp("[0-9]+.?[0-9]{,2}")
input_validator = QRegExpValidator(reg_ex, self.le_input)
self.le_input.setValidator(input_validator)
if __name__ == '__main__':
a = QApplication(sys.argv)
w = MyWidget()
w.show()
a.exec()
A question arose, regarding that the regular expression validator should allow scientific notation too, theoretical solution found: https://stackoverflow.com/questions/18152597/extract-scientific-number-from-string
Currently, 2 types of regular expressions are being set up. One is for integers and one for general numbers. Where-what should be allowed to be discussed.
step should be less than nperseg see #17 for reference
Before initializing calculations input parameters should be checked and feedback should be provided to the user in order to correct their mistakes.