Index: guitools/plottables.py
===================================================================
--- guitools/plottables.py	(revision 150c04a24a22c547a7794c40bfb8d089fe3ff50b)
+++ guitools/plottables.py	(revision b43a00952d61f7d74e84e0fd6420c550eadbfaab)
@@ -53,17 +53,5 @@
             if not cond: return False
         return True
-def error_msg(msg, parent=None):
-    """
-    Signal an error condition -- in a GUI, popup a error dialog
-    """
-    # Code brought with minor podifications from mpl.backends.backend_wx
-    # Copyright (C) Jeremy O'Donoghue & John Hunter, 2003-4
-    dialog =wx.MessageDialog(parent  = parent,
-                             message = msg,
-                             caption = 'Polplot error',
-                             style=wx.OK | wx.CENTRE)
-    dialog.ShowModal()
-    dialog.Destroy()
-    return None
+
 # Graph structure for holding multiple plottables
 class Graph:
@@ -204,6 +192,6 @@
                      "title":""}
         self.plottables = {}
-    def setGraph(self,listofplottable):
-        self.plottables = listofplottable
+        
+        
     def _make_labels(self):
         # Find groups of related plottables
@@ -223,4 +211,9 @@
     
     def returnPlottable(self):
+        """
+            This method returns a dictionary of plottables contained in graph
+            It is just by Plotpanel to interact with the complete list of plottables 
+            inside the graph.
+        """
         return self.plottables
 
@@ -234,6 +227,5 @@
         plot.render()
    
-    def clear(self,plot): 
-        plot.clear()
+   
 
     def __init__(self,**kw):
@@ -376,7 +368,12 @@
     ##Use the following if @classmethod doesn't work
     # labels = classmethod(labels)
-    def getTransform(self,transx,transy):
-        self.view.transx = transx
-        self.view.transy = transy
+    def setLabel(self,labelx,labely):
+        """
+            It takes a label of the x and y transformation and set View parameters
+            @param transx: The label of x transformation is sent by Properties Dialog
+            @param transy: The label of y transformation is sent Properties Dialog
+        """
+        self.view.xLabel= labelx
+        self.view.yLabel = labely
         
     def __init__(self):
@@ -418,25 +415,61 @@
     
     def transformView(self):
-       
+        """
+            It transforms x, y before displaying
+        """
         self.view.transform( self.x, self.y, self.dx,self.dy)
         
     def returnValuesOfView(self):
+        """
+            Return View parameters and it is used by Fit Dialog
+        """
         return self.view.returnXview()
     
     def check_data_PlottableX(self): 
+        """
+            Since no transformation is made for log10(x), check that 
+            no negative values is plot in log scale
+        """
         self.view.check_data_logX()
         
     def check_data_PlottableY(self): 
+        """
+            Since no transformation is made for log10(y), check that 
+            no negative values is plot in log scale
+        """
         self.view.check_data_logY() 
         
-    def returnTransformationx(self,transx,transdx):
-        self.view.returntransformx(transx,transdx)
-        
-    def returnTransformationy(self,transy,transdy):
-        self.view.returntransformy(transy,transdy)
+    def transformX(self,transx,transdx):
+        """
+            Receive pointers to function that transform x and dx 
+            and set corresponding View pointers
+            @param transx: pointer to function that transforms x
+            @param transdx: pointer to function that transforms dx
+        """
+        self.view.setTransformX(transx,transdx)
+        
+    def transformY(self,transy,transdy):
+        """
+            Receive pointers to function that transform y and dy 
+            and set corresponding View pointers
+            @param transy: pointer to function that transforms y
+            @param transdy: pointer to function that transforms dy
+        """
+        self.view.setTransformY(transy,transdy)
+        
     def onReset(self):
+        """
+            Reset x, y, dx, dy view with its parameters
+        """
         self.view.onResetView()
+        
     def onFitRange(self,xmin=None,xmax=None):
+        """
+            It limits View data range to plot from min to max
+            @param xmin: the minimum value of x to plot.
+            @param xmax: the maximum value of x to plot
+        """
         self.view.onFitRangeView(xmin,xmax)
+        
     class View:
         """
@@ -454,13 +487,13 @@
             self.dx = dx
             self.dy = dy
-            #to change x range to the reel range
+            # To change x range to the reel range
             self.Xreel = self.x
             self.Yreel = self.y
             self.DXreel = self.dx
             self.DYreel = self.dy
-            
-            self.transx =""
-            self.transy =""
-            # function to transform x and y
+            # Labels of x and y received from Properties Dialog
+            self.xLabel =""
+            self.yLabel =""
+            # Function to transform x, y, dx and dy
             self.funcx= None
             self.funcy= None
@@ -469,14 +502,15 @@
         def transform(self, x=None,y=None,dx=None, dy=None):
             """
-                Transforms the x and dx vectors and stores the output.
-                
-                @param func: function to apply to the data
+                Transforms the x,y,dx and dy vectors and stores the output in View parameters
+        
                 @param x: array of x values
-                @param dx: array of error values
-                @param errfunc: function to apply to errors
+                @param y: array of y values
+                @param dx: array of  errors values on x 
+                @param dy: array of error values on y
             """
             
             # Sanity check
-            if (x!=None) and (y!=None):
+            # Do the transofrmation only when x and y are empty
+            if (x!=None) and (y!=None): 
                 if dx and not len(x)==len(dx):
                         raise ValueError, "Plottable.View: Given x and dx are not of the same length" 
@@ -522,28 +556,57 @@
                 and(len(self.x)==len(self.y))and(len(self.y)==len(self.dy)) :
                         raise ValueError, "Plottable.View: Given x,y,dy and dx are not of the same length" 
+                # Check that negative values are not plot on x and y axis for log10 transformation
                 self.check_data_logX()
                 self.check_data_logY()
+                # Store x ,y dx,and dy in their full range for reset
                 self.Xreel = self.x
                 self.Yreel = self.y
                 self.DXreel = self.dx
                 self.DYreel = self.dy
+                
+                
+                
         def onResetView(self):
-            self.x=self.Xreel
-            self.y=self.Yreel
-            self.dx=self.DXreel
-            self.dy=self.DYreel
-        def returntransformx(self,funcx,funcdx):    
+            """
+                Reset x,y,dx and y in their full range  and in the initial scale
+                in case their previous range has changed  
+            """
+            self.x = self.Xreel
+            self.y = self.Yreel
+            self.dx = self.DXreel
+            self.dy = self.DYreel
+            
+        def setTransformX(self,funcx,funcdx):  
+            """
+                Receive pointers to function that transform x and dx 
+                and set corresponding View pointers
+                @param transx: pointer to function that transforms x
+                @param transdx: pointer to function that transforms dx
+            """
             self.funcx= funcx
             self.funcdx= funcdx
             
-        def returntransformy(self,funcy,funcdy):    
+        def setTransformY(self,funcy,funcdy):
+            """
+                Receive pointers to function that transform y and dy 
+                and set corresponding View pointers
+                @param transx: pointer to function that transforms y
+                @param transdx: pointer to function that transforms dy
+            """    
             self.funcy= funcy
             self.funcdy= funcdy
        
         def returnXview(self):
+            """
+                Return View  x,y,dx,dy
+            """
             return self.x,self.y,self.dx,self.dy
         
      
         def check_data_logX(self): 
+            """
+                 Remove negative value in x vector 
+                 to avoid plotting negative value of Log10
+            """
             tempx=[]
             tempdx=[]
@@ -554,5 +617,5 @@
             if self.dy==None:
                 self.dy=numpy.zeros(len(self.y))
-            if self.transx=="log10(x)" :
+            if self.xLabel=="log10(x)" :
                 for i in range(len(self.x)):
                     try:
@@ -568,14 +631,14 @@
                         pass 
            
-                self.x=[]
-                self.dx=[]
-                self.y=[]
-                self.dy=[]
-                self.x=tempx
-                self.y=tempy
-                self.dx=tempdx
-                self.dy=tempdy
+                self.x = tempx
+                self.y = tempy
+                self.dx = tempdx
+                self.dy = tempdy
             
         def check_data_logY(self): 
+            """
+                 Remove negative value in y vector 
+                 to avoid plotting negative value of Log10
+            """
             tempx=[]
             tempdx=[]
@@ -586,5 +649,5 @@
             if self.dy==None:
                 self.dy=numpy.zeros(len(self.y))
-            if (self.transy == "log10(y)" ):
+            if (self.yLabel == "log10(y)" ):
                 for i in range(len(self.x)):
                      try:
@@ -598,15 +661,16 @@
                         print sys.exc_value  
                         pass
-                
-                self.x=[]
-                self.dx=[]
-                self.y=[]
-                self.dy=[]
-                self.x=tempx
-                self.y=tempy
-                self.dx=tempdx
-                self.dy=tempdy
+              
+                self.x = tempx
+                self.y = tempy
+                self.dx = tempdx
+                self.dy = tempdy
                 
         def onFitRangeView(self,xmin=None,xmax=None):
+            """
+                It limits View data range to plot from min to max
+                @param xmin: the minimum value of x to plot.
+                @param xmax: the maximum value of x to plot
+            """
             tempx=[]
             tempdx=[]
@@ -676,5 +740,5 @@
         The title is the name that will show up on the legend.
         """
-        self.name= "theo"
+        self.name= "theory"
         self.x = x
         self.y = y
@@ -683,4 +747,5 @@
         self.yaxis( 'intensity', 'cm')
         self.view = self.View(self.x, self.y, None, self.dy)
+        
     def render(self,plot,**kw):
         #plot.curve(self.x,self.y,dy=self.dy,**kw)
