Ignore:
Timestamp:
Sep 4, 2018 6:18:49 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
e3df84e
Parents:
f53bc04
Message:

Added freeze action for inner main model datasets. SASVIEW-1002

File:
1 edited

Legend:

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

    ra24eacf r6b50296  
    394394        # Notify the GuiManager about the send request 
    395395        self._perspective().setData(data_item=selected_items, is_batch=self.chkBatch.isChecked()) 
     396 
     397    def freezeCheckedData(self): 
     398        """ 
     399        Convert checked results (fitted model, residuals) into separate dataset. 
     400        """ 
     401        outer_index = -1 
     402        theories_copied = 0 
     403        orig_model_size = self.model.rowCount() 
     404        while outer_index < orig_model_size: 
     405            outer_index += 1 
     406            outer_item = self.model.item(outer_index) 
     407            if not outer_item: 
     408                continue 
     409            if not outer_item.isCheckable(): 
     410                continue 
     411            # Look for checked inner items 
     412            inner_index = -1 
     413            while inner_index < outer_item.rowCount(): 
     414               inner_item = outer_item.child(inner_index) 
     415               inner_index += 1 
     416               if not inner_item: 
     417                   continue 
     418               if not inner_item.isCheckable(): 
     419                   continue 
     420               if inner_item.checkState() != QtCore.Qt.Checked: 
     421                   continue 
     422               self.model.beginResetModel() 
     423               theories_copied += 1 
     424               new_item = self.cloneTheory(inner_item) 
     425               self.model.appendRow(new_item) 
     426               self.model.endResetModel() 
     427 
     428        freeze_msg = "" 
     429        if theories_copied == 0: 
     430            return 
     431        elif theories_copied == 1: 
     432            freeze_msg = "1 theory copied to a separate data set" 
     433        elif theories_copied > 1: 
     434            freeze_msg = "%i theories copied to separate data sets" % theories_copied 
     435        else: 
     436            freeze_msg = "Unexpected number of theories copied: %i" % theories_copied 
     437            raise AttributeError(freeze_msg) 
     438        self.communicator.statusBarUpdateSignal.emit(freeze_msg) 
    396439 
    397440    def freezeTheory(self, event): 
Note: See TracChangeset for help on using the changeset viewer.