def openDir(self):
        dialog = QtWidgets.QFileDialog()
        dialog.setFileMode(QFileDialog.DirectoryOnly)

        dic_file = []
        if dialog.exec_():  # == QtGui.QDialog.Accepted:
            dic_file = dialog.selectedFiles()
        print("openDir: (dic_file) ", dic_file)

        log_file = []
        has_log = False
        suf = 'log'
        if dic_file:
            for f in os.listdir(dic_file[0]):
                #         print(f)
                suffix = f[f.rfind('.') + 1:]
                name = f[:f.rfind('.')]
                print(name)
                if suffix == suf:
                    has_log = True
                    if "AnalogicStandaloneType" in name:  # if match AnalogicStandaloneType*.log, append to log_file
                        log_file += dic_file[0] + "/" + f,
            print(has_log, log_file)
            if not has_log:
                self.showdialog(False, has_log)
            if len(log_file) == 0 and has_log:
                self.showdialog(False, False)
            if len(log_file) != 0:
                pp = PreProc(log_file)  # pass files into PreProc class
                dp = DataProc('in_window_logfile.csv',
                              'machine_decision_logfile.csv'
                              )  # pass the prepared data into DataProc class
                dp.getDiffHistogram(dp.linked)
                self.image.setPixmap(QtGui.QPixmap('his.png'))
    def openFile(self):
        filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(
            None, "QFileDialog.getOpenFileNames()", "",
            "All Files (*);;Log Files (*.log);;")
        if filenames:
            print("inside:", filenames)
        print("fdsfs", filenames)

        illegal = False
        suf = 'log'  # test for single .txt first, need to modify for final version
        if len(filenames) != 0:
            for f in filenames:  # check all files are illegal in here
                suffix = f[f.rfind('.') + 1:]
                if suffix != suf:
                    print("Illegal selection")
                    illegal = True
            print(illegal)
            if illegal:
                self.showdialog(illegal, True)
            else:
                pp = PreProc(filenames)  # pass files into PreProc class
                dp = DataProc('in_window_logfile.csv',
                              'machine_decision_logfile.csv'
                              )  # pass the prepared data into DataProc class
                dp.getDiffHistogram(dp.linked)
                self.image.setPixmap(QtGui.QPixmap('his.png'))