Changeset bf7ad65 in sasview


Ignore:
Timestamp:
Apr 13, 2012 11:48:09 AM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
a5e749f
Parents:
5625551
Message:

Fixing code style problems and bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/local_perspectives/plotting/masking.py

    r046af80 rbf7ad65  
    1  
     1""" 
     2    Mask editor 
     3""" 
    24################################################################################ 
    35#This software was developed by the University of Tennessee as part of the 
     
    2830from sans.guiframe.dataFitting import Data1D, Data2D 
    2931from boxMask import BoxMask 
    30 from sectorMask import SectorMask 
    3132from sans.guiframe.events import SlicerEvent 
    3233from sans.guiframe.events import StatusEvent 
     
    6465        """ 
    6566        """ 
    66         CalcThread.__init__(self,completefn, 
     67        CalcThread.__init__(self, completefn, 
    6768                 updatefn, 
    6869                 yieldtime, 
     
    278279        self.slicer_mask = self.slicer.update()  
    279280 
    280     def onOuterSectorMask(self,event=None): 
     281    def onOuterSectorMask(self, event=None): 
    281282        """ 
    282283        Call Draw Sector Slicer and get mask outside of the sector 
     
    319320            self.onClearSlicer(event) 
    320321        self.slicer_z += 1 
    321         self.slicer = CircularMask(self,self.subplot, 
     322        self.slicer = CircularMask(self, self.subplot, 
    322323                                   zorder=self.slicer_z, side=False)    
    323324        self.subplot.set_ylim(self.data.ymin, self.data.ymax) 
     
    350351        Erase new mask from old mask 
    351352        """ 
    352         if not self.slicer==None: 
     353        if not self.slicer == None: 
    353354            self.slicer_mask = self.slicer.update() 
    354355            mask = self.data.mask 
    355             mask[self.slicer_mask==False] = True 
     356            mask[self.slicer_mask == False] = True 
    356357            self._check_display_mask(mask, event) 
    357358             
     
    394395            self.slicer = None 
    395396 
    396     def _setSlicer(self): 
    397         """ 
    398         Clear the previous slicer and create a new one.Post an internal 
    399         event. 
    400          
    401         :param slicer: slicer class to create 
    402         """ 
    403         ## Clear current slicer 
    404         if not self.slicer == None:   
    405             self.slicer.clear()             
    406         ## Create a new slicer     
    407         self.slicer_z += 1 
    408         self.slicer = slicer(self, self.subplot, zorder=self.slicer_z) 
    409         self.subplot.set_ylim(self.data2D.ymin, self.data2D.ymax) 
    410         self.subplot.set_xlim(self.data2D.xmin, self.data2D.xmax) 
    411         ## Draw slicer 
    412         self.update() 
    413         self.slicer.update() 
    414         msg = "Plotter2D._setSlicer  %s"%self.slicer.__class__.__name__ 
    415         wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    416         # Post slicer event 
    417         event = self._getEmptySlicerEvent() 
    418         event.type = self.slicer.__class__.__name__ 
    419         event.obj_class = self.slicer.__class__ 
    420         event.params = self.slicer.get_params() 
    421         wx.PostEvent(self, event) 
    422     
    423397    def update(self, draw=True): 
    424398        """ 
     
    440414        pass 
    441415     
    442     def _update_mask(self,mask): 
     416    def _update_mask(self, mask): 
    443417        """ 
    444418        Respond to changes in masking 
     
    460434        # set temp_data value for self.mask==True, else still None  
    461435        #temp_mask[mask] = temp_data[mask] 
    462         temp_data.data[mask==False] = temp_mask[mask==False] 
     436         
     437        #TODO: refactor this horrible logic  
     438        temp_data.data[mask == False] = temp_mask[mask == False] 
    463439        self.plotpanel.clear() 
    464440        if self.slicer != None: 
     
    541517    def OnClose(self, event): 
    542518        """ 
     519            Processing close event 
    543520        """ 
    544521        try: 
     
    720697        self.plots[plot.name] = plot 
    721698        #init graph 
    722         self.gaph = Graph() 
     699        self.graph = Graph() 
    723700        #add plot 
    724701        self.graph.add(plot) 
     
    781758            pass 
    782759        else: 
    783            self.subplot.figure.canvas.draw_idle()  
     760            self.subplot.figure.canvas.draw_idle()  
    784761         
    785762        msg = 'Plotting Completed.' 
     
    794771         
    795772        id = wx.NewId() 
    796         slicerpop.Append(id,'&Print Image', 'Print image') 
     773        slicerpop.Append(id, '&Print Image', 'Print image') 
    797774        wx.EVT_MENU(self, id, self.onPrint) 
    798775 
Note: See TracChangeset for help on using the changeset viewer.