Exemple #1
0
    def exportPDF(self):
        """Exports the current Pandas Dataframe as a PDF File (No modifications is made)"""
        dateTimeFormat = time.strftime(
            "%Y%m%d-%H%M%S")  # Date and Time Format (YYYYMMDD-HHMMSS)
        config = pdf.configuration(
            wkhtmltopdf="wkhtmltopdf\\bin\\wkhtmltopdf.exe"
        )  # where the config file is located at

        try:
            if self.table.empty:
                raise ValueError("There is no data!")
            else:
                self.table.to_html(
                    'exportPDF.html')  # convert table data to html

                pdfFileName = 'tablePDF-' + dateTimeFormat + ".pdf"  # name file of the pdf file
                pdf.from_file('exportPDF.html',
                              pdfFileName,
                              configuration=config)  # convert html to pdf file

                os.remove('exportPDF.html')  # delete the html file
                mod.successGUI()  # prompt file downloaded

        except Exception as e:
            mod.errorGUI(str(e))
Exemple #2
0
    def exportTXT(self):
        dateTimeFormat = time.strftime(
            "%Y%m%d-%H%M%S")  # Date and Time Format (YYYYMMDD-HHMMSS)
        try:
            if self.table.empty:
                raise ValueError("There is no data!")
            else:
                self.table.to_csv('tableTXT-' + dateTimeFormat + '.TXT',
                                  sep='\t')  # export data to TXT file
                mod.successGUI()  # prompt file downloaded

        except Exception as e:
            mod.errorGUI(str(e))
Exemple #3
0
 def exportCSV(self):
     """Exports the current Pandas Dataframe (after merges and modifications) as a CSV File"""
     try:
         fileName = mod.saveFileLocation(
             self)  # if search is valid export with the latest version
         if not self.view.empty:
             self.view.to_csv(fileName, encoding='utf-8', index=False)
             mod.successGUI()
         else:
             self.table.to_csv(fileName, encoding='utf-8', index=False)
             mod.successGUI()
     except Exception as e:
         # Display error message
         mod.errorGUI(str(e))
Exemple #4
0
    def exportIMG_filter(self):
        """Exports the current Pandas Dataframe (after merges and modifications) as a IMG(.png) File"""
        dateTimeFormat = time.strftime(
            "%Y%m%d-%H%M%S")  # Date and Time Format (YYYYMMDD-HHMMSS)
        config = img.config(
            wkhtmltoimage="wkhtmltopdf\\bin\\wkhtmltoimage.exe")

        try:
            if self.view.empty:
                raise ValueError("There is no search data!")
            else:
                self.view.to_html('exportIMG_filter.html')
                img.from_file(
                    "exportIMG_filter.html",
                    "table_image_filter-" + dateTimeFormat + ".png",
                    config=config)  # from html change to img(.png) file
                os.remove('exportIMG_filter.html')  # delete html file
                mod.successGUI()  # prompt file downloaded

        except Exception as e:
            mod.errorGUI(str(e))