Ignore:
Timestamp:
Oct 28, 2017 9:15:26 AM (6 years ago)
Author:
krzywon
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:
dfd8233
Parents:
d132f33
Message:

Multiple data sets loading into P(r) and able to calculate them all, but not cleanly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    rd132f33 r26f42b1  
    252252            self.explorerButton.setEnabled(False) 
    253253 
    254     def populateDataComboBox(self, filename): 
     254    def populateDataComboBox(self, filename, data_ref): 
    255255        """ 
    256256        Append a new file name to the data combobox 
     
    258258        """ 
    259259        qt_item = QtCore.QString.fromUtf8(filename) 
    260         self.dataList.addItem(qt_item) 
     260        ref = QtCore.QVariant(data_ref) 
     261        self.dataList.addItem(qt_item, ref) 
    261262 
    262263    def acceptNoTerms(self): 
     
    271272 
    272273    def displayChange(self): 
    273         data_name = str(self.dataList.currentText()) 
    274         # TODO: Find data ref based on file name 
    275         # TODO: Find way to link standardmodelitem with combobox entry 
     274        variant_ref = self.currentWidget() 
     275        self.setCurrentData(variant_ref.toPyObject()[0]) 
    276276 
    277277    ###################################################################### 
     
    356356            raise AttributeError, msg 
    357357 
    358         if not isinstance(data_item[0], QtGui.QStandardItem): 
     358        for data in data_item: 
     359            self.setCurrentData(data) 
     360 
     361    def setCurrentData(self, data_ref): 
     362        """Set an individual data set to the current data""" 
     363 
     364        if not isinstance(data_ref, QtGui.QStandardItem): 
    359365            msg = "Incorrect type passed to the P(r) Perspective" 
    360366            raise AttributeError, msg 
    361367 
    362         for data in data_item: 
    363             # Data references 
    364             self._data = data 
    365             self._data_set = GuiUtils.dataFromItem(data) 
    366             self.populateDataComboBox(self._data_set.filename) 
    367             self._data_list[self._data] = self._calculator 
    368  
    369             # Estimate initial values from data 
    370             self.performEstimate() 
    371             self.logic = InversionLogic(self._data_set) 
    372  
    373             # Estimate q range 
    374             qmin, qmax = self.logic.computeDataRange() 
    375             self.model.setItem(WIDGETS.W_QMIN, QtGui.QStandardItem( 
    376                 "{:.4g}".format(qmin))) 
    377             self.model.setItem(WIDGETS.W_QMAX, QtGui.QStandardItem( 
    378                 "{:.4g}".format(qmax))) 
    379  
    380             self.enableButtons() 
     368        # Data references 
     369        self._data = data_ref 
     370        self._data_set = GuiUtils.dataFromItem(data_ref) 
     371        ref = QtCore.QVariant(self._data) 
     372        self.populateDataComboBox(self._data_set.filename, ref) 
     373        self._data_list[self._data] = self._calculator 
     374 
     375        # Estimate initial values from data 
     376        self.performEstimate() 
     377        self.logic = InversionLogic(self._data_set) 
     378 
     379        # Estimate q range 
     380        qmin, qmax = self.logic.computeDataRange() 
     381        self.model.setItem(WIDGETS.W_QMIN, QtGui.QStandardItem( 
     382            "{:.4g}".format(qmin))) 
     383        self.model.setItem(WIDGETS.W_QMAX, QtGui.QStandardItem( 
     384            "{:.4g}".format(qmax))) 
     385 
     386        self.enableButtons() 
    381387 
    382388    ###################################################################### 
Note: See TracChangeset for help on using the changeset viewer.