Ignore:
Timestamp:
Jan 25, 2018 10:00:20 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
17968c3
Parents:
116dd4c1
Message:

C&S fitting now runs and updates fit tabs - SASVIEW-860

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py

    r116dd4c1 rc6343a5  
    9393 
    9494        # External signals 
    95         #self.parent.tabsModifiedSignal.connect(self.initializeFitList) 
    9695        self.parent.tabsModifiedSignal.connect(self.onModifiedTabs) 
    9796 
     
    135134        fitter_id = 0 
    136135        sim_fitter=[sim_fitter] 
    137         for tab in tabs_to_fit: 
    138             tab_object = ObjectLibrary.getObject(tab) 
    139             sim_fitter, fitter_id = tab_object.prepareFitters(fitter=sim_fitter[0], fit_id=fitter_id) 
    140             page_ids.append([tab_object.page_id]) 
     136        # Prepare the fitter object 
     137        try: 
     138            for tab in tabs_to_fit: 
     139                tab_object = ObjectLibrary.getObject(tab) 
     140                if tab_object is None: 
     141                    # No such tab! 
     142                    return 
     143                sim_fitter, fitter_id = tab_object.prepareFitters(fitter=sim_fitter[0], fit_id=fitter_id) 
     144                page_ids.append([tab_object.page_id]) 
     145        except ValueError as ex: 
     146            # No parameters selected in one of the tabs 
     147            no_params_msg = "Fitting can not be performed.\n" +\ 
     148                            "Not all tabs chosen for fitting have parameters selected for fitting." 
     149            reply = QtWidgets.QMessageBox.question(self, 
     150                                               'Warning', 
     151                                               no_params_msg, 
     152                                               QtWidgets.QMessageBox.Ok) 
     153 
     154            return 
    141155 
    142156        # Create the fitting thread, based on the fitter 
     
    182196    def onHelp(self): 
    183197        """ 
    184         Display the help page 
    185         """ 
    186         pass 
     198        Show the "Fitting" section of help 
     199        """ 
     200        tree_location = "/user/sasgui/perspectives/fitting/" 
     201 
     202        helpfile = "fitting_help.html#simultaneous-fit-mode" 
     203        help_location = tree_location + helpfile 
     204 
     205        # OMG, really? Crawling up the object hierarchy... 
     206        self.parent.parent.showHelp(help_location) 
    187207 
    188208    def onTabCellEdit(self, row, column): 
     
    276296        Respond to the successful fit complete signal 
    277297        """ 
    278         pass 
     298        # get the elapsed time 
     299        elapsed = result[1] 
     300 
     301        # result list 
     302        results = result[0][0] 
     303 
     304        # Find out all tabs to fit 
     305        tabs_to_fit = [tab for tab in self.tabs_for_fitting if self.tabs_for_fitting[tab]] 
     306 
     307        # update all involved tabs 
     308        for i, tab in enumerate(tabs_to_fit): 
     309            tab_object = ObjectLibrary.getObject(tab) 
     310            if tab_object is None: 
     311                # No such tab. removed while job was running 
     312                return 
     313            # Make sure result and target objects are the same (same model moniker) 
     314            if tab_object.kernel_module.name == results[i].model.name: 
     315                tab_object.fitComplete(([[results[i]]], elapsed)) 
    279316 
    280317    def onBatchFitComplete(self, result): 
Note: See TracChangeset for help on using the changeset viewer.