Index: guitools/fitDialog.py
===================================================================
--- guitools/fitDialog.py	(revision 49c8dc52b5ccd4896932367247626dd496bc5af3)
+++ guitools/fitDialog.py	(revision 83fe2cc98a7bb84ccd3def8be393942e394d02f2)
@@ -39,10 +39,10 @@
         self.tcErrB = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
         self.tcChi = wx.TextCtrl(panel, -1,size=(120,20),style=wx.SIMPLE_BORDER)
-        self.FXmin = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
-        self.FXmax = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
-        self.FXminX = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
-        self.FXmaxX = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
-        self.PXmin = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
-        self.PXmax = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.xminFit = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.xmaxFit = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.xminTransFit = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.xmaxTransFit = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.initXmin = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
+        self.initXmax = wx.TextCtrl(panel,-1,size=(120,20),style=wx.SIMPLE_BORDER)
         self.btFit =wx.Button(panel,-1,'Fit',size=(120, 30))
         self.btClose =wx.Button(panel, wx.ID_CANCEL,'Close',size=(90, 30) )
@@ -89,8 +89,8 @@
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix +=1
-        sizer.Add(self.PXmin, (iy, ix),(1,1),\
+        sizer.Add(self.initXmin, (iy, ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 2
-        sizer.Add(self.PXmax, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer.Add(self.initXmax, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
        
         iy += 1
@@ -99,8 +99,8 @@
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        sizer.Add(self.FXmin, (iy, ix),(1,1),\
+        sizer.Add(self.xminTransFit, (iy, ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 2
-        sizer.Add(self.FXmax, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer.Add(self.xmaxTransFit, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
       
         iy += 1
@@ -109,8 +109,8 @@
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        sizer.Add(self.FXminX, (iy, ix),(1,1),\
+        sizer.Add(self.xminFit, (iy, ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 2
-        sizer.Add(self.FXmaxX, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer.Add(self.xmaxFit, (iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         iy += 1
         ix = 1
@@ -161,18 +161,19 @@
             self.mini =min(self.plottable.x)
             self.maxi =max(self.plottable.x)
-            xView,yView,dxView,dyView= self.plottable.returnValuesOfView()
-            
-            self.FXmin.SetLabel(str(min(xView)))
-            self.FXmax.SetLabel(str(max(xView)))
-            self.FXmin.Disable()
-            self.FXmax.Disable()
-            
-            self.PXmin.SetValue(str(self.mini))
-            self.PXmax.SetValue(str(self.maxi))
-            self.PXmin.Disable()
-            self.PXmax.Disable()
-            
-            self.FXminX.SetLabel(str(self.mini))
-            self.FXmaxX.SetLabel(str(self.maxi))
+            #store the values of View in self.x,self.y,self.dx,self.dy
+            self.x,self.y,self.dx,self.dy= self.plottable.returnValuesOfView()
+            
+            self.xminTransFit.SetLabel(str(min(self.x)))
+            self.xmaxTransFit.SetLabel(str(max(self.x)))
+            self.xminTransFit.Disable()
+            self.xmaxTransFit.Disable()
+            
+            self.initXmin.SetValue(str(self.mini))
+            self.initXmax.SetValue(str(self.maxi))
+            self.initXmin.Disable()
+            self.initXmax.Disable()
+            
+            self.xminFit.SetLabel(str(self.mini))
+            self.xmaxFit.SetLabel(str(self.maxi))
             
       
@@ -187,47 +188,47 @@
         tempdy = []
        
-        #store the values of View in x,y, dx,dy
-        x,y,dx,dy=self.plottable.returnValuesOfView()
+       
+        
         
         # Check if View contains a x array .we online fit when x exits
         # makes transformation for y as a line to fit
-        if x != []: 
-            
-                
-            if(self.checkFitValues(self.FXminX) == True):
+        if self.x != []: 
+            
+                
+            if(self.checkFitValues(self.xminFit) == True):
                 #Check if the field of Fit Dialog contain values and use the x max and min of the user
-                xmin,xmax = self._checkVal(self.FXminX.GetValue(),self.FXmaxX.GetValue())
+                xmin,xmax = self._checkVal(self.xminFit.GetValue(),self.xmaxFit.GetValue())
                 
                 xminView=self.floatTransform(xmin)
                 xmaxView=self.floatTransform(xmax)
                 if (self.xLabel=="log10(x)"):
-                    self.FXmin.SetValue(str(math.log10(xminView)))
-                    self.FXmax.SetValue(str(math.log10(xmaxView)))
-                else:
-                    self.FXmin.SetValue(str(xminView))
-                    self.FXmax.SetValue(str(xmaxView))
-                self.FXmin.Disable()
-                self.FXmax.Disable()
+                    self.xminTransFit.SetValue(str(math.log10(xminView)))
+                    self.xmaxTransFit.SetValue(str(math.log10(xmaxView)))
+                else:
+                    self.xminTransFit.SetValue(str(xminView))
+                    self.xmaxTransFit.SetValue(str(xmaxView))
+                self.xminTransFit.Disable()
+                self.xmaxTransFit.Disable()
                 # Store the transformed values of view x, y,dy in variables  before the fit
                 if  self.yLabel.lower() == "log10(y)":
                     if (self.xLabel.lower() == "log10(x)"):
-                        for i in range(len(x)):
-                            if x[i]>= math.log10(xmin):
-                                tempy.append(math.log10(y[i])) 
-                                tempdy.append(transform.errToLogX(y[i],0,dy[i],0))
+                        for i in range(len(self.x)):
+                            if self.x[i]>= math.log10(xmin):
+                                tempy.append(math.log10(self.y[i])) 
+                                tempdy.append(transform.errToLogX(self.y[i],0,self.dy[i],0))
                     else:
-                        for i in range(len(y)):
-                            tempy.append(math.log10(y[i])) 
-                            tempdy.append(transform.errToLogX(y[i],0,dy[i],0))
-                else:
-                    tempy = y
-                    tempdy = dy
+                        for i in range(len(self.y)):
+                            tempy.append(math.log10(self.y[i])) 
+                            tempdy.append(transform.errToLogX(self.y[i],0,self.dy[i],0))
+                else:
+                    tempy = self.y
+                    tempdy = self.dy
                
                 if (self.xLabel.lower() == "log10(x)"):
-                    for x_i in x:
+                    for x_i in self.x:
                         if x_i >= math.log10(xmin):
                             tempx.append(math.log10(x_i)) 
                 else:
-                    tempx = x
+                    tempx = self.x
               
                 #Find the fitting parameters
@@ -287,4 +288,5 @@
                 else: 
                     tempy.append(y_model)
+                #Set the fit parameter display when  FitDialog is opened again
                 self.Avalue=cstA
                 self.Bvalue=cstB
@@ -315,6 +317,4 @@
          return self.Avalue, self.Bvalue,self.ErrAvalue,self.ErrBvalue,self.Chivalue
          
-    def _returnPlottable(self):
-        return self.file_data1
     
     def _checkVal(self,usermin, usermax):
@@ -325,15 +325,15 @@
         if float(usermin) < float(usermax):
             if float(usermin) >= float(self.mini) and float(usermin) < float(self.maxi):
-                self.FXminX.SetValue(str(usermin))
+                self.xminFit.SetValue(str(usermin))
             else:
-                self.FXminX.SetValue(str(self.mini))
+                self.xminFit.SetValue(str(self.mini))
                 
             if float(usermax) > float(self.mini) and float(usermax) <= float(self.maxi):
-                self.FXmaxX.SetLabel(str(usermax))
+                self.xmaxFit.SetLabel(str(usermax))
             else:
-                self.FXmaxX.SetLabel(str(self.maxi))
-                
-            mini =float(self.FXminX.GetValue())
-            maxi =float(self.FXmaxX.GetValue())
+                self.xmaxFit.SetLabel(str(self.maxi))
+                
+            mini =float(self.xminFit.GetValue())
+            maxi =float(self.xmaxFit.GetValue())
             
             return mini, maxi
@@ -373,13 +373,12 @@
         return flag
        
-    def setFitRange(self,xmin,xmax,Reelxmin,Reelxmax):
-        if (self.xLabel=="log10(x)"):
-            self.FXmin.SetValue(str(math.log10(xmin)))
-            self.FXmax.SetValue(str(math.log10(xmax)))
-        else:
-            self.FXmin.SetValue(str(xmin))
-            self.FXmax.SetValue(str(xmax))
-        self.FXminX.SetValue(str(Reelxmin))
-        self.FXmaxX.SetValue(str(Reelxmax))
+    def setFitRange(self,xmin,xmax,xminTrans,xmaxTrans):
+        """
+            Set fit parameters
+        """
+        self.xminFit.SetValue(str(xmin))
+        self.xmaxFit.SetValue(str(xmax))
+        self.xminTransFit.SetValue(str(xminTrans))
+        self.xmaxTransFit.SetValue(str(xmaxTrans))
         
    
