Index: sansview/perspectives/fitting/fitpage1D.py
===================================================================
--- sansview/perspectives/fitting/fitpage1D.py	(revision 5cab7d3a9f1478cea177fb1914473b36526f6d00)
+++ sansview/perspectives/fitting/fitpage1D.py	(revision 44bbf6a18b0c05b5a9c2a72e75e3e936cb3a6fee)
@@ -54,7 +54,10 @@
         self.sizer2 = wx.GridBagSizer(5,5)
         self.sizer1 = wx.GridBagSizer(5,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.DataSource      = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
+        #self.DataSource.SetToolTipString("name of data to fit")
+        #self.DataSource.SetValue(str(data.name))
+        #self.DataSource.Disable()
+        self.DataSource  =wx.StaticText(self, -1,str(data.name))
+        
         self.modelbox = wx.ComboBox(self, -1)
         id = wx.NewId()
@@ -64,15 +67,10 @@
         self.static_line_1 = wx.StaticLine(self, -1)
        
-        
-       
         self.vbox.Add(self.sizer3)
         self.vbox.Add(self.sizer2)
         self.vbox.Add(self.static_line_1, 0, wx.EXPAND, 0)
         self.vbox.Add(self.sizer5)
-        
         self.vbox.Add(self.sizer4)
         self.vbox.Add(self.sizer1)
-        
-        
         
         id = wx.NewId()
@@ -82,5 +80,5 @@
         ix = 0
         iy = 1
-        self.sizer3.Add(wx.StaticText(self, -1, 'Data Source'),(iy,ix),\
+        self.sizer3.Add(wx.StaticText(self, -1, 'Data Source Name : '),(iy,ix),\
                  (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
@@ -120,4 +118,5 @@
         self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
         self.xmin.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter)
+        self.xmin.Disable()
         ix += 2
         self.xmax    = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
@@ -127,4 +126,5 @@
         self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter)
         self.xmax.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter)
+        self.xmax.Disable()
         #Set chisqr  result into TextCtrl
         ix = 0
@@ -252,5 +252,5 @@
             post an event to its owner to draw an appropriate theory
         """
-        
+        self.btFit.SetFocus()
         for item in self.model_list_box.itervalues():
             name = item.__name__
@@ -342,5 +342,5 @@
         self.model = model
         keys = self.model.getParamList()
-        print "fitpage1D : dispersion list",self.model.getDispParamList()
+        #print "fitpage1D : dispersion list",self.model.getDispParamList()
         keys.sort()
         disp_list=self.model.getDispParamList()
@@ -407,7 +407,18 @@
         ix= 0
         iy=1
-        self.disp = wx.StaticText(self, -1, 'Dispersion')
-        self.sizer5.Add(self.disp,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        iy+=1
+        if len(disp_list)>0:
+            disp = wx.StaticText(self, -1, 'Dispersion')
+            self.sizer5.Add(disp,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1 
+            values = wx.StaticText(self, -1, 'Values')
+            self.sizer5.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            #ix += 1 
+            #disps = wx.StaticText(self, -1, 'Disp')
+            #self.sizer5.Add(disps,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            #ix += 1 
+            #npts = wx.StaticText(self, -1, 'npts')
+            #self.sizer5.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy+=1
+            
         for item in disp_list:
             ix = 0
Index: sansview/perspectives/fitting/fitpage2D.py
===================================================================
--- sansview/perspectives/fitting/fitpage2D.py	(revision 2dbb6812a796357379c72f2ee764a292e372784d)
+++ sansview/perspectives/fitting/fitpage2D.py	(revision 44bbf6a18b0c05b5a9c2a72e75e3e936cb3a6fee)
@@ -49,11 +49,14 @@
         #panel interface
         self.vbox  = wx.BoxSizer(wx.VERTICAL)
+        self.sizer5 = wx.GridBagSizer(5,5)
         self.sizer4 = wx.GridBagSizer(5,5)
         self.sizer3 = wx.GridBagSizer(5,5)
         self.sizer2 = wx.GridBagSizer(5,5)
         self.sizer1 = wx.GridBagSizer(5,5)
-        self.DataSource      = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20))
-        self.DataSource.SetValue(str(data.name))
-        self.DataSource.SetToolTipString("name of data to fit")
+        #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.DataSource.Disable()
+        self.DataSource  =wx.StaticText(self, -1,str(data.name))
         self.modelbox = wx.ComboBox(self, -1)
         id = wx.NewId()
@@ -61,6 +64,10 @@
         self.btFit.Bind(wx.EVT_BUTTON, self.onFit,id=id)
         self.btFit.SetToolTipString("Perform fit.")
+        self.static_line_1 = wx.StaticLine(self, -1)
+        
         self.vbox.Add(self.sizer3)
         self.vbox.Add(self.sizer2)
+        self.vbox.Add(self.static_line_1, 0, wx.EXPAND, 0)
+        self.vbox.Add(self.sizer5)
         self.vbox.Add(self.sizer4)
         self.vbox.Add(self.sizer1)
@@ -362,4 +369,6 @@
         keys = self.model.getParamList()
         keys.sort()
+        disp_list=self.model.getDispParamList()
+        disp_list.sort()
         iy = 1
         ix = 0
@@ -383,38 +392,72 @@
         self.text2_4.Hide()
         for item in keys:
-            iy += 1
+            if not item in disp_list:
+                iy += 1
+                ix = 0
+    
+                cb = wx.CheckBox(self, -1, item, (10, 10))
+                cb.SetValue(False)
+                self.sizer2.Add( cb,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+                wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param)
+                
+                ix += 1
+                value= self.model.getParam(item)
+                ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
+                ctl1.SetValue(str (format_number(value)))
+                ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)
+                ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter)
+                self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
+                ix += 1
+                text2=wx.StaticText(self, -1, '+/-')
+                self.sizer2.Add(text2,(iy, ix),(1,1),\
+                                wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+                text2.Hide()  
+                ix += 1
+                ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
+                self.sizer2.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+                ctl2.Hide()
+                ix +=1
+                #save data
+                self.parameters.append([cb,ctl1,text2,ctl2])
+                # Units
+                try:
+                    units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
+                except:
+                    units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
+                 
+                self.sizer2.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        iy+=1
+        self.sizer2.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        ix= 0
+        iy=1
+        if len(disp_list)>0:
+            disp = wx.StaticText(self, -1, 'Dispersion')
+            self.sizer5.Add(disp,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            ix += 1 
+            values = wx.StaticText(self, -1, 'Values')
+            self.sizer5.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            #ix += 1 
+            #disps = wx.StaticText(self, -1, 'Disp')
+            #self.sizer5.Add(disps,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            #ix += 1 
+            #npts = wx.StaticText(self, -1, 'npts')
+            #self.sizer5.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy+=1
+            
+        for item in disp_list:
             ix = 0
-
-            cb = wx.CheckBox(self, -1, item, (10, 10))
-            cb.SetValue(False)
-            self.sizer2.Add( cb,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-            wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param)
+            cb2 = wx.CheckBox(self, -1, item, (10, 10))
+            cb2.SetValue(False)
+            self.sizer5.Add( cb2,( iy, ix),(1,1),  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+            wx.EVT_CHECKBOX(self, cb2.GetId(), self.select_param)
             
             ix += 1
             value= self.model.getParam(item)
-            ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
-            ctl1.SetValue(str (format_number(value)))
-            ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)
-            ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter)
-            self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-            ix += 1
-            text2=wx.StaticText(self, -1, '+/-')
-            self.sizer2.Add(text2,(iy, ix),(1,1),\
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-            text2.Hide()  
-            ix += 1
             ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
-            self.sizer2.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-            ctl2.Hide()
-            ix +=1
-            # Units
-            try:
-                units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-            except:
-                units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
-             
-            self.sizer2.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-            #save data
-            self.parameters.append([cb,ctl1,text2,ctl2])
+            ctl2.SetValue(str (format_number(value)))
+            ctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)
+            ctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter)
+            self.sizer5.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+            iy += 1
         #Display units text on panel
         for item in keys:   
@@ -425,20 +468,16 @@
                 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()
-                self.ymin.Disable()
-                self.ymax.Disable()
-            else:
-                self.xmin.Enable()
-                self.xmax.Enable()
-                self.ymin.Enable()
-                self.ymax.Enable()
-        else:
+        
+        if not (len(self.param_toFit ) >0):
             self.xmin.Disable()
             self.xmax.Disable()
             self.ymin.Disable()
             self.ymax.Disable()
+        else:
+            self.xmin.Enable()
+            self.xmax.Enable()
+            self.ymin.Enable()
+            self.ymax.Enable()
+     
         self.compute_chisqr()
         self.vbox.Layout()
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 2dbb6812a796357379c72f2ee764a292e372784d)
+++ sansview/perspectives/fitting/fitting.py	(revision 44bbf6a18b0c05b5a9c2a72e75e3e936cb3a6fee)
@@ -14,5 +14,9 @@
 import fitpage1D,fitpage2D
 import park
-
+class Theory2D(Data2D):
+    def __init__(self,image=None,err_image=None,xmin=None,
+                 xmax=None,ymin=None,ymax=None,zmin=None,zmax=None):
+        Data2D.__init__(self,image,err_image,xmin,
+                        xmax,ymin,ymax,zmin,zmax)
 class Plugin:
     """
@@ -513,5 +517,4 @@
                     theory.x.append(tempx)
                     theory.y.append(tempy)
-                   
                 except:
                     wx.PostEvent(self.parent, StatusEvent(status="fitting \
@@ -519,4 +522,5 @@
             else:
                 theory=Data2D(data.image, data.err_image)
+                #theory=Theory2D(data.image, data.err_image)
                 theory.x_bins= data.x_bins
                 theory.y_bins= data.y_bins
@@ -530,16 +534,14 @@
                 if ymax==None:
                     ymax=data.ymax
-              
-                #for i in range(len(data.y_bins)):
-                #    if data.y_bins[i]>= ymin and data.y_bins[i]<= ymax:
-                #        for j in range(len(data.x_bins)):
-                #            if data.x_bins[i]>= qmin and data.x_bins[i]<= qmax:
-                #                theory.image= model.runXY([data.x_bins[j],data.y_bins[i]])
+                    
+                theory.image = numpy.zeros((len(data.y_bins),len(data.x_bins)))
+                for i in range(len(data.y_bins)):
+                    if data.y_bins[i]>= ymin and data.y_bins[i]<= ymax:
+                        for j in range(len(data.x_bins)):
+                            if data.x_bins[i]>= qmin and data.x_bins[i]<= qmax:
+                                theory.image[j][i]=model.runXY([data.x_bins[j],data.y_bins[i]])
                
-                    
-                    #print "fitting : plot_helper:", theory.image
+                #print "fitting : plot_helper:", theory.image
                 #print data.image
-                theory.image=model.runXY(data.image)
-                
                 #print "fitting : plot_helper:",theory.image
                 theory.zmin= data.zmin
Index: sansview/perspectives/fitting/models.py
===================================================================
--- sansview/perspectives/fitting/models.py	(revision 2dbb6812a796357379c72f2ee764a292e372784d)
+++ sansview/perspectives/fitting/models.py	(revision 44bbf6a18b0c05b5a9c2a72e75e3e936cb3a6fee)
@@ -177,8 +177,7 @@
                     #self.custom_models[str(id)] = item
                 self.model_list[str(id)]=items
-                item=items()
-                name = item.__class__.__name__
-                if hasattr(item, "name"):
-                    name = item.name
+                name = items.__name__
+                if hasattr(items, "name"):
+                    name = items.name
                 added_models.Append(id, name, name)
                 self.model_list_box[name] =items
