diff --git a/app_config.py b/app_config.py index 384c7cd..6bbf9b7 100644 --- a/app_config.py +++ b/app_config.py @@ -8,7 +8,8 @@ import logging _log = logging.getLogger(__name__) -from PyQt5.QtCore import QSettings +from PyQt5.QtCore import QSettings, QRegularExpression +from PyQt5.QtGui import QRegularExpressionValidator from PyQt5.QtWidgets import QApplication, QMainWindow import json,re import numpy as np @@ -558,6 +559,14 @@ verbose bits: self._paramTree=pt=ParameterTree(parent=self) pt.setParameters(p, showTop=True) + + # restrict prefix/protein fields to alphanumeric characters and underscores, + # since these feed directly into DAQ file/directory naming + alnum_underscore=QRegularExpressionValidator(QRegularExpression(r'^[A-Za-z0-9_]*$')) + for param in (p.param('data acquisition',AppCfg.DAQ_RUN,'prefix'), p.param('data acquisition',AppCfg.DAQ_SAMPLE,'protein')): + for item in param.items: + item.widget.setValidator(alnum_underscore) + pt.setWindowTitle('SwissMX parameters') #t.resize(600, 800) self.setCentralWidget(pt)