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: # self.statusbar.showMessage('Processing Files...') pp = PreProc(filenames) # pass files into PreProc class # self.statusbar.showMessage('Analyzing datas...') dp = DataProc() # pass the prepared data into DataProc class self.statusbar.showMessage('Done')
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() # pass the prepared data into DataProc class self.statusbar.showMessage('Done')
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 openDir(self): dialog = QtWidgets.QFileDialog() dialog.setFileMode(QFileDialog.DirectoryOnly) dic_file = [] if dialog.exec_(): # == QtGui.QDialog.Accepted: dic_file = dialog.selectedFiles() print(dic_file) filenames = [] if len(dic_file) != 0: for f in os.listdir(dic_file[0]): print(f) filenames += dic_file[0]+"/"+f, print(filenames) # has_log = False # suf = 'log' # if dic_file: # for f in os.listdir(dic_file[0]): # print(f) # suffix = f[f.rfind('.')+1:] # if suffix == suf: # has_log = True # if not has_log: # self.showdialog(False, has_log); # # self.processFile(filenames) # 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 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
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'))
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: # self.statusbar.showMessage('Processing Files...') start_time = timeit.default_timer() pp = PreProc(filenames) # pass files into PreProc class elapsed = timeit.default_timer() - start_time print("time cost preProc:", elapsed) # self.statusbar.showMessage('Analyzing datas...') start_time1 = timeit.default_timer() dp = DataProc() # pass the prepared data into DataProc class elapsed1 = timeit.default_timer() - start_time1 print("time cost dataProc:", elapsed1) self.linked = dp.linked self.unlinked = dp.unlinked self.dfinal = dp.dfinal self.cut_oversized = dp.cut_oversized self.statusbar.showMessage('Done') self.removeWidgets() self.layout.addWidget(self.createBar())
def choosePath(self): # pop out the file dialog dialog = QFileDialog() dialog.setFileMode(QFileDialog.ExistingFiles) filenames = [] if dialog.exec_(): filenames = dialog.selectedFiles() # print(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 print(f) #, f.rfind('.'), f[f.rfind('.')+1:]) suffix = f[f.rfind('.') + 1:] if suffix != suf: print("Illegal selection") illegal = True if illegal: print("Should pop up message box") self.showdialog() # then go back to selection # we made here because all files are log file # go to File process procedure, I might prababely create a calss for process log files else: self.textBox.setText((',').join(filenames)) print("show loding dialog") # self.l = LoadView() # self.l # fp = FileProc(filenames) pp = PreProc(filenames) dp = DataProc('in_window_logfile.csv', 'machine_decision_logfile.csv') # linked_bags = fp.getLinkedBags() # unlinked_bags = fp.getUnlinkedBags() # print(len(linked_bags), len(unlinked_bags)) # dp = DataProc(linked_bags, unlinked_bags) # # self.l.setParent(None) # # uncomment below when fileProc connect to dataProc # self.m = MainMenu('his.png') # this line is to show histogram # self.h = HisView('his.png') # self.h.show() # to here print(dp.dfinal) model = pandasModel(dp.dfinal) self.view = QTableView() self.view.setModel(model) self.view.resize(800, 600) self.view.show()
def openDir(self): dialog = QtWidgets.QFileDialog() dialog.setFileMode(QFileDialog.DirectoryOnly) dic_file = [] if dialog.exec_(): # == QtGui.QDialog.Accepted: dic_file = dialog.selectedFiles() log_file = [] has_log = False suf = 'log' if dic_file: for f in os.listdir(dic_file[0]): suffix = f[f.rfind('.')+1:] name = f[:f.rfind('.')] if suffix == suf: has_log = True if "AnalogicStandaloneType" in name:# if match AnalogicStandaloneType*.log, append to log_file log_file += dic_file[0]+"/"+f, 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: start_time = timeit.default_timer() pp = PreProc(log_file) # pass files into PreProc class elapsed = timeit.default_timer() - start_time print("time cost on processing data:", elapsed) start_time1 = timeit.default_timer() dp = DataProc() # pass the prepared data into DataProc class elapsed1 = timeit.default_timer() - start_time1 print("time cost on load data:", elapsed1) self.linked = dp.linked self.unlinked = dp.unlinked self.dfinal = dp.dfinal self.cut_oversized = dp.cut_oversized self.slipping = dp.slipping self.pushed = dp.pushed self.entrance_events = pp.entrance_events self.entrance_misreads = pp.misread_entrance self.found_prev_bag = pp.found_prev_bag self.total_bins = pp.total_bins self.scanner_linked_rfid = pp.scanner_linked_rfid self.already_sent_moveback_bag = pp.bag_already_sent self.lost_track_crusty_bag = pp.lost_track_crusty_bag self.exit_events = pp.exit_events self.exit_misreads = pp.misread_exit self.exit_read_unlinked = pp.exit_read_unlinked self.statusbar.showMessage('Done') self.setSummaryLabel() self.setUnlinkedLabel() self.setFileLists(log_file) self.onActivated(self.currText) # to display chart corresponding to dropdown selections
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]): 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: start_time = timeit.default_timer() pp = PreProc(log_file) # pass files into PreProc class elapsed = timeit.default_timer() - start_time print("time cost preProc:", elapsed) start_time1 = timeit.default_timer() dp = DataProc() # pass the prepared data into DataProc class elapsed1 = timeit.default_timer() - start_time1 print("time cost dataProc:", elapsed1) self.linked = dp.linked self.unlinked = dp.unlinked self.dfinal = dp.dfinal self.cut_oversized = dp.cut_oversized self.statusbar.showMessage('Done') self.removeWidgets() self.layout.addWidget(self.createBar())
def openFile(self): filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(None,"QFileDialog.getOpenFileNames()", "","All Files (*);;Log Files (*.log);;") 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: illegal = True if illegal: self.showdialog(illegal, True); else: start_time = timeit.default_timer() pp = PreProc(filenames) # pass files into PreProc class elapsed = timeit.default_timer() - start_time print("time cost on processing data:", elapsed) start_time1 = timeit.default_timer() dp = DataProc() # pass the prepared data into DataProc class elapsed1 = timeit.default_timer() - start_time1 print("time cost on load data:", elapsed1) self.linked = dp.linked self.unlinked = dp.unlinked self.dfinal = dp.dfinal self.cut_oversized = dp.cut_oversized self.slipping = dp.slipping self.pushed = dp.pushed self.entrance_events = pp.entrance_events self.entrance_misreads = pp.misread_entrance self.found_prev_bag = pp.found_prev_bag self.total_bins = pp.total_bins self.scanner_linked_rfid = pp.scanner_linked_rfid self.already_sent_moveback_bag = pp.bag_already_sent self.lost_track_crusty_bag = pp.lost_track_crusty_bag self.exit_events = pp.exit_events self.exit_misreads = pp.misread_exit self.exit_read_unlinked = pp.exit_read_unlinked self.statusbar.showMessage('Done') self.setSummaryLabel() self.setUnlinkedLabel() self.setFileLists(filenames) self.onActivated(self.currText) # to display chart corresponding to dropdown selections
def choosePath(self): # pop out the file browser, triggered by "open" button dialog = QFileDialog() dialog.setFileMode(QFileDialog.ExistingFiles) filenames = [] if dialog.exec_(): filenames = dialog.selectedFiles() # print(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 # print(f) #, f.rfind('.'), f[f.rfind('.')+1:]) suffix = f[f.rfind('.')+1:] if suffix != suf: print("Illegal selection") illegal = True # if selected file contains illegal extension, show warning if illegal: print("Should pop up message box") self.showdialog(); # then go back to selection # we made here because all files are log file, go to File process procedure,seperate calss for process log files else: self.textBox.setText((',').join(filenames)) # display selected files inside the textedit box 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 self.m = MainMenu('his.png') # this line is to show histogram print(dp.dfinal) # print the final dataframe, show on console # diaplay the dataframe on seperate widget model = pandasModel(dp.dfinal) self.view = QTableView() self.view.setModel(model) self.view.resize(800, 600) self.view.show()
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
def openFile(self): filenames, _ = QtWidgets.QFileDialog.getOpenFileNames(None,"QFileDialog.getOpenFileNames()", "","All Files (*);;Log Files (*.log);;") if filenames: print("inside:",filenames) print("fdsfs", filenames) # self.processFile(filenames) # illegal_file = False # has_log = 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 # print("fff") # suffix = f[f.rfind('.')+1:] # if suffix != suf: # print("Illegal selection") # illegal = True # elif suffix == suf: # has_log = True # self.showdialog(illegal_file, has_log); 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