Changeset 87ca467 in sasview


Ignore:
Timestamp:
Nov 19, 2018 8:34:03 AM (6 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:
8c85ac1
Parents:
a2b8607
Message:

Update circular average plot on 2D chart redraw. Show the updated plot
if graph visible - SASVIEW-1205

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotting/Plotter2D.py

    r1942f63 r87ca467  
    107107                      zmax=zmax_2D_temp, show_colorbar=show_colorbar, 
    108108                      update=update) 
     109 
     110        self.updateCircularAverage() 
    109111 
    110112    def calculateDepth(self): 
     
    240242        self.slicer_widget.show() 
    241243 
    242     def onCircularAverage(self): 
    243         """ 
    244         Perform circular averaging on Data2D 
     244    def circularAverage(self): 
     245        """ 
     246        Calculate the circular average and create the Data object for it 
    245247        """ 
    246248        # Find the best number of bins 
     
    281283        new_plot.id = "Circ avg " + self.data.name 
    282284        new_plot.is_data = True 
     285 
     286        return new_plot 
     287 
     288    def onCircularAverage(self): 
     289        """ 
     290        Perform circular averaging on Data2D 
     291        """ 
     292        new_plot = self.circularAverage() 
     293 
    283294        item = self._item 
    284295        if self._item.parent() is not None: 
    285296            item = self._item.parent() 
     297 
    286298        GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 
    287299 
     
    290302        self.manager.communicator.forcePlotDisplaySignal.emit([item, new_plot]) 
    291303 
    292         # Show the plot 
     304    def updateCircularAverage(self): 
     305        """ 
     306        Update circular averaging plot on Data2D change 
     307        """ 
     308        item = self._item 
     309        if self._item.parent() is not None: 
     310            item = self._item.parent() 
     311 
     312        # Get all plots for current item 
     313        plots = GuiUtils.plotsFromModel("", item) 
     314        ca_caption = '2daverage'+self.data.name 
     315        # See if current item plots contain 2D average plot 
     316        test = [ca_caption in plot.group_id for plot in plots] 
     317        # return prematurely if no circular average plot found 
     318        if not any(test): return 
     319 
     320        # Create a new plot 
     321        new_plot = self.circularAverage() 
     322 
     323        # Overwrite existing plot 
     324        GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 
     325        # Show the new plot, if already visible 
     326        self.manager.communicator.plotUpdateSignal.emit([new_plot]) 
    293327 
    294328    def setSlicer(self, slicer): 
Note: See TracChangeset for help on using the changeset viewer.