From c86962ce72934ef991f4877936fed5a6e1387559 Mon Sep 17 00:00:00 2001 From: eneelo Date: Thu, 7 Dec 2023 15:31:53 +0100 Subject: [PATCH 1/3] gui: fix import/export file dialogue bug --- qats/app/gui.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/qats/app/gui.py b/qats/app/gui.py index adbf91a..dc096a3 100644 --- a/qats/app/gui.py +++ b/qats/app/gui.py @@ -762,13 +762,14 @@ def on_export(self): # file save dialogue dlg = QFileDialog() dlg.setWindowIcon(self.icon) - options = dlg.Options() + # options = dlg.Options() # raises expection in qt6 (pyside6) -- probably not needed + dlg.setViewMode(QFileDialog.Detail) # https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QFileDialog.html name, _ = dlg.getSaveFileName(dlg, "Export time series to file", "", "Direct access file (*.ts);;" "ASCII file with header (*.dat);;" "SIMA H5 file (*.h5);;" - "All Files (*)", options=options) + "All Files (*)") # , options=options) # get list of selected time series keys = self.selected_series() @@ -799,7 +800,8 @@ def on_import(self): """ dlg = QFileDialog() dlg.setWindowIcon(self.icon) - options = dlg.Options() + # options = dlg.Options() # raises expection in qt6 (pyside6) -- probably not needed + dlg.setViewMode(QFileDialog.Detail) # https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QFileDialog.html files, _ = dlg.getOpenFileNames(dlg, "Load time series files", "", "Direct access files (*.ts);;" "SIMO S2X direct access files with info array (*.tda);;" @@ -810,7 +812,7 @@ def on_import(self): "SIMA H5 files (*.h5);;" "CSV file with header (*.csv);;" "Technical Data Management Streaming files (*.tdms);;" - "All Files (*)", options=options) + "All Files (*)") #, options=options) # load files into db and update application model and view self.load_files(files) @@ -1396,7 +1398,7 @@ def update_model(self, newdb): # fill item model with time series by unique id (common path is removed) names = self.db.list(names="*", relative=True, display=False) self.db_source_model.clear() # clear before re-adding - + # quickfix for Wildcard issue (#119): replace '\' by '/' for name in names: # set each item as unchecked initially item = QStandardItem(name) From 14d034f05cb2de80c2d900124ef96164869e384a Mon Sep 17 00:00:00 2001 From: eneelo Date: Thu, 7 Dec 2023 15:41:22 +0100 Subject: [PATCH 2/3] removed commented code to please SonarCloud --- qats/app/gui.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qats/app/gui.py b/qats/app/gui.py index dc096a3..2191e18 100644 --- a/qats/app/gui.py +++ b/qats/app/gui.py @@ -762,14 +762,13 @@ def on_export(self): # file save dialogue dlg = QFileDialog() dlg.setWindowIcon(self.icon) - # options = dlg.Options() # raises expection in qt6 (pyside6) -- probably not needed dlg.setViewMode(QFileDialog.Detail) # https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QFileDialog.html name, _ = dlg.getSaveFileName(dlg, "Export time series to file", "", "Direct access file (*.ts);;" "ASCII file with header (*.dat);;" "SIMA H5 file (*.h5);;" - "All Files (*)") # , options=options) + "All Files (*)") # get list of selected time series keys = self.selected_series() @@ -800,8 +799,8 @@ def on_import(self): """ dlg = QFileDialog() dlg.setWindowIcon(self.icon) - # options = dlg.Options() # raises expection in qt6 (pyside6) -- probably not needed dlg.setViewMode(QFileDialog.Detail) # https://doc.qt.io/qtforpython-6/PySide6/QtWidgets/QFileDialog.html + files, _ = dlg.getOpenFileNames(dlg, "Load time series files", "", "Direct access files (*.ts);;" "SIMO S2X direct access files with info array (*.tda);;" @@ -812,7 +811,7 @@ def on_import(self): "SIMA H5 files (*.h5);;" "CSV file with header (*.csv);;" "Technical Data Management Streaming files (*.tdms);;" - "All Files (*)") #, options=options) + "All Files (*)") # load files into db and update application model and view self.load_files(files) From f72fa2b2b2c8c3072ee304f7913826de80888e40 Mon Sep 17 00:00:00 2001 From: eneelo Date: Thu, 7 Dec 2023 16:14:19 +0100 Subject: [PATCH 3/3] gui: fix wildcard filter when multiple files loaded --- qats/app/gui.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qats/app/gui.py b/qats/app/gui.py index 2191e18..150f15b 100644 --- a/qats/app/gui.py +++ b/qats/app/gui.py @@ -638,7 +638,10 @@ def model_view_filter_changed(self): # construct regexp string that may be used to initiate QRegularExpression instance if filter_type == "wildcard": # pad with wildcard ('*') to get expected behaviour - reg_exp_pattern = QRegularExpression.wildcardToRegularExpression(f"*{pattern}*") + reg_exp_pattern = QRegularExpression.wildcardToRegularExpression( + f"*{pattern}*", + options=QRegularExpression.WildcardConversionOption.NonPathWildcardConversion + ) elif filter_type == "regexp": # pattern string should be interpreted as a regexp pattern reg_exp_pattern = pattern @@ -1397,7 +1400,6 @@ def update_model(self, newdb): # fill item model with time series by unique id (common path is removed) names = self.db.list(names="*", relative=True, display=False) self.db_source_model.clear() # clear before re-adding - # quickfix for Wildcard issue (#119): replace '\' by '/' for name in names: # set each item as unchecked initially item = QStandardItem(name)