the from PySide2. QtCore import QThread
The from PySide2. QtCore import QObject
The from PySide2. QtWidgets import QApplication
The from PySide2. QtWidgets import QFileDialog
# signal channel
The from PySide2. QtCore import Signal
The from PySide2. QtCore import Slot
The from process_package. Process_data_module import TrackDataProcessing
The class FileManager (QObject) :
Def __init__ (self) :
Super (FileManager, self) __init__ ()
Self. __init_instance ()
Self. __init_connections ()
Def __del__ (self) :
# print (' delete ')
Self. __split_data_thread. Quit ()
Self. __split_data_thread. Wait ()
Def split_data_to_new_file (self) :
"" "
Open dialog box to choose to split the data document, the document list to the back-end processing
"" "
# get all the name list of open
Files_in_list=QFileDialog. GetOpenFileNames () [0]
# to open the file number is 0, the file name list to the back-end processing
If 0!=len (files_in_list) :
# to judge the child thread state, if has not started, the promoter thread
Self. __start_sub_thread (self. __split_data_thread, self __track_processing)
Self. Si_file_name_with_path. Emit (files_in_list)
@ Slot ()
Def __close_application (self) :
"" "
Exit program
"" "
QApplication. CloseAllWindows ()
Def __init_instance (self) :
"" "
Initializes the object variable
"" "
Self. __track_processing=TrackDataProcessing ()
Self. __split_data_thread=QThread ()
Def __init_connections (self) :
"" "
Initialization signal channel
"" "
# signal channel new writing, recommend
# to the groove function to open the file name list
Self. Si_close_application. Connect (self __close_application)
Def __start_sub_thread (self, thread: QThread, process: QObject) :
"" "
Start the variable into the child thread, promoter thread
: param thread: the child thread
Variables: param process: move the child thread
"" "
Self. Si_file_name_with_path. Connect (self) __track_processing) split_data_to_different_file)
If not thread. Set () :
Process. MoveToThread (thread)
Thread. Finished. The connect process. DeleteLater ()
Self. Si_file_name_with_path. Connect (self) __track_processing) split_data_to_different_file)
Thread. The start ()
# to open the file name and file path
Si_file_name_with_path=Signal (list)
Si_close_application=Signal ()
I'm "__del__ (self)" end in the process, in "__start_sub_thread" promoter threads, create signals at the same time slot, what operation can be carried out as normal and subsequent read data, is closing the front line which exceptions, don't know where the thread error,