Changeset 6b50296 in sasview


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

Location:
src/sas/qtgui
Files:
5 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): 
  • src/sas/qtgui/MainWindow/GuiManager.py

    raa1db44 r6b50296  
    438438        self._workspace.actionImage_Viewer.triggered.connect(self.actionImage_Viewer) 
    439439        self._workspace.actionOrientation_Viewer.triggered.connect(self.actionOrientation_Viewer) 
     440        self._workspace.actionFreeze_Theory.triggered.connect(self.actionFreeze_Theory) 
    440441        # Fitting 
    441442        self._workspace.actionNew_Fit_Page.triggered.connect(self.actionNew_Fit_Page) 
     
    683684        self._workspace.addDockWidget(Qt.RightDockWidgetArea, self.ipDockWidget) 
    684685 
     686    def actionFreeze_Theory(self): 
     687        """ 
     688        Convert a child index with data into a separate top level dataset 
     689        """ 
     690        self.filesWidget.freezeCheckedData() 
     691 
    685692    def actionOrientation_Viewer(self): 
    686693        """ 
  • src/sas/qtgui/MainWindow/UI/MainWindowUI.ui

    raa1db44 r6b50296  
    6464    <addaction name="actionReport"/> 
    6565    <addaction name="actionReset"/> 
     66    <addaction name="separator"/> 
     67    <addaction name="actionFreeze_Theory"/> 
    6668   </widget> 
    6769   <widget class="QMenu" name="menuView"> 
     
    535537   </property> 
    536538  </action> 
     539  <action name="actionFreeze_Theory"> 
     540   <property name="text"> 
     541    <string>Freeze Theory</string> 
     542   </property> 
     543  </action> 
    537544 </widget> 
    538545 <resources/> 
  • src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py

    rff3b293 r6b50296  
    430430 
    431431    theory_name = str(current_data.name.split()[0]) 
    432     residuals.name = "Residuals for " + str(theory_name) + "[" + \ 
    433                     str(reference_data.filename) + "]" 
     432    res_name = reference_data.filename if reference_data.filename else reference_data.name 
     433    residuals.name = "Residuals for " + str(theory_name) + "[" + res_name + "]" 
    434434    residuals.title = residuals.name 
    435435    residuals.ytransform = 'y' 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    rf53bc04 r6b50296  
    392392        # Tag along functionality 
    393393        self.label.setText("Data loaded from: ") 
    394         self.lblFilename.setText(self.logic.data.filename) 
     394        if self.logic.data.filename: 
     395            self.lblFilename.setText(self.logic.data.filename) 
     396        else: 
     397            self.lblFilename.setText(self.logic.data.name) 
    395398        self.updateQRange() 
    396399        # Switch off Data2D control 
Note: See TracChangeset for help on using the changeset viewer.