Changeset c70eb7c in sasview for guiframe/data_state.py
- Timestamp:
- Mar 9, 2011 7:02:50 PM (14 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_state.py
r5c4b674 rc70eb7c 10 10 """ 11 11 """ 12 import copy 13 12 14 13 15 class DataState(object): … … 24 26 self.path = None 25 27 self.theory_list = {} 26 self.state_list = []27 28 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 28 69 29 70 def set_name(self, name): 30 71 self.name = name 72 31 73 def get_name(self): 32 74 return self.name 75 33 76 def set_data(self, data): 34 77 self.data = data … … 49 92 return self.path 50 93 51 def set_theory(self, theory ):94 def set_theory(self, theory_data, theory_state=None): 52 95 """ 53 96 """ 54 self.theory_list[theory .id] = theory97 self.theory_list[theory_data.id] = [theory_data, theory_state] 55 98 56 99 def get_theory(self): 57 100 return self.theory_list 58 59 def set_state(self, state):60 """61 """62 #self.theory_list.append(state)63 return64 65 def get_state(self):66 return self.state_list67 101 68 102 def get_message(self):
Note: See TracChangeset
for help on using the changeset viewer.