Ignore:
Timestamp:
Oct 28, 2017 1:17:49 PM (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:
c00a28ff
Parents:
26f42b1
Message:

Properly switch between data sets in P(r) view. Send all data to thread.

File:
1 edited

Legend:

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

    r26f42b1 rdfd8233  
    120120        self.enableButtons() 
    121121        self.dataList.currentIndexChanged.connect(self.displayChange) 
    122         self.calculateButton.clicked.connect(self._calculation) 
     122        self.calculateButton.clicked.connect(self.startThread) 
    123123        self.helpButton.clicked.connect(self.help) 
    124124        self.estimateBgd.toggled.connect(self.toggleBgd) 
     
    272272 
    273273    def displayChange(self): 
    274         variant_ref = self.currentWidget() 
    275         self.setCurrentData(variant_ref.toPyObject()[0]) 
     274        variant_ref = self.dataList.itemData(self.dataList.currentIndex()) 
     275        self.setCurrentData(variant_ref.toPyObject()) 
    276276 
    277277    ###################################################################### 
     
    283283        self._calculator.set_y(self._data_set.y) 
    284284        self._calculator.set_err(self._data_set.dy) 
    285  
    286     def _calculation(self): 
    287         """ 
    288         Calculate the P(r) for every data set in the data list 
    289         """ 
    290         for data_ref, pr in self._data_list.items(): 
    291             self._data_set = GuiUtils.dataFromItem(data_ref) 
    292             self._calculator = pr 
    293             # Set data before running the calculations 
    294             self.update_calculator() 
    295             # Run 
    296             self.startThread() 
    297285 
    298286    def model_changed(self): 
     
    358346        for data in data_item: 
    359347            self.setCurrentData(data) 
     348            ref_var = QtCore.QVariant(data) 
     349            self.populateDataComboBox(self._data_set.filename, ref_var) 
    360350 
    361351    def setCurrentData(self, data_ref): 
     
    369359        self._data = data_ref 
    370360        self._data_set = GuiUtils.dataFromItem(data_ref) 
    371         ref = QtCore.QVariant(self._data) 
    372         self.populateDataComboBox(self._data_set.filename, ref) 
    373361        self._data_list[self._data] = self._calculator 
    374362 
     
    395383        from Thread import CalcPr 
    396384 
    397         # If a thread is already started, stop it 
    398         if self.calc_thread is not None and self.calc_thread.isrunning(): 
    399             self.calc_thread.stop() 
    400         pr = self._calculator.clone() 
    401         nfunc = int(UI.TabbedInversionUI._fromUtf8( 
    402             self.noOfTermsInput.text())) 
    403         self.calc_thread = CalcPr(pr, nfunc, 
    404                                   error_func=self._threadError, 
    405                                   completefn=self._completed, updatefn=None) 
    406         self.calc_thread.queue() 
    407         self.calc_thread.ready(2.5) 
     385        for data_ref, pr in self._data_list.items(): 
     386            self._data_set = GuiUtils.dataFromItem(data_ref) 
     387            self._calculator = pr 
     388            # Set data before running the calculations 
     389            self.update_calculator() 
     390 
     391            # If a thread is already started, stop it 
     392            if self.calc_thread is not None and self.calc_thread.isrunning(): 
     393                self.calc_thread.stop() 
     394            pr = self._calculator.clone() 
     395            nfunc = int(UI.TabbedInversionUI._fromUtf8( 
     396                self.noOfTermsInput.text())) 
     397            self.calc_thread = CalcPr(pr, nfunc, 
     398                                      error_func=self._threadError, 
     399                                      completefn=self._completed, updatefn=None) 
     400            self.calc_thread.queue() 
     401            self.calc_thread.ready(2.5) 
    408402 
    409403    def performEstimateNT(self): 
     
    437431        from Thread import EstimatePr 
    438432 
    439         self._calculation() 
     433        self.startThread() 
    440434 
    441435        # If a thread is already started, stop it 
Note: See TracChangeset for help on using the changeset viewer.