Changeset 1970780 in sasview


Ignore:
Timestamp:
Apr 9, 2017 5:33:01 AM (8 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:
9208346
Parents:
71361f0
Message:

Add display of orientational parameters + minor refactoring

Location:
src/sas/qtgui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/DataExplorer.py

    r71361f0 r1970780  
    2424from sas.qtgui.DroppableDataLoadWidget import DroppableDataLoadWidget 
    2525from sas.qtgui.MaskEditor import MaskEditor 
     26 
     27import Perspectives 
    2628 
    2729class DataExplorerWindow(DroppableDataLoadWidget): 
     
    9193        self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo) 
    9294 
    93         self._perspective = self.parent.perspective() 
    94  
    9595        # Proxy model for showing a subset of Data1D/Data2D content 
    9696        self.data_proxy = QtGui.QSortFilterProxyModel(self) 
     
    151151        Populate the Perspective combobox and define callbacks 
    152152        """ 
     153        available_perspectives = sorted([p for p in Perspectives.PERSPECTIVES.keys()]) 
     154        if available_perspectives: 
     155            self.cbFitting.clear() 
     156            self.cbFitting.addItems(available_perspectives) 
    153157        self.cbFitting.currentIndexChanged.connect(self.updatePerspectiveCombo) 
    154158        # Set the index so we see the default (Fitting) 
    155159        self.updatePerspectiveCombo(0) 
     160 
     161    def _perspective(self): 
     162        """ 
     163        Returns the current perspective 
     164        """ 
     165        return self.parent.perspective() 
    156166 
    157167    def loadFromURL(self, url): 
     
    313323        Send selected item data to the current perspective and set the relevant notifiers 
    314324        """ 
    315         # should this reside on GuiManager or here? 
    316         self._perspective = self.parent.perspective() 
    317  
    318325        # Set the signal handlers 
    319326        self.communicator.updateModelFromPerspectiveSignal.connect(self.updateModelFromPerspective) 
     
    332339 
    333340        # Which perspective has been selected? 
    334         if len(selected_items) > 1 and not self._perspective.allowBatch(): 
    335             msg = self._perspective.title() + " does not allow multiple data." 
     341        if len(selected_items) > 1 and not self._perspective().allowBatch(): 
     342            msg = self._perspective().title() + " does not allow multiple data." 
    336343            msgbox = QtGui.QMessageBox() 
    337344            msgbox.setIcon(QtGui.QMessageBox.Critical) 
     
    342349 
    343350        # Notify the GuiManager about the send request 
    344         self._perspective.setData(data_item=selected_items) 
     351        self._perspective().setData(data_item=selected_items) 
    345352 
    346353    def freezeTheory(self, event): 
     
    424431        """ 
    425432        self.communicator.perspectiveChangedSignal.emit(self.cbFitting.currentText()) 
     433        self.chkBatch.setEnabled(self.parent.perspective().allowBatch()) 
    426434 
    427435    def newPlot(self): 
  • src/sas/qtgui/GuiManager.py

    r71361f0 r1970780  
    3030# Perspectives 
    3131import Perspectives 
    32 from sas.qtgui.Perspectives.Invariant.InvariantPerspective import InvariantWindow 
    33 from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow 
     32#from sas.qtgui.Perspectives.Invariant.InvariantPerspective import InvariantWindow 
     33#from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow 
    3434from sas.qtgui.DataExplorer import DataExplorerWindow 
    3535 
  • src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py

    rf182f93 r1970780  
    3636    return (param_name, param_length) 
    3737 
    38 def addParametersToModel(parameters, model): 
     38def addParametersToModel(parameters, is2D): 
    3939    """ 
    4040    Update local ModelModel with sasmodel parameters 
     
    4242    multishell_parameters = getIterParams(parameters) 
    4343    multishell_param_name, _ = getMultiplicity(parameters) 
    44  
    45     for param in parameters.iq_parameters: 
     44    params = parameters.iqxy_parameters if is2D else parameters.iq_parameters 
     45    item = [] 
     46    for param in params: 
    4647        # don't include shell parameters 
    4748        if param.name == multishell_param_name: 
     
    8081        item4 = QtGui.QStandardItem(str(param.limits[1])) 
    8182        item5 = QtGui.QStandardItem(param.units) 
    82         model.appendRow([item1, item2, item3, item4, item5]) 
    83  
    84 def addSimpleParametersToModel(parameters, model): 
     83        item.append([item1, item2, item3, item4, item5]) 
     84    return item 
     85 
     86def addSimpleParametersToModel(parameters, is2D): 
    8587    """ 
    8688    Update local ModelModel with sasmodel parameters 
    8789    """ 
    88     for param in parameters.iq_parameters: 
     90    params = parameters.iqxy_parameters if is2D else parameters.iq_parameters 
     91    item = [] 
     92    for param in params: 
    8993        # Create the top level, checkable item 
    9094        item_name = param.name 
     
    99103        item5 = QtGui.QStandardItem(str(param.limits[1])) 
    100104        item6 = QtGui.QStandardItem(param.units) 
    101         model.appendRow([item1, item2, item4, item5, item6]) 
     105        item.append([item1, item2, item4, item5, item6]) 
     106    return item 
    102107 
    103108def addCheckedListToModel(model, param_list): 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    rd7ff531 r1970780  
    201201        self.chkMagnetism.setEnabled(isChecked) 
    202202        self.is2D = isChecked 
     203        # Reload the current model 
     204        self.onSelectModel() 
    203205 
    204206    def initializeControls(self): 
     
    671673 
    672674        # Update the QModel 
    673         FittingUtilities.addParametersToModel(self.model_parameters, self._model_model) 
     675        new_rows = FittingUtilities.addParametersToModel(self.model_parameters, self.is2D) 
     676        for row in new_rows: 
     677            self._model_model.appendRow(row) 
    674678        # Update the counter used for multishell display 
    675679        self._last_model_row = self._model_model.rowCount() 
     
    681685            structure_module = generate.load_kernel_module(structure_factor) 
    682686            structure_parameters = modelinfo.make_parameter_table(getattr(structure_module, 'parameters', [])) 
    683             FittingUtilities.addSimpleParametersToModel(structure_parameters, self._model_model) 
     687            new_rows = FittingUtilities.addSimpleParametersToModel(structure_parameters, self.is2D) 
     688            for row in new_rows: 
     689                self._model_model.appendRow(row) 
    684690            # Update the counter used for multishell display 
    685691            self._last_model_row = self._model_model.rowCount() 
     
    724730 
    725731        self.kernel_module.params[parameter_name] = value 
    726         print "UPDATED %s / %s with %0.3f." %(parameter_name, property_name, value) 
    727732 
    728733        # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] 
Note: See TracChangeset for help on using the changeset viewer.