Changeset c70eb7c in sasview for guiframe/data_state.py


Ignore:
Timestamp:
Mar 9, 2011 7:02:50 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
8b6f489
Parents:
99abf5d
Message:

working data_panel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_state.py

    r5c4b674 rc70eb7c  
    1010""" 
    1111""" 
     12import copy 
     13 
    1214 
    1315class DataState(object): 
     
    2426        self.path = None 
    2527        self.theory_list = {} 
    26         self.state_list = [] 
    2728        self.message = "" 
     29        self.id = None 
     30         
     31    def __str__(self): 
     32        _str  = "" 
     33        _str += "State with ID : %s \n" % str(self.id) 
     34        if self.data is not None: 
     35            _str += "Data name : %s \n" % str(self.data.name) 
     36            _str += "Data ID : %s \n" % str(self.data.id) 
     37        else: 
     38            _str += "Data: %s \n" % str(self.data) 
     39             
     40        if self.theory_list: 
     41            _str += "Theories available: \n" 
     42            for id, item in self.theory_list.iteritems(): 
     43                theory_data, theory_state = item 
     44                _str += "Theory name : %s \n" % str(theory_data.name) 
     45                _str += "Theory ID : %s \n" % str(id) 
     46        else: 
     47            for key , value in self.theory_list.iteritems(): 
     48                theory_data, theory_state = value 
     49                _str += "Theory with ID : %s \n" % str(key) 
     50                _str += str(theory_data) 
     51                _str += str(theory_state) 
     52        return _str 
     53         
     54    def clone(self): 
     55        obj = DataState(copy.deepcopy(self.data)) 
     56        obj.parent = self.parent 
     57        obj.name = self.name  
     58        obj.path = self.path  
     59        obj.message = self.message 
     60        obj.id = self.id 
     61        for id, item in self.theory_list.iteritems(): 
     62            theory_data, theory_state = item 
     63            state = None 
     64            if theory_state is not None: 
     65                state = theory_state.clone() 
     66            obj.theory_list[id] = [copy.deepcopy(theory_data),  
     67                                   state] 
     68        return obj 
    2869         
    2970    def set_name(self, name): 
    3071        self.name = name 
     72         
    3173    def get_name(self): 
    3274        return self.name 
     75     
    3376    def set_data(self, data): 
    3477        self.data = data 
     
    4992        return self.path 
    5093     
    51     def set_theory(self, theory): 
     94    def set_theory(self, theory_data, theory_state=None): 
    5295        """ 
    5396        """ 
    54         self.theory_list[theory.id] = theory 
     97        self.theory_list[theory_data.id] = [theory_data, theory_state] 
    5598         
    5699    def get_theory(self): 
    57100        return self.theory_list 
    58      
    59     def set_state(self, state): 
    60         """ 
    61         """ 
    62         #self.theory_list.append(state) 
    63         return 
    64          
    65     def get_state(self): 
    66         return self.state_list 
    67101     
    68102    def get_message(self): 
Note: See TracChangeset for help on using the changeset viewer.