def export(self):
        """ Launch view to select parameters and export content to file.
        """
        if self.interactive:
            ui = self.edit_traits(kind="livemodal")

        if not self.interactive or ui.result:
            msg = f"Exporting plot content to {self.export_format}."
            logger.log(ACTION_LEVEL, msg)

            to_meth = getattr(self, METHOD_MAP[self.export_format])
            try:
                to_meth()
                if self.interactive:
                    target = self.target_dir if self.export_format != \
                                              PPT_FORMAT else self.target_file
                    open_file(target)

            except Exception as e:
                msg = f"Failed to export the plot list. Error was {e}."
                logger.exception(msg)
                if self.interactive:
                    error(None, msg)
 def _summary_exporter_fired(self):
     filepath = request_csv_file(action="save as")
     if filepath:
         self.model.summary_df.to_csv(filepath)
         open_file(filepath)
 def _data_exporter_fired(self):
     filepath = request_csv_file(action="save as")
     if filepath:
         self.model.filtered_df.to_csv(filepath)
         open_file(filepath)
示例#4
0
 def open_tutorial_files(self):
     tut_target = join(dirname(kromatography.__file__), "data",
                       "tutorial_data")
     open_file(tut_target)
示例#5
0
 def open_documentation(self):
     doc_target = join(dirname(kromatography.__file__), "doc", "index.html")
     open_file(doc_target)
示例#6
0
 def export_plot_to_file(self):
     filepath = to_png_file_requester(title="Select export path")
     if filepath:
         save_plot_to_file(self.target, filepath)
         logger.info("Plot saved to {}".format(filepath))
         open_file(filepath)