Index: src/sas/guiframe/local_perspectives/plotting/Plotter2D.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/Plotter2D.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/guiframe/local_perspectives/plotting/Plotter2D.py	(revision c039589ad31dec3058311cae229f7aa1dc56faf8)
@@ -3,5 +3,5 @@
 #This software was developed by the University of Tennessee as part of the
 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-#project funded by the US National Science Foundation. 
+#project funded by the US National Science Foundation.
 #
 #See the license text in license.txt
@@ -15,8 +15,9 @@
 import math
 import numpy
+import logging
 from sas.plottools.PlotPanel import PlotPanel
 from sas.plottools.plottables import Graph
 from sas.plottools.TextDialog import TextDialog
-from sas.guiframe.events import StatusEvent 
+from sas.guiframe.events import StatusEvent
 from sas.guiframe.events import NewPlotEvent
 from sas.guiframe.events import PanelOnFocusEvent
@@ -25,5 +26,5 @@
 from  sas.guiframe.local_perspectives.plotting.binder import BindArtist
 from Plotter1D import ModelPanel1D
-from sas.plottools.toolbar import NavigationToolBar 
+from sas.plottools.toolbar import NavigationToolBar
 from matplotlib.font_manager import FontProperties
 from graphAppearance import graphAppearance
@@ -46,5 +47,5 @@
     def __init__(self, canvas, parent=None):
         NavigationToolBar.__init__(self, canvas=canvas, parent=parent)
-        
+
     def delete_option(self):
         """
@@ -52,10 +53,10 @@
         """
         #delete reset button
-        self.DeleteToolByPos(0) 
+        self.DeleteToolByPos(0)
         #delete dragging
-        self.DeleteToolByPos(2) 
+        self.DeleteToolByPos(2)
         #delete unwanted button that configures subplot parameters
         self.DeleteToolByPos(4)
-        
+
     def add_option(self):
         """
@@ -65,22 +66,20 @@
         id_context = wx.NewId()
         context_tip = 'Graph Menu'
-        context =  wx.ArtProvider.GetBitmap(wx.ART_LIST_VIEW, wx.ART_TOOLBAR)
-        self.InsertSimpleTool(0, id_context, context, 
-                                   context_tip, context_tip)
-        wx.EVT_TOOL(self, id_context,  self.parent.onToolContextMenu)
+        context = wx.ArtProvider.GetBitmap(wx.ART_LIST_VIEW, wx.ART_TOOLBAR)
+        self.InsertSimpleTool(0, id_context, context, context_tip, context_tip)
+        wx.EVT_TOOL(self, id_context, self.parent.onToolContextMenu)
         self.InsertSeparator(1)
         #add print button
         id_print = wx.NewId()
-        print_bmp =  wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR)
-        self.AddSimpleTool(id_print, print_bmp,
-                           'Print', 'Activate printing')
+        print_bmp = wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_TOOLBAR)
+        self.AddSimpleTool(id_print, print_bmp, 'Print', 'Activate printing')
         wx.EVT_TOOL(self, id_print, self.on_print)
-        
-        
+
+
 class ModelPanel2D(ModelPanel1D):
     """
     Plot panel for use with the GUI manager
     """
-    
+
     ## Internal name for the AUI manager
     window_name = "plotpanel"
@@ -92,7 +91,7 @@
     ## Group ID
     group_id = None
-    
-    
-    def __init__(self, parent, id=-1, data2d=None, color = None,
+
+
+    def __init__(self, parent, id=-1, data2d=None, color=None,
                  dpi=None, style=wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs):
         """
@@ -106,5 +105,5 @@
         ## Dictionary containing Plottables
         self.plots = {}
-        ## Save reference of the current plotted 
+        ## Save reference of the current plotted
         self.data2D = data2d
         ## Unique ID (from gui_manager)
@@ -120,7 +119,7 @@
         ## Reference to the current slicer
         self.slicer = None
-        ## event to send slicer info 
+        ## event to send slicer info
         self.Bind(EVT_INTERNAL, self._onEVT_INTERNAL)
-        
+
         self.axes_frozen = False
         ## panel that contains result from slicer motion (ex: Boxsum info)
@@ -129,10 +128,10 @@
         self.title_font = None
         self.title_color = 'black'
-        ## Graph        
+        ## Graph
         self.graph = Graph()
         self.graph.xaxis("\\rm{Q}", 'A^{-1}')
         self.graph.yaxis("\\rm{Intensity} ", "cm^{-1}")
         self.graph.render(self)
-        ## store default value of zmin and zmax 
+        ## store default value of zmin and zmax
         self.default_zmin_ctl = self.zmin_2D
         self.default_zmax_ctl = self.zmax_2D
@@ -145,18 +144,18 @@
         if event == None:
             return
-        event.Skip() 
-                       
-    def onLeftDown(self, event): 
+        event.Skip()
+
+    def onLeftDown(self, event):
         """
         left button down and ready to drag
-        
+
         """
         # Check that the LEFT button was pressed
-        PlotPanel.onLeftDown(self, event)    
+        PlotPanel.onLeftDown(self, event)
         ax = event.inaxes
         if ax != None:
             # data coordinate position
-            pos_x = "%8.3g"% event.xdata
-            pos_y = "%8.3g"% event.ydata
+            pos_x = "%8.3g" % event.xdata
+            pos_y = "%8.3g" % event.ydata
             position = "x: %s    y: %s" % (pos_x, pos_y)
             wx.PostEvent(self.parent, StatusEvent(status=position))
@@ -164,5 +163,5 @@
         self._manager.set_panel_on_focus(self)
         wx.PostEvent(self.parent, PanelOnFocusEvent(panel=self))
-        
+
     def add_toolbar(self):
         """
@@ -174,24 +173,24 @@
         # On Windows platform, default window size is incorrect, so set
         # toolbar width to figure width.
-        tw, th = self.toolbar.GetSizeTuple()
-        fw, fh = self.canvas.GetSizeTuple()
+        _, th = self.toolbar.GetSizeTuple()
+        fw, _ = self.canvas.GetSizeTuple()
         self.toolbar.SetSize(wx.Size(fw, th))
-        self.sizer.Add(self.toolbar, 0, wx.LEFT|wx.EXPAND)
+        self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
         # update the axes menu on the toolbar
         self.toolbar.update()
-         
+
     def plot_data(self, data):
         """
         Data is ready to be displayed
-        
+
         :TODO: this name should be changed to something more appropriate
              Don't forget that changing this name will mean changing code
              in plotting.py
-         
+
         :param event: data event
         """
         xlo = None
         xhi = None
-        ylo = None 
+        ylo = None
         yhi = None
         if data.__class__.__name__ == 'Data1D':
@@ -207,13 +206,13 @@
         else:
             self.plots[data.id] = data
-            self.graph.add(self.plots[data.id]) 
+            self.graph.add(self.plots[data.id])
             # update qmax with the new xmax of data plotted
-            self.qmax = data.xmax  
+            self.qmax = data.xmax
         self.slicer = None
         # Check axis labels
         #TODO: Should re-factor this
-        ## render the graph with its new content   
+        ## render the graph with its new content
         #data2D: put 'Pixel (Number)' for axis title and unit in case of having no detector info and none in _units
-        if len(data.detector) < 1: 
+        if len(data.detector) < 1:
             if len(data._xunit) < 1 and len(data._yunit) < 1:
                 data._xaxis = '\\rm{x}'
@@ -224,8 +223,8 @@
         self.graph.xaxis(data._xaxis, data._xunit)
         self.graph.yaxis(data._yaxis, data._yunit)
-        if self._is_changed_legend_label:   
-                data.label = self.title_label
+        if self._is_changed_legend_label:
+            data.label = self.title_label
         if data.label == None:
-            data.label = data.name   
+            data.label = data.name
         if not self.title_font:
             self.graph.title(data.label)
@@ -240,6 +239,6 @@
                                    fontproperties=self.title_font,
                                    color=self.title_color)
-            self.subplot.figure.canvas.draw_idle()    
-        ## store default value of zmin and zmax 
+            self.subplot.figure.canvas.draw_idle()
+        ## store default value of zmin and zmax
         self.default_zmin_ctl = self.zmin_2D
         self.default_zmax_ctl = self.zmax_2D
@@ -247,10 +246,10 @@
             return
         # Recover the x,y limits
-        if (xlo and xhi and ylo and yhi) != None:
-            if (xlo > data.xmin and xhi < data.xmax and\
-                        ylo > data.ymin and yhi < data.ymax):
-                self.subplot.set_xlim((xlo, xhi))     
-                self.subplot.set_ylim((ylo, yhi)) 
-            else: 
+        if xlo and xhi and ylo and yhi:
+            if xlo > data.xmin and xhi < data.xmax and \
+                        ylo > data.ymin and yhi < data.ymax:
+                self.subplot.set_xlim((xlo, xhi))
+                self.subplot.set_ylim((ylo, yhi))
+            else:
                 self.toolbar.update()
                 self.is_zoomed = False
@@ -276,130 +275,123 @@
             self.xaxis_label = xname
             self.xaxis_unit = xunits
-        self.xaxis(xname, xunits, self.xaxis_font, 
+        self.xaxis(xname, xunits, self.xaxis_font,
                    self.xaxis_color, self.xaxis_tick)
-        self.yaxis(yname, yunits, self.yaxis_font, 
+        self.yaxis(yname, yunits, self.yaxis_font,
                    self.yaxis_color, self.yaxis_tick)
-        
+
     def onContextMenu(self, event):
         """
         2D plot context menu
-        
+
         :param event: wx context event
-        
+
         """
         slicerpop = PanelMenu()
         slicerpop.set_plots(self.plots)
         slicerpop.set_graph(self.graph)
-             
-        id = wx.NewId()
-        slicerpop.Append(id, '&Save Image')
-        wx.EVT_MENU(self, id, self.onSaveImage)
-        
-        id = wx.NewId()
-        slicerpop.Append(id,'&Print Image', 'Print image')
-        wx.EVT_MENU(self, id, self.onPrint)
-        
-        id = wx.NewId()
-        slicerpop.Append(id,'&Print Preview', 'Print preview')
-        wx.EVT_MENU(self, id, self.onPrinterPreview)
-
-        id = wx.NewId()
-        slicerpop.Append(id, '&Copy to Clipboard', 'Copy to the clipboard')
-        wx.EVT_MENU(self, id, self.OnCopyFigureMenu)
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Save Image')
+        wx.EVT_MENU(self, wx_id, self.onSaveImage)
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Print Image', 'Print image')
+        wx.EVT_MENU(self, wx_id, self.onPrint)
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Print Preview', 'Print preview')
+        wx.EVT_MENU(self, wx_id, self.onPrinterPreview)
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Copy to Clipboard', 'Copy to the clipboard')
+        wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu)
         slicerpop.AppendSeparator()
         # saving data
         plot = self.data2D
-        id = wx.NewId()
-        name = plot.name
-        slicerpop.Append(id, "&Data Info" )
-        wx.EVT_MENU(self, id, self._onDataShow)
-
-        id = wx.NewId()
-        name = plot.name
-        slicerpop.Append(id, "&Save as a File (DAT)" )
-        self.action_ids[str(id)] = plot
-        wx.EVT_MENU(self, id, self._onSave)
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, "&Data Info")
+        wx.EVT_MENU(self, wx_id, self._onDataShow)
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, "&Save as a File (DAT)")
+        self.action_ids[str(wx_id)] = plot
+        wx.EVT_MENU(self, wx_id, self._onSave)
 
         slicerpop.AppendSeparator()
-        if len(self.data2D.detector) == 1:        
-            
+        if len(self.data2D.detector) == 1:
             item_list = self.parent.get_current_context_menu(self)
             if (not item_list == None) and (not len(item_list) == 0) and\
-                self.data2D.name.split(" ")[0] != 'Residuals':  
+                self.data2D.name.split(" ")[0] != 'Residuals':
                 # The line above; Not for trunk
                 for item in item_list:
                     try:
-                        id = wx.NewId()
-                        slicerpop.Append(id, item[0], item[1])
-                        wx.EVT_MENU(self, id, item[2])
+                        wx_id = wx.NewId()
+                        slicerpop.Append(wx_id, item[0], item[1])
+                        wx.EVT_MENU(self, wx_id, item[2])
                     except:
                         msg = "ModelPanel1D.onContextMenu: "
-                        msg += "bad menu item  %s"%sys.exc_value
+                        msg += "bad menu item  %s" % sys.exc_value
                         wx.PostEvent(self.parent, StatusEvent(status=msg))
-                        pass
                 slicerpop.AppendSeparator()
-            
-            id = wx.NewId()
-            slicerpop.Append(id, '&Perform Circular Average')
-            wx.EVT_MENU(self, id, self.onCircular) \
+
+            wx_id = wx.NewId()
+            slicerpop.Append(wx_id, '&Perform Circular Average')
+            wx.EVT_MENU(self, wx_id, self.onCircular) \
             # For Masked Data
             if not plot.mask.all():
-                id = wx.NewId()
-                slicerpop.Append(id, '&Masked Circular Average')
-                wx.EVT_MENU(self, id, self.onMaskedCircular) 
-            id = wx.NewId()
-            slicerpop.Append(id, '&Sector [Q View]')
-            wx.EVT_MENU(self, id, self.onSectorQ) 
-            id = wx.NewId()
-            slicerpop.Append(id, '&Annulus [Phi View ]')
-            wx.EVT_MENU(self, id, self.onSectorPhi) 
-            id = wx.NewId()
-            slicerpop.Append(id, '&Box Sum')
-            wx.EVT_MENU(self, id, self.onBoxSum) 
-            id = wx.NewId()
-            slicerpop.Append(id, '&Box Averaging in Qx')
-            wx.EVT_MENU(self, id, self.onBoxavgX) 
-            id = wx.NewId()
-            slicerpop.Append(id, '&Box Averaging in Qy')
-            wx.EVT_MENU(self, id, self.onBoxavgY) 
+                wx_id = wx.NewId()
+                slicerpop.Append(wx_id, '&Masked Circular Average')
+                wx.EVT_MENU(self, wx_id, self.onMaskedCircular)
+            wx_id = wx.NewId()
+            slicerpop.Append(wx_id, '&Sector [Q View]')
+            wx.EVT_MENU(self, wx_id, self.onSectorQ)
+            wx_id = wx.NewId()
+            slicerpop.Append(wx_id, '&Annulus [Phi View ]')
+            wx.EVT_MENU(self, wx_id, self.onSectorPhi)
+            wx_id = wx.NewId()
+            slicerpop.Append(wx_id, '&Box Sum')
+            wx.EVT_MENU(self, wx_id, self.onBoxSum)
+            wx_id = wx.NewId()
+            slicerpop.Append(wx_id, '&Box Averaging in Qx')
+            wx.EVT_MENU(self, wx_id, self.onBoxavgX)
+            wx_id = wx.NewId()
+            slicerpop.Append(wx_id, '&Box Averaging in Qy')
+            wx.EVT_MENU(self, wx_id, self.onBoxavgY)
             if self.slicer != None:
-                id = wx.NewId()
-                slicerpop.Append(id, '&Clear Slicer')
-                wx.EVT_MENU(self, id,  self.onClearSlicer) 
-                if self.slicer.__class__.__name__  != "BoxSum":
-                    id = wx.NewId()
-                    slicerpop.Append(id, '&Edit Slicer Parameters')
-                    wx.EVT_MENU(self, id, self._onEditSlicer) 
-            slicerpop.AppendSeparator() 
-            
-        id = wx.NewId()
-        slicerpop.Append(id, '&Edit Graph Label', 'Edit Graph Label')
-        wx.EVT_MENU(self, id, self.onEditLabels)
+                wx_id = wx.NewId()
+                slicerpop.Append(wx_id, '&Clear Slicer')
+                wx.EVT_MENU(self, wx_id, self.onClearSlicer)
+                if self.slicer.__class__.__name__ != "BoxSum":
+                    wx_id = wx.NewId()
+                    slicerpop.Append(wx_id, '&Edit Slicer Parameters')
+                    wx.EVT_MENU(self, wx_id, self._onEditSlicer)
+            slicerpop.AppendSeparator()
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Edit Graph Label', 'Edit Graph Label')
+        wx.EVT_MENU(self, wx_id, self.onEditLabels)
         slicerpop.AppendSeparator()
-        
+
         # ILL mod here
 
-        id = wx.NewId()
-        slicerpop.Append(id, '&Modify graph appearance','Modify graph appearance')
-        wx.EVT_MENU(self, id, self.modifyGraphAppearance)
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Modify graph appearance', 'Modify graph appearance')
+        wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance)
         slicerpop.AppendSeparator()
 
-
-        
-        id = wx.NewId()
-        slicerpop.Append(id, '&2D Color Map')
-        wx.EVT_MENU(self, id, self._onEditDetector)
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&2D Color Map')
+        wx.EVT_MENU(self, wx_id, self._onEditDetector)
         slicerpop.AppendSeparator()
-        
-        id = wx.NewId()
-        slicerpop.Append(id, '&Toggle Linear/Log Scale')
-        wx.EVT_MENU(self, id, self._onToggleScale) 
-        
-        
+
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Toggle Linear/Log Scale')
+        wx.EVT_MENU(self, wx_id, self._onToggleScale)
+
         slicerpop.AppendSeparator()
-        id = wx.NewId()
-        slicerpop.Append(id, '&Window Title')
-        wx.EVT_MENU(self, id, self.onChangeCaption)
-        
+        wx_id = wx.NewId()
+        slicerpop.Append(wx_id, '&Window Title')
+        wx.EVT_MENU(self, wx_id, self.onChangeCaption)
+
         try:
             pos_evt = event.GetPosition()
@@ -409,6 +401,5 @@
             pos = (pos_x, pos_y + 5)
         self.PopupMenu(slicerpop, pos)
-        
-            
+
     def onEditLabels(self, event):
         """
@@ -443,25 +434,23 @@
                                            color=self.title_color)
                     self._is_changed_legend_label = True
-                    self.subplot.figure.canvas.draw_idle()  
+                    self.subplot.figure.canvas.draw_idle()
             except:
+                msg = "Add Text: Error. Check your property values..."
+                logging.error(msg)
                 if self.parent != None:
-                    from sas.guiframe.events import StatusEvent 
-                    msg= "Add Text: Error. Check your property values..."
-                    wx.PostEvent(self.parent, StatusEvent(status = msg ))
-                else:
-                    raise
+                    wx.PostEvent(self.parent, StatusEvent(status=msg))
         dial.Destroy()
-        
+
     def _onEditDetector(self, event):
         """
         Allow to view and edits  detector parameters
-        
+
         :param event: wx.menu event
-        
+
         """
         import detector_dialog
-        dialog = detector_dialog.DetectorDialog(self, -1,base=self.parent,
-                       reset_zmin_ctl =self.default_zmin_ctl,
-                       reset_zmax_ctl = self.default_zmax_ctl,cmap=self.cmap)
+        dialog = detector_dialog.DetectorDialog(self, -1, base=self.parent,
+                                                reset_zmin_ctl=self.default_zmin_ctl,
+                                                reset_zmax_ctl=self.default_zmax_ctl, cmap=self.cmap)
         ## info of current detector and data2D
         xnpts = len(self.data2D.x_bins)
@@ -470,10 +459,9 @@
         ymax = max(self.data2D.ymin, self.data2D.ymax)
         qmax = math.sqrt(math.pow(xmax, 2) + math.pow(ymax, 2))
-        beam = self.data2D.xmin
         ## set dialog window content
-        dialog.setContent(xnpts=xnpts,ynpts=ynpts,qmax=qmax,
-                           beam=self.data2D.xmin,
-                           zmin = self.zmin_2D,
-                          zmax = self.zmax_2D)
+        dialog.setContent(xnpts=xnpts, ynpts=ynpts, qmax=qmax,
+                          beam=self.data2D.xmin,
+                          zmin=self.zmin_2D,
+                          zmax=self.zmax_2D)
         if dialog.ShowModal() == wx.ID_OK:
             evt = dialog.getContent()
@@ -486,69 +474,69 @@
                    qx_data=self.data2D.qx_data,
                    qy_data=self.data2D.qy_data,
-                   xmin= self.data2D.xmin,
-                   xmax= self.data2D.xmax,
-                   ymin= self.data2D.ymin,
-                   ymax= self.data2D.ymax,
-                   zmin= self.zmin_2D,
-                   zmax= self.zmax_2D,
-                   cmap= self.cmap,
+                   xmin=self.data2D.xmin,
+                   xmax=self.data2D.xmax,
+                   ymin=self.data2D.ymin,
+                   ymax=self.data2D.ymax,
+                   zmin=self.zmin_2D,
+                   zmax=self.zmax_2D,
+                   cmap=self.cmap,
                    color=0, symbol=0, label=self.data2D.name)
         self.subplot.figure.canvas.draw_idle()
-        
+
     def freeze_axes(self):
         """
         """
         self.axes_frozen = True
-        
+
     def thaw_axes(self):
         """
         """
         self.axes_frozen = False
-        
-    def onMouseMotion(self,event):
+
+    def onMouseMotion(self, event):
         """
         """
         pass
-    
+
     def onWheel(self, event):
         """
         """
-        pass  
-      
+        pass
+
     def update(self, draw=True):
         """
-        Respond to changes in the model by recalculating the 
+        Respond to changes in the model by recalculating the
         profiles and resetting the widgets.
         """
         self.draw_plot()
-        
+
     def _getEmptySlicerEvent(self):
         """
-        create an empty slicervent 
+        create an empty slicervent
         """
         return SlicerEvent(type=None, params=None, obj_class=None)
-        
+
     def _onEVT_INTERNAL(self, event):
         """
         Draw the slicer
-        
+
         :param event: wx.lib.newevent (SlicerEvent) containing slicer
             parameter
-            
+
         """
         self._setSlicer(event.slicer)
-            
+
     def _setSlicer(self, slicer):
         """
         Clear the previous slicer and create a new one.Post an internal
         event.
-        
+
         :param slicer: slicer class to create
-        
+
         """
         ## Clear current slicer
-        if not self.slicer == None:  
-            self.slicer.clear()            
-        ## Create a new slicer    
+        if not self.slicer == None:
+            self.slicer.clear()
+        ## Create a new slicer
         self.slicer_z += 1
         self.slicer = slicer(self, self.subplot, zorder=self.slicer_z)
@@ -558,5 +546,5 @@
         self.update()
         self.slicer.update()
-        msg = "Plotter2D._setSlicer  %s"%self.slicer.__class__.__name__
+        msg = "Plotter2D._setSlicer  %s" % self.slicer.__class__.__name__
         wx.PostEvent(self.parent, StatusEvent(status=msg))
         # Post slicer event
@@ -566,20 +554,20 @@
         event.params = self.slicer.get_params()
         wx.PostEvent(self, event)
-        
+
     def onMaskedCircular(self, event):
         """
         perform circular averaging on Data2D with mask if it exists
-        
+
         :param event: wx.menu event
-        
+
         """
         self.onCircular(event, True)
-        
+
     def onCircular(self, event, ismask=False):
         """
         perform circular averaging on Data2D
-        
+
         :param event: wx.menu event
-        
+
         """
         # Find the best number of bins
@@ -588,13 +576,13 @@
         from sas.dataloader.manipulations import CircularAverage
         ## compute the maximum radius of data2D
-        self.qmax = max(math.fabs(self.data2D.xmax), 
+        self.qmax = max(math.fabs(self.data2D.xmax),
                         math.fabs(self.data2D.xmin))
         self.ymax = max(math.fabs(self.data2D.ymax),
                         math.fabs(self.data2D.ymin))
-        self.radius = math.sqrt(math.pow(self.qmax, 2)+ math.pow(self.ymax, 2)) 
+        self.radius = math.sqrt(math.pow(self.qmax, 2) + math.pow(self.ymax, 2))
         ##Compute beam width
-        bin_width = (self.qmax + self.qmax)/npt
+        bin_width = (self.qmax + self.qmax) / npt
         ## Create data1D circular average of data2D
-        Circle = CircularAverage(r_min=0, r_max=self.radius, 
+        Circle = CircularAverage(r_min=0, r_max=self.radius,
                                  bin_width=bin_width)
         circ = Circle(self.data2D, ismask=ismask)
@@ -617,5 +605,5 @@
         new_plot.interactive = True
         new_plot.detector = self.data2D.detector
-        
+
         ## If the data file does not tell us what the axes are, just assume...
         new_plot.xaxis("\\rm{Q}", "A^{-1}")
@@ -627,20 +615,20 @@
             new_plot.yaxis("\\rm{Intensity} ", "cm^{-1}")
 
-        new_plot.group_id = "2daverage"  + self.data2D.name
+        new_plot.group_id = "2daverage" + self.data2D.name
         new_plot.id = "Circ avg " + self.data2D.name
         new_plot.is_data = True
         self.parent.update_theory(data_id=self.data2D.id, \
                                        theory=new_plot)
-        wx.PostEvent(self.parent, 
+        wx.PostEvent(self.parent,
                      NewPlotEvent(plot=new_plot, title=new_plot.name))
-       
+
     def _onEditSlicer(self, event):
         """
-        Is available only when a slicer is drawn.Create a dialog 
+        Is available only when a slicer is drawn.Create a dialog
         window where the user can enter value to reset slicer
         parameters.
-        
+
         :param event: wx.menu event
-        
+
         """
         if self.slicer != None:
@@ -648,8 +636,8 @@
             dialog = SlicerParameterPanel(self, -1, "Slicer Parameters")
             dialog.set_slicer(self.slicer.__class__.__name__,
-                            self.slicer.get_params())
+                              self.slicer.get_params())
             if dialog.ShowModal() == wx.ID_OK:
-                dialog.Destroy() 
-        
+                dialog.Destroy()
+
     def onSectorQ(self, event):
         """
@@ -659,5 +647,5 @@
         self.onClearSlicer(event)
         wx.PostEvent(self, InternalEvent(slicer=SectorInteractor))
-        
+
     def onSectorPhi(self, event):
         """
@@ -667,5 +655,5 @@
         self.onClearSlicer(event)
         wx.PostEvent(self, InternalEvent(slicer=AnnulusInteractor))
-        
+
     def onBoxSum(self, event):
         """
@@ -675,5 +663,5 @@
         self.onClearSlicer(event)
         self.slicer_z += 1
-        self.slicer =  BoxSum(self, self.subplot, zorder=self.slicer_z)
+        self.slicer = BoxSum(self, self.subplot, zorder=self.slicer_z)
         self.subplot.set_ylim(self.data2D.ymin, self.data2D.ymax)
         self.subplot.set_xlim(self.data2D.xmin, self.data2D.xmax)
@@ -681,5 +669,4 @@
         self.slicer.update()
         ## Value used to initially set the slicer panel
-        type = self.slicer.__class__.__name__
         params = self.slicer.get_params()
         ## Create a new panel to display results of summation of Data2D
@@ -687,30 +674,30 @@
         win = MDIFrame(self.parent, None, 'None', (100, 200))
         new_panel = SlicerPanel(parent=win, id=-1,
-                                    base=self, type=type,
-                                    params=params, style=wx.RAISED_BORDER)
-        
+                                base=self, type=self.slicer.__class__.__name__,
+                                params=params, style=wx.RAISED_BORDER)
+
         new_panel.window_caption = self.slicer.__class__.__name__ + " " + \
                                     str(self.data2D.name)
-        new_panel.window_name = self.slicer.__class__.__name__+ " " + \
+        new_panel.window_name = self.slicer.__class__.__name__ + " " + \
                                     str(self.data2D.name)
         ## Store a reference of the new created panel
-        
+
         ## save the window_caption of the new panel in the current slicer
         self.slicer.set_panel_name(name=new_panel.window_caption)
-        ## post slicer panel to guiframe to display it 
+        ## post slicer panel to guiframe to display it
         from sas.guiframe.events import SlicerPanelEvent
-        
+
         win.set_panel(new_panel)
         new_panel.frame = win
         wx.PostEvent(self.parent, SlicerPanelEvent(panel=new_panel,
-                                                    main_panel=self))
+                                                   main_panel=self))
         wx.CallAfter(new_panel.frame.Show)
         self.panel_slicer = new_panel
-        
-    def onBoxavgX(self,event):
+
+    def onBoxavgX(self, event):
         """
         Perform 2D data averaging on Qx
         Create a new slicer .
-        
+
         :param event: wx.menu event
         """
@@ -718,17 +705,17 @@
         self.onClearSlicer(event)
         wx.PostEvent(self, InternalEvent(slicer=BoxInteractorX))
-       
-    def onBoxavgY(self,event):
+
+    def onBoxavgY(self, event):
         """
         Perform 2D data averaging on Qy
         Create a new slicer .
-        
+
         :param event: wx.menu event
-        
+
         """
         from boxSlicer import BoxInteractorY
         self.onClearSlicer(event)
         wx.PostEvent(self, InternalEvent(slicer=BoxInteractorY))
-        
+
     def onClearSlicer(self, event):
         """
@@ -742,13 +729,13 @@
             event = self._getEmptySlicerEvent()
             wx.PostEvent(self, event)
-            
+
     def _onSave(self, evt):
         """
         Save a data set to a dat(text) file
-        
+
         :param evt: Menu event
-        
-        """
-        id = str(evt.GetId())
+
+        """
+        event_id = str(evt.GetId())
         if self.parent != None:
             self._default_save_location = self.parent._default_save_location
@@ -757,18 +744,17 @@
             default_name = default_name.split('.')[0]
         default_name += "_out"
-        if id in self.action_ids:         
-            path = None
+        if event_id in self.action_ids:
             self.parent.save_data2d(self.data2D, default_name)
-            
+
     def _onDataShow(self, evt):
         """
         Show the data set in text
-        
+
         :param evt: Menu event
-        
+
         """
         menu = evt.GetEventObject()
-        id = evt.GetId()
-        self.set_selected_from_menu(menu, id)
+        event_id = evt.GetId()
+        self.set_selected_from_menu(menu, event_id)
         data = self.plots[self.graph.selected_plottable]
         default_name = data.label
@@ -778,29 +764,22 @@
         if self.parent != None:
             self.parent.show_data2d(data, default_name)
-        
-
-    def modifyGraphAppearance(self,e):
-        self.graphApp = graphAppearance(self,'Modify graph appearance',
-                                        legend=False)
-
-        
-
-        self.graphApp.setDefaults(self.grid_on,self.legend_on,
-                                  self.xaxis_label,self.yaxis_label,
-                                  self.xaxis_unit,self.yaxis_unit,
-                                  self.xaxis_font,self.yaxis_font,
-                                  find_key(self.get_loc_label(),self.legendLoc),
-                                  self.xcolor,self.ycolor,
-                                   self.is_xtick, self.is_ytick)
+
+    def modifyGraphAppearance(self, e):
+        self.graphApp = graphAppearance(self, 'Modify graph appearance', legend=False)
+        self.graphApp.setDefaults(self.grid_on, self.legend_on,
+                                  self.xaxis_label, self.yaxis_label,
+                                  self.xaxis_unit, self.yaxis_unit,
+                                  self.xaxis_font, self.yaxis_font,
+                                  find_key(self.get_loc_label(), self.legendLoc),
+                                  self.xcolor, self.ycolor,
+                                  self.is_xtick, self.is_ytick)
         self.graphApp.Bind(wx.EVT_CLOSE, self.on_graphApp_close)
-    
-
-    def on_graphApp_close(self,e):
-        # gets values from graph appearance dialog and sends them off
-        # to modify the plot
-
+
+    def on_graphApp_close(self, e):
+        """
+            Gets values from graph appearance dialog and sends them off
+            to modify the plot
+        """
         self.onGridOnOff(self.graphApp.get_togglegrid())
-
-        
         self.xaxis_label = self.graphApp.get_xlab()
         self.yaxis_label = self.graphApp.get_ylab()
@@ -809,6 +788,6 @@
         self.xaxis_font = self.graphApp.get_xfont()
         self.yaxis_font = self.graphApp.get_yfont()
-        self.is_xtick =  self.graphApp.get_xtick_check()
-        self.is_ytick =  self.graphApp.get_ytick_check()
+        self.is_xtick = self.graphApp.get_xtick_check()
+        self.is_ytick = self.graphApp.get_ytick_check()
         if self.is_xtick:
             self.xaxis_tick = self.xaxis_font
@@ -816,8 +795,8 @@
             self.yaxis_tick = self.yaxis_font
 
-        self.xaxis(self.xaxis_label, self.xaxis_unit, 
-                   self.graphApp.get_xfont(), self.graphApp.get_xcolor(), 
+        self.xaxis(self.xaxis_label, self.xaxis_unit,
+                   self.graphApp.get_xfont(), self.graphApp.get_xcolor(),
                    self.xaxis_tick)
-        self.yaxis(self.yaxis_label, self.yaxis_unit, 
+        self.yaxis(self.yaxis_label, self.yaxis_unit,
                    self.graphApp.get_yfont(), self.graphApp.get_ycolor(),
                    self.yaxis_tick)
Index: src/sas/guiframe/local_perspectives/plotting/masking.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/masking.py	(revision 7d56795669085f6578efe03fcbfb0a2068d2827e)
+++ src/sas/guiframe/local_perspectives/plotting/masking.py	(revision c039589ad31dec3058311cae229f7aa1dc56faf8)
@@ -30,5 +30,5 @@
 from sas.guiframe.dataFitting import Data1D, Data2D
 from boxMask import BoxMask
-from sectorMask import SectorMask
+from sector_mask import SectorMask
 from AnnulusSlicer import CircularMask
 
Index: src/sas/guiframe/local_perspectives/plotting/plotting.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/plotting.py	(revision b9dbd6b5e3f5275da6eb798e3bc7343fddcb6d50)
+++ src/sas/guiframe/local_perspectives/plotting/plotting.py	(revision c039589ad31dec3058311cae229f7aa1dc56faf8)
@@ -5,5 +5,5 @@
 #This software was developed by the University of Tennessee as part of the
 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
-#project funded by the US National Science Foundation. 
+#project funded by the US National Science Foundation.
 #
 #See the license text in license.txt
@@ -16,5 +16,4 @@
 from sas.guiframe.events import EVT_NEW_PLOT
 from sas.guiframe.events import EVT_PLOT_QRANGE
-from sas.guiframe.events import StatusEvent 
 from sas.guiframe.events import DeletePlotPanelEvent
 from sas.guiframe.plugin_base import PluginBase
@@ -25,6 +24,6 @@
 DEFAULT_MENU_ITEM_ID = wx.NewId()
 
-IS_WIN = True    
-if sys.platform.count("win32")==0:
+IS_WIN = True
+if sys.platform.count("win32") == 0:
     if int(str(wx.__version__).split('.')[0]) == 2:
         if int(str(wx.__version__).split('.')[1]) < 9:
@@ -36,8 +35,8 @@
     Plug-in class to be instantiated by the GUI manager
     """
-    
+
     def __init__(self, standalone=False):
         PluginBase.__init__(self, name="Plotting", standalone=standalone)
-      
+
         ## Plot panels
         self.plot_panels = {}
@@ -47,35 +46,28 @@
         self.menu = None
 
-     
+
     def set_panel_on_focus(self, panel):
         """
         """
         self._panel_on_focus = panel
-        
+
     def is_always_active(self):
         """
-        return True is this plugin is always active even if the user is 
+        return True is this plugin is always active even if the user is
         switching between perspectives
         """
         return True
-    
+
     def populate_menu(self, parent):
         """
         Create a 'Plot' menu to list the panels
         available for displaying
-        
+
         :param id: next available unique ID for wx events
         :param parent: parent window
-        
+
         """
         return []
-        """
-        self.menu = wx.Menu()
-        self.menu.Append(DEFAULT_MENU_ITEM_ID, DEFAULT_MENU_ITEM_LABEL, 
-                             "No graph available")
-        self.menu.FindItemByPosition(0).Enable(False)
-        return [(self.menu, "Show")]
-        """
-    
+
     def get_panels(self, parent):
         """
@@ -89,6 +81,6 @@
         # We have no initial panels for this plug-in
         return []
-    
-    def _on_plot_qrange(self, event= None):
+
+    def _on_plot_qrange(self, event=None):
         """
         On Qmin Qmax vertical line event
@@ -103,21 +95,21 @@
             return
         panel.on_plot_qrange(event)
-            
+
     def _on_show_panel(self, event):
         """show plug-in panel"""
         pass
-    
+
     def remove_plot(self, group_id, id):
         """
         remove plot of ID = id from a panel of group ID =group_id
         """
-        
+
         if group_id in self.plot_panels.keys():
             panel = self.plot_panels[group_id]
             panel.remove_data_by_id(id=id)
-            
+
             return True
         return False
-        
+
     def clear_panel(self):
         """
@@ -129,5 +121,5 @@
             self.hide_panel(group_id)
         self.plot_panels = {}
-    
+
     def clear_panel_by_id(self, group_id):
         """
@@ -141,5 +133,5 @@
             return True
         return False
-            
+
     def hide_panel(self, group_id):
         """
@@ -148,5 +140,5 @@
         # Not implemeted
         return False
-    
+
     def create_panel_helper(self, new_panel, data, group_id, title=None):
         """
@@ -167,22 +159,12 @@
         new_panel.uid = event_id
         # Ship the plottable to its panel
-        wx.CallAfter(new_panel.plot_data, data) 
+        wx.CallAfter(new_panel.plot_data, data)
         #new_panel.canvas.set_resizing(new_panel.resizing)
         self.plot_panels[new_panel.group_id] = new_panel
-        
-        # Set Graph menu and help string        
-        self.help_string = ' Graph: '
-        for plot in  new_panel.plots.itervalues():
-            help_string += (' ' + plot.label + ';')
-        #self.menu.AppendCheckItem(event_id, new_panel.window_caption, 
-        #                          helpString)
-        #self.menu.Check(event_id, IS_WIN)
-        #wx.EVT_MENU(self.parent, event_id, self._on_check_menu)
-
-        
+
     def create_1d_panel(self, data, group_id):
         """
         """
-        # Create a new plot panel if none was available        
+        # Create a new plot panel if none was available
         if issubclass(data.__class__, Data1D):
             from Plotter1D import ModelPanel1D
@@ -194,5 +176,5 @@
             win = MDIFrame(self.parent, None, 'None', (100, 200))
             new_panel = ModelPanel1D(win, -1, xtransform=xtransform,
-                     ytransform=ytransform, style=wx.RAISED_BORDER)
+                                     ytransform=ytransform, style=wx.RAISED_BORDER)
             win.set_panel(new_panel)
             win.Show(False)
@@ -200,8 +182,8 @@
             #win.Show(True)
             return  new_panel
-        
+
         msg = "1D Panel of group ID %s could not be created" % str(group_id)
         raise ValueError, msg
-    
+
     def create_2d_panel(self, data, group_id):
         """
@@ -213,14 +195,13 @@
             win = MDIFrame(self.parent, None, 'None', (200, 150))
             win.Show(False)
-            new_panel = ModelPanel2D(win, id = -1,
-                                data2d=data, scale = scale, 
-                                style=wx.RAISED_BORDER)
+            new_panel = ModelPanel2D(win, id=-1,
+                                     data2d=data, scale=scale,
+                                     style=wx.RAISED_BORDER)
             win.set_panel(new_panel)
             new_panel.frame = win
-            #win.Show(True)
             return new_panel
         msg = "2D Panel of group ID %s could not be created" % str(group_id)
         raise ValueError, msg
-    
+
     def update_panel(self, data, panel):
         """
@@ -228,7 +209,7 @@
         """
         # Check whether we already have a graph with the same units
-        # as the plottable we just received. 
-        _, x_unit =  data.get_xaxis()
-        _, y_unit =  data.get_yaxis()
+        # as the plottable we just received.
+        _, x_unit = data.get_xaxis()
+        _, y_unit = data.get_yaxis()
         flag_x = (panel.graph.prop["xunit"] is not None) and \
                     (panel.graph.prop["xunit"].strip() != "") and\
@@ -237,5 +218,5 @@
                     (panel.graph.prop["yunit"].strip() != "") and\
                     (y_unit != panel.graph.prop["yunit"]) and False
-        if (flag_x and flag_y):
+        if flag_x and flag_y:
             msg = "Cannot add %s" % str(data.name)
             msg += " to panel %s\n" % str(panel.window_caption)
@@ -253,9 +234,7 @@
             panel = self.plot_panels[group_id]
             uid = panel.uid
-            wx.PostEvent(self.parent, 
+            wx.PostEvent(self.parent,
                          DeletePlotPanelEvent(name=panel.window_caption,
-                                    caption=panel.window_caption))
-            #remove menu item
-            #self.delete_menu_item(panel.window_caption, panel.uid)
+                                              caption=panel.window_caption))
             del self.plot_panels[group_id]
             if uid in self.parent.plot_panels.keys():
@@ -265,5 +244,5 @@
 
         return False
-    
+
     def _on_plot_event(self, event):
         """
@@ -271,7 +250,7 @@
         Check whether we have a panel to put in on, or create
         a new one
-        
+
         :param event: EVT_NEW_PLOT event
-        
+
         """
         action_check = False
@@ -285,6 +264,5 @@
                     #remove data from panel
                     if action_string == 'remove':
-                        id = event.id
-                        return self.remove_plot(group_id, id)
+                        return self.remove_plot(group_id, event.id)
                     if action_string == 'hide':
                         return self.hide_panel(group_id)
@@ -295,18 +273,18 @@
                     if action_string == "clear":
                         return self.clear_panel_by_id(group_id)
-                    
-        if not hasattr(event, 'plot'):    
+
+        if not hasattr(event, 'plot'):
             return
         title = None
         if hasattr(event, 'title'):
-            title = 'Graph'#event.title      
+            title = 'Graph'  #event.title
         data = event.plot
-        group_id = data.group_id    
+        group_id = data.group_id
         if group_id in self.plot_panels.keys():
             if action_check:
                 # Check if the plot already exist. if it does, do nothing.
                 if data.id in self.plot_panels[group_id].plots.keys():
-                    return 
-            #update a panel graph 
+                    return
+            #update a panel graph
             panel = self.plot_panels[group_id]
             self.update_panel(data, panel)
@@ -331,7 +309,6 @@
                             p_plot.group_id = group_id
                             return
-                
+
                 new_panel = self.create_2d_panel(data, group_id)
-            self.create_panel_helper(new_panel, data, group_id, title) 
+            self.create_panel_helper(new_panel, data, group_id, title)
         return
-        frame.Show(True)
Index: src/sas/guiframe/local_perspectives/plotting/profile_dialog.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/profile_dialog.py	(revision 090e07ec682df3bf454d95d0e69d079939a51fbc)
+++ src/sas/guiframe/local_perspectives/plotting/profile_dialog.py	(revision c039589ad31dec3058311cae229f7aa1dc56faf8)
@@ -3,5 +3,4 @@
 """
 import wx
-import os
 import sys
 from copy import deepcopy
@@ -10,7 +9,6 @@
 from sas.guiframe.dataFitting import Data1D
 from sas.guiframe.gui_style import GUIFRAME_ID
-import pylab
-
-DEFAULT_CMAP = None#pylab.cm.jet
+
+DEFAULT_CMAP = None  #pylab.cm.jet
 _BOX_WIDTH = 76
 _STATICBOX_WIDTH = 400
@@ -19,5 +17,5 @@
 _Y_OFF = 0.5
 
-#SLD panel size 
+#SLD panel size
 if sys.platform.count("win32") > 0:
     _STATICBOX_WIDTH = 563
@@ -28,6 +26,6 @@
     PANEL_SIZE = 500
     FONT_VARIANT = 1
-    
-     
+
+
 class SLDPanel(wx.Dialog):
     """
@@ -40,12 +38,12 @@
     ## Flag to tell the AUI manager to put this panel in the center pane
     CENTER_PANE = True
-    def __init__(self, parent=None, base=None, data=None, axes =['Radius'], 
+    def __init__(self, parent=None, base=None, data=None, axes=['Radius'],
                  id=-1, *args, **kwds):
         kwds["style"] = wx.DEFAULT_DIALOG_STYLE
-        kwds["size"] = wx.Size(_STATICBOX_WIDTH, PANEL_SIZE) 
+        kwds["size"] = wx.Size(_STATICBOX_WIDTH, PANEL_SIZE)
         wx.Dialog.__init__(self, parent, id=id, *args, **kwds)
 
         if data != None:
-            #Font size 
+            #Font size
             kwds = []
             self.SetWindowVariant(variant=FONT_VARIANT)
@@ -59,6 +57,6 @@
             self.name = self.data.name
             # Panel for plot
-            self.plotpanel = SLDplotpanel(self, axes, -1, 
-                                             style=wx.TRANSPARENT_WINDOW)
+            self.plotpanel = SLDplotpanel(self, axes, -1,
+                                          style=wx.TRANSPARENT_WINDOW)
             self.cmap = DEFAULT_CMAP
             ## Create Artist and bind it
@@ -66,5 +64,5 @@
             # layout
             self._setup_layout()
-            
+
             # plot
             data_plot = deepcopy(self.data)
@@ -72,5 +70,5 @@
             # unit increase to M times for users
             data_plot.y = self._set_y_data()
-            
+
             self.newplot = Data1D(data_plot.x, data_plot.y, data_plot.dy)
             self.newplot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM
@@ -78,39 +76,39 @@
             self.newplot.name = 'SLD'
             self.newplot.is_data = False
-            
+
             self.newplot.id = self.newplot.name
-            self.plotpanel.add_image(self.newplot) 
-            
+            self.plotpanel.add_image(self.newplot)
+
             self.plotpanel.resizing = False
             self.plotpanel.canvas.set_resizing(self.plotpanel.resizing)
-            
-            self.plotpanel.subplot.set_ylim(min(data_plot.y) - _Y_OFF , 
-                                                max(data_plot.y) + _Y_OFF)
-            self.plotpanel.subplot.set_xlim(min(data_plot.x) - _X_OFF, 
-                                                max(data_plot.x) + _X_OFF)
+
+            self.plotpanel.subplot.set_ylim(min(data_plot.y) - _Y_OFF,
+                                            max(data_plot.y) + _Y_OFF)
+            self.plotpanel.subplot.set_xlim(min(data_plot.x) - _X_OFF,
+                                            max(data_plot.x) + _X_OFF)
             self.plotpanel.graph.render(self.plotpanel)
             self.plotpanel.canvas.draw()
 
-    def _set_dy_data(self): 
+    def _set_dy_data(self):
         """
         make fake dy data
-        
-        :return dy: 
+
+        :return dy:
         """
         # set dy as zero
         dy = [0 for y in self.data.y]
-        return dy      
-
-    def _set_y_data(self): 
+        return dy
+
+    def _set_y_data(self):
         """
         make y data unit Mega times
-        
-        :return y_value: 
+
+        :return y_value:
         """
         # changes the unit
         y_value = [yvalue * 1e+006 for yvalue in self.data.y]
-        
-        return y_value     
-    
+
+        return y_value
+
     def _setup_layout(self):
         """
@@ -119,14 +117,13 @@
         # panel sizer
         sizer = wx.BoxSizer(wx.VERTICAL)
-        sizer.Add(self.plotpanel, 0, wx.LEFT|wx.RIGHT, 5)
-        sizer.Add(wx.StaticLine(self), 0, wx.ALL|wx.EXPAND, 5)
+        sizer.Add(self.plotpanel, 0, wx.LEFT | wx.RIGHT, 5)
+        sizer.Add(wx.StaticLine(self), 0, wx.ALL | wx.EXPAND, 5)
         sizer.Add((0, 5))
         #-----Button------------1
-        id = wx.NewId()
-        button_reset = wx.Button(self, id, "Close")
+        button_reset = wx.Button(self, wx.NewId(), "Close")
         button_reset.SetToolTipString("Close...")
-        button_reset.Bind(wx.EVT_BUTTON, self._close, 
-                          id=button_reset.GetId()) 
-        sizer.Add(button_reset, 0, wx.LEFT, _STATICBOX_WIDTH - 80) 
+        button_reset.Bind(wx.EVT_BUTTON, self._close,
+                          id=button_reset.GetId())
+        sizer.Add(button_reset, 0, wx.LEFT, _STATICBOX_WIDTH - 80)
         sizer.Add((0, 10))
         self.SetSizerAndFit(sizer)
@@ -134,5 +131,5 @@
         self.Show(True)
         button_reset.SetFocus()
-        
+
     def _close(self, event):
         """
@@ -149,13 +146,13 @@
     def get_current_context_menu(self, graph=None):
         """
-        When the context menu of a plot is rendered, the 
-        get_context_menu method will be called to give you a 
+        When the context menu of a plot is rendered, the
+        get_context_menu method will be called to give you a
         chance to add a menu item to the context menu.
         :param graph: the Graph object to which we attach the context menu
-        
+
         :return: a list of menu items with call-back function
         """
         return []
-    
+
     def set_schedule_full_draw(self, panel=None, func=None):
         """
@@ -164,5 +161,5 @@
         # Not implemented
         pass
-    
+
     def set_schedule(self, schedule=False):
         """
@@ -171,5 +168,5 @@
         # Not implemented
         pass
-        
+
     def set_plot_unfocus(self):
         """
@@ -178,10 +175,10 @@
         # NOt implemented
         pass
-    
+
     def on_change_caption(self, name, old_caption, new_caption):
         """
         """
         self.parent.parent.parent.on_change_caption(name, old_caption, new_caption)
-    
+
     def disable_app_menu(self, panel):
         """
@@ -190,22 +187,21 @@
         # Not implemented!
         return
-    
+
     def show_data1d(self, data, name):
         """
         Show data dialog
-        """   
+        """
         self.parent._manager.parent.show_data1d(data, name)
-        
+
 class SLDplotpanel(PlotPanel):
     """
     Panel
     """
-    def __init__(self, parent, axes=[], id=-1, color=None, dpi=None,
-                  **kwargs):
-        """
-        """
-        PlotPanel.__init__(self, parent, id=id, xtransform='x', ytransform='y', 
-                           color=color, dpi=dpi, 
-                           size=(_STATICBOX_WIDTH, PANEL_SIZE-100), **kwargs)
+    def __init__(self, parent, axes=[], id=-1, color=None, dpi=None, **kwargs):
+        """
+        """
+        PlotPanel.__init__(self, parent, id=id, xtransform='x', ytransform='y',
+                           color=color, dpi=dpi,
+                           size=(_STATICBOX_WIDTH, PANEL_SIZE - 100), **kwargs)
 
         # Keep track of the parent Frame
@@ -216,5 +212,5 @@
         self.prevYtrans = "y"
         self.viewModel = "--"
-        # Internal list of plottable names (because graph 
+        # Internal list of plottable names (because graph
         # doesn't have a dictionary of handles for the plottables)
         self.plots = {}
@@ -230,5 +226,5 @@
         self.xcolor = 'black'
         self.ycolor = 'black'
-        
+
     def add_image(self, plot):
         """
@@ -241,5 +237,5 @@
         #add axes
         x1_label = self.axes_label[0]
-        self.xaxis_label = '\\rm{%s} '% x1_label
+        self.xaxis_label = '\\rm{%s} ' % x1_label
         self.xaxis_unit = 'A'
         self.graph.xaxis(self.xaxis_label, self.xaxis_unit)
@@ -247,15 +243,12 @@
         self.yaxis_unit = '10^{-6}A^{-2}'
         self.graph.yaxis(self.yaxis_label, self.yaxis_unit)
-        #self.subplot.figure.canvas.draw_idle()
-        # For latter scale changes 
-        self.plots[plot.id].xaxis('\\rm{%s} '% x1_label, 'A')
+        # For latter scale changes
+        self.plots[plot.id].xaxis('\\rm{%s} ' % x1_label, 'A')
         self.plots[plot.id].yaxis('\\rm{SLD} ', '10^{-6}A^{-2}')
-        #draw
-        #self.graph.render(self)
-        
+
     def on_set_focus(self, event):
         """
         send to the parenet the current panel on focus
-        
+
         """
         #Not implemented
@@ -265,9 +258,9 @@
         """
         reset the panel color
-        
+
         """
         #Not implemented
         pass
-    
+
     def onChangeCaption(self, event):
         """
@@ -275,15 +268,15 @@
         """
         pass
-                           
+
     def _onSave(self, evt):
         """
         Save a data set to a text file
-        
+
         :param evt: Menu event
-        
+
         """
         menu = evt.GetEventObject()
-        id = evt.GetId()
-        self.set_selected_from_menu(menu, id)
+        event_id = evt.GetId()
+        self.set_selected_from_menu(menu, event_id)
         data = self.plots[self.graph.selected_plottable]
         default_name = data.label
@@ -295,5 +288,5 @@
             fit_panel = self.parent.parent.parent
             fit_panel._manager.parent.save_data1d(data, default_name)
-             
+
 class ViewerFrame(wx.Frame):
     """
@@ -306,18 +299,18 @@
         """
         # Initialize the Frame object
-        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, 
+        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition,
                           wx.Size(_STATICBOX_WIDTH, PANEL_SIZE))
         # Panel for 1D plot
-        self.plotpanel    = SLDplotpanel(self, -1, style=wx.RAISED_BORDER)
+        self.plotpanel = SLDplotpanel(self, -1, style=wx.RAISED_BORDER)
 
 class ViewApp(wx.App):
     def OnInit(self):
-        frame = ViewerFrame(None, -1, 'testView')    
+        frame = ViewerFrame(None, -1, 'testView')
         frame.Show(True)
         self.SetTopWindow(frame)
-        
+
         return True
-               
-if __name__ == "__main__": 
+
+if __name__ == "__main__":
     app = ViewApp(0)
-    app.MainLoop()     
+    app.MainLoop()
Index: src/sas/guiframe/local_perspectives/plotting/sectorMask.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/sectorMask.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,220 +1,0 @@
-
-import math
-import wx
-#from copy import deepcopy
-from BaseInteractor import _BaseInteractor
-from SectorSlicer import SideInteractor
-from SectorSlicer import LineInteractor
-from sas.guiframe.events import SlicerParameterEvent
-
-class SectorMask(_BaseInteractor):
-    """
-    Draw a sector slicer.Allow to find the data 2D inside of the sector lines
-    """
-    def __init__(self, base, axes, color='gray', zorder=3, side=False):
-        """
-        """
-        _BaseInteractor.__init__(self, base, axes, color=color)
-        ## Class initialization
-        self.markers = []
-        self.axes = axes   
-        self.is_inside = side
-        ## connect the plot to event 
-        self.connect = self.base.connect
-        
-        ## compute qmax limit to reset the graph     
-        x = math.pow(max(self.base.data.xmax, 
-                         math.fabs(self.base.data.xmin)), 2)
-        y = math.pow(max(self.base.data.ymax, 
-                         math.fabs(self.base.data.ymin)), 2)
-        self.qmax = math.sqrt(x + y)
-        ## Number of points on the plot
-        self.nbins = 20
-        ## Angle of the middle line
-        self.theta2 = math.pi/3
-        ## Absolute value of the Angle between the middle line and any side line
-        self.phi = math.pi/12
-        
-        ## Middle line
-        self.main_line = LineInteractor(self, self.base.subplot, color='blue',
-                                zorder=zorder, r=self.qmax, theta=self.theta2)
-        self.main_line.qmax = self.qmax
-        ## Right Side line
-        self.right_line = SideInteractor(self, self.base.subplot, color='gray',
-                            zorder=zorder, r=self.qmax, phi= -1*self.phi,
-                                                            theta2=self.theta2)
-        self.right_line.qmax = self.qmax
-        ## Left Side line 
-        self.left_line = SideInteractor(self, self.base.subplot, color='gray', 
-                                    zorder=zorder, r=self.qmax, phi= self.phi,
-                                                        theta2=self.theta2)
-        self.left_line.qmax = self.qmax
-        ## draw the sector               
-        self.update()
-        self._post_data()
-        
-    def clear(self):
-        """
-        Clear the slicer and all connected events related to this slicer
-        """
-        self.clear_markers()
-        self.main_line.clear()
-        self.left_line.clear()
-        self.right_line.clear()
-        self.base.connect.clearall()
-        #self.base.Unbind(EVT_SLICER_PARS)
-        
-    def update(self):
-        """
-        Respond to changes in the model by recalculating the profiles and
-        resetting the widgets.
-        """
-        # Update locations  
-        ## Check if the middle line was dragged and 
-        #update the picture accordingly     
-        if self.main_line.has_move:
-            self.main_line.update()
-            self.right_line.update(delta=-self.left_line.phi/2,
-                                    mline=self.main_line.theta)
-            self.left_line.update(delta=self.left_line.phi/2,
-                                   mline=self.main_line.theta)
-        ## Check if the left side has moved and update the slicer accordingly  
-        if self.left_line.has_move:
-            self.main_line.update()
-            self.left_line.update(phi=None, delta=None, mline=self.main_line ,
-                                  side=True, left=True )
-            self.right_line.update(phi=self.left_line.phi, delta=None,
-                                     mline=self.main_line, side=True,
-                                     left=False, right=True)
-        ## Check if the right side line has moved and 
-        #update the slicer accordingly
-        if self.right_line.has_move:
-            self.main_line.update()
-            self.right_line.update(phi=None, delta=None, mline=self.main_line,
-                                   side=True, left=False, right=True)
-            self.left_line.update(phi=self.right_line.phi, delta=None,
-                                    mline=self.main_line, side=True, left=False)
-        #if self.is_inside != None:
-        out = self._post_data()
-        return out
-
-    def save(self, ev):
-        """
-        Remember the roughness for this layer and the next so that we
-        can restore on Esc.
-        """
-        self.base.freeze_axes()
-        self.main_line.save(ev)
-        self.right_line.save(ev)
-        self.left_line.save(ev)
-
-    def _post_data(self):
-        """
-        compute sector averaging of data into data1D
-        """
-        ## get the data to average
-        data = self.base.data
-        # If we have no data, just return
-        if data == None:
-            return
-
-        mask = data.mask
-        ## Averaging
-        from sas.dataloader.manipulations import Sectorcut
-        radius = self.qmax 
-        phimin =  -self.left_line.phi + self.main_line.theta
-        phimax = self.left_line.phi + self.main_line.theta
-         
-        mask = Sectorcut(phi_min=phimin, phi_max=phimax)
-        if self.is_inside:
-            out = (mask(data) == False)
-        else:
-            out = (mask(data))
-        #self.base.data.mask=out
-        return out       
-
-    def moveend(self, ev):
-        """
-        Called a dragging motion ends.Get slicer event 
-        """
-        self.base.thaw_axes()
-        ## Post parameters
-        event = SlicerParameterEvent()
-        event.type = self.__class__.__name__
-        event.params = self.get_params()
-        ## Send slicer paramers to plotter2D
-        wx.PostEvent(self.base, event)
-        self._post_data()
-            
-    def restore(self):
-        """
-        Restore the roughness for this layer.
-        """
-        self.main_line.restore()
-        self.left_line.restore()
-        self.right_line.restore()
-
-    def move(self, x, y, ev):
-        """
-        Process move to a new position, making sure that the move is allowed.
-        """
-        pass
-        
-    def set_cursor(self, x, y):
-        pass
-        
-    def get_params(self):
-        """
-        Store a copy of values of parameters of the slicer into a dictionary.
-        
-        :return params: the dictionary created
-        
-        """
-        params = {}
-        ## Always make sure that the left and the right line are at phi 
-        ## angle of the middle line
-        if math.fabs(self.left_line.phi) != math.fabs(self.right_line.phi):
-            msg = "Phi left and phi right are "
-            msg += "different %f, %f" % (self.left_line.phi, 
-                                         self.right_line.phi)
-            raise ValueError, msg
-        params["Phi"] = self.main_line.theta
-        params["Delta_Phi"] = math.fabs(self.left_line.phi)
-        return params
-    
-    def set_params(self, params):
-        """
-        Receive a dictionary and reset the slicer with values contained 
-        in the values of the dictionary.
-        
-        :param params: a dictionary containing name of slicer parameters and 
-            values the user assigned to the slicer.
-        """
-        main = params["Phi"] 
-        phi = math.fabs(params["Delta_Phi"])
-        
-        self.main_line.theta = main
-        ## Reset the slicer parameters
-        self.main_line.update()
-        self.right_line.update(phi=phi, delta=None, mline=self.main_line,
-                               side=True, right=True)
-        self.left_line.update(phi=phi, delta=None,
-                              mline=self.main_line, side=True)
-        ## post the new corresponding data
-        self._post_data()
-        
-    def freeze_axes(self):
-        """
-        """
-        self.base.freeze_axes()
-        
-    def thaw_axes(self):
-        """
-        """
-        self.base.thaw_axes()
-
-    def draw(self):
-        """
-        """
-        self.base.update()
-        
Index: src/sas/guiframe/local_perspectives/plotting/sector_mask.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/sector_mask.py	(revision c039589ad31dec3058311cae229f7aa1dc56faf8)
+++ src/sas/guiframe/local_perspectives/plotting/sector_mask.py	(revision c039589ad31dec3058311cae229f7aa1dc56faf8)
@@ -0,0 +1,216 @@
+"""
+    Sector mask interactor
+"""
+import math
+import wx
+#from copy import deepcopy
+from BaseInteractor import _BaseInteractor
+from SectorSlicer import SideInteractor
+from SectorSlicer import LineInteractor
+from sas.guiframe.events import SlicerParameterEvent
+
+class SectorMask(_BaseInteractor):
+    """
+    Draw a sector slicer.Allow to find the data 2D inside of the sector lines
+    """
+    def __init__(self, base, axes, color='gray', zorder=3, side=False):
+        """
+        """
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        ## Class initialization
+        self.markers = []
+        self.axes = axes
+        self.is_inside = side
+        ## connect the plot to event
+        self.connect = self.base.connect
+
+        ## compute qmax limit to reset the graph
+        x = math.pow(max(self.base.data.xmax,
+                         math.fabs(self.base.data.xmin)), 2)
+        y = math.pow(max(self.base.data.ymax,
+                         math.fabs(self.base.data.ymin)), 2)
+        self.qmax = math.sqrt(x + y)
+        ## Number of points on the plot
+        self.nbins = 20
+        ## Angle of the middle line
+        self.theta2 = math.pi / 3
+        ## Absolute value of the Angle between the middle line and any side line
+        self.phi = math.pi / 12
+
+        ## Middle line
+        self.main_line = LineInteractor(self, self.base.subplot, color='blue',
+                                        zorder=zorder, r=self.qmax, theta=self.theta2)
+        self.main_line.qmax = self.qmax
+        ## Right Side line
+        self.right_line = SideInteractor(self, self.base.subplot, color='gray',
+                                         zorder=zorder, r=self.qmax, phi=-1 * self.phi,
+                                         theta2=self.theta2)
+        self.right_line.qmax = self.qmax
+        ## Left Side line
+        self.left_line = SideInteractor(self, self.base.subplot, color='gray',
+                                        zorder=zorder, r=self.qmax, phi=self.phi,
+                                        theta2=self.theta2)
+        self.left_line.qmax = self.qmax
+        ## draw the sector
+        self.update()
+        self._post_data()
+
+    def clear(self):
+        """
+        Clear the slicer and all connected events related to this slicer
+        """
+        self.clear_markers()
+        self.main_line.clear()
+        self.left_line.clear()
+        self.right_line.clear()
+        self.base.connect.clearall()
+
+    def update(self):
+        """
+        Respond to changes in the model by recalculating the profiles and
+        resetting the widgets.
+        """
+        # Update locations
+        ## Check if the middle line was dragged and
+        #update the picture accordingly
+        if self.main_line.has_move:
+            self.main_line.update()
+            self.right_line.update(delta=-self.left_line.phi / 2,
+                                   mline=self.main_line.theta)
+            self.left_line.update(delta=self.left_line.phi / 2,
+                                  mline=self.main_line.theta)
+        ## Check if the left side has moved and update the slicer accordingly
+        if self.left_line.has_move:
+            self.main_line.update()
+            self.left_line.update(phi=None, delta=None, mline=self.main_line,
+                                  side=True, left=True)
+            self.right_line.update(phi=self.left_line.phi, delta=None,
+                                   mline=self.main_line, side=True,
+                                   left=False, right=True)
+        ## Check if the right side line has moved and
+        #update the slicer accordingly
+        if self.right_line.has_move:
+            self.main_line.update()
+            self.right_line.update(phi=None, delta=None, mline=self.main_line,
+                                   side=True, left=False, right=True)
+            self.left_line.update(phi=self.right_line.phi, delta=None,
+                                  mline=self.main_line, side=True, left=False)
+        #if self.is_inside != None:
+        out = self._post_data()
+        return out
+
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.base.freeze_axes()
+        self.main_line.save(ev)
+        self.right_line.save(ev)
+        self.left_line.save(ev)
+
+    def _post_data(self):
+        """
+        compute sector averaging of data into data1D
+        """
+        ## get the data to average
+        data = self.base.data
+        # If we have no data, just return
+        if data == None:
+            return
+        ## Averaging
+        from sas.dataloader.manipulations import Sectorcut
+        phimin = -self.left_line.phi + self.main_line.theta
+        phimax = self.left_line.phi + self.main_line.theta
+
+        mask = Sectorcut(phi_min=phimin, phi_max=phimax)
+        if self.is_inside:
+            out = (mask(data) == False)
+        else:
+            out = (mask(data))
+        return out
+
+    def moveend(self, ev):
+        """
+        Called a dragging motion ends.Get slicer event
+        """
+        self.base.thaw_axes()
+        ## Post parameters
+        event = SlicerParameterEvent()
+        event.type = self.__class__.__name__
+        event.params = self.get_params()
+        ## Send slicer paramers to plotter2D
+        wx.PostEvent(self.base, event)
+        self._post_data()
+
+    def restore(self):
+        """
+        Restore the roughness for this layer.
+        """
+        self.main_line.restore()
+        self.left_line.restore()
+        self.right_line.restore()
+
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        pass
+
+    def set_cursor(self, x, y):
+        pass
+
+    def get_params(self):
+        """
+        Store a copy of values of parameters of the slicer into a dictionary.
+
+        :return params: the dictionary created
+
+        """
+        params = {}
+        ## Always make sure that the left and the right line are at phi
+        ## angle of the middle line
+        if math.fabs(self.left_line.phi) != math.fabs(self.right_line.phi):
+            msg = "Phi left and phi right are "
+            msg += "different %f, %f" % (self.left_line.phi,
+                                         self.right_line.phi)
+            raise ValueError, msg
+        params["Phi"] = self.main_line.theta
+        params["Delta_Phi"] = math.fabs(self.left_line.phi)
+        return params
+
+    def set_params(self, params):
+        """
+        Receive a dictionary and reset the slicer with values contained
+        in the values of the dictionary.
+
+        :param params: a dictionary containing name of slicer parameters and
+            values the user assigned to the slicer.
+        """
+        main = params["Phi"]
+        phi = math.fabs(params["Delta_Phi"])
+
+        self.main_line.theta = main
+        ## Reset the slicer parameters
+        self.main_line.update()
+        self.right_line.update(phi=phi, delta=None, mline=self.main_line,
+                               side=True, right=True)
+        self.left_line.update(phi=phi, delta=None,
+                              mline=self.main_line, side=True)
+        ## post the new corresponding data
+        self._post_data()
+
+    def freeze_axes(self):
+        """
+        """
+        self.base.freeze_axes()
+
+    def thaw_axes(self):
+        """
+        """
+        self.base.thaw_axes()
+
+    def draw(self):
+        """
+        """
+        self.base.update()
