Esempio n. 1
0
    def parseButton_clicked(self):
        csv2excelwbPath = self.lookForCsv2Excel()
        rwparser = RwParser()
        savePath = self.dirName + "/" + self.fileNameNoExt
        if self.excelCheckBox.isChecked():
            # filter, calculate hourly, running streaks etc.
            
            rwparser.parseDistData(self.distCsvName, self.fileNameNoExt, 
                self.newFolderPath, self.qtStartDateTime, self.qtEndDateTime)
            self.changableLabel.setText("Parsing complete.")

            self.disableButtons()
            
            self.changableLabel.setText("Compiling excel worksheet. Please wait...")

            # Pop-up info box for user feedback
            msgBox = QtGui.QMessageBox()
            QtGui.QPlainTextEdit.LineWrapMode
            msgBox.setText("Compiling Excel workbook with csv output. Please wait. (Don't panic, the program may not respond for a few minutes.)")
            msgBox.exec_()

            # call csv2execlwb.py/.exe
            self.callCsv2Excel()

            # More feedback
            msgBox = QtGui.QMessageBox()
            msgBox.setText("Excel file complete! Results can be found in the " + savePath + " directory.")
            msgBox.exec_()
            
            # Export to Excel
            # This block is not currently used. Reserved for future. Hopefully,
            # I can figure out the segfault error and integrate the export
            # to excel portion back into the script.
            # rwparser.exportToExcel(self.fileNameNoExt, self.newFolderPath)
            
            self.changableLabel.setText("Finished compiling Excel workbook.")
            # Turn controls back on when done
            self.enableButtons()
        else: # pass onto
            rwparser.parseDistData(self.distCsvName, self.fileNameNoExt, 
                self.newFolderPath, self.qtStartDateTime, self.qtEndDateTime)
            self.changableLabel.setText("Parsing complete.")
            self.disableButtons()
            
            # Pop-up info box for user feedback
            msgBox = QtGui.QMessageBox()
            QtGui.QPlainTextEdit.LineWrapMode
            msgBox.setText("Parsing complete. Results can be found in the " + savePath + " directory ")
            msgBox.exec_()
            self.enableButtons()