Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision 6bcdad180ced0a30920cebfc41f2c610d8297ba6)
+++ sansview/perspectives/fitting/fitpanel.py	(revision 86c1832466ddab5c573aec133a29d224902b0e03)
@@ -105,5 +105,5 @@
     def _help_add_model_page(self,model,description,page_title):
         from modelpage import ModelPage
-        panel = ModelPage(self.nb,model, -1)
+        panel = ModelPage(self.nb,model,page_title, -1)
         panel.set_manager(self.manager)
         panel.set_owner(self.event_owner)
@@ -122,4 +122,5 @@
             @param page_title: the name of the page
         """
+        print "page_title fitpanel", page_title
         if  self.draw_model_name ==None:
             
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision be404bc0be3ab6e812f4a74c59f75406d59e33bc)
+++ sansview/perspectives/fitting/fitting.py	(revision 86c1832466ddab5c573aec133a29d224902b0e03)
@@ -578,4 +578,7 @@
             Plot a theory from a model selected from the menu
         """
+        name = evt.model.__name__
+        if hasattr(evt.model, "name"):
+            name = evt.model.name
         model=evt.model()
         #name="Model View"
@@ -584,15 +587,16 @@
         #self.fit_panel.add_model_page(model,description,name)  
         
-        self.draw_model(model,self.enable_model2D)
-        
-    def draw_model(self,model,description=None,enable1D=True, enable2D=False,qmin=None, qmax=None,qstep=None):
+        self.draw_model(model=model,name=name,enable2D=self.enable_model2D)
+        
+    def draw_model(self,model,name ,description=None,enable1D=True, enable2D=False,qmin=None, qmax=None,qstep=None):
         """
              draw model with default data value
         """
-        self.fit_panel.add_model_page(model,model.description,model.name) 
-        self._draw_model2D(model,model.description, enable2D,qmin,qmax,qstep)
-        self._draw_model1D(model,model.description, enable1D,qmin,qmax, qstep)
+        
+        self.fit_panel.add_model_page(model=model,description=model.description,page_title=name) 
+        self._draw_model2D(model,name,model.description, enable2D,qmin,qmax,qstep)
+        self._draw_model1D(model,name,model.description, enable1D,qmin,qmax, qstep)
        
-    def _draw_model1D(self,model,description=None, enable1D=True,qmin=None,qmax=None, qstep=None):
+    def _draw_model1D(self,model,name,description=None, enable1D=True,qmin=None,qmax=None, qstep=None):
         
         if enable1D:
@@ -604,5 +608,5 @@
                 qstep =0.001
            
-            print "x in data1D",qmin,qmax
+            #print "x in data1D",qmin,qmax
             x = numpy.arange(qmin, qmax, qstep)        
             xlen= len(x)
@@ -614,6 +618,5 @@
                 try:
                     new_plot = Theory1D(x, y)
-                    #new_plot.name = model.name
-                    new_plot.name = model.name
+                    new_plot.name = name
                     new_plot.xaxis("\\rm{Q}", 'A^{-1}')
                     new_plot.yaxis("\\rm{Intensity} ","cm^{-1}")
@@ -627,8 +630,8 @@
                 for i in range(xlen):
                     y[i] = model.run(x[i])
-        
+                    
                 try:
                     new_plot = Theory1D(x, y)
-                    new_plot.name = model.name
+                    new_plot.name = name
                     new_plot.xaxis("\\rm{Q}", 'A^{-1}')
                     new_plot.yaxis("\\rm{Intensity} ","cm^{-1}")
@@ -636,9 +639,9 @@
                     new_plot.group_id ="Model"
                     wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
-                                     title="Analytical model 1D %s"%str(model.name) ))
+                                     title="Analytical model 1D " ))
                     
                 except:
                     raise
-    def _draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None):
+    def _draw_model2D(self,model,name,description=None, enable2D=False,qmin=None,qmax=None, qstep=None):
         if qmin==None:
             qmin= -0.05
@@ -653,5 +656,5 @@
         data=numpy.zeros([len(x),len(y)])
         if enable2D:
-        
+            #print "drawing model 2D params",qmin, qmax,model.getParamList()
             for i_x in range(int(len(x))):
                 for i_y in range(len(y)):
@@ -662,7 +665,7 @@
                          wx.PostEvent(self.parent, StatusEvent(status="\
                         Error computing %s at [%g,%g] :%s" %(model.name,x[i_x],y[i_y], sys.exc_value)))
-                       
+            #print "data2 draw" ,data          
             theory= Data2D(data)
-            theory.name= model.name
+            theory.name= name
             theory.group_id ="Model"
             theory.id ="Model"
@@ -672,46 +675,7 @@
             theory.ymax= qmax
             wx.PostEvent(self.parent, NewPlotEvent(plot=theory,
-                             title="Analytical model 2D %s" %str(model.name)))
+                             title="Analytical model 2D %s" %str(name)))
              
-                
-                
-    def H_draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None):
-        if qmin==None:
-            qmin= -0.05
-        if qmax==None:
-            qmax= 0.05
-        if qstep ==None:
-            qstep =0.001
-        x = numpy.arange(qmin,qmax, qstep)
-        y = numpy.arange(qmin,qmax,qstep)
-        lx = len(self.x)
-        if enable2D:
-            data=numpy.zeros([len(x),len(y)])
-            for i in range(len(x)):
-                for j in range(len(x)):
-                    try:
-                        data[i][j]=model.runXY([j,i])
-                    except:
-                         wx.PostEvent(self.parent, StatusEvent(status="\
-                        Model 2D cannot be plot %g %s %s" %(data[i][j],model.name, sys.exc_value)))
-            theory = Data2D(data)  
-            theory.group_id =str(model.name)+" 2D"
-            theory.xmin= qmin
-            theory.xmax= qmax
-            theory.ymin= qmin
-            theory.ymax= qmax
-            wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model 2D"))
-    
-    
-    def on_draw_model2D(self, event):
-        """
-             plot view model 2D
-        """
-        
-        if self.enable_model2D== True:
-            self.enable_model2D=False
-        else:
-            self.enable_model2D=True
-        print "self.enable_model2D",self.enable_model2D
+  
 if __name__ == "__main__":
     i = Plugin()
Index: sansview/perspectives/fitting/modelpage.py
===================================================================
--- sansview/perspectives/fitting/modelpage.py	(revision 2e10b70358372330d714586241ecbfbe6c2eb099)
+++ sansview/perspectives/fitting/modelpage.py	(revision 86c1832466ddab5c573aec133a29d224902b0e03)
@@ -39,5 +39,5 @@
     
     
-    def __init__(self, parent,model, *args, **kwargs):
+    def __init__(self, parent,model,name, *args, **kwargs):
         wx.ScrolledWindow.__init__(self, parent, *args, **kwargs)
         """ 
@@ -69,5 +69,5 @@
         self.btClose.Bind(wx.EVT_BUTTON, self.onClose,id=id)
         self.btClose.SetToolTipString("Close page.")
-        ix = 0
+        ix = 1
         iy = 1 
         self.sizer4.Add(wx.StaticText(self, -1, 'Min'),(iy, ix),(1,1),\
@@ -111,8 +111,11 @@
         ix += 1
         self.sizer3.Add(self.modelbox,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix = 0
-        iy += 1
-        self.model_view= wx.CheckBox(self, -1, "View in 2D", (10, 10))
-        wx.EVT_CHECKBOX(self, self.model_view.GetId(), self.onModel2D)
+        #ix = 0
+        #iy += 1
+        ix += 1
+        id = wx.NewId()
+        self.model_view =wx.Button(self,id,'View 2D')
+        self.model_view.Bind(wx.EVT_BUTTON, self.onModel2D,id=id)
+        self.model_view.SetToolTipString("View model in 2D")
         self.sizer3.Add(self.model_view,(iy,ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
@@ -129,5 +132,5 @@
             raise
         # preview selected model name
-        self.prevmodel_name=model.__class__.__name__
+        self.prevmodel_name=name
         self.modelbox.SetValue(self.prevmodel_name)
         # flag to check if the user has selected a new model in the combox box
@@ -135,4 +138,7 @@
         #dictionary of model name and model class
         self.model_list_box={}
+       
+        #enable model 2D draw
+        self.enable2D= False
         # Data1D to make a deep comparison between 2 Data1D for checking data
         #change
@@ -165,9 +171,14 @@
         
     def onModel2D(self, event):
-        
-        if self.model_view.GetValue()==True:
-            print "2D model"
-            self.manager.draw_model(self.model,
-                                    description=None, enable2D=True,qmin=None, qmax=None)
+        """
+         call manager to plot model in 2D
+        """
+        self.enable2D=True
+        print "modelpage name", self.prevmodel_name
+        self.manager.draw_model(model=self.model,name=self.prevmodel_name,
+                                    description=None,
+                                     enable2D=self.enable2D,
+                                     qmin=float(self.xmin.GetValue()),
+                                    qmax=float(self.xmax.GetValue()))
     def populate_box(self, dict):
         """
@@ -180,7 +191,6 @@
         for item in  self.model_list_box.itervalues():
             name = item.__name__
-            model=item()
-            if hasattr(model, "name"):
-                name = model.name
+            if hasattr(item, "name"):
+                name = item.name
             list_name.append(name)
         list_name.sort()   
@@ -190,17 +200,7 @@
         wx.EVT_COMBOBOX(self.modelbox,-1, self._on_select_model) 
         return 0
+    
+  
    
-    def set_page(self, model,description=None):
-        #print " modelpage: set_page was called",model
-        self.model=model
-        name = self.model.__class__.__name__
-        if hasattr(self.model, "name"):
-            name = self.model.name
-        
-           
-        self.modelbox.SetValue(name)
-        self.set_panel(self.model)
-        self.manager.draw_model(self.model)
-        
     def _on_select_model(self,event):
         """
@@ -211,26 +211,15 @@
         for item in self.model_list_box.itervalues():
             name = item.__name__
-            items=item()
-            if hasattr(items, "name"):
-                name = items.name
-            #print "fitpage: _on_select_model model name",name ,event.GetString()
+            if hasattr(item, "name"):
+                name = item.name
             if name ==event.GetString():
-                model=items
+                model=item()
                 #print "fitpage: _on_select_model model name",name ,event.GetString()
                 self.model= model
                 self.set_panel(model)
-                self.manager.draw_model(model)
+                print "name in model page", name,event.GetString()
+                self.name= name
+                self.manager.draw_model(model, name)
                 
-    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.prevmodel_name=self.modelbox.GetValue()
        
             
@@ -377,7 +366,9 @@
                      wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\
                             "Model Drawing  Error:wrong value entered : %s"% sys.exc_value))
+            
+            print self.enable2D
             self.manager.draw_model(self.model,qmin=float(self.xmin.GetValue()),
                                     qmax=float(self.xmax.GetValue()),
-                                    enable2D=self.model_view.GetValue())
+                                    enable2D=self.enable2D)
             #self.manager.draw_model(self,model,description=None,
             # enable1D=True,qmin=None,qmax=None, qstep=None)
