Index: sansview/perspectives/fitting/fitpage1D.py
===================================================================
--- sansview/perspectives/fitting/fitpage1D.py	(revision 1309e919ebb6b4fff686becfbf2722a5108bcef9)
+++ sansview/perspectives/fitting/fitpage1D.py	(revision ef8b580e1d81d99a7c4cb6d0465ea7a27c2dfcbf)
@@ -4,5 +4,5 @@
 import numpy,math
 import copy
-import sans.models.dispersion_models 
+
 from sans.guicomm.events import StatusEvent 
 from sans.guiframe.utils import format_number
@@ -78,18 +78,4 @@
         #---------sizer 1 draw--------------------------------
         self.DataSource  =wx.StaticText(self, -1,str(data.name))
-        self.smearer_box = wx.ComboBox(self, -1)
-        wx.EVT_COMBOBOX( self.smearer_box,-1, self.onSmear ) 
-        self.smeares= sans.models.dispersion_models.models
-        i=0
-        self.smearer_box.SetValue(str(None))
-        self.smearer_box.Insert(str(None),i)
-        
-        for k,v in self.smeares.iteritems():
-            if str(v)=="GaussianModel":
-                self.smearer_box.Insert("Gaussian Resolution",i)
-            else:
-              self.smearer_box.Insert(str(v),i)  
-            i+=1
-            
         #Filing the sizer containing data related fields
         ix = 0
@@ -102,8 +88,8 @@
         
         #---------sizer 2 draw--------------------------------
-        ix = 0
-        iy = 1
         #set maximum range for x in linear scale
         if not hasattr(self.data,"data"): #Display only for 1D data fit
+            ix = 0
+            iy = 1
             # Minimum value of data   
             self.data_min    = wx.StaticText(self, -1,str(format_number(numpy.min(data.x))))
@@ -126,4 +112,8 @@
         
         #----sizer 3 draw--------------------------------
+        self.disable_smearer = wx.RadioButton(self, -1, 'No', (10, 10), style=wx.RB_GROUP)
+        self.enable_smearer = wx.RadioButton(self, -1, 'Yes', (10, 30))
+        self.Bind(wx.EVT_RADIOBUTTON, self.onSmear, id=self.disable_smearer.GetId())
+        self.Bind(wx.EVT_RADIOBUTTON, self.onSmear, id=self.enable_smearer.GetId())
         ix = 0
         iy = 1
@@ -131,5 +121,7 @@
                   , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.sizer3.Add(self.smearer_box,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.sizer3.Add(self.enable_smearer,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        ix += 1
+        self.sizer3.Add(self.disable_smearer,(iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix =0
         iy+=1
@@ -570,12 +562,18 @@
         
     def onSmear(self, event):
-        if event.GetString()=="None":
-            self.manager.set_smearer(None)   
-            
-            
-        if event.GetString()=="Gaussian Resolution":
+        #print "in smearer",self.enable_smearer.GetValue()
+        smear =None
+        if self.enable_smearer.GetValue():
             from DataLoader.qsmearing import smear_selection
             smear =smear_selection( self.data )
-            self.manager.set_smearer(smear)   
-#            print "on smearing"
+            if smear ==None:
+                wx.PostEvent(self.manager.parent, StatusEvent(status=\
+                            "Data contains no smearing information"))
+            else:
+                wx.PostEvent(self.manager.parent, StatusEvent(status=\
+                            "Data contains smearing information"))
+        self.manager.set_smearer(smear)   
+            
+              
+        
        
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision fee6059476bfaa226ad4d49b64c6931f2be6c45a)
+++ sansview/perspectives/fitting/fitpanel.py	(revision ef8b580e1d81d99a7c4cb6d0465ea7a27c2dfcbf)
@@ -102,13 +102,11 @@
         except:
             name = 'Fit'
+        
         if self.fit_page_name != name:
-            print"went here"
-            #self.count +=1
-         
             #self.about_page.Disable()
             from fitpage1D import FitPage1D
             panel = FitPage1D(self,data, -1)
             panel.name=name
-            m_name= "M"+str(self.count)  
+            #m_name= "M"+str(self.count)  
             panel.set_manager(self.manager)
             panel.set_owner(self.event_owner)
@@ -118,7 +116,7 @@
             self.fit_page_name = name
             EVT_FIT_PAGE
-            return panel,m_name
+            return panel #,m_name
         else:
-            return None, None
+            return None #, None
         
     def _help_add_model_page(self,model,description,page_title, qmin=0, qmax=0.1, npts=50):
@@ -137,5 +135,5 @@
         self.AddPage(page=panel,caption="Model",select=True)
         panel.populate_box( self.model_list_box)
-        panel.name=page_title
+        panel.name = page_title
         self.draw_model_name=page_title
         self.model_page_number=self.GetSelection()
@@ -166,9 +164,14 @@
         """
         print "self.draw_model_name none",self.draw_model_name
-        if  self.draw_model_name ==None:
-            print "self.draw_model_name none"
-            self._help_add_model_page(model,description,page_title, qmin=qmin, qmax=qmax, npts=npts)
-        elif topmenu==True:
-            self.model_page.select_model(model, page_title)
+        if topmenu==True:
+            if  self.draw_model_name ==None:
+                print "self.draw_model_name none"
+                self._help_add_model_page(model,description,page_title, qmin=qmin, qmax=qmax, npts=npts)
+            else:
+                #self.model_page.name=page_title
+                #self.draw_model_name=page_title
+                #print "wnent here self.draw_model_name ",self.draw_model_name,self.model_page.name,self.model_page
+                
+                self.model_page.select_model(model, page_title)
           
     def get_current_page(self):
@@ -211,5 +214,5 @@
                 #Delete the page from notebook
                 page_number = self.GetSelection()
-                print selected_page.name,self.GetPageText(page_number),self.draw_model_name
+                print "on close",selected_page.name,self.GetPageText(page_number),self.draw_model_name
                 if selected_page.name== self.draw_model_name:
                     print "went here"
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision 2268d100cf4d0c2aa066591523a5c8846391f5d0)
+++ sansview/perspectives/fitting/fitting.py	(revision ef8b580e1d81d99a7c4cb6d0465ea7a27c2dfcbf)
@@ -206,5 +206,6 @@
                 try:
                    
-                    page, model_name = self.fit_panel.add_fit_page(item)
+                    page = self.fit_panel.add_fit_page(item)
+                    #page, model_name = self.fit_panel.add_fit_page(item)
                     # add data associated to the page created
                    
@@ -212,5 +213,5 @@
                         #create a fitproblem storing all link to data,model,page creation
                         self.page_finder[page]= FitProblem()
-                        self.page_finder[page].save_model_name(model_name)  
+                        #self.page_finder[page].save_model_name(model_name)  
                         self.page_finder[page].add_data(item)
                         wx.PostEvent(self.parent, StatusEvent(status="Page Created"))
@@ -310,7 +311,8 @@
             
             cpage.onsetValues(result.fitness, result.pvec,result.stderr)
+            #title="Fitted model 2D "
             self.plot_helper(currpage=cpage,qmin=qmin,qmax=qmax,
                              ymin=ymin, ymax=ymax,
-                             xmin=xmin, xmax=xmax,title="Fitted model 2D ")
+                             xmin=xmin, xmax=xmax,title=None)
         except:
             #raise
@@ -547,13 +549,15 @@
         if current_pg != sim_page:
             current_pg.set_panel(model)
-            model.name = self.page_finder[current_pg].get_name()
+            #model.name = self.page_finder[current_pg].get_name()
+            #print "model name", model.name
+            model.name="M"+str(self.index_model)
             try:
                 metadata=self.page_finder[current_pg].get_data()
-                #M_name=model.name+"= "+name+"("+metadata.group_id+")"
-                M_name=model.name+"= "+name+"("+metadata.id+")"
+                M_name=model.name+"= "+name+"("+metadata.group_id+")"
             except:
-                M_name=model.name+"= "+name+"("+metadata.group_id+")"
-            model.name="M"+str(self.index_model)
+                M_name=model.name+"= "+name
             self.index_model += 1  
+            
+            
             # save model name
             
@@ -598,4 +602,5 @@
                 theory.name = model.name
                 theory.group_id = data.group_id
+                """
                 if hasattr(data, "id"):
                     import string
@@ -605,5 +610,6 @@
                         self.index_theory +=1
                     else:
-                        theory.id = "Model"
+                    """
+                theory.id = "Model"
                    
                 x_name, x_units = data.get_xaxis() 
Index: sansview/perspectives/fitting/modelpage.py
===================================================================
--- sansview/perspectives/fitting/modelpage.py	(revision 10c43a589031ebfba8be2dfa4a95124ab9c0f6c4)
+++ sansview/perspectives/fitting/modelpage.py	(revision ef8b580e1d81d99a7c4cb6d0465ea7a27c2dfcbf)
@@ -102,5 +102,7 @@
         self.sizer4.Add(self.model_view,(iy,ix),(1,1),\
                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        self.model_view.Enable()
         self.model_view.SetFocus()
+        
         #----------sizer6-------------------------------------------------
         self.disable_disp = wx.RadioButton(self, -1, 'No', (10, 10), style=wx.RB_GROUP)
@@ -194,4 +196,5 @@
         self.fixed_param=[]
         self.fittable_param=[]
+        self.polydisp= {}
         #contains link between a model and selected parameters to fit 
         self.param_toFit=[]
@@ -298,7 +301,11 @@
             # set up the combox box
             id = 0
+            import sans.models.dispersion_models 
+            self.polydisp= sans.models.dispersion_models.models
             self.disp_box = wx.ComboBox(self, -1)
-            self.disp_box.SetValue("Gaussian")
-            self.disp_box.Insert("Gaussian",int(id))
+            self.disp_box.SetValue("GaussianModel")
+            for k,v in self.polydisp.iteritems():
+                self.disp_box.Insert(str(v),id)  
+                id+=1
             wx.EVT_COMBOBOX(self.disp_box,-1, self._on_select_Disp) 
             self.sizer7.Add(self.disp_box,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -379,6 +386,9 @@
             @param model: model object 
         """
-        self.model= model
-        print "select_model", model.__class__
+        self.model = model
+        self.parent.model_page.name = name
+        self.parent.draw_model_name = name
+       
+        print "select_model", self.name,model.__class__
         self.set_panel(model)
         self._draw_model(name)
@@ -388,5 +398,4 @@
         for i in range(len(items)):
             print "model name",items[i],model.name, model.__class__.__name__
-            #if items[i]==model.__class__.__name__:
             if items[i]==name:
                 self.modelbox.SetSelection(i)
@@ -398,7 +407,6 @@
              self.disp_list should change type later .now only gaussian
         """
-        type = "Gaussian" 
-        if type ==event.GetString():
-            self.set_panel_dispers( self.disp_list,type )
+        type =event.GetString()
+        self.set_panel_dispers( self.disp_list,type )
                 
     def _on_select_model(self,event):
@@ -423,7 +431,10 @@
                 self.set_panel(model)
                 self.name= name
+                
+                self.parent.model_page.name=name
+                self.parent.draw_model_name=name
                 #self.manager.draw_model(model, name)
-                self.enable2D=False
-                self.model_view.Enable()
+                #self.enable2D=False
+                #self.model_view.Enable()
                 self._draw_model(name)
             
@@ -557,7 +568,36 @@
         self.Layout()
         self.parent.GetSizer().Layout()
-        
-       
-    def  set_panel_dispers(self, disp_list, type="Gaussian" ):
+    def _selectDlg(self):
+        import os
+        dlg = wx.FileDialog(self, "Choose a weight file", os.getcwd(), "", "*.*", wx.OPEN)
+        path = None
+        if dlg.ShowModal() == wx.ID_OK:
+            path = dlg.GetPath()
+        dlg.Destroy()
+        return path
+    def read_file(self, path):
+        try:
+            input_f = open(path, 'r')
+            buff = input_f.read()
+            lines = buff.split('\n')
+            
+            angles = []
+            weights=[]
+            for line in lines:
+                toks = line.split()
+                if len(toks)==2:
+                    try:
+                        angle = float(toks[0])
+                        weight = float(toks[1])
+                    except:
+                        # Skip non-data lines
+                        pass
+                    angles.append(angle)
+                    weights.append(weight)
+            return numpy.array(angles), numpy.array(weights)
+        except:
+            raise
+                   
+    def  set_panel_dispers(self, disp_list, type="GaussianModel" ):
         
         self.fittable_param=[]
@@ -566,7 +606,27 @@
         ix=0
         iy=1
-        ### this will become a separate method
-        if type== "Gaussian" :
+                ### this will become a separate method
+        if type== "MyModel":
+            
+            self.sizer8.Clear(True)
+            path = self._selectDlg()
+            dispersion=None
+            for key, value in self.polydisp.iteritems():
+                if value =="MyModel":
+                    dispersion= key()
+                    break
+            values,weights = self.read_file(path)
+            dispersion.set_weights( values, weights)
+            print "sipersion model", dispersion.value
+            for param in self.model.dispersion.keys():
+                print 
+                print "on MyModel disp",dispersion,param, self.model.set_dispersion(param, dispersion)
+
+            wx.PostEvent(self.parent.parent, StatusEvent(status=\
+                            " Selected Distribution: %s"%path))
+                
+        if type== "GaussianModel" :
             print "went here"
+           
             self.sizer8.Clear(True)
             disp = wx.StaticText(self, -1, 'Dispersion')
@@ -589,5 +649,5 @@
             
             disp_list.sort()
-            #print disp_list,self.model.fixed,self.model.dispersion
+            print disp_list,self.model.dispersion
             for item in self.model.dispersion.keys():
                 name1=item+".width"
@@ -644,5 +704,6 @@
                             self.sizer8.Add(Tctl, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
                             self.fixed_param.append([name3, Tctl])
-                    
+                wx.PostEvent(self.parent.parent, StatusEvent(status=\
+                            " Selected Distribution: Gaussian"))   
             ix =0
             iy +=1 
@@ -652,4 +713,5 @@
             self.Layout()
             self.parent.GetSizer().Layout()  
+          
          
            
@@ -747,10 +809,5 @@
                                 qstep= self.num_points,
                                 enable2D=self.enable2D)
-        """
-            self.manager.draw_model(self.model, self.model.name, 
-                                    qmin=self.qmin, qmax=self.qmax,
-                                    qstep= self.num_points,
-                                    enable2D=self.enable2D)
-        """
+       
     def select_param(self,event):
         pass
@@ -773,11 +830,4 @@
                         list= [item[0],item[1],item[2],item[3]]
                         self.param_toFit.append(list )
-               
-                if not (len(self.param_toFit ) >0):
-                    self.qmin.Disable()
-                    self.qmax.Disable()
-                else:
-                    self.qmin.Enable()
-                    self.qmax.Enable()
             else:
                 for item in self.parameters:
@@ -786,6 +836,5 @@
                     item[0].SetValue(False)
                 self.param_toFit=[]
-              
-                self.qmin.Disable()
-                self.qmax.Disable()
-       
+               
+                
+       
