Index: invariantview/perspectives/invariant/invariant.py
===================================================================
--- invariantview/perspectives/invariant/invariant.py	(revision 1e3610d502f239cd8652dab2c4e5bbc4cba36b6f)
+++ invariantview/perspectives/invariant/invariant.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
@@ -258,9 +258,8 @@
         :param state: State object
         """
-        
         try:
             if datainfo is None:
                 raise RuntimeError, "invariant.set_state: datainfo parameter cannot be None in standalone mode"
-            datainfo.meta_data['invstate'].file = datainfo.meta_data['invstate'].file+"_copy"
+            datainfo.meta_data['invstate'].file = datainfo.meta_data['invstate'].file
             datainfo.name = datainfo.meta_data['invstate'].file
             datainfo.filename = datainfo.meta_data['invstate'].file
@@ -274,7 +273,6 @@
             # Make sure the user sees the invariant panel after loading
             self.parent.set_perspective(self.perspective)
-
             # set state
-            self.invariant_panel.set_state(state=temp_state,data=self.__data)                
+            self.invariant_panel.set_state(state=temp_state,data=self.__data)              
 
         except:
Index: invariantview/perspectives/invariant/invariant_panel.py
===================================================================
--- invariantview/perspectives/invariant/invariant_panel.py	(revision 1a3a03bf8a98b03b04c61ba913cd8ec43ac4e065)
+++ invariantview/perspectives/invariant/invariant_panel.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
@@ -205,4 +205,5 @@
             self.state = IState()
         else:
+            
             if not self.set_current_data(data):
                 return
@@ -211,14 +212,13 @@
 
             num = self.state.saved_state['state_num']
-            self.get_state_by_num(state_num=num)
-            
-            if num >0 :
+            
+            if num > 0 :
                 self._undo_enable()
             if num < len(state.state_list)-1:
                 self._redo_enable()
                 
-            
             # get bookmarks
             self.bookmark_num = len(self.state.bookmark_list)
+
             total_bookmark_num = self.bookmark_num+1
             for ind in range(1,total_bookmark_num):
@@ -229,8 +229,12 @@
                 id = wx.NewId()
                 self.popUpMenu.Append(id,name,str(''))
-                wx.EVT_MENU(self, id, self._back_to_bookmark)  
+                wx.EVT_MENU(self, id, self._back_to_bookmark) 
+
+            self.get_state_by_num(state_num=str(num))
+            
             self._get_input_list() 
+            
             self.new_state = False 
-
+            
 
     def get_background(self):
@@ -494,6 +498,8 @@
         elif event != None: 
             self._set_compute_state(state='compute')
+            self.button_bookmark.Enable(True)
             msg= "\n\nStarting a new invariant computation..."            
             wx.PostEvent(self.parent, StatusEvent(status=msg))
+            
 
         if self._data is None or self.err_check_on_data():
@@ -579,14 +585,15 @@
             self.state.timestamp= self._get_time_stamp()
             msg = self.state.__str__()
+            self.state.set_report_string()
             self.is_power_out = False
             wx.PostEvent(self.parent, StatusEvent(status = msg ))
-        
+
         #enable the button_ok for more details
         self.button_details.Enable()
-        
         self.button_details.SetFocus()
         if event != None: 
+            self.button_report.Enable(True)
             wx.PostEvent(self.parent, StatusEvent(status = '\nFinished invariant computation...'))
-    
+        
     def undo(self,event=None):
         """
@@ -594,5 +601,4 @@
         
         : param event: undo button event
-        
         """
         if event != None: event.Skip()
@@ -612,5 +618,4 @@
         self._info_state_num()
         
-
         
     def redo(self,event=None):
@@ -619,5 +624,4 @@
         
         : param event: redo button event
-        
         """
         if event != None: event.Skip()
@@ -636,4 +640,16 @@
         self._info_state_num()
         
+    def report(self, event=None):
+        """
+        Invoke report dialog panel
+        
+        : param event: report button event
+        """
+        from report_dialog import ReportDialog
+
+        report_string = self.state.report_str
+        dialog = ReportDialog(report_string, None, -1, "")
+        dialog.ShowModal()
+        
     def get_state_by_num(self,state_num=None):
         """
@@ -648,5 +664,5 @@
 
         backup_state_list = copy.deepcopy(self.state.state_list)
-
+        
         # get the previous state
         try:
@@ -656,5 +672,5 @@
         except :
             raise ValueError,  "No such state exists in history"
-
+        
         # get the state at pre_compute_num
         comp_state = copy.deepcopy(self.state.state_list[current_compute_num])
@@ -669,5 +685,5 @@
             except:
                 pass
-            
+          
         self.compute_invariant(event=None)
         # set the input params at the state at pre_state_num
@@ -693,5 +709,6 @@
         self.state.saved_state = current_state
         self.state.state_num = state_num
-
+        
+        
         
     def get_bookmark_by_num(self, num=None):
@@ -733,5 +750,5 @@
                 pass
         self.state.saved_state = copy.deepcopy(current_state)
-
+       
         self._enable_high_q_section(event=None)
         self._enable_low_q_section(event=None)
@@ -766,4 +783,6 @@
         self.button_undo.Disable()
         self.button_redo.Disable()
+        self.button_bookmark.Disable()
+        self.button_report.Disable()
         self.button_calculate.SetFocus()
         #self.SetupScrolling()
@@ -851,4 +870,5 @@
         self._redo_disable()
         
+        
     def _reset_state_list(self,data=None):
         """
@@ -870,4 +890,6 @@
 
         self.state.state_num = self.state.saved_state['state_num']
+        self.state.timestamp = "('00:00:00', '00/00/0000')"
+
         # Put only the current state in the list
         self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
@@ -923,4 +945,7 @@
         self._undo_enable()
         self._redo_disable()
+        self.button_bookmark.Enable(True)
+        self.button_report.Disable()
+       
         
     def _on_out_text(self, event):     
@@ -1269,4 +1294,6 @@
         """
         if event != None: 
+            self.button_bookmark.Enable(True)
+            self.button_report.Disable()
             print "enable fit==>event!=None"
 
@@ -1285,5 +1312,8 @@
         Disable or enable some button if the user enable low q extrapolation
         """
-        #if event != None: self._set_compute_state()
+        if event != None: 
+            self.button_bookmark.Enable(True)
+            self.button_report.Disable()
+            
         if self.enable_low_cbox.GetValue():
             self.npts_low_tcl.Enable()
@@ -1309,5 +1339,7 @@
         Enable editing power law section at low q range
         """
-        #if event != None: self._set_compute_state()
+        if event != None: 
+            self.button_bookmark.Enable(True)
+            self.button_report.Disable()
         if self.guinier.GetValue():
             self.power_law_low.SetValue(False)
@@ -1399,5 +1431,7 @@
         Enable and disable the power value editing
         """
-        #if event != None: self._set_compute_state()
+        if event != None: 
+            self.button_bookmark.Enable(True)
+            self.button_report.Disable()
         if self.fix_enable_high.IsEnabled():
             if self.fix_enable_high.GetValue():
@@ -1413,5 +1447,7 @@
         Disable or enable some button if the user enable high q extrapolation
         """
-        #if event != None: self._set_compute_state()
+        if event != None: 
+            self.button_bookmark.Enable(True)
+            self.button_report.Disable()
         if self.enable_high_cbox.GetValue():
             self.npts_high_tcl.Enable()
@@ -1668,4 +1704,6 @@
         self.undo_png = os.path.join(path,"undo.png")
         self.redo_png = os.path.join(path,"redo.png")
+        self.bookmark_png = os.path.join(path,"bookmark.png")
+        self.report_png = os.path.join(path,"report.png")
         self.save_png = os.path.join(path,"save.png")
         #undo button
@@ -1681,4 +1719,16 @@
         self.Bind(wx.EVT_BUTTON, self.redo, id=id)
         self.button_redo.Disable()   
+        #bookmark button
+        id = wx.NewId()
+        self.button_bookmark = wx.BitmapButton(self, id,wx.Bitmap(self.bookmark_png))#wx.Button(self, id, "Undo",size=(50,20))
+        self.button_bookmark.SetToolTipString("Bookmark: right-click on the panel to retrieve")
+        self.Bind(wx.EVT_BUTTON, self._on_bookmark, id=id)
+        #self.button_bookmark.Disable()
+        #report button
+        id = wx.NewId()
+        self.button_report = wx.BitmapButton(self, id,wx.Bitmap(self.report_png))#wx.Button(self, id, "Redo",size=(50,20))
+        self.button_report.SetToolTipString("Report the result of the computation")
+        self.Bind(wx.EVT_BUTTON, self.report, id=id)
+        #self.button_report.Disable()   
         #save button
         id = wx.NewId()
@@ -1687,7 +1737,9 @@
         self.Bind(wx.EVT_BUTTON, self._on_save_button, id=id)   
         self.button_save.Disable()  
-        self.save_button_sizer.AddMany([((PANEL_WIDTH/1.5,20), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0),
+        self.save_button_sizer.AddMany([((PANEL_WIDTH/2,20), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0),
                                    (self.button_undo, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10),
                                    (self.button_redo, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10),
+                                   (self.button_bookmark, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10),
+                                   (self.button_report, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10),
                                    (self.button_save, 0 ,wx.LEFT|wx.ADJUST_MINSIZE, 10)])        
     def _do_layout(self):
Index: invariantview/perspectives/invariant/invariant_state.py
===================================================================
--- invariantview/perspectives/invariant/invariant_state.py	(revision 4e1c362faa5def12383a4fd3550db72d838ee262)
+++ invariantview/perspectives/invariant/invariant_state.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
@@ -42,5 +42,12 @@
 bookmark_list = {}
 # list of input parameters (will be filled up on panel init) used by __str__ 
-input_list = {}   
+input_list = {'background_tcl':0,
+        'scale_tcl':0,
+        'contrast_tcl':0,
+        'porod_constant_tcl':'',
+        'npts_low_tcl':0,
+        'npts_high_tcl':0,
+        'power_high_tcl':0,
+        'power_low_tcl': 0}  
 # list of output parameters (order sensitive) used by __str__    
 output_list = [["qstar_low",                  "Q* from low Q extrapolation [1/(cm*A)]"],
@@ -84,7 +91,16 @@
         self.compute_num = 0
         self.state_num = 0
-        self.timestamp = None
+        self.timestamp = "('00:00:00', '00/00/0000')"
         self.container = None
-        
+        # report_html strings
+        import sans.perspectives.invariant as invariant
+        path = invariant.get_data_path(media='media')
+        path_report_html= os.path.join(path,"report_template.html")
+        html_template=open(path_report_html,"r")
+        self.template_str = html_template.read()
+        self.report_str = self.template_str
+        html_template.close()
+        
+
         
     def __str__(self):
@@ -199,5 +215,5 @@
         # Include warning msg
         state += "\n\nNote:\n" + self.container.warning_msg
-
+        
         return state
 
@@ -369,5 +385,4 @@
                             except:
                                 exec "temp_state['%s'] = '%s'"% (item,val)
-
                             
                     comp_entry = get_content('ns:comp_state', entry )
@@ -416,6 +431,62 @@
                         self.set_saved_state(name=item, value=val)
 
-
-            
+    def set_report_string(self):
+        """
+        Get the values (strings) from __str__ for report 
+        """
+        strings = self.__str__()
+    
+        # default string values
+        for num in range (1,19):
+            exec "s_%s = 'NA'"% str(num)
+        lines = strings.split('\n')
+        # get all string values from __str__()
+        for line in range(0,len(lines)):
+            if line == 1:
+                s_1 = lines[1]
+            elif line == 2:
+                s_2 = lines[2]
+            else:
+                item = lines[line].split(':')
+                item[0] = item[0].strip()
+                if item[0]== "scale":
+                    s_3 = item[1]
+                elif item[0] == "porod constant":
+                    s_4 = item[1]
+                elif item[0] == "background":
+                    s_5 = item[1]
+                elif item[0] == "contrast":
+                    s_6 = item[1]
+                elif item[0] == "Extrapolation":
+                    extra = item[1].split(";")
+                    bool_0 = extra[0].split("=")
+                    bool_1 = extra[1].split("=")
+                    s_7 = " "+bool_0[0]+" = "+bool_0[1]
+                    s_8 = " "+bool_1[0]+" = "+bool_1[1]
+                elif item[0]=="npts low":
+                    s_9 = item[1]
+                elif item[0]=="npts high":
+                    s_10 = item[1]
+                elif item[0] == "volume fraction":
+                    s_17 = item[1]
+                elif item[0] == "specific surface":
+                    s_18 = item[1]
+                elif item[0].split("(")[0].strip()=="power high":
+                    s_11 = item[0]+" ="+item[1]
+                elif item[0].split("(")[0].strip()=="power low":
+                    s_12 = item[0]+" ="+item[1]
+                elif item[0].split("[")[0].strip()=="Q* from low Q extrapolation":
+                    s_13 = item[1]
+                elif item[0].split("[")[0].strip()=="Q* from data":
+                    s_14 = item[1]
+                elif item[0].split("[")[0].strip()=="Q* from high Q extrapolation":
+                    s_15 = item[1]
+                elif item[0].split("[")[0].strip()=="total Q*":
+                    s_16 = item[1]
+                else:
+                    continue
+
+        self.report_str = str(self.template_str)% (s_1,s_2,s_3,s_4,s_5,s_6,s_7,s_8,s_9,s_10,s_11,s_12,s_13,s_14,s_15,s_16,s_17,s_18)
+
     def set_saved_state(self, name, value):
         """
Index: invariantview/perspectives/invariant/report_dialog.py
===================================================================
--- invariantview/perspectives/invariant/report_dialog.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
+++ invariantview/perspectives/invariant/report_dialog.py	(revision cb463b40545bccbeac64d10c722c2076b6c27aa0)
@@ -0,0 +1,119 @@
+
+################################################################################
+#This software was developed by the University of Tennessee as part of the
+#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+#project funded by the US National Science Foundation. 
+#
+#See the license text in license.txt
+#
+#copyright 2009, University of Tennessee
+################################################################################
+
+"""
+Dialog report panel to show and summarize the results of the invariant calculation.
+"""
+    
+
+import wx
+import sys,os
+import wx.html as html
+
+if sys.platform.count("win32")>0:
+    _STATICBOX_WIDTH = 450
+    PANEL_WIDTH = 500 
+    PANEL_HEIGHT = 700
+    FONT_VARIANT = 0
+else:
+    _STATICBOX_WIDTH = 480
+    PANEL_WIDTH = 530
+    PANEL_HEIGHT = 700
+    FONT_VARIANT = 1
+    
+
+        
+class ReportDialog(wx.Dialog):
+    """
+    The report dialog box. 
+    """
+    
+    def __init__(self,  string, *args, **kwds):
+        """
+        Initialization. The parameters added to Dialog are:
+        
+        :param string: report_string  from invariant_state
+        """
+        kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE
+        wx.Dialog.__init__(self, *args, **kwds)
+        # title
+        self.SetTitle("Report: Invariant computaion")
+        # size
+        self.SetSize((720, 650))
+        # font size 
+        self.SetWindowVariant(variant=FONT_VARIANT)
+        # report string
+        self.report_string =string
+        # layout
+        self._setup_layout()
+
+    def _setup_layout(self):
+        """
+        Set up layout
+        """
+        # panel for buttons
+        bpanel = wx.Panel(self, -1)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        
+        # buttons
+        id = wx.NewId()
+        button_save = wx.Button(self, id, "Save")
+        button_save.SetToolTipString("Save this report.")
+        button_save.Bind(wx.EVT_BUTTON, self.onSave, id = button_save.GetId()) 
+        hbox.Add(button_save)
+
+        id = wx.NewId()
+        button_preview = wx.Button(self, id, "Preview")
+        button_preview.SetToolTipString("Print preview this report.")
+        button_preview.Bind(wx.EVT_BUTTON, self.onPreview, id = button_preview.GetId()) 
+        #hbox.Add(button_preview)
+
+        id = wx.NewId()
+        button_print = wx.Button(self, id, "Print")
+        button_print.SetToolTipString("Print this report.")
+        button_print.Bind(wx.EVT_BUTTON, self.onPrint, id = button_print.GetId()) 
+        hbox.Add(button_print)
+        
+        
+        # panel for report page
+        panel = wx.Panel(self, -1)
+        vbox= wx.BoxSizer(wx.VERTICAL)
+        # html window
+        self.hwindow = html.HtmlWindow(panel, -1,style=wx.BORDER,size=(700,500))
+        # set the html page with the report string
+        self.hwindow.SetPage(self.report_string)
+        # add panels to boxsizers
+        hbox.Add(bpanel)
+        vbox.Add(hbox,40, wx.EXPAND)
+        vbox.Add(panel,500, wx.EXPAND)
+
+        self.SetSizerAndFit(vbox)
+        self.Centre()
+        self.Show(True)
+
+    def onSave(self,event):
+        """
+        """
+        pass
+    
+    def onPreview(self,event):
+        """
+        """
+        pass
+    
+    def onPrint(self,event):
+        """
+        """
+        gg=html.HtmlEasyPrinting(name="Printing", parentWindow=self)
+        
+        gg.PreviewText(self.report_string)
+        
+        
