Ignore:
Timestamp:
Nov 13, 2018 5:25:48 AM (5 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
baeac95
Parents:
133812c7
Message:

Added C&S tab serialization.

File:
1 edited

Legend:

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

    raed0532 re5ae812  
    3131        # To keep with previous SasView values, use 300 as the start offset 
    3232        self.page_id = 301 
     33        self.tab_id = self.page_id 
    3334 
    3435        # Are we chain fitting? 
     
    693694        # Update the tab 
    694695        constrained_tab.addConstraintToRow(constraint, constrained_row) 
     696 
     697    def getFitPage(self): 
     698        """ 
     699        Retrieves the state of this page 
     700        """ 
     701        param_list = [] 
     702 
     703        param_list.append(['is_constraint', 'True']) 
     704        param_list.append(['data_id', "cs_tab"+str(self.page_id)]) 
     705        param_list.append(['current_type', self.currentType]) 
     706        param_list.append(['is_chain_fitting', str(self.is_chain_fitting)]) 
     707        param_list.append(['special_case', self.cbCases.currentText()]) 
     708 
     709        return param_list 
     710 
     711    def getFitModel(self): 
     712        """ 
     713        Retrieves current model 
     714        """ 
     715        model_list = [] 
     716 
     717        checked_models = {} 
     718        for row in range(self.tblTabList.rowCount()): 
     719            model_name = self.tblTabList.item(row,1).data(0) 
     720            active = self.tblTabList.item(row,0).checkState()# == QtCore.Qt.Checked 
     721            checked_models[model_name] = str(active) 
     722 
     723        checked_constraints = {} 
     724        for row in range(self.tblConstraints.rowCount()): 
     725            model_name = self.tblConstraints.item(row,0).data(0) 
     726            active = self.tblConstraints.item(row,0).checkState()# == QtCore.Qt.Checked 
     727            checked_constraints[model_name] = str(active) 
     728 
     729        model_list.append(['checked_models', checked_models]) 
     730        model_list.append(['checked_constraints', checked_constraints]) 
     731        return model_list 
     732 
     733    def createPageForParameters(self, parameters=None): 
     734        """ 
     735        Update the page with passed parameter values 
     736        """ 
     737        # checked models 
     738        if not 'checked_models' in parameters: 
     739            return 
     740        models = parameters['checked_models'][0] 
     741        for model, check_state in models.items(): 
     742            for row in range(self.tblTabList.rowCount()): 
     743                model_name = self.tblTabList.item(row,1).data(0) 
     744                if model_name != model: 
     745                    continue 
     746                # check/uncheck item 
     747                self.tblTabList.item(row,0).setCheckState(int(check_state)) 
     748 
     749        if not 'checked_constraints' in parameters: 
     750            return 
     751        # checked constraints 
     752        models = parameters['checked_constraints'][0] 
     753        for model, check_state in models.items(): 
     754            for row in range(self.tblConstraints.rowCount()): 
     755                model_name = self.tblConstraints.item(row,0).data(0) 
     756                if model_name != model: 
     757                    continue 
     758                # check/uncheck item 
     759                self.tblConstraints.item(row,0).setCheckState(int(check_state)) 
     760 
     761        # fit/batch radio 
     762        isBatch = parameters['current_type'][0] == 'BatchPage' 
     763        if isBatch: 
     764            self.btnBatch.toggle() 
     765 
     766        # chain 
     767        is_chain = parameters['is_chain_fitting'][0] == 'True' 
     768        if isBatch: 
     769            self.chkChain.setChecked(is_chain) 
     770 
     771 
Note: See TracChangeset for help on using the changeset viewer.