source: sasview/guiframe/data_manager.py @ 7342634

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 7342634 was 32c0841, checked in by Gervaise Alina <gervyh@…>, 14 years ago

working on pylint

  • Property mode set to 100644
File size: 2.3 KB
Line 
1################################################################################
2#This software was developed by the University of Tennessee as part of the
3#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4#project funded by the US National Science Foundation.
5#
6#See the license text in license.txt
7#
8#copyright 2010, University of Tennessee
9################################################################################
10"""
11This module manages all data loaded into the application. Data_manager makes
12available all data loaded  for the current perspective.
13
14All modules creating
15fake Data posts their data to data_manager . Data_manager  make these new data
16available for all other perspectives.
17"""
18
19class DataManager(object):
20    """
21     Manage a list of data
22    """
23    def __init__(self, parent):
24        """
25        Store opened path and data object created at the loading time
26        """
27        self.loaded_data_list = []
28        self.created_data_list = []
29        self.list_of_data = []
30        self.message = ""
31        self.parent = parent
32       
33    def get_message(self):
34        """
35        return message
36        """
37        return self.message
38   
39    def set_loaded_data(self, data_list=None):
40        """
41        save data and path
42        """
43        if data_list is None:
44            return
45        for data, path in data_list:
46            if data.name not in self.list_of_data:
47                self.loaded_data_list.append((data, path))
48                self.list_of_data.append(data.name)
49            else:
50                self.message += " %s already loaded" % str(data.name)
51       
52    def set_created_data(self, data_list=None):
53        """
54        return
55        """
56        if data_list is None:
57            return
58        for data, path in data_list:
59            for created_data, _ in self.created_data_list:
60                if data.name == created_data.name:
61                    self.message += " %s already created" % str(data.name)
62                else:
63                    self.created_data_list.append((data, path))
64   
65    def get_data(self):
66        """
67        Send list of available data
68        """
69        return self.loaded_data_list + self.created_data_list
70       
Note: See TracBrowser for help on using the repository browser.