Index: guiframe/gui_manager.py
===================================================================
--- guiframe/gui_manager.py	(revision acb1ad19c181aa91944426be9f0f55ae00548501)
+++ guiframe/gui_manager.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -35,5 +35,5 @@
     import config
     
-from sans.guicomm.events import EVT_STATUS
+from sans.guicomm.events import EVT_STATUS,Model2DPanelEvent
 
 import warnings
@@ -227,5 +227,5 @@
         # Register to status events
         self.Bind(EVT_STATUS, self._on_status_event)
-             
+       
     def build_gui(self):
         # Set up the layout
@@ -419,5 +419,12 @@
             if self.panels[item].window_name.startswith(p.window_name): 
                 count += 1
-                
+                """
+        if p.window_name =="Analytical model 2D ":
+            print "guiframe 2D id",ID, p.window_name
+            event = Model2DPanelEvent(id= ID, pname=p.window_name)
+            for plug in self.plugins:
+                if hasattr(plug, fitpanel)
+                wx.PostEvent(plug, event)
+         """   
         windowname = p.window_name
         caption = p.window_caption
@@ -450,4 +457,5 @@
         
         # Register for showing/hiding the panel
+        
         wx.EVT_MENU(self, ID, self._on_view)
         
@@ -488,5 +496,5 @@
             if len(pers)>0:
                 n_panels += 1
-        
+       
         if n_panels>1:
             viewmenu = wx.Menu()
@@ -501,4 +509,7 @@
                         if panel.window_name in pers:
                             plugmenu.Append(int(item), panel.window_caption, "Show %s window" % panel.window_caption)
+                           
+                            
+                            
                             wx.EVT_MENU(self, int(item), self._on_view)
                     
@@ -551,5 +562,5 @@
                 for (self.next_id, menu, name) in item.populate_menu(self.next_id, self):
                     menubar.Append(menu, name)
-        
+                   
 
         menubar.Append(helpmenu, '&Help')
Index: guiframe/local_perspectives/plotting/AnnulusSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/AnnulusSlicer.py	(revision 7608cb5760073d833b8b83f05194ef28ea47223a)
+++ guiframe/local_perspectives/plotting/AnnulusSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -6,14 +6,11 @@
 #
 
- 
+import math
+import wx
+from copy import deepcopy 
 # Debug printout
-from sans.guicomm.events import StatusEvent 
-from sans.guicomm.events import NewPlotEvent
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
-
-import SlicerParameters
-import wx
+
 
 class AnnulusInteractor(_BaseInteractor):
@@ -57,5 +54,5 @@
         
         # Bind to slice parameter events
-        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
         
 
@@ -90,5 +87,5 @@
         self.inner_circle.clear()
         #self.base.connect.disconnect()
-        self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS)
+        self.base.parent.Unbind(EVT_SLICER_PARS)
         
     def update(self):
@@ -154,5 +151,5 @@
         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{\phi}", ' ^{o}')
+        new_plot.xaxis("\\rm{\phi}", 'rad')
         new_plot.yaxis("\\rm{Intensity} ","cm^{-1}")
         new_plot.group_id = "SectorPhi"+self.base.data2D.name
@@ -169,5 +166,5 @@
         
         # Post paramters
-        event = SlicerParameters.SlicerParameterEvent()
+        event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/Arc.py
===================================================================
--- guiframe/local_perspectives/plotting/Arc.py	(revision cd84dcae89f5f702b6ad8b4626aa2531188ccf0f)
+++ guiframe/local_perspectives/plotting/Arc.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -1,12 +1,11 @@
-#from config import printEVT
+
+import math
+import wx 
+from copy import deepcopy
+
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
-
-#from Plotter1D import AddPlotEvent
-import SlicerParameters
-import wx   
-#import radii 
-#(FunctionRadiusEvent, EVT_FUNC_RAD) = wx.lib.newevent.NewEvent()      
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+  
+ 
 class ArcInteractor(_BaseInteractor):
     """
@@ -114,5 +113,5 @@
         self.has_move= False
         
-        event = SlicerParameters.SlicerParameterEvent()
+        event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/AzimutSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/AzimutSlicer.py	(revision 54cc36ad4f87967b7af0579e5ddc0d69d0bf199d)
+++ guiframe/local_perspectives/plotting/AzimutSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -8,12 +8,12 @@
 
 # Debug printout
+import math
+import wx
+from copy import deepcopy
 
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
-
-from sans.guicomm.events import NewPlotEvent, StatusEvent
-import SlicerParameters
-import wx
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+
+
 
 class SectorInteractor(_BaseInteractor):
@@ -59,5 +59,5 @@
         self._post_data()
         # Bind to slice parameter events
-        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
 
 
@@ -96,5 +96,5 @@
         self.left_edge.clear()
         #self.base.connect.disconnect()
-        self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS)
+        self.base.parent.Unbind(EVT_SLICER_PARS)
         
     def update(self):
@@ -197,5 +197,5 @@
         
          # Post paramters
-        #event = SlicerParameters.SlicerParameterEvent()
+        #event = SlicerParameterEvent()
         #event.type = self.__class__.__name__
         #event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/BoxParameters.py
===================================================================
--- guiframe/local_perspectives/plotting/BoxParameters.py	(revision 92c2345cf1edfe8401d0b7ce54d43eec01e8ca56)
+++ 	(revision )
@@ -1,138 +1,0 @@
-"""
-    Panel class to show the slicer parameters 
-"""
-
-import wx
-import wx.lib.newevent
-from copy import deepcopy
-
-(SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent()
-(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent()
-
-
-def format_number(value, high=False):
-    """
-        Return a float in a standardized, human-readable formatted string 
-    """
-    try: 
-        value = float(value)
-    except:
-        return "NaN"
-    
-    if high:
-        return "%-6.4g" % value
-    else:
-        return "%-5.3g" % value
-
-class SlicerParameterPanel(wx.Dialog):
-    #TODO: show units
-    #TODO: order parameters properly
-    
-    def __init__(self, parent, *args, **kwargs):
-        wx.Dialog.__init__(self, parent, *args, **kwargs)
-        self.params = {}
-        self.parent = parent
-        self.type = None
-        self.listeners = []
-        self.parameters = []
-        self.bck = wx.GridBagSizer(5,5)
-        self.SetSizer(self.bck)
-               
-        title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
-        self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
-        
-        # Bindings
-        self.parent.Bind(EVT_SLICER, self.onEVT_SLICER)
-        self.parent.Bind(EVT_SLICER_PARS, self.onParamChange)
-
-    def onEVT_SLICER(self, event):
-        """
-            Process EVT_SLICER events
-            When the slicer changes, update the panel
-            
-            @param event: EVT_SLICER event
-        """
-        event.Skip()
-        if event.obj_class==None:
-            self.set_slicer(None, None)
-        else:
-            self.set_slicer(event.type, event.params)
-        
-    def set_slicer(self, type, params):
-        """
-            Rebuild the panel
-        """
-        self.bck.Clear(True)  
-        self.type = type  
-        
-        if type==None:
-            title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
-            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
-
-        else:
-            title = wx.StaticText(self, -1, "Slicer Parameters", style=wx.ALIGN_LEFT)
-            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)
-            ix = 0
-            iy = 0
-            self.parameters = []
-            #params = slicer.get_params()
-            keys = params.keys()
-            keys.sort()
-            
-            for item in keys:
-                iy += 1
-                ix = 0
-                text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT)
-                #self.bck.Add(text, (iy,ix), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)
-                self.bck.Add(text, (iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER)
-                
-                ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item)
-                
-                ix = 1
-                ctl.SetValue(format_number(str(params[item])))
-                self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter)
-                ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter)
-                self.parameters.append([item, ctl])
-                #self.bck.Add(ctl, (iy,ix), flag=wx.TOP|wx.BOTTOM, border = 0)
-                self.bck.Add(ctl, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                
-                ix =3
-                self.bck.Add((20,20), (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-            iy +=1
-            ix = 1
-            self.bck.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.bck.Layout()
-        self.bck.Fit(self)
-        self.parent.GetSizer().Layout()
-
-    def onParamChange(self, evt):
-        evt.Skip()
-        if evt.type == "UPDATE":
-            for item in self.parameters:              
-                if item[0] in evt.params:
-                    item[1].SetValue("%-5.3g" %evt.params[item[0]])
-                    item[1].Refresh()
-        
-    def onTextEnter(self, evt): 
-        """
-            Parameters have changed
-        """ 
-        params = {}
-        has_error = False
-        for item in self.parameters:
-            try:
-                params[item[0]] = float(item[1].GetValue())
-                item[1].SetBackgroundColour(
-                        wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
-                item[1].Refresh()
-            except:
-                has_error = True
-                item[1].SetBackgroundColour("pink")
-                item[1].Refresh()
-
-        if has_error==False:
-            # Post parameter event
-            event = SlicerParameterEvent(type=self.type, params=params)
-            wx.PostEvent(self.parent, event)
-        
Index: guiframe/local_perspectives/plotting/Edge.py
===================================================================
--- guiframe/local_perspectives/plotting/Edge.py	(revision e8c96f51ec0e9f1d2c4bedbb070fee80c770d464)
+++ guiframe/local_perspectives/plotting/Edge.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -1,12 +1,12 @@
-#from config import printEVT
+
+import math
+import wx  
+from copy import deepcopy
+
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+   
 
-#from Plotter1D import AddPlotEvent
-import SlicerParameters
-import wx     
 
-import wx.lib.newevent
        
 class RadiusInteractor(_BaseInteractor):
Index: guiframe/local_perspectives/plotting/LineSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/LineSlicer.py	(revision 54cc36ad4f87967b7af0579e5ddc0d69d0bf199d)
+++ guiframe/local_perspectives/plotting/LineSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -8,12 +8,12 @@
 
 # Debug printout
-from sans.guicomm.events import StatusEvent 
+import math
+import wx
+from copy import deepcopy
+
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
-
-from sans.guicomm.events import NewPlotEvent
-import SlicerParameters
-import wx
+
+
 
 class LineInteractor(_BaseInteractor):
@@ -68,5 +68,5 @@
         
         # Bind to slice parameter events
-        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
         
     def _onEVT_SLICER_PARS(self, event):
@@ -123,5 +123,5 @@
         # Unbind panel
         #self.base.connect.disconnect()
-        self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS)
+        self.base.parent.Unbind(EVT_SLICER_PARS)
 
         
@@ -241,5 +241,5 @@
         
         # Post paramters
-        event = SlicerParameters.SlicerParameterEvent()
+        event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/Plotter1D.py
===================================================================
--- guiframe/local_perspectives/plotting/Plotter1D.py	(revision ffd23b50a217b6b70d069bda563e2e42824e88f7)
+++ guiframe/local_perspectives/plotting/Plotter1D.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -12,32 +12,22 @@
 import wx
 import sys
+import pylab
+
 import danse.common.plottools
 from danse.common.plottools.PlotPanel import PlotPanel
 from danse.common.plottools.plottables import Graph,Data1D
 from sans.guicomm.events import EVT_NEW_PLOT
-from sans.guicomm.events import StatusEvent ,NewPlotEvent
-
-
-from SlicerParameters import SlicerEvent
+from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent
+from sans.guiframe.utils import PanelMenu
+
 from binder import BindArtist
-(InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent()
-#from SlicerParameters import SlicerEvent
-#(InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent()
+
+
 DEFAULT_QMAX = 0.05
-
 DEFAULT_QSTEP = 0.001
 DEFAULT_BEAM = 0.005
 BIN_WIDTH =1
-import pylab
-
-class PanelMenu(wx.Menu):
-    plots = None
-    graph = None
-    
-    def set_plots(self, plots):
-        self.plots = plots
-    
-    def set_graph(self, graph):
-        self.graph = graph
+
+
 class ModelPanel1D(PlotPanel):
     """
Index: guiframe/local_perspectives/plotting/Plotter2D.py
===================================================================
--- guiframe/local_perspectives/plotting/Plotter2D.py	(revision 50cbacefffa06e9b3fc1977ff378587f5f0b9b7a)
+++ guiframe/local_perspectives/plotting/Plotter2D.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -12,26 +12,27 @@
 import wx
 import sys
+import pylab
+
 import danse.common.plottools
 from danse.common.plottools.PlotPanel import PlotPanel
 from danse.common.plottools.plottables import Graph,Data1D
-from sans.guicomm.events import EVT_NEW_PLOT
-from sans.guicomm.events import StatusEvent ,NewPlotEvent
-
-
-from SlicerParameters import SlicerEvent
+from sans.guicomm.events import EVT_NEW_PLOT,EVT_SLICER_PARS_UPDATE
+from sans.guicomm.events import EVT_SLICER_PARS
+from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent
+from sans.guiframe.utils import PanelMenu
 from binder import BindArtist
+from Plotter1D import ModelPanel1D
 (InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent()
-#from SlicerParameters import SlicerEvent
-#(InternalEvent, EVT_INTERNAL)   = wx.lib.newevent.NewEvent()
-from Plotter1D import ModelPanel1D
+
+
+
 DEFAULT_QMAX = 0.05
-
 DEFAULT_QSTEP = 0.001
 DEFAULT_BEAM = 0.005
 BIN_WIDTH = 1.0
-import pylab
-from Plotter1D import PanelMenu
-#import boxSum
-from sans.guicomm.events import EVT_SLICER_PARS_UPDATE
+
+
+
+
 class ModelPanel2D( ModelPanel1D):
     """
@@ -86,11 +87,21 @@
         self.graph.render(self)
         #self.Bind(boxSum.EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PARS)
-        self.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PARS)
-  
+        self.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PANEL)
+        
+        
     def _onEVT_SLICER_PARS(self, event):
+        print "paramaters entered on slicer panel", event.type, event.params
+        self.slicer.set_params(event.params)
+        from sans.guicomm.events import SlicerPanelEvent
+        wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer))
+        
+        
+    def _onEVT_SLICER_PANEL(self, event):
         print "box move plotter2D", event.type, event.params
         self.panel_slicer.set_slicer(event.type, event.params)
         from sans.guicomm.events import SlicerPanelEvent
-        wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer))
+        wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer)) 
+        
     def _onEVT_1DREPLOT(self, event):
         """
@@ -406,5 +417,5 @@
         
         from slicerpanel import SlicerPanel
-        new_panel = SlicerPanel(parent= self.parent,id= -1,type=event.type,
+        new_panel = SlicerPanel(parent= self.parent,id= -1,base= self,type=event.type,
                                  params=event.params, style=wx.RAISED_BORDER)
         #new_panel.set_slicer(self.slicer.__class__.__name__,
@@ -422,5 +433,5 @@
         self.onClearSlicer(event)
         wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractorX))
-        
+        """
         from slicerpanel import SlicerPanel
         new_panel = SlicerPanel(self.parent, -1, style=wx.RAISED_BORDER)
@@ -428,10 +439,10 @@
         from sans.guicomm.events import SlicerPanelEvent
         wx.PostEvent(self.parent, SlicerPanelEvent (panel= new_panel))
-        
+        """
     def onBoxavgY(self,event):
         from boxSlicer import BoxInteractorY
         self.onClearSlicer(event)
         wx.PostEvent(self.parent, InternalEvent(slicer= BoxInteractorY))
-        
+        """
         from slicerpanel import SlicerPanel
         new_panel = SlicerPanel(self.parent, -1, style=wx.RAISED_BORDER)
@@ -439,5 +450,5 @@
         from sans.guicomm.events import SlicerParameterEvent 
         wx.PostEvent(self.parent, SlicerParameterEvent (panel= new_panel))
-         
+        """
     def onClearSlicer(self, event):
         """
Index: guiframe/local_perspectives/plotting/SectorSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/SectorSlicer.py	(revision 54cc36ad4f87967b7af0579e5ddc0d69d0bf199d)
+++ guiframe/local_perspectives/plotting/SectorSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -8,13 +8,15 @@
 
 # Debug printout
-from sans.guicomm.events import StatusEvent 
-from sans.guicomm.events import NewPlotEvent
+import math
+import wx
+from copy import deepcopy
+
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
-
-
-import SlicerParameters
-import wx
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+
+
+
+
+
 
 class SectorInteractor(_BaseInteractor):
@@ -61,5 +63,5 @@
         
         # Bind to slice parameter events
-        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
 
 
@@ -95,5 +97,5 @@
         self.right_line.clear()
         #self.base.connect.disconnect()
-        self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS)
+        self.base.parent.Unbind(EVT_SLICER_PARS)
         
     def update(self):
@@ -194,5 +196,5 @@
         
         # Post paramters
-        event = SlicerParameters.SlicerParameterEvent()
+        event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/SlicerParameters.py
===================================================================
--- guiframe/local_perspectives/plotting/SlicerParameters.py	(revision 54cc36ad4f87967b7af0579e5ddc0d69d0bf199d)
+++ guiframe/local_perspectives/plotting/SlicerParameters.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -7,21 +7,9 @@
 from copy import deepcopy
 
-(SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent()
-(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent()
+from sans.guiframe.utils import format_number
+from sans.guicomm.events import EVT_SLICER,EVT_SLICER_PARS,SlicerParameterEvent
 
 
-def format_number(value, high=False):
-    """
-        Return a float in a standardized, human-readable formatted string 
-    """
-    try: 
-        value = float(value)
-    except:
-        return "NaN"
-    
-    if high:
-        return "%-6.4g" % value
-    else:
-        return "%-5.3g" % value
+
 
 class SlicerParameterPanel(wx.Dialog):
Index: guiframe/local_perspectives/plotting/boxSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/boxSlicer.py	(revision ffd23b50a217b6b70d069bda563e2e42824e88f7)
+++ guiframe/local_perspectives/plotting/boxSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -13,5 +13,5 @@
 import math
 
-from sans.guicomm.events import NewPlotEvent, StatusEvent
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
 import SlicerParameters
 import wx
@@ -75,5 +75,5 @@
         
         # Bind to slice parameter events
-        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
 
 
@@ -111,5 +111,5 @@
         self.bottom_line.clear()
         #self.base.connect.disconnect()
-        self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS)
+        self.base.parent.Unbind(EVT_SLICER_PARS)
         
     def update(self):
@@ -245,5 +245,5 @@
         
         # Post paramters
-        event = SlicerParameters.SlicerParameterEvent()
+        event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/old_ boxSum.py
===================================================================
--- guiframe/local_perspectives/plotting/old_ boxSum.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
+++ guiframe/local_perspectives/plotting/old_ boxSum.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -0,0 +1,510 @@
+#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
+import math
+import wx
+from copy import deepcopy
+
+from BaseInteractor import _BaseInteractor
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+class BoxSum(_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.xmin= -1* x_min
+        self.ymin= -1* y_min
+        self.xmax= x_max
+        self.ymax=  y_max
+        # center of the figure
+        self.center_x= 0.0
+        self.center_y= 0.0
+       
+        ## Number of points on the plot
+        self.nbins = 20
+        self.count=0
+        self.error=0
+        
+        self.left_line = VerticalLine(self, self.base.subplot,color='blue', zorder=zorder, 
+                                        ymin= self.ymin, ymax= self.ymax,
+                                        x= self.xmin,
+                                        center_x= self.center_x,
+                                        center_y= self.center_y)
+        self.left_line.qmax = self.qmax
+        
+        self.right_line= VerticalLine(self, self.base.subplot,color='black', zorder=zorder,
+                                     ymin= self.ymin, ymax= self.ymax,
+                                     x=self.xmax,
+                                     center_x= self.center_x,
+                                     center_y= self.center_y)
+        self.right_line.qmax = self.qmax
+        
+        self.top_line= HorizontalLine(self, self.base.subplot,color='green', zorder=zorder,
+                                    y= self.ymax,
+                                    xmin= self.xmin, xmax= self.xmax,
+                                    center_x= self.center_x,
+                                    center_y= self.center_y)
+        self.top_line.qmax = self.qmax
+        
+        self.bottom_line= HorizontalLine(self, self.base.subplot,color='red', zorder=zorder,
+                                    y =self.ymin,
+                                    xmin= self.xmin, xmax= self.xmax,
+                                    center_x= self.center_x,
+                                    center_y= self.center_y)
+        self.bottom_line.qmax = self.qmax
+        #self.outer_circle.set_cursor(self.base.qmax/1.8, 0)
+        
+        self.connect_markers([])
+                      
+        self.update()
+        self._post_data()
+        
+        # Bind to slice parameter events
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+
+
+    def _onEVT_SLICER_PARS(self, event):
+        #printEVT("AnnulusSlicer._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.clear_markers()
+        self.left_line.clear()
+        self.right_line.clear()
+        self.top_line.clear()
+        self.bottom_line.clear()
+        
+        #self.base.connect.disconnect()
+        self.base.parent.Unbind(EVT_SLICER_PARS)
+        
+    def update(self):
+        """
+        Respond to changes in the model by recalculating the profiles and
+        resetting the widgets.
+        """
+        if self.left_line.has_move:
+            print "left has moved"
+            self.left_line.update(mline=[self.center_x, self.center_y],translation=True)
+            
+            #self.right_line.update(mline= [self.center_x, self.center_y],translation=True)
+            self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x,
+                                  mline= [self.center_x, self.center_y],translation=True)
+            self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x,
+                                    mline= [self.center_x, self.center_y],translation=True)
+        if self.right_line.has_move:
+            print "right has moved"
+            self.right_line.update(mline= [self.center_x, self.center_y],translation=True)
+            #self.left_line.update(mline=[self.center_x, self.center_y],translation=True)
+            #self.left_line.update(xmin= self.right_line.x ,xmax=-1*self.right_line.x)
+            self.top_line.update( xmin= self.left_line.x ,xmax= self.right_line.x,
+                                  mline= [self.center_x, self.center_y],translation=True)
+            self.bottom_line.update(xmin= self.left_line.x ,xmax= self.right_line.x,
+                                    mline= [self.center_x, self.center_y],translation=True)
+            
+            
+        if self.bottom_line.has_move:
+            print "bottom has moved"
+            self.bottom_line.update(mline= [self.center_x, self.center_y],translation=True)
+            #self.top_line.update(y= -1*self.top_line.y,translation=True)
+            self.left_line.update( ymin= self.bottom_line.y ,ymax= self.top_line.y,
+                                   mline= [self.center_x, self.center_y],translation=True)
+            self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y,
+                                   mline= [self.center_x, self.center_y],translation=True)
+            
+        if self.top_line.has_move:
+            print "top has moved"
+            self.top_line.update(mline= [self.center_x, self.center_y],translation=True)
+            
+            #self.bottom_line.update(y= -1*self.top_line.y,mline= [self.center_x, self.center_y],
+            #                        translation=True )
+            self.left_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y,
+                                  mline= [self.center_x, self.center_y],translation=True)
+            self.right_line.update(ymin= self.bottom_line.y ,ymax= self.top_line.y,
+                                   mline= [self.center_x, self.center_y],translation=True)
+            
+    
+    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.inner_circle.save(ev)
+        self.outer_circle.save(ev)
+
+    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))
+        x_min= self.left_line.x 
+        x_max= self.right_line.x 
+        y_min= self.bottom_line.y
+        y_max= self.top_line.y
+        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 "count, error",self.count, self.error
+        
+                                       
+    def moveend(self, ev):
+        self.base.thaw_axes()
+        
+        # Post paramters
+        event = SlicerParameterEvent()
+        event.type = self.__class__.__name__
+        print "event type boxsum: ", event.type
+        event.params = self.get_params()
+        
+        wx.PostEvent(self.base.parent, event)
+
+        self._post_data()
+            
+    def restore(self):
+        """
+        Restore the roughness for this layer.
+        """
+        self.inner_circle.restore()
+        self.outer_circle.restore()
+
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        print "in move"
+        if self.xmin <= x and x <= self.xmax:
+            print "has move whole", x
+        
+    def set_cursor(self, x, y):
+        pass
+        
+    def get_params(self):
+        params = {}
+        params["x_min"] = self.left_line.x 
+        params["x_max"] = self.right_line.x 
+        params["y_min"] = self.bottom_line.y
+        params["y_max"] = self.top_line.y
+        params["count"] = self.count
+        params["errors"]= self.error
+        return params
+    
+    
+    def get_result(self):
+        """
+            return the result of box summation
+        """
+        result={}
+        result["count"] = self.count
+        result["error"] = self.error
+        return result
+        
+        
+    def set_params(self, params):
+        
+        x_min = -math.fabs(params["x_min"] )
+        x_max = math.fabs(params["x_max"] )
+        y_min = -math.fabs(params["y_min"])
+        y_max = math.fabs(params["y_max"]) 
+        
+        self.left_line.update(ymin= y_min ,ymax= y_max , x= x_min)
+        self.right_line.update(ymin= y_min ,ymax= y_max, x= x_max)
+        self.top_line.update( xmin= x_min ,xmax= x_max, y= y_max)
+        self.bottom_line.update(xmin= x_min ,xmax= x_max, y=y_min)
+        """
+        self.left_line.update(mline= [center_x, center_y],ymin= y_min ,ymax= y_max)
+        self.right_line.update(mline= [center_x, center_y],ymin= y_min ,ymax= y_max)
+        self.top_line.update(mline= [center_x, center_y], xmin= x_min ,xmax= xmax)
+        self.bottom_line.update(mline= [center_x, center_y],xmin= xmin ,xmax= xmax)
+        """
+        
+        self._post_data()
+    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, y=0.5,
+                 xmin=0.0,xmax=0.5,
+                 center_x= 0.0,
+                 center_y= 0.0):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        # center
+        self.center_x = center_x
+        self.center_y = center_y
+        
+        self.y= y - self.center_y
+        self.save_y= y- self.center_y
+        
+        self.xmin = xmin - self.center_x
+        self.save_xmin = xmin - self.center_x
+        self.xmax = xmax - self.center_x
+        self.save_xmax = xmax - self.center_x
+        
+       
+        self.line = self.axes.plot([self.xmin,self.xmax],[self.y,self.y],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+ 
+
+        self.npts = 20
+        self.has_move=False
+        self.connect_markers([self.line])
+        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,y=None, mline=None,translation=False):
+        """
+        Draw the new roughness on the graph.
+        """
+        #print "update main line", self.has_move
+        if xmin !=None:
+            self.xmin = xmin # - self.center_x
+        if xmax !=None:
+            self.xmax = xmax #- self.center_x
+        if y !=None:
+            self.y = y #- self.center_y
+        
+        self.line.set(xdata=[self.xmin,self.xmax], ydata=[self.y,self.y])
+     
+        
+        
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.save_xmin= self.xmin
+        self.save_xmax= self.xmax
+       
+        self.save_y= self.y
+        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.y= self.save_y
+       
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        self.y= y - self.center_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.xmin
+        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, ymin=0.0, 
+                 ymax=0.5,x= 0.5,
+                   center_x= 0,
+                 center_y= 0):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        # x coordinate of the vertical line
+        self.center_x= center_x
+        self.center_y= center_y
+        self.x = x - center_x
+        self.save_x = x - center_x
+        # minimum value of y coordinate of the vertical line 
+        self.ymin = ymin - center_y
+        self.save_ymin = ymin - center_y
+        # maximum value of y coordinate of the vertical line 
+        self.ymax= ymax - center_y
+        self.save_ymax= ymax - center_y
+        
+        # Draw vertical line
+        self.line = self.axes.plot([self.x,self.x],[self.ymin,self.ymax],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+      
+        self.npts = 20
+        # Check vertical line motion
+        self.has_move=False
+        self.connect_markers([self.line])
+        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,x=None,ymin=None, ymax=None, mline=None,translation=False):
+        """
+        Draw the new roughness on the graph.
+        """
+        if x!=None:
+            self.x = x #-self.center_x
+        if ymin !=None:
+            self.ymin = ymin #- self.center_y
+        if ymax !=None:
+            self.ymax = ymax #- self.center_y
+        
+        self.line.set(xdata=[self.x,self.x], ydata=[self.ymin,self.ymax])
+     
+        
+        
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.save_x= self.x
+        self.save_ymin= self.ymin
+        self.save_ymax= self.ymax
+        
+        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.x = self.save_x
+        
+        self.ymin=self.save_ymin
+        self.ymax=self.save_ymax
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        self.x = x - self.center_x
+       
+        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["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)
+        
+
+         
Index: guiframe/local_perspectives/plotting/old_boxSlicer.py
===================================================================
--- guiframe/local_perspectives/plotting/old_boxSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
+++ guiframe/local_perspectives/plotting/old_boxSlicer.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -0,0 +1,876 @@
+#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
+import math
+import wx
+from copy import deepcopy
+
+from BaseInteractor import _BaseInteractor
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
+
+
+def find_intersection(a1= 2, a2= -0.5,b1= 1,b2= 1 ):
+    """ @ return x, y  coordinates of an intersection between 2 lines
+        @param a1: the slope of the first line
+        @param a2 : the slope of the 2nd line
+        @param b1 : line intercept of the 1 st line
+        @param b2 : line intercept of the 2 nd ligne
+        @note 1st line equation  is y= a1*x +b1 ; 2nd line equation  is y= a2*x +b2 
+    """
+    x= ( b2- b1) /(a1- a2)
+    y= ( -a2*b1 + a1*b2 )/(a1 -a2)
+    return x, y
+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.qmax
+        self.connect = self.base.connect
+        self.xmin= -1* x_min
+        self.ymin= -1* y_min
+        
+        self.xmax= x_max
+        self.ymax=  y_max
+        
+        self.theta2= math.pi/3
+        ## Number of points on the plot
+        self.nbins = 20
+        self.count=0
+        self.error=0
+        self.main_line = LineInteractor(self, self.base.subplot,color='orange',
+                                         zorder=zorder, ymin=y_min ,ymax=y_max,
+                                           theta= self.theta2)
+        self.main_line.qmax = self.base.qmax
+        self.left_line = VerticalLine(self, self.base.subplot,color='blue', 
+                                      zorder=zorder,
+                                      mline= self.main_line, 
+                                        ymin= self.ymin , 
+                                        ymax= self.ymax ,
+                                        xmin=self.xmin,
+                                        xmax=self.xmin,
+                                        theta2= self.theta2)
+        self.left_line.qmax = self.base.qmax
+        
+        self.right_line= VerticalLine(self, self.base.subplot,color='black', 
+                                      zorder=zorder,
+                                      mline= self.main_line, 
+                                     ymin= self.ymin , 
+                                     ymax= self.ymax,
+                                    xmin= self.xmax,
+                                    xmax= self.xmax,
+                                    theta2= self.theta2)
+        self.right_line.qmax = self.base.qmax
+        
+        self.top_line= HorizontalLine(self, self.base.subplot,color='green', 
+                                      zorder=zorder,
+                                      mline= self.main_line,
+                                      xmin=self.right_line.x1,
+                                      xmax=self.left_line.x1,
+                                      ymin=self.right_line.y1,
+                                      ymax=self.left_line.y1)
+        self.top_line.qmax= self.base.qmax
+        
+        self.bottom_line= HorizontalLine(self, self.base.subplot,color='gray', 
+                                      zorder=zorder,
+                                      mline= self.main_line,
+                                      xmin=self.right_line.x2,
+                                      xmax=self.left_line.x2,
+                                      ymin=self.right_line.y2,
+                                      ymax=self.left_line.y2)
+        self.bottom_line.qmax= self.base.qmax
+        
+        self.update()
+        #self._post_data()
+        
+        # Bind to slice parameter events
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+
+
+    def _onEVT_SLICER_PARS(self, event):
+        #printEVT("AnnulusSlicer._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.clear_markers()
+       
+       
+        self.main_line.clear()
+        #self.base.connect.disconnect()
+        self.base.parent.Unbind(EVT_SLICER_PARS)
+        
+    def update(self):
+        """
+        Respond to changes in the model by recalculating the profiles and
+        resetting the widgets.
+        """
+        
+        if self.main_line.has_move:
+            
+            self.main_line.update()
+            self.left_line.update(
+                                  xmin= self.xmin,
+                                  xmax= self.xmin,
+                                  ymin= self.ymin,
+                                  ymax=self.ymax
+                                  )
+            self.right_line.update(
+                                   xmin= self.xmax,
+                                  xmax= self.xmax,
+                                  ymin= self.ymin,
+                                  ymax=self.ymax)
+            self.top_line.update(xmin= self.right_line.x1,
+                                 xmax= self.left_line.x1,
+                                 ymin= self.right_line.y1,
+                                 ymax= self.left_line.y1)
+            self.bottom_line.update(xmin= self.right_line.x2,
+                                 xmax= self.left_line.x2,
+                                 ymin= self.right_line.y2,
+                                 ymax= self.left_line.y2)
+        if self.top_line.has_move:
+            print "top has moved",self.left_line.slope, self.top_line.slope
+            x2, y2= find_intersection(a1= self.left_line.slope,
+                                     a2= self.top_line.slope,
+                                     b1= self.left_line.b,
+                                     b2= self.top_line.b )
+            print "x, y max: ",x2,y2
+            x1, y1= find_intersection(a1= self.right_line.slope,
+                                     a2= self.top_line.slope,
+                                     b1= self.right_line.b,
+                                     b2= self.top_line.b )
+            print "x, y min: ",x1 ,y1
+            self.top_line.update(xmin= x2,
+                                 ymin= y2,
+                                 xmax= x1,
+                                 ymax= y1)
+            
+            self.bottom_line.update(xmin= -x2,
+                                    ymin= -y2,
+                                    xmax= -x1,
+                                    ymax= -y1)
+            self.left_line.update(xmin= -x1,
+                                  ymin= -y1,
+                                  xmax= x2,
+                                  ymax= y2,
+                                  translation= True)
+            self.right_line.update(
+                                   xmin= -x2,
+                                   ymin= -y2,
+                                   xmax= x1,
+                                   ymax= y1,
+                                  translation= True)
+            print "top has moved",self.left_line.slope, self.top_line.slope
+            x2, y2= find_intersection(a1= self.main_line.slope,
+                                     a2= self.top_line.slope,
+                                     b1= self.main_line.b,
+                                     b2= self.top_line.b )
+            print "main x, y max: ",x2,y2
+            x1, y1= find_intersection(a1= self.main_line.slope,
+                                     a2= self.bottom_line.slope,
+                                     b1= self.main_line.b,
+                                     b2= self.bottom_line.b )
+            print "main x, y min: ",x1,y1
+            self.main_line.update(x1= -x2,
+                                  y1= -y2,
+                                  x2= x2,
+                                  y2= y2,
+                                  translation= True)
+        if self.bottom_line.has_move:
+            
+            print "bottom has moved",self.left_line.slope, self.bottom_line.slope
+            x2, y2= find_intersection(a1= self.left_line.slope,
+                                     a2= self.bottom_line.slope,
+                                     b1= self.left_line.b,
+                                     b2= self.bottom_line.b )
+            print "x, y max: ",x2,y2
+            x1, y1= find_intersection(a1= self.right_line.slope,
+                                     a2= self.bottom_line.slope,
+                                     b1= self.right_line.b,
+                                     b2= self.bottom_line.b )
+            print "x, y min: ",x1 ,y1
+            self.bottom_line.update(xmin= x2,
+                                 ymin= y2,
+                                 xmax= x1,
+                                 ymax= y1)
+            
+            self.top_line.update(xmin= -x2,
+                                    ymin= -y2,
+                                    xmax= -x1,
+                                    ymax= -y1)
+            self.left_line.update(xmin= -x1,
+                                  ymin= -y1,
+                                  xmax= x2,
+                                  ymax= y2,
+                                  translation= True)
+            self.right_line.update(
+                                   xmin= -x2,
+                                   ymin= -y2,
+                                   xmax= x1,
+                                   ymax= y1,
+                                  translation= True)
+            print "bottom has moved",self.left_line.slope, self.bottom_line.slope
+            x2, y2= find_intersection(a1= self.main_line.slope,
+                                     a2= self.bottom_line.slope,
+                                     b1= self.main_line.b,
+                                     b2= self.bottom_line.b )
+            print "main x, y max: ",x2,y2
+            x1, y1= find_intersection(a1= self.main_line.slope,
+                                     a2= self.top_line.slope,
+                                     b1= self.main_line.b,
+                                     b2= self.top_line.b )
+            print "main x, y min: ",x1,y1
+            self.main_line.update(x1= -x2,
+                                  y1= -y2,
+                                  x2= x2,
+                                  y2= y2,
+                                  translation= True)
+        if self.left_line.has_move:
+            print "left_line has moved",self.left_line.slope, self.top_line.slope
+            x2, y2= find_intersection(a1= self.left_line.slope,
+                                     a2= self.top_line.slope,
+                                     b1= self.left_line.b,
+                                     b2= self.top_line.b )
+            print "main x, y max: ",x2,y2
+            x1, y1= find_intersection(a1= self.left_line.slope,
+                                     a2= self.bottom_line.slope,
+                                     b1= self.left_line.b,
+                                     b2= self.bottom_line.b )
+            self.left_line.update(xmin = x1,
+                                   xmax = x2,
+                                    ymin= y1, 
+                                    ymax= y2,
+                                   translation=True)
+            
+            self.right_line.update(xmin = -x1,
+                                   xmax = -x2,
+                                    ymin= -y1, 
+                                    ymax= -y2,
+                                   translation=True)
+            
+            self.bottom_line.update(xmin= x1,
+                                 ymin= y1,
+                                 xmax= -x2,
+                                 ymax= -y2)
+            
+            self.top_line.update(xmin= x2,
+                                    ymin= y2,
+                                    xmax= -x1,
+                                    ymax= -y1)
+            print "initial xmin", self.xmin
+            self.xmin= math.sqrt(math.pow((self.main_line.x2 - self.left_line.x2),2)\
+                                 +math.pow((self.main_line.y2 - self.left_line.y2),2))
+                                 
+            print "new xmin ", self.xmin, self.main_line.x2 , self.left_line.x2
+        if self.right_line.has_move:
+            print "right_line has moved",self.right_line.slope, self.top_line.slope
+            x2, y2= find_intersection(a1= self.right_line.slope,
+                                     a2= self.top_line.slope,
+                                     b1= self.right_line.b,
+                                     b2= self.top_line.b )
+            print "main x, y max: ",x2,y2
+            x1, y1= find_intersection(a1= self.right_line.slope,
+                                     a2= self.bottom_line.slope,
+                                     b1= self.right_line.b,
+                                     b2= self.bottom_line.b )
+            self.right_line.update(xmin = x1,
+                                   xmax = x2,
+                                    ymin= y1, 
+                                    ymax= y2,
+                                   translation=True)
+            
+            self.left_line.update(xmin = -x1,
+                                   xmax = -x2,
+                                    ymin= -y1, 
+                                    ymax= -y2,
+                                   translation=True)
+            
+            self.bottom_line.update(xmin= x1,
+                                 ymin= y1,
+                                 xmax= -x2,
+                                 ymax= -y2)
+            
+            self.top_line.update(xmin= x2,
+                                    ymin= y2,
+                                    xmax= -x1,
+                                    ymax= -y1)
+               
+            print "initial xmax", self.xmax
+            self.xmax= math.sqrt(math.pow((self.main_line.x2 - self.right_line.x2),2)\
+                                 +math.pow((self.main_line.y2 - self.right_line.y2),2))
+            print "new xmax",self.xmax
+    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.inner_circle.save(ev)
+        self.outer_circle.save(ev)
+
+    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))
+        #x_min= self.left_line.xmin 
+        #x_max= self.right_line.xmax 
+        #y_min= self.bottom_line.y
+        #y_max= self.top_line.y
+        #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 "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.inner_circle.restore()
+        self.outer_circle.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["x1"]= self.xmax
+        params["y1"]= self.ymin
+        params["x2"]= self.xmin
+        params["y2"]= self.ymax
+        params["phi"] = self.main_line.theta
+        return params
+    
+    def set_params(self, params):
+        self.xmax = params["x1"]
+        self.ymin = params["y1"] 
+        self.xmin = params["x2"]
+        self.ymax = params["y2"]
+        theta = params["theta"]
+        print "theta setparams",theta
+        self.main_line.update(radius1= math.fabs(self.ymax), radius2= math.fabs(self.ymin), theta= theta)
+        self.left_line.update(xmin= -1*self.xmin)
+        self.right_line.update(xmin= self.xmax)
+        
+        self.top_line.update(xmin= self.right_line.x1,
+                                 xmax= self.left_line.x1,
+                                 ymin= self.right_line.y1,
+                                 ymax= self.left_line.y1)
+        self.bottom_line.update(xmin= self.right_line.x2,
+                                 xmax= self.left_line.x2,
+                                 ymin= self.right_line.y2,
+                                 ymax= self.left_line.y2)
+        self._post_data()
+    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,
+                 theta2= math.pi/3 ):
+        
+        _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
+        self.line = self.axes.plot([self.x1,self.x2],
+                                   [self.y1,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+        
+        self.slope= -1/math.tan(self.mline.theta)
+        self.b= self.y1- self.slope* self.x1
+        self.save_b= self.b
+        print "slope from point",(self.y2- self.y1)/(self.x2- self.x1)
+        print "my slope horizontal", self.slope
+        print "b from point ", self.y2- self.slope*self.x2, self.b
+        self.npts = 20
+        self.has_move=False
+        self.connect_markers([self.line])
+        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.
+        """
+        self.slope= -1/math.tan(self.mline.theta)
+        if xmin !=None:
+            self.x2 = xmin
+        if xmax !=None:
+            self.x1 = xmax
+        if ymin !=None:
+            self.y2 = ymin
+        if ymax != None:
+            self.y1 = ymax
+        self.b= self.y1- self.slope * self.x1
+        self.line.set(xdata=[self.x1,self.x2],
+                       ydata=[self.y1,self.y2])
+    
+        
+        
+    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.save_b= self.b
+        
+        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
+        self.b = self.save_b
+
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        print "horizontal move x y ", x, y
+        self.b =  y - (-1/self.mline.slope) *x
+        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,
+                 theta2= math.pi/3 ):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        
+        self.theta2 = mline.theta
+        self.mline =mline
+        self.xmin= xmin
+        self.x1= mline.x1 + xmin*math.cos(math.pi/2 - self.theta2)
+        self.x2= mline.x2 + xmin*math.cos(math.pi/2 - self.theta2)
+        self.y1= mline.y1 - xmin*math.sin(math.pi/2 - self.theta2)
+        self.y2= mline.y2 - xmin*math.sin(math.pi/2 - self.theta2)
+        self.line = self.axes.plot([self.x1,self.x2],[self.y1,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+      
+        
+        self.slope= math.tan(self.mline.theta)
+        print "vertical line intercetp ",self.y2- self.slope*self.x2, self.y1- self.slope* self.x1 
+       
+        self.b = self.y1- self.slope* self.x1 
+        self.has_move=False
+        self.connect_markers([self.line])
+        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.
+        """
+        
+        self.slope= math.tan(self.mline.theta)
+        if translation:
+            if xmin!=None:
+                self.x2=xmin
+                self.xmin= xmin
+            if xmax!=None:
+                self.x1=xmax
+            if ymin!=None:
+                self.y2=ymin
+            if ymax!=None:
+                self.y1=ymax
+            self.line.set(xdata=[self.x1,self.x2],
+                           ydata=[self.y1,self.y2]) 
+            self.b= self.y1- self.slope * self.x1
+            return 
+        
+        self.x1= self.mline.x1 + self.xmin*math.cos(math.pi/2 - self.mline.theta)
+        self.x2= self.mline.x2 + self.xmin*math.cos(math.pi/2 - self.mline.theta)
+        self.y1= self.mline.y1 - self.xmin*math.sin(math.pi/2 - self.mline.theta)
+        self.y2= self.mline.y2 - self.xmin*math.sin(math.pi/2 - self.mline.theta)
+        self.line.set(xdata=[self.x1,self.x2],
+                           ydata=[self.y1,self.y2]) 
+        print "update slope ", (self.y2-self.y1)/(self.x2- self.x1)
+        #print "main slope", math.tan(self.mline.theta)
+        
+    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.b=y - self.mline.slope * 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 LineInteractor(_BaseInteractor):
+    """
+         Select an annulus through a 2D plot
+    """
+    def __init__(self,base,axes,color='black', zorder=5, ymin=1.0,ymax=1.0,theta=math.pi/4):
+        
+        _BaseInteractor.__init__(self, base, axes, color=color)
+        self.markers = []
+        self.axes = axes
+        
+        self.save_theta = theta 
+        self.theta= theta
+        
+        self.radius1 = math.fabs(ymax)
+        self.radius2 = math.fabs(ymin)
+        self.scale = 10.0
+           
+        # Inner circle
+        self.x1= self.radius1*math.cos(self.theta)
+        self.y1= self.radius1*math.sin(self.theta)
+        self.x2= -1*self.radius2*math.cos(self.theta)
+        self.y2= -1*self.radius2*math.sin(self.theta)
+       
+        self.line = self.axes.plot([self.x1,self.x2],[self.y1,self.y2],
+                                      linestyle='-', marker='',
+                                      color=self.color,
+                                      visible=True)[0]
+        self.slope= math.tan(self.theta)
+        self.b= math.fabs(self.y1- self.slope * self.x1)
+        print "intercept main",math.fabs(self.y2- self.slope * self.x2),math.fabs(self.y1- self.slope * self.x1)
+        self.npts = 20
+        self.has_move=False
+        self.connect_markers([self.line])
+        self.update()
+
+    def set_layer(self, n):
+        
+        self.layernum = n
+        self.update()
+        
+    def clear(self):
+        """
+            Remove the line of the plot
+        """
+        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_delta_angle(self):
+        """
+            return difference between initial angle and the final angle during
+            rotation
+        """
+        return self.theta - self.save_theta
+        
+    def update(self,x1=None,
+               y1=None,
+               x2=None,
+               y2=None,
+               translation=False,
+               xmin=None,vline=None, theta=None,radius1=None,radius2=None):
+        """
+            Draw a line given and angle relative to the x-axis and a radius
+            @param  theta: the angle realtive to the x-axis
+            @param radius: the distance between the center and one end of the line
+        """
+        if translation:
+            if x1 !=None:
+                self.x1= x1
+            if x2 !=None:
+                self.x2= x2
+            if y1 !=None:
+                self.y1= y1
+            if y2 !=None:
+                self.y2= y2
+        
+            self.line.set(xdata=[self.x1,self.x2], ydata=[self.y1,self.y2])
+            self.radius1= math.fabs(self.x1/math.cos(self.theta))
+            self.radius2= math.fabs(self.x2/math.cos(self.theta))
+            print "radius 1, radius2", self.radius1, self.radius2
+            return     
+      
+        if theta !=None:
+            self.theta= theta
+        if radius1 !=None:
+            self.radius1 =radius1
+        if radius2 !=None:
+            self.radius2 =radius2
+        #print "update main line", math.degrees(self.theta),self.radius1, self.radius2
+        #print "smain radius 1 2", self.radius1, self.radius2
+        self.x1= self.radius1*math.cos(self.theta)
+        self.y1= self.radius1*math.sin(self.theta)
+        self.x2= -1*self.radius2*math.cos(self.theta)
+        self.y2= -1*self.radius2*math.sin(self.theta)
+        print "init mainline sintercept ", self.y1 - math.tan(self.theta)*self.x1,\
+         self.y2 - math.tan(self.theta)*self.x2
+        #print "main line slope ", (self.y2- self.y1)/(self.x2- self.x1)
+        #print "theta", math.tan(self.theta)
+        self.line.set(xdata=[self.x1,self.x2], ydata=[self.y1,self.y2])  
+     
+        
+        
+    def save(self, ev):
+        """
+        Remember the roughness for this layer and the next so that we
+        can restore on Esc.
+        """
+        self.save_theta= self.theta
+        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.theta = self.save_theta
+
+    def move(self, x, y, ev):
+        """
+        Process move to a new position, making sure that the move is allowed.
+        """
+        self.theta= math.atan2(y,x)
+        self.slope= math.tan(self.theta)
+        self.b=  y - self.slope *x
+        
+        print "main move slope , theta, b", self.slope, self.theta, self.b
+        
+        #print "main_line previous theta --- next theta ",math.degrees(self.save_theta),math.degrees(self.theta)
+        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):
+        """
+            return params a dictionary containing values of paramters necessary to draw 
+            this line
+        """
+        params = {}
+        params["ymax"] = self.radius1
+        params["ymin"] = self.radius2
+        params["theta"] = self.theta
+        return params
+    
+    def set_params(self, params):
+        """
+            Draw the line given value contains by params
+            @param params: dictionary containing name of parameters and their values
+        """
+        radius1 = params["ymax"]
+        radius2 = params["ymin"]
+        theta = params["theta"]
+        self.update(x, theta= theta , radius1 = radius1 ,radius2 = radius2)
+        
+
+
+
+        
Index: guiframe/local_perspectives/plotting/ring.py
===================================================================
--- guiframe/local_perspectives/plotting/ring.py	(revision ffd23b50a217b6b70d069bda563e2e42824e88f7)
+++ guiframe/local_perspectives/plotting/ring.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -8,12 +8,10 @@
 
 # Debug printout
-from config import printEVT
+import math
+import wx
+from copy import deepcopy
+
 from BaseInteractor import _BaseInteractor
-from copy import deepcopy
-import math
-
-from Plotter1D import AddPlotEvent
-import SlicerParameters
-import wx
+from sans.guicomm.events import NewPlotEvent, StatusEvent,SlicerParameterEvent,EVT_SLICER_PARS
 
 class AnnulusInteractor(_BaseInteractor):
@@ -43,5 +41,5 @@
         
         # Bind to slice parameter events
-        self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
+        self.base.parent.Bind(EVT_SLICER_PARS, self._onEVT_SLICER_PARS)
 
 
@@ -76,5 +74,5 @@
         self.inner_circle.clear()
         #self.base.connect.disconnect()
-        self.base.parent.Unbind(SlicerParameters.EVT_SLICER_PARS)
+        self.base.parent.Unbind(EVT_SLICER_PARS)
         
     def update(self):
@@ -170,5 +168,5 @@
         
         # Post paramters
-        event = SlicerParameters.SlicerParameterEvent()
+        event = SlicerParameterEvent()
         event.type = self.__class__.__name__
         event.params = self.get_params()
Index: guiframe/local_perspectives/plotting/slicerpanel.py
===================================================================
--- guiframe/local_perspectives/plotting/slicerpanel.py	(revision 1f3655a09820a0d7ddfb8549f0b3ed9783b574ad)
+++ guiframe/local_perspectives/plotting/slicerpanel.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -7,6 +7,8 @@
 from copy import deepcopy
 
-(SlicerEvent, EVT_SLICER)   = wx.lib.newevent.NewEvent()
-(SlicerParameterEvent, EVT_SLICER_PARS)   = wx.lib.newevent.NewEvent()
+from sans.guiframe.utils import format_number
+from sans.guicomm.events  import SlicerParameterEvent,EVT_SLICER_PARS,EVT_SLICER
+
+
 
 class SlicerPanel(wx.Panel):
@@ -20,7 +22,8 @@
     CENTER_PANE = False
     
-    def __init__(self, parent,id=-1,type=None, params={}, *args, **kwargs):
+    def __init__(self, parent,id=-1,type=None,base=None, params={}, *args, **kwargs):
         wx.Panel.__init__(self, parent,id, *args, **kwargs)
-        print "panel created"
+        #print "panel created", base
+        self.base= base
         self.params = params
         self.parent = parent
@@ -28,4 +31,5 @@
         self.listeners = []
         self.parameters = []
+        
         self.bck = wx.GridBagSizer(5,5)
         self.SetSizer(self.bck)
@@ -47,5 +51,5 @@
             @param event: EVT_SLICER event
         """
-        print "went here panel"
+        #print "went here panel"
         event.Skip()
         if event.obj_class==None:
@@ -62,5 +66,5 @@
         self.bck.Clear(True)  
         self.type = type  
-        print "in set slicer", type, params
+        #print "in set slicer", type, params
         if type==None:
             title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)
@@ -78,18 +82,25 @@
             
             for item in keys:
-                n += 1
-                text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT)
-                self.bck.Add(text, (n-1,0), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)
-                ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER)
+                if not  item.lower() in ["errors", "count"]:
+                    n += 1
+                    text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT)
+                    self.bck.Add(text, (n-1,0), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)
+                    ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER)
+                    ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item)
+                    ctl.SetValue(str(format_number(params[item])))
+                    #ctl.Disable()
+                    self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter)
+                    ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter)
+                    self.parameters.append([item, ctl])
+                    self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0)
+            for item in keys:
+                if  item.lower() in ["errors", "count"]:
+                    n += 1
+                    text = wx.StaticText(self, -1, item+": ", style=wx.ALIGN_LEFT)
+                    self.bck.Add(text, (n-1,0), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15)
+                    ctl = wx.StaticText(self, -1, str(format_number(params[item])), style=wx.ALIGN_LEFT)
+                    ctl.SetToolTipString("Result %s" % item)
+                    self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0)
                 
-                ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item)
-                
-                
-                ctl.SetValue(str(params[item]))
-                ctl.Disable()
-                self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter)
-                ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter)
-                self.parameters.append([item, ctl])
-                self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0)
 
         self.bck.Layout()
@@ -97,20 +108,12 @@
         self.parent.GetSizer().Layout()
     def onParamChange(self, evt):
-        print "parameters changed"
+        #print "parameters changed"
         evt.Skip()
         #if evt.type == "UPDATE":
         for item in self.parameters:              
             if item[0] in evt.params:
-                item[1].SetValue("%-5.3g" %evt.params[item[0]])
+                item[1].SetValue(format_number(evt.params[item[0]]))
                 item[1].Refresh()
-        
-
-    def old_onParamChange(self, evt):
-        evt.Skip()
-        if evt.type == "UPDATE":
-            for item in self.parameters:              
-                if item[0] in evt.params:
-                    item[1].SetValue("%-5.3g" %evt.params[item[0]])
-                    item[1].Refresh()
+   
         
     def onTextEnter(self, evt): 
@@ -133,7 +136,7 @@
         if has_error==False:
             # Post parameter event
-            print "post new param"
+            #print "post new param"
             event = SlicerParameterEvent(type=self.type, params=params)
-            wx.PostEvent(self.parent, event)
-            print "self parent ", self.parent
+            wx.PostEvent(self.base, event)
+            #print "panel slicer: self base ", self.base
         
Index: guiframe/utils.py
===================================================================
--- guiframe/utils.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
+++ guiframe/utils.py	(revision 0d9dae840601f23ae4dd0b9e0317056593727f90)
@@ -0,0 +1,29 @@
+"""
+     Contains common classes
+"""
+import wx
+
+def format_number(value, high=False):
+    """
+        Return a float in a standardized, human-readable formatted string 
+    """
+    try: 
+        value = float(value)
+    except:
+        print "returning 0"
+        return "0"
+    
+    if high:
+        return "%-6.4g" % value
+    else:
+        return "%-5.3g" % value
+    
+class PanelMenu(wx.Menu):
+    plots = None
+    graph = None
+    
+    def set_plots(self, plots):
+        self.plots = plots
+    
+    def set_graph(self, graph):
+        self.graph = graph
