From 6f1a84af104abdeb430c263dd157a99599eef6d1 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Wed, 3 Apr 2024 17:26:37 +0200 Subject: [PATCH] cancel ascii reading only if skip is True --- src/gui_qt/io/filereaders.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui_qt/io/filereaders.py b/src/gui_qt/io/filereaders.py index 808d96f..d1428fc 100755 --- a/src/gui_qt/io/filereaders.py +++ b/src/gui_qt/io/filereaders.py @@ -51,7 +51,9 @@ class QFileReader(QtCore.QObject): if not isinstance(fname, list): fname = [fname] + status = QtWidgets.QDialog.Accepted for f in fname: + print(f) f = Path(f) dtype = self.guess_type(f) if dtype in self.reader: @@ -60,10 +62,13 @@ class QFileReader(QtCore.QObject): raise ValueError(f'Unknown type for file {f}') try: + print(status, QtWidgets.QDialog.DialogCode.Accepted) + print(r) + print(repr(self.reader['txt'].skip)) # If QAsciiReader.skip = True it accepts automatically and returns None - status = r(f).exec() - if status == QtWidgets.QDialog.Rejected and isinstance(r, QAsciiReader): + if status == QtWidgets.QDialog.DialogCode.Rejected and isinstance(r, QAsciiReader) and self.reader['txt'].skip: break + status = r(f).exec() except AttributeError: pass