Index: guiframe/local_perspectives/plotting/AnnulusSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/AnnulusSlicer.py	(revision 18eba35c7477f0694169ce9f4575ba08f17c4cc0)
+++ guiframe/local_perspectives/plotting/AnnulusSlicer.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -122,5 +122,5 @@
         rmax = max(math.fabs(self.inner_circle.get_radius()),
                    math.fabs(self.outer_circle.get_radius()))
-        print "rmin, rmax", rmin, rmax
+        #print "rmin, rmax", rmin, rmax
         if nbins==None:
             nbins = 20
Index: guiframe/local_perspectives/plotting/Plotter1D.py
===================================================================
--- guiframe/local_perspectives/plotting/Plotter1D.py	(revision 8bd764d24747a8a4ae90ca4c10c529656b5ac9cc)
+++ guiframe/local_perspectives/plotting/Plotter1D.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -263,14 +263,5 @@
         slicerpop.Append(id, '&Reset Graph')
         wx.EVT_MENU(self, id, self.onResetGraph)  
-        """
-        slicerpop.AppendSeparator() 
-        id = wx.NewId()
-        slicerpop.Append(id,'&Printer setup', 'Set image size')
-        wx.EVT_MENU(self, id, self.onPrinterSetup)
-        
-        id = wx.NewId()
-        slicerpop.Append(id,'&Printer Preview', 'Set image size')
-        wx.EVT_MENU(self, id, self.onPrinterPreview)
-        """
+       
         
 
Index: guiframe/local_perspectives/plotting/Plotter2D.py
===================================================================
--- guiframe/local_perspectives/plotting/Plotter2D.py	(revision 8bd764d24747a8a4ae90ca4c10c529656b5ac9cc)
+++ guiframe/local_perspectives/plotting/Plotter2D.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -93,5 +93,5 @@
         
     def _onEVT_SLICER_PARS(self, event):
-        print "paramaters entered on slicer panel", event.type, event.params
+        #print "paramaters entered on slicer panel", event.type, event.params
         self.slicer.set_params(event.params)
         #from sans.guicomm.events import SlicerPanelEvent
@@ -247,12 +247,5 @@
         slicerpop.AppendSeparator() 
        
-        """
-        # Option to save the data displayed
-        id = wx.NewId()
-        slicerpop.Append(id,'&Printer setup', 'Set image size')
-        wx.EVT_MENU(self, id, self.onPrinterSetup)
-        
-       
-        """
+     
         id = wx.NewId()
         slicerpop.Append(id, '&Toggle Linear/Log scale')
@@ -265,5 +258,7 @@
    
     def _onEditDetector(self, event):
-        print "edit detortor param",self.zmin_2D, self.zmax_2D
+        """
+        """
+        #print "edit detortor param",self.zmin_2D, self.zmax_2D
         import detector_dialog
         dialog = detector_dialog.DetectorDialog(self, -1,base=self.parent)
@@ -286,5 +281,5 @@
        
         dialog.Destroy()
-        print "zmn ,zmax", self.zmin_2D, self.zmax_2D
+        #print "zmn ,zmax", self.zmin_2D, self.zmax_2D
         self.image(data= self.data2D.data,
                    xmin= self.data2D.xmin,
Index: guiframe/local_perspectives/plotting/boxSum.py
===================================================================
--- guiframe/local_perspectives/plotting/boxSum.py	(revision 18eba35c7477f0694169ce9f4575ba08f17c4cc0)
+++ guiframe/local_perspectives/plotting/boxSum.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -74,9 +74,12 @@
         #print "box sum  self.base.parent",self.base.parent
         self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        
     def set_panel_name(self, name):
         self.panel_name= name
+        
+        
     def _onEVT_SLICER_PARS(self, event):
         wx.PostEvent(self.base.parent, StatusEvent(status="Boxsum._onEVT_SLICER_PARS"))
-        print "receiving value ",event.params
+        #print "receiving value ",event.params
         event.Skip()
         if event.type == self.__class__.__name__:
@@ -157,8 +160,8 @@
         y_min= self.vertical_lines.y2
         y_max= self.vertical_lines.y1
-        print "xmin, xmax, ymin , ymax", x_min, x_max, y_min, y_max
+        #print "xmin, xmax, ymin , ymax", x_min, x_max, y_min, y_max
         box =  Boxavg (x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max)
         self.count, self.error = box(self.base.data2D)
-        print "box_sum output",box(self.base.data2D)
+        #print "box_sum output",box(self.base.data2D)
                           
     def moveend(self, ev):
Index: guiframe/local_perspectives/plotting/last_boxSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/last_boxSlicer.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
+++ guiframe/local_perspectives/plotting/last_boxSlicer.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -0,0 +1,613 @@
+#TODO: the line slicer should listen to all 2DREFRESH events, get the data and slice it
+#      before pushing a new 1D data update.
+
+#
+#TODO: NEED MAJOR REFACTOR
+#
+
+
+# Debug printout
+#from config import printEVT
+from BaseInteractor import _BaseInteractor
+from copy import deepcopy
+import math
+
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+import SlicerParameters
+import wx
+
+
+class BoxInteractor(_BaseInteractor):
+    """
+         Select an annulus through a 2D plot
+    """
+    def __init__(self,base,axes,color='black', zorder=3,
+                  x_min=0.0025, x_max=0.0025, y_min=0.0025, y_max=0.0025):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        self.qmax = self.base.data2D.xmax
+        self.connect = self.base.connect
+        self.x= 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin))
+        self.y= 0.5*min(math.fabs(self.base.data2D.xmax),math.fabs( self.base.data2D.xmin))        
+         
+        self.theta2= math.pi/3
+        ## Number of points on the plot
+        self.nbins = 30
+        self.count=0
+        self.error=0
+        self.averager=None
+        self.left_line = VerticalLine(self, self.base.subplot,color='blue', 
+                                      zorder=zorder,
+                                        ymin= -self.y , 
+                                        ymax= self.y ,
+                                        xmin= -self.x,
+                                        xmax= -self.x)
+        self.left_line.qmax = self.qmax
+        
+        self.right_line= VerticalLine(self, self.base.subplot,color='black', 
+                                      zorder=zorder,
+                                     ymin= -self.y , 
+                                     ymax= self.y,
+                                     xmin= self.x,
+                                     xmax= self.x)
+        self.right_line.qmax = self.qmax
+        
+        self.top_line= HorizontalLine(self, self.base.subplot,color='green', 
+                                      zorder=zorder,
+                                      xmin= -self.x,
+                                      xmax= self.x,
+                                      ymin= self.y,
+                                      ymax= self.y)
+        self.top_line.qmax= self.qmax
+        
+        self.bottom_line= HorizontalLine(self, self.base.subplot,color='gray', 
+                                      zorder=zorder,
+                                      xmin= -self.x,
+                                      xmax= self.x,
+                                      ymin= -self.y,
+                                      ymax= -self.y)
+        self.bottom_line.qmax= self.qmax
+        
+        self.update()
+        self._post_data()
+        
+        # Bind to slice parameter events
+        self.base.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+
+
+    def _onEVT_SLICER_PARS(self, event):
+        wx.PostEvent(self.base, StatusEvent(status="BoxSlicer._onEVT_SLICER_PARS"))
+        event.Skip()
+        if event.type == self.__class__.__name__:
+            self.set_params(event.params)
+            self.base.update()
+
+    def update_and_post(self):
+        self.update()
+        self._post_data()
+
+    def save_data(self, path, image, x, y):
+        output = open(path, 'w')
+        
+        data_x, data_y = self.get_data(image, x, y)
+        
+        output.write("<phi>  <average>\n")
+        for i in range(len(data_x)):
+            output.write("%g  %g\n" % (data_x[i], data_y[i]))
+        output.close()
+
+    def set_layer(self, n):
+        self.layernum = n
+        self.update()
+        
+    def clear(self):
+        self.averager=None
+        self.clear_markers()
+        self.left_line.clear()
+        self.right_line.clear()
+        self.top_line.clear()
+        self.bottom_line.clear()
+        #self.base.connect.disconnect()
+        self.base.Unbind(EVT_SLICER_PARS)
+        
+    def update(self):
+        """
+        Respond to changes in the model by recalculating the profiles and
+        resetting the widgets.
+        """
+        
+        if self.top_line.has_move:
+            #print"top has moved"
+            self.top_line.update()
+            self.bottom_line.update(ymin= -self.top_line.y1,
+                                    ymax= -self.top_line.y2)
+            self.left_line.update(ymin= -self.top_line.y1,
+                                    ymax= -self.top_line.y2)
+            self.right_line.update(ymin= -self.top_line.y1,
+                                    ymax= -self.top_line.y2)
+           
+        if self.bottom_line.has_move:
+            #print "bottom has move"
+            self.bottom_line.update()
+            self.top_line.update(ymin= -self.bottom_line.y1,
+                                    ymax= -self.bottom_line.y2)
+            self.left_line.update(ymin= self.bottom_line.y1,
+                                    ymax= self.top_line.y1)
+            self.right_line.update(ymin= self.bottom_line.y1,
+                                    ymax=self.top_line.y1)
+           
+        if self.left_line.has_move:
+           
+            self.left_line.update()
+            self.right_line.update(xmin = - self.left_line.x1,
+                                   xmax = - self.left_line.x1)
+            self.bottom_line.update(xmin=  self.left_line.x1,
+                                     xmax= self.right_line.x1)
+            self.top_line.update(xmin= self.left_line.x1,
+                                    xmax= self.right_line.x1)
+           
+        if self.right_line.has_move:
+           
+            self.right_line.update()
+            self.left_line.update(xmin = -self.right_line.x1,
+                                   xmax = -self.right_line.x1)
+            
+            self.bottom_line.update(xmin= self.left_line.x1,
+                                 xmax= self.right_line.x1)
+            
+            self.top_line.update(xmin= self.left_line.x1,
+                                    xmax= self.right_line.x1)
+               
+            
+    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.left_line.save(ev)
+        self.right_line.save(ev)
+        self.top_line.save(ev)
+        self.bottom_line.save(ev)
+    def _post_data(self):
+        pass
+        
+    
+    def post_data(self,new_slab=None , nbins=None):
+        """ post data averaging in Q"""
+        x_min= min(self.left_line.x1, self.right_line.x1)
+        x_max= max(self.left_line.x1, self.right_line.x1)
+        
+        y_min= min(self.top_line.y1, self.bottom_line.y1)
+        y_max= max(self.top_line.y1, self.bottom_line.y1)  
+        
+        if nbins !=None:
+            self.nbins
+        if self.averager==None:
+            if new_slab ==None:
+                raise ValueError,"post data:cannot average , averager is empty"
+            self.averager= new_slab
+        bin_width= (x_max + math.fabs(x_min))/self.nbins
+        
+        box = self.averager( x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max,
+                         bin_width=bin_width)
+        
+        boxavg = box(self.base.data2D)
+        
+        from sans.guiframe.dataFitting import Data1D
+        if hasattr(boxavg,"dxl"):
+            dxl= boxavg.dxl
+        else:
+            dxl= None
+        if hasattr(boxavg,"dxw"):
+            dxw=boxavg.dxw
+        else:
+            dxw= None
+       
+        new_plot = Data1D(x=boxavg.x,y=boxavg.y,dy=boxavg.dy,dxl=dxl,dxw=dxw)
+        new_plot.name = str(self.averager.__name__) +"("+ self.base.data2D.name+")"
+        
+       
+
+        new_plot.source=self.base.data2D.source
+        new_plot.interactive = True
+        #print "loader output.detector",output.source
+        new_plot.detector =self.base.data2D.detector
+        # If the data file does not tell us what the axes are, just assume...
+        new_plot.xaxis("\\rm{Q}", 'rad')
+        new_plot.yaxis("\\rm{Intensity} ","cm^{-1}")
+        new_plot.group_id = str(self.averager.__name__)+self.base.data2D.name
+        new_plot.id = str(self.averager.__name__)
+        wx.PostEvent(self.base.parent, NewPlotEvent(plot=new_plot,
+                                                 title=str(self.averager.__name__) ))
+        
+        
+    def _post_data(self):
+        # Compute data
+        data = self.base.data2D
+        from DataLoader.manipulations import  Boxavg
+        radius = math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2))
+        self.x= math.fabs(self.right_line.x1)
+        self.y= math.fabs(self.top_line.y1 )
+       
+        box =  Boxavg (x_min=-self.x, x_max=self.x, y_min=-self.y, y_max=self.y)
+       
+        self.count, self.error= box(self.base.data2D)
+        
+        #print "post data"
+              
+                                       
+    def moveend(self, ev):
+        self.base.thaw_axes()
+        
+        # Post paramters
+        event = SlicerParameterEvent()
+        event.type = self.__class__.__name__
+        event.params = self.get_params()
+        wx.PostEvent(self.base.parent, event)
+
+        self._post_data()
+            
+    def restore(self):
+        """
+        Restore the roughness for this layer.
+        """
+        self.left_line.restore()
+        self.right_line.restore()
+        self.top_line.restore()
+        self.bottom_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):
+        params = {}
+        params["x_max"]= math.fabs(self.right_line.x1)
+        params["y_max"]= math.fabs(self.top_line.y1)
+        params["nbins"]= self.nbins
+        params["errors"] = self.error
+        params["count"]= self.count
+        return params
+    
+    def set_params(self, params):
+        
+        self.x = float(math.fabs(params["x_max"]))
+        self.y = float(math.fabs(params["y_max"] ))
+        self.nbins=params["nbins"]
+        self.left_line.update(xmin= -1*self.x,
+                              xmax = -1*self.x,
+                              ymin= -self.y,
+                              ymax=  self.y, 
+                              )
+        self.right_line.update(xmin= self.x,
+                              xmax = self.x,
+                              ymin= -self.y,
+                              ymax=  self.y, 
+                              )
+        self.top_line.update(xmin= -1*self.x,
+                             xmax= self.x,
+                             ymin= self.y,
+                             ymax= self.y)
+        self.bottom_line.update(xmin= -1*self.x,
+                                 xmax= self.x,
+                                 ymin= -1*self.y,
+                                 ymax= -1*self.y)
+       
+        self.post_data( nbins=None)
+    def freeze_axes(self):
+        self.base.freeze_axes()
+        
+    def thaw_axes(self):
+        self.base.thaw_axes()
+
+    def draw(self):
+        self.base.draw()
+
+class HorizontalLine(_BaseInteractor):
+    """
+         Select an annulus through a 2D plot
+    """
+    def __init__(self,base,axes,color='black', zorder=5,mline=None,ymin=None, ymax=None, y=0.5,
+                 xmin=0.0,xmax=0.5):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        self.x1= xmax
+        self.save_x1= xmax
+        
+        self.x2= xmin
+        self.save_x2= xmin
+        
+        self.y1= ymax
+        self.save_y1= ymax
+        
+        self.y2= ymin
+        self.save_y2= ymin
+        self.mline= mline
+        try:
+            # Inner circle marker
+            self.inner_marker = self.axes.plot([0],[self.y1], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          pickradius=5, label="pick", 
+                                          zorder=zorder, # Prefer this to other lines
+                                          visible=True)[0]
+        except:
+            self.inner_marker = self.axes.plot([0],[self.y1], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          label="pick", 
+                                          visible=True)[0]
+            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n"
+            message += "Get the SVN version that is at least as recent as June 1, 2007"
+            
+        self.line = self.axes.plot([self.x1,-self.x1],
+                                   [self.y1,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+        
+        self.npts = 20
+        self.has_move=False
+        self.connect_markers([self.line, self.inner_marker])
+        self.update()
+
+    def set_layer(self, n):
+        self.layernum = n
+        self.update()
+        
+    def clear(self):
+        self.clear_markers()
+        try:
+            
+            self.line.remove()
+        except:
+            # Old version of matplotlib
+            for item in range(len(self.axes.lines)):
+                del self.axes.lines[0]
+   
+    def get_radius(self):
+        
+        return 0
+   
+    def update(self,xmin=None, xmax=None,ymin=None,ymax=None, mline=None,translation=False):
+        """
+        Draw the new roughness on the graph.
+        """
+        if xmin !=None:
+            self.x1 = xmin
+        if ymin !=None:
+            self.y1 = ymin
+        self.inner_marker.set(xdata=[0],ydata=[self.y1])
+        self.line.set(xdata=[self.x1,-self.x1],
+                       ydata=[self.y1,self.y1])
+    
+        
+        
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.save_x1= self.x1
+        self.save_x2= self.x2
+       
+        self.save_y1= self.y1
+        self.save_y2= self.y2
+    
+        
+        self.base.freeze_axes()
+
+    def moveend(self, ev):
+       
+        self.has_move=False
+        self.base.moveend(ev)
+            
+    def restore(self):
+        """
+        Restore the roughness for this layer.
+        """
+        self.x1 = self.save_x1
+        self.x2 = self.save_x2
+        self.y1 = self.save_y1
+        self.y2 = self.save_y2
+        
+
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        #print "horizontal move x y "
+        self.y1= y
+        self.has_move=True
+        self.base.base.update()
+        
+    def set_cursor(self, x, y):
+        self.move(x, y, None)
+        self.update()
+        
+        
+    def get_params(self):
+        params = {}
+        params["radius"] = self.x1
+        #params["theta"] = self.xmax
+        return params
+    
+    def set_params(self, params):
+
+        x = params["radius"] 
+        self.set_cursor(x, self._inner_mouse_y)
+        
+
+
+
+class VerticalLine(_BaseInteractor):
+    """
+         Select an annulus through a 2D plot
+    """
+    def __init__(self,base,axes,color='black', zorder=5, mline=None, ymin=0.0, 
+                 ymax=0.5,xmin=-0.5,xmax=0.5
+                 ):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        
+        self.x1= xmax
+        self.x2= xmin
+        self.y1= ymax
+        self.y2= ymin
+        try:
+            # Inner circle marker
+            self.inner_marker = self.axes.plot([self.x1],[0], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          pickradius=5, label="pick", 
+                                          zorder=zorder, # Prefer this to other lines
+                                          visible=True)[0]
+        except:
+            self.inner_marker = self.axes.plot([self.x1],[0], linestyle='',
+                                          marker='s', markersize=10,
+                                          color=self.color, alpha=0.6,
+                                          label="pick", 
+                                          visible=True)[0]
+            message  = "\nTHIS PROTOTYPE NEEDS THE LATEST VERSION OF MATPLOTLIB\n"
+            message += "Get the SVN version that is at least as recent as June 1, 2007"
+            
+        self.line = self.axes.plot([self.x1,self.x2],[self.y1,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+      
+        self.has_move=False
+        self.connect_markers([self.line, self.inner_marker])
+        self.update()
+
+    def set_layer(self, n):
+        self.layernum = n
+        self.update()
+        
+    def clear(self):
+        self.clear_markers()
+        try:
+            
+            self.line.remove()
+        except:
+            # Old version of matplotlib
+            for item in range(len(self.axes.lines)):
+                del self.axes.lines[0]
+   
+    
+    def get_radius(self):
+        return 0
+    
+    def update(self,xmin=None,xmax=None,ymin=None, ymax=None, opline=None,translation=False):
+        """
+        Draw the new roughness on the graph.
+        """
+
+   
+        if xmin!=None:
+            self.x1=xmin
+        if ymin!=None:
+            self.y1=ymin
+        self.inner_marker.set(xdata=[self.x1],ydata=[0]) 
+        self.line.set(xdata=[self.x1,self.x1],
+                       ydata=[self.y1,-self.y1]) 
+        
+    
+        
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.save_x1= self.x1
+        self.save_x2= self.x2
+        self.save_y1= self.y1
+        self.save_y2= self.y2
+        
+        self.base.freeze_axes()
+
+    def moveend(self, ev):
+        
+        self.has_move=False
+        self.base.moveend(ev)
+            
+    def restore(self):
+        """
+        Restore the roughness for this layer.
+        """
+        self.x1 = self.save_x1
+        self.x2 = self.save_x2
+        self.y1 = self.save_y1
+        self.y2= self.save_y2
+      
+        
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        self.has_move=True
+        
+        # compute the b intercept of the vertical line
+        self.x1= x
+        
+        
+        self.base.base.update()
+        
+        
+    def set_cursor(self, x, y):
+        self.move(x, y, None)
+        self.update()
+        
+        
+    def get_params(self):
+        params = {}
+        params["x"] = self.xmin
+        params["ymin"] = self.ymin
+        params["ymax"] = self.ymax
+        return params
+    
+    def set_params(self, params):
+        """
+            Draw a vertical line given some value of params
+            @param params: a dictionary containing value for x, ymin , ymax to draw 
+            a vertical line
+        """
+        x = params["x"] 
+        ymin = params["ymin"] 
+        ymax = params["ymax"] 
+        #self.set_cursor(x, self._inner_mouse_y)
+        self.update(self,x =x,ymin =ymin, ymax =ymax)
+        
+
+class BoxInteractorX(BoxInteractor):
+    def __init__(self,base,axes,color='black', zorder=3):
+        BoxInteractor.__init__(self, base, axes, color=color)
+        self.base=base
+        self._post_data()
+    def _post_data(self):
+        from DataLoader.manipulations import SlabX
+        self.post_data(SlabX )   
+        
+
+class BoxInteractorY(BoxInteractor):
+    def __init__(self,base,axes,color='black', zorder=3):
+        BoxInteractor.__init__(self, base, axes, color=color)
+        self.base=base
+        self._post_data()
+    def _post_data(self):
+        from DataLoader.manipulations import SlabY
+        self.post_data(SlabY )   
+        
+        
Index: guiframe/local_perspectives/plotting/old_detector_dialog.py
===================================================================
--- guiframe/local_perspectives/plotting/old_detector_dialog.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
+++ guiframe/local_perspectives/plotting/old_detector_dialog.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -0,0 +1,207 @@
+#!/usr/bin/env python
+
+# version
+__id__ = "$Id: aboutdialog.py 1193 2007-05-03 17:29:59Z dmitriy $"
+__revision__ = "$Revision: 1193 $"
+
+import wx
+from sans.guiframe.utils import format_number
+from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent
+class DetectorDialog(wx.Dialog):
+    """
+        Dialog box to let the user edit detector settings
+    """
+    
+    def __init__(self,parent,id=1,base=None, *args, **kwds):
+
+        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
+        wx.Dialog.__init__(self,parent,id=1, *args, **kwds)
+        self.parent=base
+        self.label_xnpts = wx.StaticText(self, -1, "Detector width in pixels")
+        self.label_ynpts = wx.StaticText(self, -1, "Detector Height in pixels")
+        self.label_qmax = wx.StaticText(self, -1, "Q max")
+        self.label_zmin = wx.StaticText(self, -1, "Min amplitude for color map (optional)")
+        self.label_zmax = wx.StaticText(self, -1, "Max amplitude for color map (optional)")
+        self.label_beam = wx.StaticText(self, -1, "Beam stop radius in units of q")
+        #self.label_sym  = wx.StaticText(self, -1, 'Use 4-fold symmetry')
+        
+        # Npts, q max
+        #self.npts_ctl = wx.TextCtrl(self, -1, size=(60,20))
+        #self.qmax_ctl = wx.TextCtrl(self, -1, size=(60,20))
+        #self.beam_ctl = wx.TextCtrl(self, -1, size=(60,20))
+        self.xnpts_ctl = wx.StaticText(self, -1, "")
+        self.ynpts_ctl = wx.StaticText(self, -1, "")
+        self.qmax_ctl = wx.StaticText(self, -1, "")
+        self.beam_ctl = wx.StaticText(self, -1, "")
+        
+        self.zmin_ctl = wx.TextCtrl(self, -1, size=(60,20))
+        self.zmax_ctl = wx.TextCtrl(self, -1, size=(60,20))
+        #self.chk_sym  = wx.CheckBox(self, -1, '')
+
+        self.static_line_3 = wx.StaticLine(self, -1)
+        
+        
+        self.button_OK = wx.Button(self, wx.ID_OK, "OK")
+        self.button_Cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
+        self.Bind(wx.EVT_BUTTON, self.checkValues, self.button_OK)
+
+        self.__set_properties()
+        self.__do_layout()
+
+        self.Fit()
+        
+    class Event:
+        xnpts = 0
+        ynpts = 0
+        qpax = 0
+        beam = 0
+        zmin = 0
+        zmax = 0
+        sym4 = False
+        
+    def checkValues(self, event):
+        flag = True
+        try:
+            value=self.zmin_ctl.GetValue()
+            if value and float( value)==0.0:
+                flag = False
+                wx.PostEvent(self.parent, StatusEvent(status="Enter number greater than zero"))
+                self.zmin_ctl.SetBackgroundColour("pink")
+                self.zmin_ctl.Refresh()
+            else:
+                self.zmin_ctl.SetBackgroundColour(wx.WHITE)
+                self.zmin_ctl.Refresh()
+        except:
+            flag = False
+            wx.PostEvent(self.parent, StatusEvent(status="Enter float value"))
+            self.zmin_ctl.SetBackgroundColour("pink")
+            self.zmin_ctl.Refresh()
+        try:
+            value=self.zmax_ctl.GetValue()
+            if value and int(value)==0.0:
+                flag = False
+                wx.PostEvent(self.parent, StatusEvent(status="Enter number greater than zero"))
+                self.zmax_ctl.SetBackgroundColour("pink")
+                self.zmax_ctl.Refresh()
+            else:
+                self.zmax_ctl.SetBackgroundColour(wx.WHITE)
+                self.zmax_ctl.Refresh()
+        except:
+            flag = False
+            wx.PostEvent(self.parent, StatusEvent(status="Enter Integer value"))
+            self.zmax_ctl.SetBackgroundColour("pink")
+            self.zmax_ctl.Refresh()
+        
+        if flag:
+            event.Skip(True)
+    
+    def setContent(self, xnpts,ynpts, qmax, beam,zmin=None,zmax=None, sym=False):
+        self.xnpts_ctl.SetLabel(str(format_number(xnpts)))
+        self.ynpts_ctl.SetLabel(str(format_number(ynpts)))
+        self.qmax_ctl.SetLabel(str(format_number(qmax)))
+        self.beam_ctl.SetLabel(str(format_number(beam)))
+        #self.chk_sym.SetValue(sym)
+        if zmin !=None:
+            self.zmin_ctl.SetValue(str(format_number(zmin)))
+        if zmax !=None:
+            self.zmax_ctl.SetValue(str(format_number(zmax)))
+
+    def getContent(self):
+        event = self.Event()
+        #event.npts = int(self.npts_ctl.GetValue())
+        #event.qmax = float(self.qmax_ctl.GetValue())
+        #event.beam = float(self.beam_ctl.GetValue())
+        #event.sym4 = self.chk_sym.GetValue()
+        
+        t_min = self.zmin_ctl.GetValue()
+        t_max = self.zmax_ctl.GetValue()
+        v_min = None
+        v_max = None
+        
+        if len(t_min.lstrip())>0:
+            try:
+                v_min = float(t_min)
+            except:
+                v_min = None
+        
+        if len(t_max.lstrip())>0:
+            try:
+                v_max = float(t_max)
+            except:
+                v_max = None
+        
+        event.zmin = v_min
+        event.zmax = v_max
+        
+        return event
+
+    def __set_properties(self):
+        self.SetTitle("Detector parameters")
+        self.SetSize((600, 595))
+
+    def __do_layout(self):
+        sizer_main = wx.BoxSizer(wx.VERTICAL)
+        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_params = wx.GridBagSizer(5,5)
+
+        iy = 0
+        sizer_params.Add(self.label_xnpts, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(self.xnpts_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        sizer_params.Add(self.label_ynpts, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(self.ynpts_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        sizer_params.Add(self.label_qmax, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(self.qmax_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        sizer_params.Add(self.label_beam, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(self.beam_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        sizer_params.Add(self.label_zmin, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(self.zmin_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        sizer_params.Add(self.label_zmax, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(self.zmax_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy += 1
+        #sizer_params.Add(self.label_sym,  (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        #sizer_params.Add(self.chk_sym,    (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+
+        sizer_main.Add(sizer_params, 0, wx.EXPAND|wx.ALL, 10)
+        sizer_main.Add(self.static_line_3, 0, wx.EXPAND, 0)
+        
+        
+        sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer_button.Add(self.button_OK, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
+        sizer_button.Add(self.button_Cancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
+        
+        
+        sizer_main.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
+        self.SetAutoLayout(True)
+        self.SetSizer(sizer_main)
+        self.Layout()
+        self.Centre()
+        # end wxGlade
+
+
+# end of class DialogAbout
+
+##### testing code ############################################################
+class MyApp(wx.App):
+    def OnInit(self):
+        wx.InitAllImageHandlers()
+        dialog = DetectorDialog(None, -1, "")
+        self.SetTopWindow(dialog)
+        dialog.setContent(128, 0.05)
+        print dialog.ShowModal()
+        evt = dialog.getContent()
+        print evt.npts, evt.qmax
+        dialog.Destroy()
+        return 1
+
+# end of class MyApp
+
+if __name__ == "__main__":
+    app = MyApp(0)
+    app.MainLoop()
+    
+##### end of testing code #####################################################    
Index: guiframe/local_perspectives/plotting/plotting.py
===================================================================
--- guiframe/local_perspectives/plotting/plotting.py	(revision 50cbacefffa06e9b3fc1977ff378587f5f0b9b7a)
+++ guiframe/local_perspectives/plotting/plotting.py	(revision 6d920cd2a2b96abc4845a5766911d8ef7fe5adc5)
@@ -108,8 +108,7 @@
                         is_available = True
                         
-                        
                         panel._onEVT_1DREPLOT(event)
                         self.parent.show_panel(panel.uid)
-                        print "went here for replottiing", event.plot.name
+                        #print "went here for replottiing", event.plot.name
                         
                 else:
@@ -125,5 +124,5 @@
                 from Plotter1D import ModelPanel1D
                 if hasattr(event.plot,"xtransform"):
-                    print "went here"
+                    #print "went here"
                     xtransform = event.plot.xtransform
                 else:
