Changeset 490e230 in sasview


Ignore:
Timestamp:
Nov 6, 2018 7:52:21 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
be74751
Parents:
17e2d502
Message:

Working batch page in project save/load

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    r17e2d502 r490e230  
    365365        return all_data 
    366366 
     367    def getItemForID(self, id): 
     368        # return the model item with the given ID 
     369        item = None 
     370        for model in (self.model, self.theory_model): 
     371            for i in range(model.rowCount()): 
     372                properties = {} 
     373                item = model.item(i) 
     374                data = GuiUtils.dataFromItem(item) 
     375                if data is None: continue 
     376                if data.id != id: continue 
     377                # We found the item - return it 
     378                break 
     379        return item 
     380 
    367381    def getAllData(self): 
    368382        """ 
     
    430444        If so, pull out relevant indices and recreate the batch page(s) 
    431445        """ 
    432         batch_page_counter = 0 
    433         # {counter:[[item1, item2,...], {properties}]} 
    434         batch_page_dict = {} 
    435446        batch_pages = [] 
    436447        for key, value in all_data.items(): 
     
    441452                if page['is_batch_fitting'][0] != 'True': 
    442453                    continue 
    443                 batch_ids = page['data_id'] 
    444                 batch_pages.append(batch_ids) 
    445         # Now we have all batchpages in batch_pages. 
    446         # remove duplicates 
    447         #for page in batch_pages: 
    448         #    if page in  
     454                batch_ids = page['data_id'][0] 
     455                # check for duplicates 
     456                batch_set = set(batch_ids) 
     457                if batch_set in batch_pages: 
     458                    continue 
     459                # Found a unique batch page. Send it away 
     460                items = [self.getItemForID(i) for i in batch_set] 
     461                # Update the batch page list 
     462                batch_pages.append(batch_set) 
     463                # Assign parameters to the most recent (current) page. 
     464                self._perspective().setData(data_item=items, is_batch=True) 
     465                self._perspective().updateFromParameters(page) 
     466 
     467        pass 
    449468 
    450469    def updatePerspectiveWithProperties(self, key, value): 
Note: See TracChangeset for help on using the changeset viewer.