stop autoamtic ascii reading if first is cancelled #260
@ -178,7 +178,7 @@ class QAsciiReader(QtWidgets.QDialog, Ui_ascii_reader):
|
||||
@QtCore.pyqtSlot()
|
||||
def accept(self):
|
||||
if self.apply():
|
||||
self.close()
|
||||
super().accept()
|
||||
|
||||
def apply(self):
|
||||
# default row for x is the first row, it will be superseded if an integer number is given.
|
||||
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
||||
from pathlib import Path
|
||||
import struct
|
||||
|
||||
from ..Qt import QtCore
|
||||
from ..Qt import QtCore, QtWidgets
|
||||
from .asciireader import QAsciiReader
|
||||
from .hdfreader import QHdfViewer
|
||||
from .bdsreader import QBDSReader
|
||||
@ -26,8 +26,12 @@ class QFileReader(QtCore.QObject):
|
||||
self.reader = {}
|
||||
|
||||
for ext, reader in [
|
||||
('txt', QAsciiReader), ('dsc', QDSCReader), ('agr', QGraceReader),
|
||||
('bds', QBDSReader), ('hdf', QHdfViewer), ('nmr', QNMRReader)
|
||||
('txt', QAsciiReader),
|
||||
('dsc', QDSCReader),
|
||||
('agr', QGraceReader),
|
||||
('bds', QBDSReader),
|
||||
('hdf', QHdfViewer),
|
||||
('nmr', QNMRReader),
|
||||
]:
|
||||
self.register(ext, reader)
|
||||
|
||||
@ -57,7 +61,10 @@ class QFileReader(QtCore.QObject):
|
||||
|
||||
try:
|
||||
# If QAsciiReader.skip = True it accepts automatically and returns None
|
||||
r(f).exec()
|
||||
status = r(f).exec()
|
||||
if status == QtWidgets.QDialog.Rejected and isinstance(r, QAsciiReader):
|
||||
break
|
||||
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user