Beispiel #1
0
 def on_save_fig(self, e=None):
     path = FileDialogs.save_file_dialog()
     base, ext = os.path.splitext(path)
     #self.init()
     #self.save_fig(base,ext)
     for i in range(0, len(self.datalist)):
         self.on_next(None)
         self.save_fig(base, ext)
Beispiel #2
0
 def on_save_common_masses(self, e):
     outdata = self.commonmassespanel.list.get_list()
     cmfilename = FileDialogs.save_file_dialog("Save Common Masses File",
                                               "*.csv*",
                                               self.config.masstablefile)
     if cmfilename is not None:
         np.savetxt(cmfilename, outdata, delimiter=",", fmt="%s")
     print("Saving Common Masses to:", cmfilename)
Beispiel #3
0
 def on_save_fig_dialog(self, evt):
     """
     Open a save figure dialog for specified plot.
     :param evt: wx.Event (unused)
     :return: None
     """
     path = FileDialogs.save_file_dialog()
     if path is not None:
         self.save_figure(path)
    def auto(self, evt=None, file_path=None):
        if file_path is None:
            file_path = FileDialogs.save_file_dialog("Save File As", "*.hdf5")
            filtered_lines = []

        if file_path is not None:
            cols, data = self.my_grid.get_data()
            meta_data_importer.auto_from_wizard(data, file_path,
                                                self.rb.GetSelection())
Beispiel #5
0
 def on_write_dialog(self, evt):
     """
     Open a save figure dialog for specified plot.
     :param evt: wx.Event (unused)
     :return: None
     """
     if self.data is not None:
         path = FileDialogs.save_file_dialog()
         if path is not None:
             self.write_data(path)
     else:
         print(
             "Data object empty. Plot likely unsupported for text file output."
         )
Beispiel #6
0
    def export_file(self, evt):
        '''
        Export import file for later import
        '''
        file_path = FileDialogs.save_file_dialog(message="Save Import CSV File", file_types="CSV (*.csv)|*.csv")
        max_index = self.my_grid.next_free_row()
        if file_path != None and max_index > 0:

            if file_path[-17:] != '_ionMS_import.csv' and file_path[-4:] != '.csv':
                file_path += '_ionMS_import.csv'

            f = open(file_path, 'w')
            # get im type
            if self.rb.GetSelection() == 0:
                f.writelines('ionMS import wizard,Linear,\n')
            elif self.rb.GetSelection() == 2:
                f.writelines("ionMS import wizard,MS,\n")
            elif self.rb.GetSelection() == 3:
                f.writelines("ionMS import wizard,MS Times,\n")
            else:
                f.writelines('ionMS import wizard,T-wave,\n')

            index = -1
            while True:
                # get column labels
                cols = self.my_grid.column_labels()

                index += 1
                if index == max_index:
                    break

                if index == 0:
                    # write column labels
                    tmp = ''
                    for c in cols:
                        tmp += '%s,' % cols[c]

                    f.writelines(tmp[:-1] + '\n')

                # write out user import list
                tmp = ''
                for c in cols:
                    tmp += '%s,' % self.my_grid.GetCellValue(index, c)

                f.writelines(tmp[:-1] + '\n')

            # don't forget to close the file
            f.close()

            return file_path  # + '_ionMS_import.csv'
    def export_file(self, evt):
        '''
        Export import file for later import
        '''
        file_path = FileDialogs.save_file_dialog(
            message="Save Import CSV File", file_types="CSV (*.csv)|*.csv")
        max_index = self.my_grid.next_free_row()
        if file_path != None and max_index > 0:

            if file_path[-17:] != '_import.csv' and file_path[-4:] != '.csv':
                file_path += '_import.csv'

            cols, data = self.my_grid.get_data()

            f = open(file_path, 'w')
            # Write Type at the Top
            if self.rb.GetSelection() == 0:
                f.writelines('MetaUniDec Import Wizard,Time,\n')
            elif self.rb.GetSelection() == 1:
                f.writelines("MetaUniDec Import Wizard,Scans,\n")

            # Write Column Values
            tmp = ''
            for c in cols:
                tmp += '%s,' % cols[c]
            f.writelines(tmp[:-1] + '\n')

            # Write Data
            for i, a in enumerate(data):
                for j, l in enumerate(a):
                    f.write(str(l) + ",")
                f.write('\n')

            # close the file
            f.close()

            return file_path