Changeset b0b09b9 in sasview for src/sas/qtgui/MainWindow/DataManager.py
- Timestamp:
- Oct 26, 2017 3:13:05 AM (7 years ago)
- Branches:
- 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
- Children:
- 895e7359
- Parents:
- def64a0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataManager.py
- Property mode changed from 100644 to 100755
rf4a1433 rb0b09b9 24 24 import json 25 25 import time 26 from StringIOimport StringIO26 from io import StringIO 27 27 import numpy as np 28 28 … … 66 66 _str += "No of states is %s \n" % str(len(self.stored_data)) 67 67 n_count = 0 68 for value in self.stored_data.values():68 for value in list(self.stored_data.values()): 69 69 n_count += 1 70 70 _str += "State No %s \n" % str(n_count) … … 146 146 receive a list of 147 147 """ 148 for id, data in data_list.ite ritems():148 for id, data in data_list.items(): 149 149 if id in self.stored_data: 150 150 msg = "Data manager already stores %s" % str(data.name) … … 162 162 """ 163 163 """ 164 if prev_data.id not in self.stored_data.keys():164 if prev_data.id not in list(self.stored_data.keys()): 165 165 return None, {} 166 166 data_state = self.stored_data[prev_data.id] 167 167 self.stored_data[new_data.id] = data_state.clone() 168 168 self.stored_data[new_data.id].data = new_data 169 if prev_data.id in self.stored_data.keys():169 if prev_data.id in list(self.stored_data.keys()): 170 170 del self.stored_data[prev_data.id] 171 171 return prev_data.id, {new_data.id: self.stored_data[new_data.id]} … … 177 177 if data_id is None and theory is not None: 178 178 uid = theory.id 179 if uid in self.stored_data.keys():179 if uid in list(self.stored_data.keys()): 180 180 data_state = self.stored_data[uid] 181 181 else: … … 207 207 if search_id == d_id: 208 208 _selected_data[search_id] = data 209 if search_id in theory_list.keys():209 if search_id in list(theory_list.keys()): 210 210 _selected_theory_list[search_id] = theory_list[search_id] 211 211 … … 216 216 """ 217 217 """ 218 return self.freeze_theory( self.stored_data.keys(), theory_id)218 return self.freeze_theory(list(self.stored_data.keys()), theory_id) 219 219 220 220 def freeze_theory(self, data_id, theory_id): … … 227 227 theory_list = data_state.get_theory() 228 228 for t_id in theory_id: 229 if t_id in theory_list.keys():229 if t_id in list(theory_list.keys()): 230 230 theory_data, theory_state = theory_list[t_id] 231 231 new_theory = copy.deepcopy(theory_data) … … 247 247 """ 248 248 for d_id in data_id: 249 if d_id in self.stored_data.keys():249 if d_id in list(self.stored_data.keys()): 250 250 data_state = self.stored_data[d_id] 251 251 if data_state.data.name in self.data_name_dict: … … 265 265 data_state = self.stored_data[d_id] 266 266 theory_list = data_state.get_theory() 267 if theory_id in theory_list.keys():267 if theory_id in list(theory_list.keys()): 268 268 del theory_list[theory_id] 269 269 #del pure theory … … 284 284 _selected_data = {} 285 285 for selected_name in name_list: 286 for id, data_state in self.stored_data.ite ritems():286 for id, data_state in self.stored_data.items(): 287 287 if data_state.data.name == selected_name: 288 288 _selected_data[id] = data_state.data … … 294 294 """ 295 295 for selected_name in name_list: 296 for id, data_state in self.stored_data.ite ritems():296 for id, data_state in self.stored_data.items(): 297 297 if data_state.data.name == selected_name: 298 298 del self.stored_data[id] … … 303 303 # Take the copy of current, possibly shorter stored_data dict 304 304 stored_data = copy.deepcopy(self.stored_data) 305 for idx in stored_data.keys():305 for idx in list(stored_data.keys()): 306 306 if str(selected_name) in str(idx): 307 307 del self.stored_data[idx] … … 313 313 _selected_data_state = {} 314 314 for id in data_id: 315 if id in self.stored_data.keys():315 if id in list(self.stored_data.keys()): 316 316 _selected_data_state[id] = self.stored_data[id] 317 317 return _selected_data_state … … 396 396 class Empty(object): 397 397 def __init__(self): 398 for key, value in data.ite ritems():398 for key, value in data.items(): 399 399 setattr(self, key, generate(value, level)) 400 400 … … 451 451 # if dictionary doesn't have __type__ then it is assumed to be just an ordinary dictionary 452 452 o = {} 453 for key, value in data.ite ritems():453 for key, value in data.items(): 454 454 o[key] = generate(value, level) 455 455 return o … … 463 463 464 464 new_stored_data = {} 465 for id, data in json.load(fp).ite ritems():465 for id, data in json.load(fp).items(): 466 466 try: 467 467 new_stored_data[id] = generate(data, 0)
Note: See TracChangeset
for help on using the changeset viewer.