Пример #1
0
    def import_dataset_file(self,
                            filename=None,
                            dataset_name=None,
                            sample_name=None,
                            import_format=None,
                            update_trophic_type=False):
        """ """
        datasettopnode = plankton_core.DatasetNode()
        #
        if import_format == 'SHARKweb':
            self._import_sharkweb_file(datasettopnode, filename,
                                       update_trophic_type)
#         if import_format == 'PhytoWin':
#             self._import_phytowin_file(datasettopnode, filename)
        if import_format == 'PlanktonCounter':
            self._import_plankton_counter_sample(datasettopnode, dataset_name,
                                                 sample_name,
                                                 update_trophic_type)
        #
        if import_format == 'PlanktonCounterExcel':
            self._import_plankton_counter_sample_from_excel(
                datasettopnode, filename, update_trophic_type)
        #
        if datasettopnode:
            plankton_core.Datasets().add_dataset(datasettopnode)
        #
        return datasettopnode
Пример #2
0
 def _copy_datasets_for_analysis(self):
     """ """
     try:
         try:
             toolbox_utils.Logging().log('Copy datasets for analysis...')
             toolbox_utils.Logging().start_accumulated_logging()
             #
             self._main_activity.view_analysis_data()
             # Clear analysis data
             self._analysisdata.clear_data()
             self._main_activity.update_viewed_data_and_tabs() 
             # Create a list of selected datasets.        
             datasets = []
             for rowindex in range(self._loaded_datasets_model.rowCount()):
                 item = self._loaded_datasets_model.item(rowindex, 0)
                 if item.checkState() == QtCore.Qt.Checked:        
                     datasets.append(plankton_core.Datasets().get_datasets()[rowindex])
             # Use the datasets for analysis.
             self._analysisdata.copy_datasets_to_analysis_data(datasets)  
             # Check.
             if (self._analysisdata.get_data() == None) or (len(self._analysisdata.get_data().get_children()) == 0):
                 toolbox_utils.Logging().log('Selected datasets are empty.')
                 raise UserWarning('Selected datasets are empty.')
             self._main_activity.update_viewed_data_and_tabs() 
         #
         except UserWarning as e:
             toolbox_utils.Logging().error('Failed to copy data for analysis. ' + str(e))
             QtWidgets.QMessageBox.warning(self._main_activity, 'Warning', 'Failed to copy data for analysis. ' + str(e))
         finally:
             toolbox_utils.Logging().log_all_accumulated_rows()
             toolbox_utils.Logging().log('Copy datasets for analysis is done.')
     #
     except Exception as e:
         debug_info = self.__class__.__name__ + ', row  ' + str(sys._getframe().f_lineno)
         toolbox_utils.Logging().error('Exception: (' + debug_info + '): ' + str(e))
 def remove_dataset_by_index(self, index):
     """ """
     plankton_core.Datasets().remove_dataset_by_index(index)
     # Emit signal.
     self._emit_change_notification()
 def add_dataset(self, dataset):
     """ """
     plankton_core.Datasets().add_dataset(dataset)
     # Emit signal.
     self._emit_change_notification()
 def get_dataset_by_index(self, index):
     """ """
     return plankton_core.Datasets().get_dataset_by_index(index)
 def get_datasets(self):
     """ """
     return plankton_core.Datasets().get_datasets()
 def clear(self):
     """ """
     plankton_core.Datasets().clear()
     # Emit signal.
     self._emit_change_notification()
 def __init__(self):
     """ """
     plankton_core.Datasets()
     #
     QtCore.QObject.__init__(self)