From 8dfd022d73a317ee316f51878e7d8ef65e299b04 Mon Sep 17 00:00:00 2001 From: John Henry Beale Date: Mon, 24 Aug 2026 12:26:26 +0200 Subject: [PATCH] only alpha numerical characters to protein and prefix fields - removes wrong data path bug --- app_config.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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)