Changeset 9ce69ec in sasview for src/sas/qtgui


Ignore:
Timestamp:
Sep 18, 2018 1:51:44 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
fc5d2d7f
Parents:
1738173
git-author:
Piotr Rozyczko <rozyczko@…> (09/18/18 01:42:03)
git-committer:
Piotr Rozyczko <rozyczko@…> (09/18/18 01:51:44)
Message:

Replaced 'smart' plot generation with explicit plot requests on "Show Plot". SASVIEW-1018

Location:
src/sas/qtgui
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Calculators/UnitTesting/SLDCalculatorTest.py

    r144fe21 r9ce69ec  
    8181        self.assertEqual(self.widget.ui.editMolecularFormula.styleSheet(), '') 
    8282        self.assertEqual(self.widget.model.columnCount(), 1) 
    83         self.assertEqual(self.widget.model.rowCount(), 12) 
     83        self.assertEqual(self.widget.model.rowCount(), 11) 
    8484        self.assertEqual(self.widget.sizePolicy().Policy(), QtWidgets.QSizePolicy.Fixed) 
    8585 
    8686    def testSimpleEntry(self): 
    8787        ''' Default compound calculations ''' 
    88  
    89         self.widget.show() 
    9088 
    9189        self.widget.ui.editMassDensity.clear() 
     
    102100 
    103101        # Change mass density 
    104         self.widget.ui.editWavelength.clear() 
    105         self.widget.ui.editWavelength.setText("666.0") 
     102        self.widget.ui.editNeutronWavelength.clear() 
     103        self.widget.ui.editNeutronWavelength.setText("666.0") 
    106104 
    107105        # Send shift-tab to update the molar volume field 
     
    130128 
    131129        # Assure the mass density field is set 
    132         self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '43.4') 
     130        #self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '43.4') 
     131        self.assertEqual(self.widget.ui.editNeutronIncXs.text(), '2.89') 
    133132 
    134133        # Reset the widget 
    135134        self.widget.modelReset() 
    136  
     135        
    137136        self.assertEqual(self.widget.ui.editMolecularFormula.text(), "H2O") 
    138137        self.assertEqual(self.widget.ui.editMassDensity.text(), "1") 
  • src/sas/qtgui/MainWindow/DataExplorer.py

    r9f4eaeb r9ce69ec  
    598598        Forces display of charts for the given data set 
    599599        """ 
    600         plot_to_show = data_list[0] 
    601         # passed plot is used ONLY to figure out its title, 
    602         # so all the charts related by it can be pulled from  
    603         # the data explorer indices. 
    604         filename = plot_to_show.filename 
    605         self.displayFile(filename=filename, is_data=plot_to_show.is_data, id=id) 
     600        # data_list = [QStandardItem, Data1D/Data2D] 
     601        plot_to_show = data_list[1] 
     602        plot_item = data_list[0] 
     603 
     604        # plots to show 
     605        new_plots = [] 
     606 
     607        # Check if this is merely a plot update 
     608        if self.updatePlot(plot_to_show): 
     609            return 
     610 
     611        # Residuals get their own plot 
     612        if plot_to_show.plot_role == Data1D.ROLE_RESIDUAL: 
     613            plot_to_show.yscale='linear' 
     614            self.plotData([(plot_item, plot_to_show)]) 
     615        elif plot_to_show.plot_role == Data1D.ROLE_DELETABLE: 
     616            # No plot 
     617            return 
     618        else: 
     619            # Plots with main data points on the same chart 
     620            # Get the main data plot 
     621            main_data = GuiUtils.dataFromItem(plot_item.parent()) 
     622            if main_data is None: 
     623                # Try the current item 
     624                main_data = GuiUtils.dataFromItem(plot_item) 
     625            if main_data is not None: 
     626                new_plots.append((plot_item, main_data)) 
     627            new_plots.append((plot_item, plot_to_show)) 
     628 
     629        if new_plots: 
     630            self.plotData(new_plots) 
    606631 
    607632    def addDataPlot2D(self, plot_set, item): 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r305114c r9ce69ec  
    18491849        # Show the chart if ready 
    18501850        data_to_show = self.data if self.data_is_loaded else self.model_data 
    1851         if data_to_show is not None: 
    1852             self.communicate.plotRequestedSignal.emit([data_to_show], self.tab_id) 
     1851        # Any models for this page 
     1852        current_index = self.all_data[self.data_index] 
     1853        plots = GuiUtils.plotsFromFilename(self.data.filename, current_index.model()) 
     1854        fitpage_name = "" if id is None else "M"+str(self.tab_id) 
     1855        # Has the fitted data been shown? 
     1856        data_shown = False 
     1857        #for plot in plots: 
     1858        for item, plot in plots.items(): 
     1859            if fitpage_name in plot.name: 
     1860                data_shown = True 
     1861                self.communicate.plotRequestedSignal.emit([item, plot], self.tab_id) 
     1862        if not data_shown: 
     1863            # fit+data has not been shown - show just data 
     1864            self.communicate.plotRequestedSignal.emit([item, data_to_show], self.tab_id) 
    18531865 
    18541866    def onOptionsUpdate(self): 
     
    20802092        self.kernel_module = self.models[model_name]() 
    20812093 
     2094        # Change the model name to a monicker 
     2095        self.kernel_module.name = self.modelName() 
     2096 
    20822097        # Explicitly add scale and background with default values 
    20832098        temp_undo_state = self.undo_supported 
     
    21122127            # Structure factor is the only selected model; build it and show all its params 
    21132128            self.kernel_module = self.models[structure_factor]() 
     2129            self.kernel_module.name = self.modelName() 
    21142130            s_params = self.kernel_module._model_info.parameters 
    21152131            s_params_orig = s_params 
     
    21222138 
    21232139            self.kernel_module = MultiplicationModel(p_kernel, s_kernel) 
     2140            # Modify the name to correspond to shown items 
     2141            self.kernel_module.name = self.modelName() 
    21242142            all_params = self.kernel_module._model_info.parameters.kernel_parameters 
    21252143            all_param_names = [param.name for param in all_params] 
     
    24272445        # Bring the GUI to normal state 
    24282446        self.enableInteractiveElements() 
    2429  
     2447        if return_data is None: 
     2448            self.calculateDataFailed("Results not available.") 
     2449            return 
    24302450        fitted_data = self.logic.new1DPlot(return_data, self.tab_id) 
    24312451        residuals = self.calculateResiduals(fitted_data) 
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    raed0532 r9ce69ec  
    233233 
    234234        plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) 
     235        #self.communicate.plotRequestedSignal.emit([item, plot], self.tab_id) 
    235236 
    236237        self._manager.filesWidget.plotData(plot_data) 
     
    347348                extrapolated_data.name = title 
    348349                extrapolated_data.title = title 
     350                extrapolated_data.style = "Line" 
     351                extrapolated_data.has_errors = False 
     352                extrapolated_data.plot_role = Data1D.ROLE_DEFAULT 
    349353 
    350354                # copy labels and units of axes for plotting 
     
    378382                high_out_data.name = title 
    379383                high_out_data.title = title 
     384                high_out_data.style = "Line" 
     385                high_out_data.has_errors = False 
     386                high_out_data.plot_role = Data1D.ROLE_DEFAULT 
    380387 
    381388                # copy labels and units of axes for plotting 
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    r855e7ad r9ce69ec  
    547547            self.prPlot.plot_role = Data1D.ROLE_RESIDUAL 
    548548            GuiUtils.updateModelItemWithPlot(self._data, self.prPlot, title) 
     549            self.communicate.plotRequestedSignal.emit([self._data,self.prPlot], None) 
    549550        if self.dataPlot is not None: 
    550551            title = self.dataPlot.name 
    551552            self.dataPlot.plot_role = Data1D.ROLE_DEFAULT 
     553            self.dataPlot.symbol = "Line" 
     554            self.dataPlot.show_errors = False 
    552555            GuiUtils.updateModelItemWithPlot(self._data, self.dataPlot, title) 
    553         if self.dataPlot is not None or self.prPlot is not None: 
    554             self.communicate.plotRequestedSignal.emit([self.logic.data], None) 
     556            self.communicate.plotRequestedSignal.emit([self._data,self.dataPlot], None) 
    555557        self.enableButtons() 
    556558 
  • src/sas/qtgui/Utilities/GuiUtils.py

    ra54bbf2b r9ce69ec  
    567567    The assumption - data stored in SasView standard, in child 0 
    568568    """ 
    569     return item.child(0).data() 
     569    try: 
     570        data = item.child(0).data() 
     571    except AttributeError: 
     572        data = None 
     573    return data 
    570574 
    571575def openLink(url): 
Note: See TracChangeset for help on using the changeset viewer.