Index: sansview/perspectives/fitting/basepage.py
===================================================================
--- sansview/perspectives/fitting/basepage.py	(revision 7c845cbc01c318cbb47a512ad1468742da9afd22)
+++ sansview/perspectives/fitting/basepage.py	(revision a07414556eb1f1ab4257288c9a6dfd76ef88922e)
@@ -3,4 +3,5 @@
 import wx
 import numpy
+import time
 
 from sans.guiframe.utils import format_number
@@ -67,4 +68,15 @@
         
         self.state= PageState(parent= self.parent,model=self.model, data=self.data)
+        
+        ## retrieve saved state
+        self.number_saved_state= 0
+        ## dictionary of saved state
+        self.saved_states={}
+        self.slicerpop = wx.Menu()
+        self.slicerpop.SetTitle("Model Saved States")
+        ## save initial state on context menu
+        self.onSave(event=None)
+        self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu)
+        
         ## create the basic structure of the panel with empty sizer
         self.define_page_structure()
@@ -72,8 +84,17 @@
         self.set_dispers_sizer()
         self._fill_save_sizer()
-        
         ## layout
         self.set_layout()
        
+       
+    def onContextMenu(self, event): 
+        """
+            Retrieve the state selected state
+        """
+        pos = event.GetPosition()
+        pos = self.ScreenToClient(pos)
+        self.PopupMenu(self.slicerpop, pos) 
+        
+        
         
     def define_page_structure(self):
@@ -106,4 +127,5 @@
         self.vbox.Add(self.sizer6)
         
+        
     def set_layout(self):
         """
@@ -117,8 +139,10 @@
         self.Centre()
         
+        
     def set_scroll(self):
         self.SetScrollbars(20,20,200,100)
         self.Layout()   
         self.SetAutoLayout(True)
+         
          
     def set_owner(self,owner):
@@ -166,5 +190,6 @@
         sizer_dispersion = wx.BoxSizer(wx.HORIZONTAL)
         sizer_dispersion.Add((20,20))
-        sizer_dispersion.Add(wx.StaticText(self,-1,'Polydispersity: '))
+        name="Polydispersity and \nOrientation average "
+        sizer_dispersion.Add(wx.StaticText(self,-1,name))
         sizer_dispersion.Add(self.enable_disp )
         sizer_dispersion.Add((20,20))
@@ -273,88 +298,52 @@
         return
     
+    
+    def onResetModel(self, event):
+        """
+            Reset model state
+        """
+        ## post help message for the selected model 
+        msg = self.slicerpop.GetHelpString(event.GetId())
+        msg +=" reloaded"
+        wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
+        
+        name= self.slicerpop.GetLabel(event.GetId())
+        if name in self.saved_states.keys():
+            previous_state = self.saved_states[name]
+            self.reset_page(previous_state)
+            
+   
     def onSave(self, event):
         """
             save history of the data and model
         """
-        self.state.model= self.model
-        self.state.data = self.data
-        import os
-                 
-            
-        path = None
-        dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.txt", wx.SAVE)
-        if dlg.ShowModal() == wx.ID_OK:
-            path = dlg.GetPath()
-            mypath = os.path.basename(path)
-            
-        dlg.Destroy()
-            
-        if not path == None:
-            out = open(path, 'w')
-            has_data = self.data !=None
-            has_model = self.model!=None
-            import time
-            year, month, day,hour,minute,second,tda,ty,tm_isdst= time.gmtime()
-            import os.path
-            out.write("Title: State for %s\n"%os.path.basename(path))
-            out.write("Date: %g\%g\%g \n"%(year, month, day))
-            out.write("GMT Time: %g:%g:%g \n\n"%(hour,minute, second))
-            # Sanity check
-            if has_data:
-                out.write("Fit Data name: %s\n\n"%self.data.name)
-    
-            if has_model:
-                out.write("Model name: %s\n"%self.model.name)
-                if len(self.parameters)>0:  
-                    out.write("Parameters Info:\n")
-                    msg= "Name\t\tValues\t\t+\-\tErrors\t\tMin\t\tMax\t\tUnits\t\tstate\n"
-                    out.write(msg)
-                    ##self.parameters=
-                    ##[cb state, name, value, "+/-", error of fit, min, max , units]
-                    for item in self.parameters:
-                        if item[1]!=None:
-                            name= item[1]
-                        else:
-                            name=""
-                        if item[2]!=None:
-                            value= str(item[2].GetValue().rstrip().lstrip())
-                        else:
-                            value=""
-                        if item[3]!=None:
-                            sign= str(item[3].GetLabelText().rstrip().lstrip())
-                        else:
-                            sign=""
-                        if item[4]!=None:
-                            error= str(item[4].GetValue().rstrip().lstrip())
-                        else:
-                            error=""
-                        if item[5]!=None:
-                            min= str(item[5].GetValue().rstrip().lstrip())
-                        else:
-                            min=""
-                        if item[6]!=None:
-                            max= str(item[6].GetValue().rstrip().lstrip())
-                        else:
-                            max=""
-                        if item[7]!=None:
-                            unit= str(item[7].GetLabelText().rstrip().lstrip())
-                        else:
-                            unit=""
-                        if item[0]!=None:
-                            if item[0].GetValue():
-                                state= "Fitted"
-                            else:
-                                state= "Not Fitted"
-                        else:
-                            state="Not Fitted"
-    
-                        msg= "%s\t\t%s\t\t%s\t%s\t\t%s\t\t%s\t\t%s\t\t%s\n"\
-                         %(name,value,sign,error,min,max,unit,state)
-                        out.write(msg)
-                        
-                
-            out.close()
-
-     
+        if self.model==None:
+            return 
+        if hasattr(self,"enable_disp"):
+            self.state.enable_disp=self.enable_disp.GetValue()
+        if hasattr(self, "disp_box"):
+            self.state.disp_box=SetSelection(self.disp_box.GetSelection()) 
+        
+        self.state.model = self.model.clone()
+        new_state = self.state.clone()
+        
+        ##Add model state on context menu
+        self.number_saved_state += 1
+        name= self.model.name+"[%g]"%self.number_saved_state 
+        self.saved_states[name]= new_state
+        
+        ## Add item in the context menu
+        year, month, day,hour,minute,second,tda,ty,tm_isdst= time.gmtime()
+        my_time= str(hour)+"hrs "+str(minute)+"min "+str(second)+"s"
+        date= str( month)+"|"+str(day)+"|"+str(year)
+        msg=  "Model saved at %s on %s"%(my_time, date)
+         ## post help message for the selected model 
+        msg +=" Saved! right click on this page to retrieve this model"
+        wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
+        
+        id = wx.NewId()
+        self.slicerpop.Append(id,name,str(msg))
+        wx.EVT_MENU(self, id, self.onResetModel)
+        
     def onSetFocus(self, evt):
         """
@@ -461,4 +450,5 @@
         wx.PostEvent(self.parent, event)
     
+    
     def reset_page_helper(self, state):
         """
@@ -485,5 +475,6 @@
         ##plotting range restore    
         self._reset_plotting_range()
-        
+        ## reset context menu items
+        self._reset_context_menu()
         ## reset state of checkbox,textcrtl  and parameters value
         if hasattr(self, "cb1"):    
@@ -496,4 +487,7 @@
         self._draw_model()
         
+   
+   
+         
         
     def _selectDlg(self):
@@ -510,4 +504,15 @@
     
     
+    def _reset_context_menu(self):
+        """
+            reset the context menu
+        """
+        for name, state in self.state.saved_states.iteritems():
+            self.number_saved_state += 1
+            ## Add item in the context menu
+            id = wx.NewId()
+            self.slicerpop.Append(id,name, 'Save model and state %g'%self.number_saved_state)
+            wx.EVT_MENU(self, id, self.onResetModel)
+    
     def _reset_plotting_range(self):
         """
@@ -542,5 +547,6 @@
         """
         if self.model !=None:
-            
+            ## save current state
+            self.save_current_state()
             # Flag to register when a parameter has changed.
             is_modified = False
@@ -569,6 +575,5 @@
                     self.num_points = float(self.npts.GetValue())
                     is_modified = True
-            ## save current state
-            self.save_current_state()
+           
             
             ## if any value is modify draw model with new value
@@ -952,8 +957,8 @@
             self.structurebox.SetSelection(0)
             
-          
+           
         s_id = self.structurebox.GetCurrentSelection()
         struct_factor = self.structurebox.GetClientData( s_id )
-            
+       
         if  struct_factor !=None:
             from sans.models.MultiplicationModel import MultiplicationModel
@@ -961,5 +966,5 @@
         else:
             self.model= form_factor()
-       
+        
         ## post state to fit panel
         self.save_current_state()
Index: sansview/perspectives/fitting/fitpage.py
===================================================================
--- sansview/perspectives/fitting/fitpage.py	(revision 7c845cbc01c318cbb47a512ad1468742da9afd22)
+++ sansview/perspectives/fitting/fitpage.py	(revision a07414556eb1f1ab4257288c9a6dfd76ef88922e)
@@ -76,39 +76,5 @@
         self.sizer3.Layout()
         self.SetScrollbars(20,20,200,100)
-            
-            
-    def _on_display_description(self, event):
-        """
-            Show or Hide description
-            @param event: wx.EVT_RADIOBUTTON
-        """
-        self._on_display_description_helper()
-        
-        
-        
-    def _on_display_description_helper(self):
-        """
-            Show or Hide description
-            @param event: wx.EVT_RADIOBUTTON
-        """
-        ## save state of radiobox
-        #self.page_info. save_radiobox_state( self.description_hide )
-        #self.page_info. save_radiobox_state( self.description_show )
-        ## Show description
-        if not self.description_show.GetValue():
-            self.sizer_description.Clear(True)
-            
-        else:
-            #model=self.page_info.model
-            
-            description=""
-            if self.model!=None:
-                description = self.model.description
-                #description = self.page_info.model.description
-            self.description = wx.StaticText( self,-1,str(description) )
-            self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 )
-           
-        self.Layout()
-    
+        
     
     def _fill_range_sizer(self):
@@ -406,4 +372,13 @@
         wx.PostEvent(self.event_owner, evt)   
         
+
+    def _onparamEnter(self,event):
+        """ 
+            when enter value on panel redraw model according to changed
+        """
+        self._onparamEnter_helper()
+        self.compute_chisqr()
+        
+        
     def reset_page(self, state):
         """
@@ -413,14 +388,6 @@
         evt = ModelEventbox(model=self.model)
         wx.PostEvent(self.event_owner, evt)   
-        
-        
-    def _onparamEnter(self,event):
-        """ 
-            when enter value on panel redraw model according to changed
-        """
-        self._onparamEnter_helper()
-        self.compute_chisqr()
-        
-        
+            
+            
     def get_range(self):
         """
@@ -662,54 +629,4 @@
         
     
-    def set_model_description(self,description,sizer):
-        """
-            fill a sizer with description
-            @param description: of type string
-            @param sizer: wx.BoxSizer()
-        """
-    
-        sizer.Clear(True)
-        box_description= wx.StaticBox(self, -1, 'Model Description')
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-                
-        self.description = wx.StaticText( self,-1,str(description) )
-        sizer_selection=wx.BoxSizer(wx.HORIZONTAL)
-        
-        
-        self.description_show = wx.RadioButton(self, -1, 'Show', style=wx.RB_GROUP)
-        self.description_hide = wx.RadioButton(self, -1, 'Hide')
-        
-        self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description,
-                   id=self.description_hide.GetId() )
-        
-        self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description,
-                   id=self.description_show.GetId() )
-        
-        self.model_description = wx.Button(self, -1, "More Details")
-     
-        
-        #self.page_info.save_radiobox_state( self.description_hide )
-        #self.page_info.save_radiobox_state( self.description_show )
-        
-        sizer_selection.Add( self.description_show )
-        sizer_selection.Add( (20,20)) 
-        sizer_selection.Add( self.description_hide )
-        sizer_selection.Add( (20,20)) 
-        sizer_selection.Add( self.model_description )
-        
-         
-        self.sizer_description=wx.BoxSizer(wx.HORIZONTAL)
-        self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 )
-       
-        boxsizer1.Add( sizer_selection) 
-        boxsizer1.Add( (20,20)) 
-        boxsizer1.Add( self.sizer_description) 
-    
-
-        sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
-        sizer.Layout()
-   
-   
-        
         
     def set_model_param_sizer(self, model):
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision 7c845cbc01c318cbb47a512ad1468742da9afd22)
+++ sansview/perspectives/fitting/fitpanel.py	(revision a07414556eb1f1ab4257288c9a6dfd76ef88922e)
@@ -134,8 +134,5 @@
         if selected_page.window_name in self.list_fitpage_name:
             self.list_fitpage_name.remove(selected_page.window_name)
-    
-        
-        
-        
+            
         
     def set_manager(self, manager):
Index: sansview/perspectives/fitting/modelpage.py
===================================================================
--- sansview/perspectives/fitting/modelpage.py	(revision 7c845cbc01c318cbb47a512ad1468742da9afd22)
+++ sansview/perspectives/fitting/modelpage.py	(revision a07414556eb1f1ab4257288c9a6dfd76ef88922e)
@@ -34,11 +34,11 @@
         description=""
         if self.model!=None:
-            #description = self.page_info.model.description
             description = self.model.description
-            self.set_model_param_sizer(self.model)
+            
+            self.select_model(self.model, self.model.name)
             self.set_model_description(description,self.sizer2)
-        
-    
-
+            
+     
+        
         
     def _on_display_description(self, event):
@@ -56,7 +56,5 @@
             @param event: wx.EVT_RADIOBUTTON
         """
-        ## save state of radiobox
-        #self.page_info. save_radiobox_state( self.description_hide )
-        #self.page_info. save_radiobox_state( self.description_show )
+        
         ## Show description
         if not self.description_show.GetValue():
@@ -64,9 +62,8 @@
             
         else:
-            #model=self.page_info.model
             description=""
             if self.model!=None:
-                #description = self.page_info.model.description
                 description = self.model.description
+                
             self.description = wx.StaticText( self,-1,str(description) )
             self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 )
@@ -293,8 +290,5 @@
         self.model_description.Bind(wx.EVT_BUTTON,self.on_button_clicked)
         self.model_description.SetToolTipString("Click Model Functions in HelpWindow...")
-        
-        #self.page_info.save_radiobox_state( self.description_hide )
-        #self.page_info.save_radiobox_state( self.description_show )
-        
+      
         sizer_selection.Add( self.description_show )
         sizer_selection.Add( (20,20)) 
Index: sansview/perspectives/fitting/pagestate.py
===================================================================
--- sansview/perspectives/fitting/pagestate.py	(revision b787e68c1ba3f939b02051b4663e38eee6a12ab3)
+++ sansview/perspectives/fitting/pagestate.py	(revision a07414556eb1f1ab4257288c9a6dfd76ef88922e)
@@ -1,5 +1,4 @@
 
 
-import wx
 import copy
 
@@ -45,7 +44,8 @@
         #contains link between a model and selected parameters to fit 
         self.param_toFit =[]
-        #dictionary of model type and model class
+        ##dictionary of model type and model class
         self.model_list_box = None
-       
+        ## save the state of the context menu
+        self.saved_states={}
         ## save  current value of combobox
         self.formfactorcombobox = ""
@@ -93,4 +93,10 @@
         obj.npts = copy.deepcopy(self.npts )
         obj.cb1 = copy.deepcopy(self.cb1)
+        for name, state in self.saved_states.iteritems():
+            copy_name = copy.deepcopy(name)
+            copy_state = state.clone()
+            obj.saved_states[copy_name]= copy_state
+                                           
+       
         
         return obj
