Index: sansview/perspectives/fitting/fitpage1D.py
===================================================================
--- sansview/perspectives/fitting/fitpage1D.py	(revision bcd6d51ec9434da3082881dfdfb88a73950d810c)
+++ sansview/perspectives/fitting/fitpage1D.py	(revision 9d31a8b73e768aee2608c8a0172d85e8dae7f31a)
@@ -39,5 +39,5 @@
     
     
-    def __init__(self, parent, *args, **kwargs):
+    def __init__(self, parent,data, *args, **kwargs):
         wx.Panel.__init__(self, parent, *args, **kwargs)
         """ 
@@ -55,4 +55,5 @@
         self.DataSource      = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
         self.DataSource.SetToolTipString("name of data to fit")
+        self.DataSource.SetValue(str(data.name))
         self.modelbox = wx.ComboBox(self, -1)
         id = wx.NewId()
@@ -83,15 +84,5 @@
         ix += 1
         self.sizer3.Add(self.modelbox,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix = 1
-        iy = 1
-        self.text4_1 = wx.StaticText(self, -1, 'Min')
-        self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\
-                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.text4_1.Hide()
-        ix += 2
-        self.text4_2 = wx.StaticText(self, -1, 'Max')
-        self.sizer4.Add(self.text4_2,(iy, ix),(1,1),\
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        self.text4_2.Hide()
+        
         ix = 0
         iy += 1
@@ -100,19 +91,36 @@
         self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.text4_3.Hide()
+        
         ix += 1
+        self.text4_1 = wx.StaticText(self, -1, 'Min')
+        self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        
+        ix += 2
+        self.text4_2 = wx.StaticText(self, -1, 'Max')
+        self.sizer4.Add(self.text4_2,(iy, ix),(1,1),\
+                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix = 0
+        iy += 1
+        self.text4_4 = wx.StaticText(self, -1, 'x range')
+        self.sizer4.Add(self.text4_4,(iy, ix),(1,1),\
+                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix += 1
+        
         self.xmin    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmin.SetValue(format_number(numpy.min(data.x)))
         self.xmin.SetToolTipString("Minimun value of x in linear scale.")
         self.sizer4.Add(self.xmin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
         self.xmin.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter)
-        self.xmin.Hide()
+        
         ix += 2
         self.xmax    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        self.xmax.SetValue(format_number(numpy.max(data.x)))
         self.xmax.SetToolTipString("Maximum value of x in linear scale.")
         self.sizer4.Add(self.xmax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
         self.xmax.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter)
-        self.xmax.Hide()
+       
         #Set chisqr  result into TextCtrl
         ix = 0
@@ -136,19 +144,16 @@
         # model on which the fit would be performed
         self.model=None
-        # preview selected model name
-        self.prevmodel_name=None
-        # flag to check if the user has selected a new model in the combox box
-        self.model_hasChanged=False
-        
+       
+    
         #dictionary of model name and model class
         self.model_list_box={}
-        #  comparison between 2 group_id for checking data changes
-        self.prev_group_id= None
-        
-        self.data=None
+      
+        self.data=data
         self.vbox.Layout()
+        self.GrandParent.GetSizer().Layout()
         self.vbox.Fit(self) 
         self.SetSizer(self.vbox)
         self.Centre()
+        
         
         
@@ -168,24 +173,4 @@
         self.manager = manager
  
-         
-    def _DataNameEnter(self):
-        """
-            reset the panel when a new data is selected
-        """
-        if len(self.parameters )>0:
-            for item in self.parameters:
-                item[0].SetValue(False)
-                wx.EVT_CHECKBOX(self, item[0].GetId(), self.select_param)
-                item[2].Hide()
-                item[3].Clear()
-                item[3].Hide()
-                self.xmax.Disable()
-                self.xmin.Disable()
-                self.text1_1.Hide()
-                self.tcChi.Clear()
-                self.vbox.Layout() 
-                self.GrandParent.GetSizer().Layout()
-                
-  
         
     def onClose(self,event):
@@ -322,57 +307,5 @@
         return flag
     
-   
-                    
-    def set_data_name(self,dataset):
-        """ 
-            set data's name.if data has changed reset the panel and xmin and xmax
-            @param name: data 's name
-            @attention:  still  haven't find a better way to display Q name and unit
-            for xmin and xmax range sizer
-        """
-        
-        if self.prev_group_id !=dataset.group_id:
-            self._DataNameEnter()
-        self.data = dataset
-        self.prev_group_id=dataset.group_id
-        #Displaying Data information
-        self.DataSource.SetValue(str(dataset.name))
-        self._xaxis,self._xunit=dataset.get_xaxis()
-        self.text4_3.SetLabel(self._xaxis+"["+self._xunit+"]")
-        self.text4_1.Show()
-        self.text4_2.Show()
-        self.text4_3.Show()
-       
-        self.xmin.SetValue(format_number(min(dataset.x)))
-        self.xmin.Show()
-        self.xmax.SetValue(format_number(max(dataset.x)))
-        self.xmax.Show()
-        
-        if ((len(self.param_toFit ) >0) and self.DataSource.GetValue()and \
-            self.modelbox.GetValue() and (self.model_hasChanged ==False)):
-            self.xmin.Enable()
-            self.xmax.Enable()
-        else:
-            self.xmin.Disable()
-            self.xmax.Disable()
-            
-        self.vbox.Layout()
-        self.GrandParent.GetSizer().Layout()
-        
-        
-    def set_model_name(self,name):
-        """ 
-            set model name. set also self.model_hasChanged to true is the model 
-            type has changed or false if it didn't
-            @param name: model 's name
-        """
-        self.model_hasChanged=False
-        if (name != self.prevmodel_name):
-            self.model_hasChanged=True
-        self.tcChi.Clear()
-        #self.modelbox.SetValue(str(name))
-        self.prevmodel_name=self.modelbox.GetValue()
-       
-            
+
     def get_model_box(self): 
         """ return reference to combox box self.model"""
@@ -470,15 +403,12 @@
                 self.text2_4.Hide()
         #Disable or enable fit button
-        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-            if not (len(self.param_toFit ) >0):
-                self.xmin.Disable()
-                self.xmax.Disable()
-            else:
-                self.xmin.Enable()
-                self.xmax.Enable()
-        else:
+        
+        if not (len(self.param_toFit ) >0):
             self.xmin.Disable()
             self.xmax.Disable()
-        
+        else:
+            self.xmin.Enable()
+            self.xmax.Enable()
+       
         self.compute_chisqr()
         self.vbox.Layout()
@@ -522,11 +452,11 @@
                     list= [item[0],item[1],item[2],item[3]]
                     self.param_toFit.append(list )
-                if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-                    if not (len(self.param_toFit ) >0):
-                        self.xmin.Disable()
-                        self.xmax.Disable()
-                    else:
-                        self.xmin.Enable()
-                        self.xmax.Enable()
+               
+                if not (len(self.param_toFit ) >0):
+                    self.xmin.Disable()
+                    self.xmax.Disable()
+                else:
+                    self.xmin.Enable()
+                    self.xmax.Enable()
             else:
                 for item in self.parameters:
@@ -555,14 +485,12 @@
         else:
             self.cb1.SetValue(False)
-        if (self.modelbox.GetValue() and self.DataSource.GetValue()):
-            if not (len(self.param_toFit ) >0):
-                self.xmin.Disable()
-                self.xmax.Disable()
-            else:
-                self.xmin.Enable()
-                self.xmax.Enable()
-        else:
+        
+        if not (len(self.param_toFit ) >0):
             self.xmin.Disable()
             self.xmax.Disable()
+        else:
+            self.xmin.Enable()
+            self.xmax.Enable()
+  
    
        
