Index: guitools/fitDialog.py
===================================================================
--- guitools/fitDialog.py	(revision 416223d9568a1d580f938f2e229d490e7c0b1980)
+++ guitools/fitDialog.py	(revision b43a00952d61f7d74e84e0fd6420c550eadbfaab)
@@ -11,9 +11,9 @@
 
 class LinearFit(wx.Dialog):
-    #def __init__(self, parent, id, title):
     def __init__(self, parent, plottable, push_data,transform, id, title):
         wx.Dialog.__init__(self, parent, id, title, size=(450, 400))
         """
-            for the fit window
+            Dialog window pops- up when select Linear fit on Context menu
+            Displays fitting parameters
         """
         self.parent = parent
@@ -22,7 +22,9 @@
         self.push_data = push_data
         #dialog self plottable
+        
         self.plottable = plottable
         # Receive transformations of x and y
-        self.xtrans,self.ytrans= self.transform()
+        self.xLabel,self.yLabel,self.Avalue,self.Bvalue,\
+        self.ErrAvalue,self.ErrBvalue,self.Chivalue= self.transform()
         #Dialog interface
         panel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)   
@@ -91,11 +93,8 @@
         ix += 2
         sizer.Add(self.PXmax, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        iy += 1
-        ix = 1
-        sizer.Add(wx.StaticText(panel, -1,"x transofrmation is: "+self.xtrans ),(iy, ix),(1,1),\
-                   wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        iy += 1
-        ix = 0
-        sizer.Add(wx.StaticText(panel, -1, 'Fit Range'),(iy, ix),(1,1),\
+       
+        iy += 1
+        ix = 0
+        sizer.Add(wx.StaticText(panel, -1, 'Fit Range of '+self.xLabel),(iy, ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
@@ -138,10 +137,25 @@
         
         # Set default value of parameter in fit dialog
-        self.tcA.SetLabel(str(self.default_A))
-        self.tcB.SetLabel(str(self.default_B))
-        self.tcErrA.SetLabel(str(0.0))
-        self.tcErrB.SetLabel(str(0.0))
-        self.tcChi.SetLabel(str(0.0))
-        
+        
+        if self.Avalue==None:
+            self.tcA.SetLabel(str(self.default_A))
+        else :
+            self.tcA.SetLabel(str(self.Avalue))
+        if self.Bvalue==None:
+            self.tcB.SetLabel(str(self.default_B))
+        else:
+            self.tcB.SetLabel(str(self.Bvalue))
+        if self.ErrAvalue==None:
+            self.tcErrA.SetLabel(str(0.0))
+        else:
+            self.tcErrA.SetLabel(str(self.ErrAvalue))
+        if self.ErrBvalue==None:
+            self.tcErrB.SetLabel(str(0.0))
+        else:
+            self.tcErrB.SetLabel(str(self.ErrBvalue))
+        if self.Chivalue==None:
+            self.tcChi.SetLabel(str(0.0))
+        else:
+            self.tcChi.SetLabel(str(self.Chivalue))
         if self.plottable.x !=[]:
             self.mini =min(self.plottable.x)
@@ -186,5 +200,5 @@
                 xminView=self.floatTransform(xmin)
                 xmaxView=self.floatTransform(xmax)
-                if (self.xtrans=="log10(x)"):
+                if (self.xLabel=="log10(x)"):
                     self.FXmin.SetValue(str(math.log10(xminView)))
                     self.FXmax.SetValue(str(math.log10(xmaxView)))
@@ -195,6 +209,6 @@
                 self.FXmax.Disable()
                 # Store the transformed values of view x, y,dy in variables  before the fit
-                if  self.ytrans.lower() == "log10(y)":
-                    if (self.xtrans.lower() == "log10(x)"):
+                if  self.yLabel.lower() == "log10(y)":
+                    if (self.xLabel.lower() == "log10(x)"):
                         for i in range(len(x)):
                             if x[i]>= math.log10(xmin):
@@ -209,5 +223,5 @@
                     tempdy = dy
                
-                if (self.xtrans.lower() == "log10(x)"):
+                if (self.xLabel.lower() == "log10(x)"):
                     for x_i in x:
                         if x_i >= math.log10(xmin):
@@ -215,14 +229,8 @@
                 else:
                     tempx = x
-                       
-                #for y_i in y:
-                #    dy = math.sqrt(math.fabs(y_i))
-                #    if dy >= y_i:
-                #        dy = 0.9*y_i
-                #    tempdy.append(dy)
-                       
+              
                 #Find the fitting parameters
                 
-                if (self.xtrans.lower() == "log10(x)"):
+                if (self.xLabel.lower() == "log10(x)"):
                     chisqr, out, cov = fittings.sansfit(self.model, [self.cstA, self.cstB],
                     tempx, tempy,tempdy,math.log10(xmin),math.log10(xmax))
@@ -230,5 +238,5 @@
                     chisqr, out, cov = fittings.sansfit(self.model, 
                                 [self.cstA, self.cstB],tempx, tempy,tempdy,xminView,xmaxView)
-                print "this out",out
+                #print "this out",out
                 #Check that cov and out are iterable before displaying them
                 if cov ==None:
@@ -253,5 +261,5 @@
                 # load tempy with the minimum transformation
                
-                if self.xtrans == "log10(x)":
+                if self.xLabel == "log10(x)":
                     y_model = self.model.run(math.log10(xmin))
                     tempx.append(xmin)
@@ -260,5 +268,5 @@
                     tempx.append(xminView)
                     
-                if self.ytrans == "log10(y)":
+                if self.yLabel == "log10(y)":
                     tempy.append(math.pow(10,y_model))
                     print "tempy",tempy
@@ -267,5 +275,5 @@
                     
                 # load tempy with the maximum transformation
-                if self.xtrans == "log10(x)":
+                if self.xLabel == "log10(x)":
                     y_model = self.model.run(math.log10(xmax))
                     tempx.append(xmax)
@@ -274,13 +282,19 @@
                     tempx.append(xmaxView)
                     
-                if self.ytrans == "log10(y)":
+                if self.yLabel == "log10(y)":
                     tempy.append(math.pow(10,y_model))
                 else: 
                     tempy.append(y_model)
-               
-                self.push_data(tempx,tempy,xminView,xmaxView,xmin,xmax)
+                self.Avalue=cstA
+                self.Bvalue=cstB
+                self.ErrAvalue=errA
+                self.ErrBvalue=errB
+                self.Chivalue=chisqr
+                self.push_data(tempx,tempy,xminView,xmaxView,xmin,xmax,self._ongetValues())
                 
                 # Display the fitting value on the Fit Dialog
                 self._onsetValues(cstA, cstB, errA,errB,chisqr)
+               
+               
             
     def _onsetValues(self,cstA,cstB,errA,errB,Chi):
@@ -293,4 +307,10 @@
          self.tcErrB.SetValue(str(errB))
          self.tcChi.SetValue(str(Chi))
+        
+    def _ongetValues(self):
+         """
+              Display  the value on fit Dialog 
+         """
+         return self.Avalue, self.Bvalue,self.ErrAvalue,self.ErrBvalue,self.Chivalue
          
     def _returnPlottable(self):
@@ -322,11 +342,11 @@
              not in x
         """
-        if ( self.xtrans=="x" ):
+        if ( self.xLabel=="x" ):
             return transform.toX(x)
         
-        if ( self.xtrans=="x^(2)" ): 
+        if ( self.xLabel=="x^(2)" ): 
             return transform.toX2(x)
         
-        if (self.xtrans=="log10(x)" ):
+        if (self.xLabel=="log10(x)" ):
             if x >0:
                 return x
@@ -341,5 +361,5 @@
         value = item.GetValue()
         # Check for possible values entered
-        if (self.xtrans=="log10(x)"):
+        if (self.xLabel=="log10(x)"):
             if (float(value) > 0):
                 item.SetBackgroundColour(wx.WHITE)
@@ -353,5 +373,5 @@
        
     def setFitRange(self,xmin,xmax,Reelxmin,Reelxmax):
-        if (self.xtrans=="log10(x)"):
+        if (self.xLabel=="log10(x)"):
             self.FXmin.SetValue(str(math.log10(xmin)))
             self.FXmax.SetValue(str(math.log10(xmax)))
