Index: invariantview/perspectives/invariant/__init__.py
===================================================================
--- invariantview/perspectives/invariant/__init__.py	(revision 85a24d9fc0668bebd4141c0ae4a293aede591c0f)
+++ invariantview/perspectives/invariant/__init__.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -24,8 +24,8 @@
         media_path = os.path.join(path, media)
         if os.path.isdir(media_path):
-             module_media_path = os.path.join(media_path,'invariant_media')
-             if os.path.isdir(module_media_path):
-                 return module_media_path
-             return media_path
+            module_media_path = os.path.join(media_path, 'invariant_media')
+            if os.path.isdir(module_media_path):
+                return module_media_path
+            return media_path
    
     raise RuntimeError('Could not find invariant media files')
@@ -39,5 +39,5 @@
 
     """
-    data_files =[]
+    data_files = []
     path = get_data_path(media="media")
     for f in findall(path):
Index: invariantview/perspectives/invariant/help_panel.py
===================================================================
--- invariantview/perspectives/invariant/help_panel.py	(revision d7a39e5e4d2fdf0181a63b2cb239064dd754a674)
+++ invariantview/perspectives/invariant/help_panel.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -19,5 +19,5 @@
         explanation = help()
            
-        label_explain = wx.StaticText(self, -1, explanation, size=(350,320))
+        label_explain = wx.StaticText(self, -1, explanation, size=(350, 320))
             
         vbox.Add(label_explain, 0, wx.ALL|wx.EXPAND, 15)
@@ -51,5 +51,5 @@
         splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
         rpanel = wx.Panel(splitter, -1)
-        lpanel = wx.Panel(splitter, -1,style=wx.BORDER_SUNKEN)
+        lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN)
         
         vbox = wx.BoxSizer(wx.VERTICAL)
@@ -66,5 +66,5 @@
         vbox.Add(header, 0, wx.EXPAND)
        
-        vboxl= wx.BoxSizer(wx.VERTICAL)
+        vboxl = wx.BoxSizer(wx.VERTICAL)
         headerl = wx.Panel(lpanel, -1, size=(-1, 20))
        
@@ -81,11 +81,11 @@
         self.lhelp = html.HtmlWindow(lpanel, -1, style=wx.NO_BORDER)
         self.rhelp = html.HtmlWindow(rpanel, -1, style=wx.NO_BORDER, 
-                                     size=(500,-1))
+                                     size=(500, -1))
         import sans.perspectives.invariant as invariant
         path = invariant.get_data_path(media='media')
-        self.path= os.path.join(path,"invariant_help.html")
+        self.path = os.path.join(path,"invariant_help.html")
      
         self.rhelp.LoadPage(self.path)
-        page="""<html>
+        page = """<html>
             <body>
             <ul>
@@ -93,10 +93,10 @@
             </ul>
             </body>
-            </html>"""%self.path
+            </html>""" % self.path
         
         self.lhelp.SetPage(page)
-        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.OnLinkClicked )
+        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
         
-        vbox.Add(self.rhelp,1, wx.EXPAND)
+        vbox.Add(self.rhelp, 1, wx.EXPAND)
         vboxl.Add(self.lhelp, 1, wx.EXPAND)
         rpanel.SetSizer(vbox)
@@ -105,5 +105,5 @@
         
         vbox1 = wx.BoxSizer(wx.HORIZONTAL)
-        vbox1.Add(splitter,1,wx.EXPAND)
+        vbox1.Add(splitter, 1, wx.EXPAND)
         splitter.AppendWindow(lpanel, 200)
         splitter.AppendWindow(rpanel)
@@ -121,5 +121,9 @@
 
 class ViewApp(wx.App):
+    """
+    """
     def OnInit(self):
+        """
+        """
         frame = HelpWindow(None, -1, 'HelpWindow')    
         frame.Show(True)
Index: invariantview/perspectives/invariant/invariant.py
===================================================================
--- invariantview/perspectives/invariant/invariant.py	(revision 7a078643f880a7d4151c32547cc839eb098db2f3)
+++ invariantview/perspectives/invariant/invariant.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -11,15 +11,17 @@
 #copyright 2009, University of Tennessee
 ################################################################################
-import os
+#import os
 import sys
 import wx
 import copy
-import logging, time
-from sans.invariant import invariant
+import logging
+#import time
+#from sans.invariant import invariant
 
 from DataLoader.data_info import Data1D as LoaderData1D
-from sans.guiframe.dataFitting import Theory1D, Data1D
-
-from sans.guicomm.events import NewPlotEvent, StatusEvent
+from sans.guiframe.dataFitting import Theory1D
+from sans.guiframe.dataFitting import Data1D
+
+from sans.guicomm.events import NewPlotEvent
 from sans.guicomm.events import ERR_DATA
 from invariant_state import Reader as reader
@@ -142,5 +144,6 @@
         self.graph = graph
         invariant_option = "Compute invariant"
-        invariant_hint = "Will displays the invariant panel for futher computation"
+        invariant_hint = "Will displays the invariant panel for"
+        invairant_hint += " futher computation"
        
         for item in self.graph.plottables:
@@ -148,8 +151,10 @@
                 if issubclass(item.__class__,LoaderData1D):
            
-                    if item.name !="$I_{obs}(q)$" and item.name !="$P_{fit}(r)$":
+                    if item.name != "$I_{obs}(q)$" and \
+                        item.name != " $P_{fit}(r)$":
                         if hasattr(item, "group_id"):
                             return [[invariant_option, 
-                                        invariant_hint, self._compute_invariant]]
+                                        invariant_hint, 
+                                        self._compute_invariant]]
         return []   
 
@@ -220,10 +225,10 @@
         """
         self.panel = event.GetEventObject()
-        Plugin.on_perspective(self,event=event)
+        Plugin.on_perspective(self, event=event)
         for plottable in self.panel.graph.plottables:
             if plottable.name == self.panel.graph.selected_plottable:
-                ## put the errors values back to the model if the errors were hiden
-                ## before sending them to the fit engine
-                if len(self.err_dy)>0:
+                ## put the errors values back to the model if the errors 
+                ## were hiden before sending them to the fit engine
+                if len(self.err_dy) > 0:
                     dy = plottable.dy
                     if plottable.name in  self.err_dy.iterkeys():
@@ -260,5 +265,7 @@
             self.state_reader.write(filepath, current_plottable, state)
         else:
-            raise RuntimeError, "invariant.save_file: the data being saved is not a DataLoader.data_info.Data1D object" 
+            msg = "invariant.save_file: the data being saved is"
+            msg += " not a DataLoader.data_info.Data1D object" 
+            raise RuntimeError, msg
 
     def set_state(self, state, datainfo=None):    
@@ -273,9 +280,12 @@
             
             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
-            datainfo.name = datainfo.meta_data['invstate'].file
-            datainfo.filename = datainfo.meta_data['invstate'].file
+                msg = "invariant.set_state: datainfo parameter cannot"
+                msg += " be None in standalone mode"
+                raise RuntimeError, msg
+            
+            name = datainfo.meta_data['invstate'].file
+            datainfo.meta_data['invstate'].file = name
+            datainfo.name = name
+            datainfo.filename = name
             self.__data = datainfo
             self.__data.group_id = datainfo.filename
@@ -300,5 +310,6 @@
         after a .inv/.svs file is loaded 
         """
-        self.invariant_panel.set_state(state=self.temp_state,data=self.__data)
+        self.invariant_panel.set_state(state=self.temp_state,
+                                       data=self.__data)
         self.temp_state = None
         
@@ -312,9 +323,9 @@
         :param name: Data's name to use for the legend
         """
-        import copy
+        #import copy
         if data is None:
             new_plot = Theory1D(x=[], y=[], dy=None)
         else:
-            scale =self.invariant_panel.get_scale()
+            scale = self.invariant_panel.get_scale()
             background = self.invariant_panel.get_background()
             
@@ -335,10 +346,11 @@
         if data != None:
             name_head = name.split('-')
-            if name_head[0]=='Low':
+            if name_head[0] == 'Low':
                 self.invariant_panel.state.theory_lowQ = copy.deepcopy(new_plot)
-            elif name_head[0]=='High':
+            elif name_head[0] == 'High':
                 self.invariant_panel.state.theory_highQ = copy.deepcopy(new_plot)
 
-        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=self.__data.name))
+        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
+                                               title=self.__data.name))
         
     def plot_data(self, scale, background):
@@ -354,4 +366,5 @@
         if new_plot != None:
             self.invariant_panel.state.data = copy.deepcopy(new_plot)
-        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title=new_plot.name))
-        
+        wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
+                                               title=new_plot.name))
+        
Index: invariantview/perspectives/invariant/invariant_details.py
===================================================================
--- invariantview/perspectives/invariant/invariant_details.py	(revision d7a39e5e4d2fdf0181a63b2cb239064dd754a674)
+++ invariantview/perspectives/invariant/invariant_details.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -2,7 +2,7 @@
 import wx
 import sys
-
 import numpy
-from sans.guiframe.utils import format_number, check_float
+from sans.guiframe.utils import format_number
+from sans.guiframe.utils import check_float
 from invariant_widgets import OutputTextCtrl
 # Dimensions related to chart
@@ -16,5 +16,5 @@
 DEFAULT_QSTAR = 1.0  
   
-if sys.platform.count("win32")>0:
+if sys.platform.count("win32") > 0:
     _STATICBOX_WIDTH = 450
     PANEL_WIDTH = 500
@@ -28,5 +28,4 @@
     
   
-    
 class InvariantContainer(wx.Object):
     """
@@ -84,5 +83,6 @@
         else:
             try:
-                self.qstar_low_percent = float(self.qstar_low)/float(self.qstar_total)
+                self.qstar_low_percent = float(self.qstar_low)\
+                                            /float(self.qstar_total)
             except:
                 self.qstar_low_percent = 'error'
@@ -92,5 +92,6 @@
         else:
             try:
-                self.qstar_high_percent = float(self.qstar_high)/float(self.qstar_total)
+                self.qstar_high_percent = float(self.qstar_high)\
+                                                /float(self.qstar_total)
             except:
                 self.qstar_high_percent = 'error'
@@ -105,8 +106,9 @@
             return 
         if self.qstar_total == 0:
-             self.existing_warning = True
-             self.warning_msg = "Invariant is zero. \n"
-             self.warning_msg += "The calculations are likely to be unreliable!\n"
-             return 
+            self.existing_warning = True
+            self.warning_msg = "Invariant is zero. \n"
+            self.warning_msg += "The calculations are likely "
+            self.warning_msg += "to be unreliable!\n"
+            return 
         #warning to the user when the extrapolated invariant is greater than %5
         msg = ''
@@ -117,6 +119,8 @@
         if self.qstar_low_percent == 'error':
             self.existing_warning = True
-            msg = 'Error occurred when computing extrapolated invariant at low-Q region.\n'
-        elif self.qstar_low_percent is not None and self.qstar_low_percent >= 0.05:
+            msg = "Error occurred when computing extrapolated invariant"
+            msg += " at low-Q region.\n"
+        elif self.qstar_low_percent is not None and \
+             self.qstar_low_percent >= 0.05:
             self.existing_warning = True
             msg += "Extrapolated contribution at Low Q is higher "
@@ -124,6 +128,8 @@
         if self.qstar_high_percent == 'error':
             self.existing_warning = True
-            msg += 'Error occurred when computing extrapolated invariant at high-Q region.\n'
-        elif self.qstar_high_percent is not None and self.qstar_high_percent >= 0.05:
+            msg += 'Error occurred when computing extrapolated'
+            msg += ' invariant at high-Q region.\n'
+        elif self.qstar_high_percent is not None and \
+            self.qstar_high_percent >= 0.05:
             self.existing_warning = True
             msg += "Extrapolated contribution at High Q is higher "
@@ -139,5 +145,6 @@
             self.warning_msg = ''
             self.warning_msg += msg 
-            self.warning_msg += "The calculations are likely to be unreliable!\n"
+            self.warning_msg += "The calculations are likely to be"
+            self.warning_msg += " unreliable!\n"
         else:
             self.warning_msg = "No Details on calculations available...\n"
@@ -150,5 +157,5 @@
                                     title="Invariant Details",
                                     size=(PANEL_WIDTH, PANEL_HEIGHT)):
-        wx.Dialog.__init__(self, parent=parent, id=id,title=title,size=size)
+        wx.Dialog.__init__(self, parent=parent, id=id, title=title, size=size)
         
         #Font size 
@@ -184,10 +191,11 @@
         Define main sizers needed for this panel
         """
-        #Box sizers must be defined first before defining buttons/textctrls (MAC).
+        #Box sizers must be defined first before defining buttons/textctrls
+        # (MAC).
         self.main_sizer = wx.BoxSizer(wx.VERTICAL)
         #Sizer related to chart
         chart_box = wx.StaticBox(self, -1, "Invariant Chart")
         self.chart_sizer = wx.StaticBoxSizer(chart_box, wx.VERTICAL)
-        self.chart_sizer.SetMinSize((PANEL_WIDTH - 50,110))
+        self.chart_sizer.SetMinSize((PANEL_WIDTH - 50, 110))
         #Sizer related to invariant values
         self.invariant_sizer =  wx.GridBagSizer(4, 4)
@@ -196,9 +204,9 @@
                                                       wx.HORIZONTAL)
 
-        self.invariant_box_sizer.SetMinSize((PANEL_WIDTH - 50,-1))
+        self.invariant_box_sizer.SetMinSize((PANEL_WIDTH - 50, -1))
         #Sizer related to warning message
         warning_box = wx.StaticBox(self, -1, "Warning")
         self.warning_sizer = wx.StaticBoxSizer(warning_box, wx.VERTICAL)
-        self.warning_sizer.SetMinSize((PANEL_WIDTH-50,-1))
+        self.warning_sizer.SetMinSize((PANEL_WIDTH-50, -1))
         #Sizer related to button
         self.button_sizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -221,81 +229,96 @@
         invariant_txt = wx.StaticText(self, -1, 'Q* from Data ')
         invariant_txt.SetToolTipString("Invariant in the data set's Q range.")
-        self.invariant_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1))
-        self.invariant_tcl.SetToolTipString("Invariant in the data set's Q range.")
-        self.invariant_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1))
-        self.invariant_err_tcl.SetToolTipString("Uncertainty on the invariant from data's range.")
+        self.invariant_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        hint_msg = "Invariant in the data set's Q range."
+        self.invariant_tcl.SetToolTipString(hint_msg)
+        self.invariant_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        hint_msg = "Uncertainty on the invariant from data's range."
+        self.invariant_err_tcl.SetToolTipString(hint_msg)
         invariant_units_txt = wx.StaticText(self, -1, unit_invariant)
-        invariant_units_txt.SetToolTipString("Unit of the invariant from data's Q range")
+        hint_msg = "Unit of the invariant from data's Q range"
+        invariant_units_txt.SetToolTipString(hint_msg)
        
         invariant_low_txt = wx.StaticText(self, -1, 'Q* from Low-Q')
-        invariant_low_txt.SetToolTipString("Extrapolated invariant from low-Q range.")
-        self.invariant_low_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1))
-        self.invariant_low_tcl.SetToolTipString("Extrapolated invariant from low-Q range.")
-        self.invariant_low_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1))
-        self.invariant_low_err_tcl.SetToolTipString("Uncertainty on the invariant from low-Q range.")
-        invariant_low_units_txt = wx.StaticText(self, -1,  unit_invariant)
-        invariant_low_units_txt.SetToolTipString("Unit of the extrapolated invariant from  low-Q range")
+        hint_msg = "Extrapolated invariant from low-Q range."
+        invariant_low_txt.SetToolTipString(hint_msg)
+        self.invariant_low_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1))
+        hint_msg = "Extrapolated invariant from low-Q range."
+        self.invariant_low_tcl.SetToolTipString(hint_msg)
+        self.invariant_low_err_tcl = OutputTextCtrl(self, -1,
+                                                    size=(_BOX_WIDTH, -1))
+        hint_msg = "Uncertainty on the invariant from low-Q range."
+        self.invariant_low_err_tcl.SetToolTipString(hint_msg)
+        invariant_low_units_txt = wx.StaticText(self, -1, unit_invariant)
+        hint_msg = "Unit of the extrapolated invariant from  low-Q range"
+        invariant_low_units_txt.SetToolTipString(hint_msg)
         
         invariant_high_txt = wx.StaticText(self, -1, 'Q* from High-Q')
-        invariant_high_txt.SetToolTipString("Extrapolated invariant from  high-Q range")
-        self.invariant_high_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1))
-        self.invariant_high_tcl.SetToolTipString("Extrapolated invariant from  high-Q range")
-        self.invariant_high_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1))
-        self.invariant_high_err_tcl.SetToolTipString("Uncertainty on the invariant from high-Q range.")
-        invariant_high_units_txt = wx.StaticText(self, -1,  unit_invariant)
-        invariant_high_units_txt.SetToolTipString("Unit of the extrapolated invariant from  high-Q range")
+        hint_msg = "Extrapolated invariant from  high-Q range"
+        invariant_high_txt.SetToolTipString(hint_msg)
+        self.invariant_high_tcl = OutputTextCtrl(self, -1,
+                                                 size=(_BOX_WIDTH, -1))
+        hint_msg = "Extrapolated invariant from  high-Q range"
+        self.invariant_high_tcl.SetToolTipString(hint_msg)
+        self.invariant_high_err_tcl = OutputTextCtrl(self, -1,
+                                                     size=(_BOX_WIDTH, -1))
+        hint_msg = "Uncertainty on the invariant from high-Q range."
+        self.invariant_high_err_tcl.SetToolTipString()
+        invariant_high_units_txt = wx.StaticText(self, -1, unit_invariant)
+        hint_msg = "Unit of the extrapolated invariant from  high-Q range"
+        invariant_high_units_txt.SetToolTipString(hint_msg)
    
         #Invariant low
         iy = 0
         ix = 0 
-        self.invariant_sizer.Add(invariant_low_txt, (iy, ix), (1,1),
+        self.invariant_sizer.Add(invariant_low_txt, (iy, ix), (1, 1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.invariant_sizer.Add(self.invariant_low_tcl, (iy, ix), (1,1),
+        self.invariant_sizer.Add(self.invariant_low_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix += 1
         self.invariant_sizer.Add( wx.StaticText(self, -1, uncertainty),
-                         (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix += 1
-        self.invariant_sizer.Add(self.invariant_low_err_tcl, (iy, ix), (1,1),
+                         (iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix += 1
+        self.invariant_sizer.Add(self.invariant_low_err_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 1
         self.invariant_sizer.Add(invariant_low_units_txt
-                         ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
+                         ,(iy, ix), (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
         #Invariant 
         iy += 1
         ix = 0 
-        self.invariant_sizer.Add(invariant_txt, (iy, ix), (1,1),
+        self.invariant_sizer.Add(invariant_txt, (iy, ix), (1, 1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.invariant_sizer.Add(self.invariant_tcl, (iy, ix), (1,1),
+        self.invariant_sizer.Add(self.invariant_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix += 1
         self.invariant_sizer.Add(wx.StaticText(self, -1, uncertainty),
-                         (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix += 1
-        self.invariant_sizer.Add(self.invariant_err_tcl, (iy, ix), (1,1),
+                         (iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix += 1
+        self.invariant_sizer.Add(self.invariant_err_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix +=1
         self.invariant_sizer.Add(invariant_units_txt
-                         ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
+                         ,(iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
         #Invariant high
         iy += 1
         ix = 0 
-        self.invariant_sizer.Add(invariant_high_txt, (iy, ix), (1,1),
+        self.invariant_sizer.Add(invariant_high_txt, (iy, ix), (1, 1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.invariant_sizer.Add(self.invariant_high_tcl, (iy, ix), (1,1),
+        self.invariant_sizer.Add(self.invariant_high_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix += 1
         self.invariant_sizer.Add(wx.StaticText(self, -1, uncertainty),
-                         (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix += 1
-        self.invariant_sizer.Add(self.invariant_high_err_tcl, (iy, ix), (1,1),
+                         (iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
+        ix += 1
+        self.invariant_sizer.Add(self.invariant_high_err_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix += 1
         self.invariant_sizer.Add(invariant_high_units_txt
-                         ,(iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        self.invariant_box_sizer.Add(self.invariant_sizer, 0, wx.TOP|wx.BOTTOM, 10)  
+                         ,(iy, ix), (1, 1),wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        self.invariant_box_sizer.Add(self.invariant_sizer, 0,
+                                     wx.TOP|wx.BOTTOM, 10)  
        
     def _layout_warning(self):
@@ -319,5 +342,5 @@
         button_ok.SetToolTipString("Give Details on Computation")
         self.Bind(wx.EVT_BUTTON, self.on_close, id=id)
-        self.button_sizer.AddMany([((20,20), 0 , wx.LEFT, 350),
+        self.button_sizer.AddMany([((20, 20), 0 , wx.LEFT, 350),
                                    (button_ok, 0 , wx.RIGHT, 10)])
     def _do_layout(self):
@@ -341,10 +364,16 @@
         Set value of txtcrtl
         """
-        self.invariant_tcl.SetValue(format_number(self.qstar_container.qstar))
-        self.invariant_err_tcl.SetValue(format_number(self.qstar_container.qstar_err)) 
-        self.invariant_low_tcl.SetValue(format_number(self.qstar_container.qstar_low))
-        self.invariant_low_err_tcl.SetValue(format_number(self.qstar_container.qstar_low_err)) 
-        self.invariant_high_tcl.SetValue(format_number(self.qstar_container.qstar_high))
-        self.invariant_high_err_tcl.SetValue(format_number(self.qstar_container.qstar_high_err)) 
+        value = format_number(self.qstar_container.qstar)
+        self.invariant_tcl.SetValue(value)
+        value = format_number(self.qstar_container.qstar_err)
+        self.invariant_err_tcl.SetValue(value) 
+        value = format_number(self.qstar_container.qstar_low)
+        self.invariant_low_tcl.SetValue(value)
+        value = format_number(self.qstar_container.qstar_low_err)
+        self.invariant_low_err_tcl.SetValue(value) 
+        value = format_number(self.qstar_container.qstar_high)
+        self.invariant_high_tcl.SetValue(value)
+        value = format_number(self.qstar_container.qstar_high_err)
+        self.invariant_high_err_tcl.SetValue(value) 
 
     def get_scale(self, percentage, scale_name='scale'):
@@ -361,5 +390,6 @@
             scale = RECTANGLE_SCALE
             self.warning_msg += "Receive an invalid scale for %s\n"
-            self.warning_msg += "check this value : %s\n"%(str(scale_name),str(percentage))
+            self.warning_msg += "check this value : %s\n"%(str(scale_name),
+                                                           str(percentage))
         return  scale
     
@@ -388,6 +418,7 @@
             gc = wx.GraphicsContext.Create(dc)
         except NotImplementedError:
-            dc.DrawText("This build of wxPython does not support the wx.GraphicsContext "
-                        "family of classes.", 25, 25)
+            msg = "This build of wxPython does not support "
+            msg += "the wx.GraphicsContext family of classes."
+            dc.DrawText(msg, 25, 25)
             return
         #Start the drawing
Index: invariantview/perspectives/invariant/invariant_panel.py
===================================================================
--- invariantview/perspectives/invariant/invariant_panel.py	(revision effce1d8fcb1513f63c6814b6c31007a20e76501)
+++ invariantview/perspectives/invariant/invariant_panel.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -3,17 +3,20 @@
 
 """
-
+import copy
+import time
+import sys
+import os
 import wx
-
-import sys,os
-
 from wx.lib.scrolledpanel import ScrolledPanel
 from sans.invariant import invariant
-from sans.guiframe.utils import format_number, check_float
+from sans.guiframe.utils import format_number
+from sans.guiframe.utils import check_float
 from sans.guicomm.events import NewPlotEvent, StatusEvent
-from invariant_details import InvariantDetailsPanel, InvariantContainer
-from invariant_widgets import OutputTextCtrl, InvTextCtrl
+from invariant_details import InvariantDetailsPanel
+from invariant_details import InvariantContainer
+from invariant_widgets import OutputTextCtrl
+from invariant_widgets import InvTextCtrl
 from invariant_state import InvariantState as IState
-import copy,time
+
 # The minimum q-value to be used when extrapolating
 Q_MINIMUM  = 1e-5
@@ -36,5 +39,5 @@
 
 
-if sys.platform.count("win32")>0:
+if sys.platform.count("win32") > 0:
     _STATICBOX_WIDTH = 450
     PANEL_WIDTH = 500 
@@ -58,7 +61,7 @@
     ## Flag to tell the AUI manager to put this panel in the center pane
     CENTER_PANE = True
-    def __init__(self, parent, data=None, manager=None,*args, **kwds):
-        kwds["size"]= (PANEL_WIDTH, PANEL_HEIGHT)
-        kwds["style"]= wx.FULL_REPAINT_ON_RESIZE
+    def __init__(self, parent, data=None, manager=None, *args, **kwds):
+        kwds["size"] = (PANEL_WIDTH, PANEL_HEIGHT)
+        kwds["style"] = wx.FULL_REPAINT_ON_RESIZE
         ScrolledPanel.__init__(self, parent=parent, *args, **kwds)
         self.SetupScrolling()
@@ -108,5 +111,6 @@
             if len(self._data.x[self._data.x==0]) > 0:
                 flag = True
-                msg = "Invariant: one of your q-values is zero. Delete that entry before proceeding"
+                msg = "Invariant: one of your q-values is zero. "
+                msg += "Delete that entry before proceeding"
                 self.hint_msg_txt.SetLabel(msg)
                 wx.PostEvent(self.parent, StatusEvent(status=msg,
@@ -137,4 +141,5 @@
             self._reset_state_list()
         return True  
+    
     def set_message(self):
         """
@@ -147,9 +152,11 @@
                 self.hint_msg_txt.SetForegroundColour("red")
     
-                wx.PostEvent(self.parent,StatusEvent(status=msg,info="warning"))
+                wx.PostEvent(self.parent,
+                             StatusEvent(status=msg,info="warning"))
             else:
                 msg = "For more information, click on Details button."
                 self.hint_msg_txt.SetForegroundColour("black")
-                wx.PostEvent(self.parent,StatusEvent(status=msg,info="info"))
+                wx.PostEvent(self.parent,
+                             StatusEvent(status=msg,info="info"))
             self.hint_msg_txt.SetLabel(msg)
             
@@ -178,5 +185,5 @@
             if num > 0 :
                 self._undo_enable()
-            if num < len(state.state_list)-1:
+            if num < len(state.state_list) - 1:
                 self._redo_enable()
                 
@@ -184,5 +191,5 @@
             self.bookmark_num = len(self.state.bookmark_list)
 
-            total_bookmark_num = self.bookmark_num+1
+            total_bookmark_num = self.bookmark_num + 1
             for ind in range(1,total_bookmark_num):
                 #bookmark_num = ind
@@ -197,5 +204,6 @@
             
             self._get_input_list() 
-            #make sure that the data is reset (especially when loaded from a inv file)
+            #make sure that the data is reset (especially
+            # when loaded from a inv file)
             self.state.data = self._data
 
@@ -238,5 +246,6 @@
             return float(background)
         else:
-            raise ValueError, "Receive invalid value for background : %s"%(background)
+            msg = "Receive invalid value for background : %s" % (background)
+            raise ValueError, msg
     
     def get_scale(self):
@@ -248,11 +257,12 @@
             raise ValueError, "Need a background"
         if check_float(self.scale_tcl):
-            if float(scale)<= 0.0:
+            if float(scale) <= 0.0:
                 self.scale_tcl.SetBackgroundColour("pink")
                 self.scale_tcl.Refresh()
-                raise ValueError, "Receive invalid value for scale: %s"%(scale)
+                msg = "Receive invalid value for scale: %s" % (scale)
+                raise ValueError, msg
             return float(scale)
         else:
-            raise ValueError, "Receive invalid value for scale : %s"%(scale)
+            raise ValueError, "Receive invalid value for scale : %s" % (scale)
         
     def get_contrast(self):
@@ -262,5 +272,5 @@
         par_str = self.contrast_tcl.GetValue().strip()
         contrast = None
-        if par_str !="" and check_float(self.contrast_tcl):
+        if par_str !=" " and check_float(self.contrast_tcl):
             contrast = float(par_str)
         return contrast
@@ -284,5 +294,5 @@
         par_str = self.porod_constant_tcl.GetValue().strip()
         porod_const = None
-        if par_str !="" and check_float(self.porod_constant_tcl):
+        if par_str != "" and check_float(self.porod_constant_tcl):
             porod_const = float(par_str)
         return porod_const
@@ -294,5 +304,5 @@
             try:
                 v, dv = inv.get_volume_fraction_with_error(contrast=contrast, 
-                                                           extrapolation=extrapolation)
+                                                extrapolation=extrapolation)
                 self.volume_tcl.SetValue(format_number(v))
                 self.volume_err_tcl.SetValue(format_number(dv))
@@ -300,5 +310,6 @@
                 self.volume_tcl.SetValue(format_number(None))
                 self.volume_err_tcl.SetValue(format_number(None))
-                msg= "Error occurred computing volume fraction: %s"%sys.exc_value
+                msg = "Error occurred computing volume "
+                msg += " fraction: %s" % sys.exc_value
                 wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                       info="error",
@@ -318,5 +329,6 @@
                 self.surface_tcl.SetValue(format_number(None))
                 self.surface_err_tcl.SetValue(format_number(None))
-                msg = "Error occurred computing specific surface: %s"%sys.exc_value
+                msg = "Error occurred computing "
+                msg += "specific surface: %s" % sys.exc_value
                 wx.PostEvent(self.parent, StatusEvent(status=msg, info="error",
                                                        type="stop"))
@@ -338,5 +350,6 @@
             self.invariant_total_tcl.SetValue(format_number(None))
             self.invariant_total_err_tcl.SetValue(format_number(None))
-            msg= "Error occurred computing invariant using extrapolation: %s"%sys.exc_value
+            msg = "Error occurred computing invariant using"
+            msg += " extrapolation: %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop"))  
             
@@ -359,6 +372,8 @@
                 self.inv_container.qstar_low_err = "ERROR"
                 self._manager.plot_theory(name="Low-Q extrapolation")
-                msg= "Error occurred computing low-Q invariant: %s"%sys.exc_value
-                wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop"))
+                msg = "Error occurred computing low-Q "
+                msg += "invariant: %s" % sys.exc_value
+                wx.PostEvent(self.parent,
+                             StatusEvent(status=msg, type="stop"))
         else:
             try:
@@ -378,5 +393,6 @@
                 power_high = inv.get_extrapolation_power(range='high') 
                 self.power_high_tcl.SetValue(format_number(power_high))
-                high_out_data = inv.get_extra_data_high(q_end=qmax_plot,npts=500)
+                high_out_data = inv.get_extra_data_high(q_end=qmax_plot,
+                                                        npts=500)
                 self._manager.plot_theory(data=high_out_data,
                                            name="High-Q extrapolation")
@@ -385,6 +401,8 @@
                 self.inv_container.qstar_high_err = "ERROR"
                 self._manager.plot_theory(name="High-Q extrapolation")
-                msg= "Error occurred computing high-Q invariant: %s"%sys.exc_value
-                wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop"))
+                msg = "Error occurred computing high-Q "
+                msg += "invariant: %s" % sys.exc_value
+                wx.PostEvent(self.parent, StatusEvent(status=msg,
+                                                      type="stop"))
         else:
             try:
@@ -420,5 +438,6 @@
                     if low_q :
                         #Raise error only when qstar at low q is requested
-                        msg = "Expect float for power at low q , got %s"%(power_low)
+                        msg = "Expect float for power at low q, "
+                        msg += " got %s" % (power_low)
                         raise ValueError, msg
        
@@ -429,5 +448,6 @@
         else:
             if low_q:
-                msg = "Expect float for number of points at low q , got %s"%(npts_low)
+                msg = "Expect float for number of points at low q,"
+                msg += " got %s" % (npts_low)
                 raise ValueError, msg
         #Set the invariant calculator
@@ -454,5 +474,6 @@
                 if high_q :
                     #Raise error only when qstar at high q is requested
-                    msg = "Expect float for power at high q , got %s"%(power_high)
+                    msg = "Expect float for power at high q,"
+                    msg += " got %s" % (power_high)
                     raise ValueError, msg
                           
@@ -462,5 +483,6 @@
         else:
             if high_q:
-                msg = "Expect float for number of points at high q , got %s"%(npts_high)
+                msg = "Expect float for number of points at high q,"
+                msg += " got %s" % (npts_high)
                 raise ValueError, msg
         inv.set_extrapolation(range="high", npts=npts_high,
@@ -483,5 +505,6 @@
         """
         if self._data == None:
-            msg = "\n\nData must be loaded first in order to perform a compution..."
+            msg = "\n\nData must be loaded first in order"
+            msg += " to perform a compution..."
             wx.PostEvent(self.parent, StatusEvent(status=msg))
         # set a state for this computation for saving
@@ -502,6 +525,6 @@
             scale = self.get_scale()
         except:
-            msg= "Invariant Error: %s"%(sys.exc_value)
-            wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop"))
+            msg = "Invariant Error: %s" % (sys.exc_value)
+            wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop"))
             return
         
@@ -516,5 +539,5 @@
             inv, npts_high = self.set_extrapolation_high(inv=inv, high_q=high_q)
         except:
-            msg = "Error occurred computing invariant: %s"%sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status=msg,
                                                  info="warning",type="stop"))
@@ -532,7 +555,8 @@
             
         except:
-            msg= "Error occurred computing invariant: %s"%sys.exc_value
+            msg= "Error occurred computing invariant: %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status=msg, 
-                                                  info="warning",type="stop"))
+                                                  info="warning",
+                                                  type="stop"))
             return
        
@@ -549,18 +573,22 @@
         try:
             #Compute volume and set value to txtcrtl
-            self.get_volume(inv=inv, contrast=contrast, extrapolation=extrapolation)
+            self.get_volume(inv=inv, contrast=contrast,
+                            extrapolation=extrapolation)
             #compute surface and set value to txtcrtl
         except:
-            msg = "Error occurred computing invariant: %s"%sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status=msg,
-                                                  info="warning",type="stop"))
+                                                  info="warning",
+                                                  type="stop"))
         try:
-            self.get_surface(inv=inv, contrast=contrast, porod_const=porod_const, 
+            self.get_surface(inv=inv, contrast=contrast,
+                                    porod_const=porod_const, 
                                     extrapolation=extrapolation)
             
         except:
-            msg = "Error occurred computing invariant: %s"%sys.exc_value
+            msg = "Error occurred computing invariant: %s" % sys.exc_value
             wx.PostEvent(self.parent, StatusEvent(status=msg,
-                                                  info="warning",type="stop"))
+                                                  info="warning",
+                                                  type="stop"))
             
         #compute percentage of each invariant
@@ -583,7 +611,10 @@
         
         if event != None: 
-            if not self.button_report.IsEnabled(): self.button_report.Enable(True)
-            if not self.button_save.IsEnabled(): self.button_save.Enable(True)
-            wx.PostEvent(self.parent, StatusEvent(status = '\nFinished invariant computation...'))
+            if not self.button_report.IsEnabled():
+                self.button_report.Enable(True)
+            if not self.button_save.IsEnabled():
+                self.button_save.Enable(True)
+            wx.PostEvent(self.parent,
+                StatusEvent(status='\nFinished invariant computation...'))
             
 
@@ -594,6 +625,8 @@
         : param event: undo button event
         """
-        if event != None: event.Skip()
-        if self.state.state_num <0: return
+        if event != None: 
+            event.Skip()
+        if self.state.state_num < 0:
+            return
         self.is_power_out = True
         # get the previous state_num
@@ -601,5 +634,5 @@
         self.get_state_by_num(state_num=str(pre_state_num))
         
-        if float(pre_state_num) <=0:
+        if float(pre_state_num) <= 0:
             self._undo_disable()
         else:
@@ -617,5 +650,6 @@
         : param event: redo button event
         """
-        if event != None: event.Skip()
+        if event != None:
+            event.Skip()
         self.is_power_out = True
         # get the next state_num
@@ -663,5 +697,6 @@
         try:
             current_state = copy.deepcopy(self.state.state_list[str(state_num)])
-            # get the previously computed state number (computation before the state changes happened)
+            # get the previously computed state number 
+            #(computation before the state changes happened)
             current_compute_num = str(current_state['compute_num'])
         except :
@@ -789,5 +824,7 @@
         name = str(obj.GetName())
         value = str(obj.GetValue())
-        rb_list = [['power_law_low','guinier'],['fit_enable_low','fix_enable_low'],['fit_enable_high','fix_enable_high']]
+        rb_list = [['power_law_low','guinier'],
+                   ['fit_enable_low','fix_enable_low'],
+                   ['fit_enable_high','fix_enable_high']]
 
         try:
@@ -797,5 +834,6 @@
             exec "self.state.saved_state['%s'] = %s" %  (name, value)
             
-            # set the count part of radio button clicked False for the saved_state
+            # set the count part of radio button clicked 
+            #False for the saved_state
             for title,content in rb_list:
                 if name ==  title:
@@ -808,8 +846,8 @@
             
             # Instead of changing the future, create a new future.
-            max_state_num = len(self.state.state_list)-1   
+            max_state_num = len(self.state.state_list) - 1   
             self.state.saved_state['state_num'] = max_state_num   
             
-            self.state.saved_state['state_num'] +=1
+            self.state.saved_state['state_num'] += 1
             self.state.state_num = self.state.saved_state['state_num']
             self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
@@ -825,5 +863,6 @@
         Notify the compute_invariant state to self.state
         
-        : param state: set 'compute' when the computation is activated by the 'compute' button, else None
+        : param state: set 'compute' when the computation is
+        activated by the 'compute' button, else None
         
         """
@@ -838,6 +877,7 @@
         self.state.saved_state['state_num'] = max_state_num        
         # A new computation is also A state
-        temp_saved_states = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
-        temp_saved_states['state_num'] +=1
+        #copy.deepcopy(self.state.saved_state)
+        temp_saved_states = self.state.clone_state()
+        temp_saved_states['state_num'] += 1
         self.state.state_num = temp_saved_states['state_num']
 
@@ -847,7 +887,9 @@
             temp_saved_states['compute_num'] = self.state.state_num
         self.state.saved_state= copy.deepcopy(temp_saved_states)
-        self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
-        
-        # A computation is a new state, so delete the states with any higher state numbers
+        #copy.deepcopy(self.state.saved_state)
+        self.state.state_list[str(self.state.state_num)] = self.state.clone_state()
+        
+        # A computation is a new state, so delete the states with any higher
+        # state numbers
         for i in range(self.state.state_num+1,len(self.state.state_list)):
             try:
@@ -860,10 +902,12 @@
         
         
-    def _reset_state_list(self,data=None):
-        """
-        Reset the state_list just before data was loading: Used in 'set_current_data()'
+    def _reset_state_list(self, data=None):
+        """
+        Reset the state_list just before data was loading:
+        Used in 'set_current_data()'
         """
         #if data == None: return
-        #temp_state = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
+        #temp_state = self.state.clone_state()
+        #copy.deepcopy(self.state.saved_state)
         # Clear the list 
         self.state.state_list.clear()
@@ -882,5 +926,6 @@
 
         # 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)
+        #copy.deepcopy(self.state.saved_state)
+        self.state.state_list[str(self.state.state_num)] = self.state.clone_state()
         self._undo_disable()
         
@@ -927,5 +972,6 @@
                     self.state.saved_state['state_num'] += 1
             self.state.state_num = self.state.saved_state['state_num']
-            self.state.state_list[str(self.state.state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
+            #copy.deepcopy(self.state.saved_state)
+            self.state.state_list[str(self.state.state_num)] = self.state.clone_state()
         except:
             pass
@@ -976,5 +1022,6 @@
         self.popUpMenu = wx.Menu()
         id = wx.NewId()
-        self._bmark = wx.MenuItem(self.popUpMenu,id,"BookMark"," Bookmark the panel to recall it later")
+        self._bmark = wx.MenuItem(self.popUpMenu,id,"BookMark",
+                                  " Bookmark the panel to recall it later")
         self.popUpMenu.AppendItem(self._bmark)
         self._bmark.Enable(True)
@@ -985,5 +1032,6 @@
     def _on_bookmark(self,event):
         """
-        Save the panel state in memory and add the list on the popup menu on bookmark context menu event
+        Save the panel state in memory and add the list on
+        the popup menu on bookmark context menu event
         """ 
         if self._data == None: return
@@ -1010,5 +1058,6 @@
         state = self.state.clone_state()
         comp_state = copy.deepcopy(self.state.state_list[str(compute_num)])
-        self.state.bookmark_list[self.bookmark_num] = [my_time,date,state,comp_state]
+        self.state.bookmark_list[self.bookmark_num] = [my_time, date,
+                                                       state,comp_state]
         self.state.toXML(self, doc=None, entry_node=None)
         
@@ -1017,5 +1066,6 @@
     def _back_to_bookmark(self,event):
         """
-        Bring the panel back to the state of bookmarked requested by context menu event
+        Bring the panel back to the state of bookmarked requested by
+        context menu event
         and set it as a new state
         """
@@ -1032,5 +1082,6 @@
         
         self.state.saved_state['state_num'] = state_num
-        self.state.state_list[str(state_num)] = self.state.clone_state()#copy.deepcopy(self.state.saved_state)
+        #copy.deepcopy(self.state.saved_state)
+        self.state.state_list[str(state_num)] = self.state.clone_state()
         self.state.state_num = state_num
         self._undo_enable()
@@ -1105,5 +1156,6 @@
         # Ask the user the location of the file to write to.
         path = None
-        dlg = wx.FileDialog(self, "Choose a file", self._default_save_location, "", "*.inv", wx.SAVE)
+        dlg = wx.FileDialog(self, "Choose a file",
+                            self._default_save_location, "", "*.inv", wx.SAVE)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
@@ -1124,7 +1176,9 @@
         count_bf = self.data_cbbox.GetCount()
         if count_bf > 1:
-            mssg += 'Loading a new data set will reset all the work done in this panel. \n\r'
-            mssg += 'Please make sure to save it first... \n\r'
-            answer = wx.MessageBox(mssg, msg, wx.CANCEL|wx.OK|wx.ICON_EXCLAMATION)
+            msg += "Loading a new data set will reset all the work"
+            msg += " done in this panel. \n\r"
+            mssg += "Please make sure to save it first... \n\r"
+            answer = wx.MessageBox(mssg, msg,
+                                   wx.CANCEL|wx.OK|wx.ICON_EXCLAMATION)
     
             if answer == wx.OK:
@@ -1159,5 +1213,6 @@
         Define main sizers needed for this panel
         """
-        ## Box sizers must be defined first before defining buttons/textctrls (MAC).
+        ## Box sizers must be defined first before 
+        #defining buttons/textctrls (MAC).
         self.main_sizer = wx.BoxSizer(wx.VERTICAL)
         #Sizer related to outputs
@@ -1193,5 +1248,6 @@
         #Sizer related to extrapolation at low q range
         high_q_box = wx.StaticBox(self, -1, "High Q")
-        self.high_extrapolation_sizer = wx.StaticBoxSizer(high_q_box, wx.VERTICAL)
+        self.high_extrapolation_sizer = wx.StaticBoxSizer(high_q_box,
+                                                          wx.VERTICAL)
         self.high_q_sizer = wx.GridBagSizer(5,5)
         #sizer to define outputs
@@ -1209,9 +1265,11 @@
         """
         #Sizer hint 
-        hint_msg = "First open data file from 'File' menu.  Then Highlight and right click on the data plot. \n"
+        hint_msg = "First open data file from 'File' menu."
+        hint_msg += "Then Highlight and right click on the data plot. \n"
         hint_msg += "Finally, select 'Compute Invariant'."
         self.hint_msg_txt = wx.StaticText(self, -1, hint_msg)  
         self.hint_msg_txt.SetForegroundColour("red")
-        msg = "Highlight = mouse the mouse's cursor on the data until the plot's color changes to yellow"
+        msg = "Highlight = mouse the mouse's cursor on the data until"
+        msg += " the plot's color changes to yellow"
         self.hint_msg_txt.SetToolTipString(msg)
         self.hint_msg_sizer.Add(self.hint_msg_txt)
@@ -1219,5 +1277,6 @@
         data_name_txt = wx.StaticText(self, -1, 'Data : ')  
        
-        self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*5, 20), style=0) 
+        self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*5, 20),
+                                            style=0) 
         self.data_name_tcl.SetToolTipString("Data's name.")
         self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT|wx.RIGHT, 10),
@@ -1226,8 +1285,10 @@
         data_range_txt = wx.StaticText(self, -1, 'Total Q Range (1/A): ') 
         data_min_txt = wx.StaticText(self, -1, 'Min : ')  
-        self.data_min_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='data_min_tcl')
+        self.data_min_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+                                           style=0, name='data_min_tcl')
         self.data_min_tcl.SetToolTipString("The minimum value of q range.")
         data_max_txt = wx.StaticText(self, -1, 'Max : ') 
-        self.data_max_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='data_max_tcl') 
+        self.data_max_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+                                           style=0, name='data_max_tcl') 
         self.data_max_tcl.SetToolTipString("The maximum value of q range.")
         self.data_range_sizer.AddMany([(data_range_txt, 0, wx.RIGHT, 10),
@@ -1245,5 +1306,6 @@
         """
         background_txt = wx.StaticText(self, -1, 'Background : ')  
-        self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='background_tcl') 
+        self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+                                          style=0, name='background_tcl') 
         wx.EVT_TEXT(self, self.background_tcl.GetId(), self._on_text)
         background_hint_txt = "Background"
@@ -1251,5 +1313,6 @@
         background_unit_txt = wx.StaticText(self, -1, '[1/cm]')  
         scale_txt = wx.StaticText(self, -1, 'Scale : ')  
-        self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, name='scale_tcl')
+        self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0,
+                                     name='scale_tcl')
         wx.EVT_TEXT(self, self.scale_tcl.GetId(), self._on_text)
         scale_hint_txt = "Scale"
@@ -1266,5 +1329,6 @@
         """
         contrast_txt = wx.StaticText(self, -1, 'Contrast : ')  
-        self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0,name='contrast_tcl')
+        self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+                                        style=0,name='contrast_tcl')
         wx.EVT_TEXT(self, self.contrast_tcl.GetId(), self._on_text)
         contrast_hint_txt = "Contrast"
@@ -1273,5 +1337,6 @@
         porod_const_txt = wx.StaticText(self, -1, 'Porod Constant:')  
         self.porod_constant_tcl = InvTextCtrl(self, -1, 
-                                              size=(_BOX_WIDTH, 20), style=0,name='porod_constant_tcl') 
+                                              size=(_BOX_WIDTH, 20), style=0,
+                                              name='porod_constant_tcl') 
         wx.EVT_TEXT(self, self.porod_constant_tcl.GetId(), self._on_text)
         porod_const_hint_txt = "Porod Constant"
@@ -1355,24 +1420,32 @@
         Draw widgets related to extrapolation at low q range
         """
-        self.enable_low_cbox = wx.CheckBox(self, -1, "Enable Extrapolate Low Q",name='enable_low_cbox')
+        self.enable_low_cbox = wx.CheckBox(self, -1,
+                                           "Enable Extrapolate Low Q",
+                                           name='enable_low_cbox')
         wx.EVT_CHECKBOX(self, self.enable_low_cbox.GetId(),
                                          self._enable_low_q_section)
         self.fix_enable_low = wx.RadioButton(self, -1, 'Fix',
-                                         (10, 10),style=wx.RB_GROUP,name='fix_enable_low')
+                                         (10, 10), style=wx.RB_GROUP,
+                                         name='fix_enable_low')
         self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_low,
                                      id=self.fix_enable_low.GetId())
-        self.fit_enable_low = wx.RadioButton(self, -1, 'Fit', (10, 10),name='fit_enable_low')
+        self.fit_enable_low = wx.RadioButton(self, -1, 'Fit', (10, 10),
+                                             name='fit_enable_low')
         self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_low, 
                                         id=self.fit_enable_low.GetId())
         self.guinier = wx.RadioButton(self, -1, 'Guinier',
-                                         (10, 10),style=wx.RB_GROUP, name='guinier')
+                                         (10, 10), style=wx.RB_GROUP,
+                                         name='guinier')
         self.Bind(wx.EVT_RADIOBUTTON, self._enable_power_law_low,
                                      id=self.guinier.GetId())        
-        self.power_law_low = wx.RadioButton(self, -1, 'Power Law', (10, 10),name='power_law_low')
+        self.power_law_low = wx.RadioButton(self, -1, 'Power Law',
+                                            (10, 10), name='power_law_low')
         self.Bind(wx.EVT_RADIOBUTTON, self._enable_power_law_low, 
                                         id=self.power_law_low.GetId())
         
         npts_low_txt = wx.StaticText(self, -1, 'Npts')
-        self.npts_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='npts_low_tcl')
+        self.npts_low_tcl = InvTextCtrl(self, -1,
+                                        size=(_BOX_WIDTH*2/3, -1),
+                                        name='npts_low_tcl')
         wx.EVT_TEXT(self, self.npts_low_tcl.GetId(), self._on_text)
         msg_hint = "Number of Q points to consider"
@@ -1380,5 +1453,6 @@
         self.npts_low_tcl.SetToolTipString(msg_hint)
         power_txt = wx.StaticText(self, -1, 'Power')
-        self.power_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='power_low_tcl')
+        self.power_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),
+                                         name='power_low_tcl')
         wx.EVT_TEXT(self, self.power_low_tcl.GetId(), self._on_text)
        
@@ -1387,9 +1461,9 @@
         iy = 0
         ix = 0
-        self.low_q_sizer.Add(self.enable_low_cbox,(iy, ix),(1,5),
+        self.low_q_sizer.Add(self.enable_low_cbox,(iy, ix), (1, 5),
                             wx.TOP|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         iy += 1
         ix = 0
-        self.low_q_sizer.Add(npts_low_txt,(iy, ix),(1,1),
+        self.low_q_sizer.Add(npts_low_txt,(iy, ix), (1, 1),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
@@ -1402,5 +1476,5 @@
         iy += 1
         ix = 0
-        self.low_q_sizer.Add(self.power_law_low,(iy, ix),(1,2),
+        self.low_q_sizer.Add(self.power_law_low,(iy, ix), (1, 2),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
        
@@ -1408,5 +1482,5 @@
         ix = 1
         iy += 1
-        self.low_q_sizer.Add(self.fix_enable_low,(iy, ix),(1,1),
+        self.low_q_sizer.Add(self.fix_enable_low,(iy, ix), (1, 1),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 1
@@ -1415,8 +1489,8 @@
         ix = 1
         iy += 1
-        self.low_q_sizer.Add(power_txt,(iy, ix),(1,1),
+        self.low_q_sizer.Add(power_txt,(iy, ix), (1, 1),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 1
-        self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1,1),
+        self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.low_extrapolation_sizer.AddMany([(self.low_q_sizer, 0,
@@ -1466,12 +1540,16 @@
         Draw widgets related to extrapolation at high q range
         """
-        self.enable_high_cbox = wx.CheckBox(self, -1, "Enable Extrapolate high-Q", name='enable_high_cbox')
+        self.enable_high_cbox = wx.CheckBox(self, -1,
+                                            "Enable Extrapolate high-Q",
+                                            name='enable_high_cbox')
         wx.EVT_CHECKBOX(self, self.enable_high_cbox.GetId(),
                                          self._enable_high_q_section)
         self.fix_enable_high = wx.RadioButton(self, -1, 'Fix',
-                                         (10, 10),style=wx.RB_GROUP,name='fix_enable_high')
+                                         (10, 10), style=wx.RB_GROUP,
+                                         name='fix_enable_high')
         self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_high,
                                      id=self.fix_enable_high.GetId())
-        self.fit_enable_high = wx.RadioButton(self, -1, 'Fit', (10, 10),name='fit_enable_high')     
+        self.fit_enable_high = wx.RadioButton(self, -1, 'Fit', (10, 10),
+                                              name='fit_enable_high')     
         self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_high, 
                                         id=self.fit_enable_high.GetId())
@@ -1481,5 +1559,6 @@
         self.power_law_high.SetToolTipString(msg_hint)
         npts_high_txt = wx.StaticText(self, -1, 'Npts')
-        self.npts_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='npts_high_tcl')
+        self.npts_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),
+                                         name='npts_high_tcl')
         wx.EVT_TEXT(self, self.npts_high_tcl.GetId(), self._on_text)
         msg_hint = "Number of Q points to consider"
@@ -1487,5 +1566,6 @@
         self.npts_high_tcl.SetToolTipString(msg_hint)
         power_txt = wx.StaticText(self, -1, 'Power')
-        self.power_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),name='power_high_tcl')
+        self.power_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1),
+                                          name='power_high_tcl')
         wx.EVT_TEXT(self, self.power_high_tcl.GetId(), self._on_text)
         power_hint_txt = "Exponent to apply to the Power_law function."
@@ -1493,16 +1573,16 @@
         iy = 0
         ix = 0
-        self.high_q_sizer.Add(self.enable_high_cbox,(iy, ix),(1,5),
+        self.high_q_sizer.Add(self.enable_high_cbox, (iy, ix), (1, 5),
                             wx.TOP|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         iy += 1
         ix = 0
-        self.high_q_sizer.Add(npts_high_txt,(iy, ix),(1,1),
+        self.high_q_sizer.Add(npts_high_txt, (iy, ix), (1, 1),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1,1),
+        self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         iy += 2
         ix = 0
-        self.high_q_sizer.Add(self.power_law_high,(iy, ix),(1,2),
+        self.high_q_sizer.Add(self.power_law_high, (iy, ix),(1, 2),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
        
@@ -1510,15 +1590,15 @@
         ix = 1
         iy += 1
-        self.high_q_sizer.Add(self.fix_enable_high,(iy, ix),(1,1),
+        self.high_q_sizer.Add(self.fix_enable_high,(iy, ix), (1, 1),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 1
-        self.high_q_sizer.Add(self.fit_enable_high,(iy, ix),(1,1),
+        self.high_q_sizer.Add(self.fit_enable_high,(iy, ix), (1, 1),
                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix = 1
         iy += 1
-        self.high_q_sizer.Add(power_txt,(iy, ix),(1,1),
+        self.high_q_sizer.Add(power_txt,(iy, ix), (1, 1),
                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.high_q_sizer.Add(self.power_high_tcl, (iy, ix), (1,1),
+        self.high_q_sizer.Add(self.power_high_tcl, (iy, ix),  (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.high_extrapolation_sizer.AddMany([(self.high_q_sizer, 0, 
@@ -1534,17 +1614,25 @@
         extrapolation_min_txt = wx.StaticText(self, -1, 'Min :')  
         self.extrapolation_min_tcl = OutputTextCtrl(self, -1, 
-                                                size=(_BOX_WIDTH, 20), style=0,name='extrapolation_min_tcl')
+                                                size=(_BOX_WIDTH, 20), style=0,
+                                                name='extrapolation_min_tcl')
         self.extrapolation_min_tcl.SetValue(str(Q_MINIMUM))
-        self.extrapolation_min_tcl.SetToolTipString("The minimum extrapolated q value.")
+        hint_msg = "The minimum extrapolated q value."
+        self.extrapolation_min_tcl.SetToolTipString(hint_msg)
         extrapolation_max_txt = wx.StaticText(self, -1, 'Max :') 
         self.extrapolation_max_tcl = OutputTextCtrl(self, -1,
-                                                  size=(_BOX_WIDTH, 20), style=0,name='extrapolation_max_tcl') 
+                                                  size=(_BOX_WIDTH, 20),
+                                                  style=0,
+                                                  name='extrapolation_max_tcl') 
         self.extrapolation_max_tcl.SetValue(str(Q_MAXIMUM))
-        self.extrapolation_max_tcl.SetToolTipString("The maximum extrapolated q value.")
-        self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0, wx.LEFT, 10),
-                                                (extrapolation_min_txt, 0, wx.LEFT, 10),
+        hint_msg = "The maximum extrapolated q value."
+        self.extrapolation_max_tcl.SetToolTipString(hint_msg)
+        self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0, 
+                                                 wx.LEFT, 10),
+                                                (extrapolation_min_txt, 0,
+                                                 wx.LEFT, 10),
                                                 (self.extrapolation_min_tcl,
                                                             0, wx.LEFT, 10),
-                                                (extrapolation_max_txt, 0, wx.LEFT, 10),
+                                                (extrapolation_max_txt, 0,
+                                                 wx.LEFT, 10),
                                                 (self.extrapolation_max_tcl,
                                                             0, wx.LEFT, 10),
@@ -1569,26 +1657,32 @@
         uncertainty = "+/-" 
         volume_txt = wx.StaticText(self, -1, 'Volume Fraction      ')
-        self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='volume_tcl')
+        self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1),
+                                         name='volume_tcl')
         wx.EVT_TEXT(self, self.volume_tcl.GetId(), self._on_out_text)
         self.volume_tcl.SetToolTipString("Volume fraction.")
-        self.volume_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='volume_err_tcl')
+        self.volume_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1),
+                                             name='volume_err_tcl')
         wx.EVT_TEXT(self, self.volume_err_tcl.GetId(), self._on_out_text)
-        self.volume_err_tcl.SetToolTipString("Uncertainty on the volume fraction.")
+        hint_msg = "Uncertainty on the volume fraction."
+        self.volume_err_tcl.SetToolTipString(hint_msg)
         volume_units_txt = wx.StaticText(self, -1, unit_volume)
         
         surface_txt = wx.StaticText(self, -1, 'Specific Surface')
-        self.surface_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='surface_tcl')
+        self.surface_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1),
+                                          name='surface_tcl')
         wx.EVT_TEXT(self, self.surface_tcl.GetId(), self._on_out_text)
         self.surface_tcl.SetToolTipString("Specific surface value.")
-        self.surface_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='surface_err_tcl')
+        self.surface_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1),
+                                              name='surface_err_tcl')
         wx.EVT_TEXT(self, self.surface_err_tcl.GetId(), self._on_out_text)
-        self.surface_err_tcl.SetToolTipString("Uncertainty on the specific surface.")
+        hint_msg = "Uncertainty on the specific surface."
+        self.surface_err_tcl.SetToolTipString(hint_msg)
         surface_units_txt = wx.StaticText(self, -1, unit_surface)
         iy = 0
         ix = 0
-        self.volume_surface_sizer.Add(volume_txt, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(volume_txt, (iy, ix), (1, 1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.volume_surface_sizer.Add(self.volume_tcl, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(self.volume_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 10)
         ix += 1
@@ -1596,15 +1690,15 @@
                          (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
         ix += 1
-        self.volume_surface_sizer.Add(self.volume_err_tcl, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(self.volume_err_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
         ix += 1
-        self.volume_surface_sizer.Add(volume_units_txt, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(volume_units_txt, (iy, ix), (1, 1),
                              wx.EXPAND|wx.ADJUST_MINSIZE, 10)
         iy += 1
         ix = 0
-        self.volume_surface_sizer.Add(surface_txt, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(surface_txt, (iy, ix), (1, 1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.volume_surface_sizer.Add(self.surface_tcl, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(self.surface_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         ix += 1
@@ -1612,8 +1706,8 @@
                          (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix += 1
-        self.volume_surface_sizer.Add(self.surface_err_tcl, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(self.surface_err_tcl, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
         ix += 1
-        self.volume_surface_sizer.Add(surface_units_txt, (iy, ix), (1,1),
+        self.volume_surface_sizer.Add(surface_units_txt, (iy, ix), (1, 1),
                             wx.EXPAND|wx.ADJUST_MINSIZE, 10)
         
@@ -1625,9 +1719,14 @@
         unit_invariant = '[1/(cm * A)]'
         invariant_total_txt = wx.StaticText(self, -1, 'Invariant Total [Q*]')
-        self.invariant_total_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='invariant_total_tcl')
+        self.invariant_total_tcl = OutputTextCtrl(self, -1,
+                                                  size=(_BOX_WIDTH,-1),
+                                                  name='invariant_total_tcl')
         msg_hint = "Total invariant [Q*], including extrapolated regions."
         self.invariant_total_tcl.SetToolTipString(msg_hint)
-        self.invariant_total_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1),name='invariant_total_err_tcl')
-        self.invariant_total_err_tcl.SetToolTipString("Uncertainty on invariant.")
+        self.invariant_total_err_tcl = OutputTextCtrl(self, -1,
+                                                      size=(_BOX_WIDTH,-1),
+                                                name='invariant_total_err_tcl')
+        hint_msg = "Uncertainty on invariant."
+        self.invariant_total_err_tcl.SetToolTipString(hint_msg)
         invariant_total_units_txt = wx.StaticText(self, -1, unit_invariant)
     
@@ -1635,8 +1734,8 @@
         iy = 0
         ix = 0
-        self.invariant_sizer.Add(invariant_total_txt, (iy, ix), (1,1),
+        self.invariant_sizer.Add(invariant_total_txt, (iy, ix), (1, 1),
                              wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        self.invariant_sizer.Add(self.invariant_total_tcl, (iy, ix), (1,1),
+        self.invariant_sizer.Add(self.invariant_total_tcl, (iy, ix), (1, 1),
                           wx.EXPAND|wx.ADJUST_MINSIZE, 10)
         ix += 1
@@ -1644,8 +1743,8 @@
                          (iy, ix),(1,1),wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
         ix += 1
-        self.invariant_sizer.Add(self.invariant_total_err_tcl, (iy, ix), (1,1),
+        self.invariant_sizer.Add(self.invariant_total_err_tcl, (iy, ix), (1, 1),
                              wx.EXPAND|wx.ADJUST_MINSIZE, 10)
         ix += 1
-        self.invariant_sizer.Add(invariant_total_units_txt,(iy, ix), (1,1),
+        self.invariant_sizer.Add(invariant_total_units_txt,(iy, ix), (1, 1),
                           wx.EXPAND|wx.ADJUST_MINSIZE, 10)
  
@@ -1675,5 +1774,6 @@
         #compute button
         id = wx.NewId()
-        self.button_calculate = wx.Button(self, id, "Compute", name ='compute_invariant' )
+        self.button_calculate = wx.Button(self, id, "Compute",
+                                          name='compute_invariant')
         self.button_calculate.SetToolTipString("Compute invariant")
         self.Bind(wx.EVT_BUTTON, self.compute_invariant, id=id)   
@@ -1681,5 +1781,6 @@
         id = wx.NewId()
         self.button_details = wx.Button(self, id, "Details?")
-        self.button_details.SetToolTipString("Details about the results of the computation")
+        hint_msg = "Details about the results of the computation"
+        self.button_details.SetToolTipString(hint_msg)
         self.Bind(wx.EVT_BUTTON, self.display_details, id=id)
         details = "Details on Invariant Total Calculations"
@@ -1689,5 +1790,6 @@
                                     wx.RIGHT|wx.BOTTOM|wx.TOP, 10),
                                    (self.button_details, 0 , wx.ALL, 10),
-                        (self.button_calculate, 0 , wx.RIGHT|wx.TOP|wx.BOTTOM, 10)])#,
+                        (self.button_calculate, 0 ,
+                         wx.RIGHT|wx.TOP|wx.BOTTOM, 10)])#,
                                    #(self.button_undo, 0 , wx.ALL, 10),
                                    #(self.button_redo, 0 , wx.ALL, 10)])
@@ -1706,5 +1808,6 @@
         #undo button
         id = wx.NewId()
-        self.button_undo = wx.BitmapButton(self, id,wx.Bitmap(self.undo_png))#wx.Button(self, id, "Undo",size=(50,20))
+        #wx.Button(self, id, "Undo",size=(50,20))
+        self.button_undo = wx.BitmapButton(self, id,wx.Bitmap(self.undo_png))
         self.button_undo.SetToolTipString("Undo")
         
@@ -1714,5 +1817,6 @@
         #redo button
         id = wx.NewId()
-        self.button_redo = wx.BitmapButton(self, id,wx.Bitmap(self.redo_png))#wx.Button(self, id, "Redo",size=(50,20))
+        #wx.Button(self, id, "Redo",size=(50,20))
+        self.button_redo = wx.BitmapButton(self, id,wx.Bitmap(self.redo_png))
         self.button_redo.SetToolTipString("Redo")
         self.Bind(wx.EVT_BUTTON, self.redo, id=id)
@@ -1720,25 +1824,39 @@
         #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 it")
+        #wx.Button(self, id, "Undo",size=(50,20))
+        self.button_bookmark = wx.BitmapButton(self, id,
+                                               wx.Bitmap(self.bookmark_png))
+        hint_msg = "Bookmark: right-click on the panel to retrieve it"
+        self.button_bookmark.SetToolTipString(hint_msg)
         self.Bind(wx.EVT_BUTTON, self._on_bookmark, id=id)
         #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")
+        #wx.Button(self, id, "Redo",size=(50,20))
+        self.button_report = wx.BitmapButton(self, id,
+                                             wx.Bitmap(self.report_png))
+        hint_msg = "Report the result of the computation"
+        self.button_report.SetToolTipString(hint_msg)
         self.Bind(wx.EVT_BUTTON, self.report, id=id)
         #self.button_report.Disable()   
         #save button
         id = wx.NewId()
-        self.button_save = wx.BitmapButton(self, id,wx.Bitmap(self.save_png), name ='Save_invariant')#wx.Button(self, id, "Save", name ='Save_invariant' )
+        #wx.Button(self, id, "Save", name ='Save_invariant' )
+        self.button_save = wx.BitmapButton(self, id, wx.Bitmap(self.save_png),
+                                           name='Save_invariant')
         self.button_save.SetToolTipString("Save as a file")
         self.Bind(wx.EVT_BUTTON, self._on_save_button, id=id)   
         self.button_save.Disable()  
-        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)])        
+        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):
         """
@@ -1781,6 +1899,6 @@
     """
     """
-    def __init__(self, parent=None, id=1,graph=None, 
-                 data=None, title="Invariant",base=None):
+    def __init__(self, parent=None, id=1, graph=None, 
+                 data=None, title="Invariant", base=None):
         
         wx.Frame.__init__(self, parent, id, title, size=(PANEL_WIDTH +100,
@@ -1789,6 +1907,6 @@
         self.loader = Loader()
         import invariant
-
-        data= self.loader.load("C:/ECLPS/workspace/trunk/DataLoader/test/ascii_test_3.txt")
+        path = "C:/ECLPS/workspace/trunk/DataLoader/test/ascii_test_3.txt"
+        data= self.loader.load(path)
         self.panel = InvariantPanel(self)
 
Index: invariantview/perspectives/invariant/invariant_state.py
===================================================================
--- invariantview/perspectives/invariant/invariant_state.py	(revision 5069a184d1cf13661c56bf250126a3c56a8d3eb4)
+++ invariantview/perspectives/invariant/invariant_state.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -1,3 +1,8 @@
-import time, os, sys
+"""
+"""
+
+import time
+import os
+import sys
 import logging
 import copy
@@ -8,7 +13,10 @@
 from DataLoader.readers.cansas_reader import get_content
 from sans.guiframe.utils import format_number
-from sans.guiframe.dataFitting import Theory1D, Data1D
+from sans.guiframe.dataFitting import Theory1D
+from sans.guiframe.dataFitting import Data1D
+
 INVNODE_NAME = 'invariant'
 CANSAS_NS = "cansas1d/1.0"
+
 # default state
 list = {'file': 'None',
@@ -37,5 +45,6 @@
         'surface_tcl':'',
         'surface_err_tcl':''}
-# list of states: This list will be filled as panel init and the number of states increases
+# list of states: This list will be filled as panel 
+# init and the number of states increases
 state_list = {}
 bookmark_list = {}
@@ -50,14 +59,14 @@
         '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)]"],
+output_list = [["qstar_low",      "Q* from low Q extrapolation [1/(cm*A)]"],
                ["qstar_low_err",             "dQ* from low Q extrapolation"],
                ["qstar_low_percent",  "Q* percent from low Q extrapolation"],
-               ["qstar",                                     "Q* from data [1/(cm*A)]"],
+               ["qstar",              "Q* from data [1/(cm*A)]"],
                ["qstar_err",                                "dQ* from data"],
                ["qstar_percent",                     "Q* percent from data"],
-               ["qstar_high",                "Q* from high Q extrapolation [1/(cm*A)]"],
+               ["qstar_high",    "Q* from high Q extrapolation [1/(cm*A)]"],
                ["qstar_high_err",           "dQ* from high Q extrapolation"],
                ["qstar_high_percent", "Q* percent from low Q extrapolation"],
-               ["qstar_total",                                   "total Q* [1/(cm*A)]"],
+               ["qstar_total",         "total Q* [1/(cm*A)]"],
                ["qstar_total_err",                              "total dQ*"],
                ["volume",                                 "volume fraction"],
@@ -97,12 +106,10 @@
         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")
+        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
         #self.report_str_save = None
         html_template.close()
-        
-
         
     def __str__(self):
@@ -119,11 +126,11 @@
 
         state_num = int(self.saved_state['state_num'])
-        state = "\n[Invariant computation for %s: "% file_name
-        state += "performed at %s on %s] \n"%(my_time, date)
-        state += "State No.: %d \n"% state_num
+        state = "\n[Invariant computation for %s: " % file_name
+        state += "performed at %s on %s] \n" % (my_time, date)
+        state += "State No.: %d \n" % state_num
         state += "\n=== Inputs ===\n"
         
         # text ctl general inputs ( excluding extrapolation text ctl)
-        for key,value in self.input_list.iteritems(): 
+        for key, value in self.input_list.iteritems(): 
             if value == '':
                 continue
@@ -131,10 +138,10 @@
             max_ind = len(key_split)-1
             if key_split[max_ind] == 'tcl': 
-                name =""
-                if key_split[1]== 'low' or key_split[1]== 'high':
+                name = ""
+                if key_split[1] == 'low' or key_split[1] == 'high':
                     continue
-                for ind in range(0,max_ind):
-                    name +=" %s"%key_split[ind]
-                state += "%s:   %s\n"% (name.lstrip(" "),value)
+                for ind in range(0, max_ind):
+                    name += " %s" % key_split[ind]
+                state += "%s:   %s\n" % (name.lstrip(" "), value)
                 
         # other input parameters       
@@ -148,24 +155,27 @@
         if compute_state['enable_high_cbox']:
             extra_hi = 'Power law'
-        state += "\nExtrapolation:  High=%s; Low=%s\n" %(extra_hi,extra_lo)   
+        state += "\nExtrapolation:  High=%s; Low=%s\n" %(extra_hi, extra_lo)   
         low_off = False
         high_off = False
-        for key,value in self.input_list.iteritems(): 
+        for key, value in self.input_list.iteritems(): 
             key_split = key.split('_') 
-            max_ind = len(key_split)-1   
+            max_ind = len(key_split) - 1   
             if key_split[max_ind] == 'tcl': 
-                name ="" 
+                name = "" 
                 # check each buttons whether or not ON or OFF
-                if key_split[1]== 'low' or key_split[1]== 'high':
-                    if not compute_state['enable_low_cbox'] and key_split[max_ind-1] == 'low':
+                if key_split[1] == 'low' or key_split[1] == 'high':
+                    if not compute_state['enable_low_cbox'] and \
+                        key_split[max_ind-1] == 'low':
                         low_off = True
                         continue              
-                    elif not compute_state['enable_high_cbox'] and key_split[max_ind-1]== 'high':
+                    elif not compute_state['enable_high_cbox'] and \
+                        key_split[max_ind-1] == 'high':
                         high_off = True
                         continue
-                    elif extra_lo == 'Guinier' and key_split[0]== 'power' and key_split[max_ind-1]== 'low':
+                    elif extra_lo == 'Guinier' and key_split[0] == 'power' and \
+                        key_split[max_ind-1] == 'low':
                         continue
-                    for ind in range(0,max_ind):
-                        name +=" %s"%key_split[ind]
+                    for ind in range(0, max_ind):
+                        name += " %s" % key_split[ind]
                     name = name.lstrip(" ")
                     if name == "power low" :
@@ -179,5 +189,5 @@
                         else:
                             name += ' (Fitted)'
-                    state += "%s:   %s\n"% (name,value)
+                    state += "%s:   %s\n" % (name, value)
         # Outputs
         state += "\n=== Outputs ==="
@@ -185,40 +195,40 @@
             item_split = item[0].split('_') 
             # Exclude the extrapolation that turned off
-            if len(item_split)>1:
-                if low_off and item_split[1] == 'low': continue
-                if high_off and item_split[1] == 'high': continue
-            max_ind = len(item_split)-1
+            if len(item_split) > 1:
+                if low_off and item_split[1] == 'low':
+                    continue
+                if high_off and item_split[1] == 'high':
+                    continue
+            max_ind = len(item_split) - 1
             value = None
             try:
                 # Q* outputs
-                exec "value = self.container.%s\n"% item[0]
+                exec "value = self.container.%s\n" % item[0]
             except:
                 # other outputs than Q*
-                name = item[0]+"_tcl"
-                exec "value = self.saved_state['%s']"% name
+                name = item[0] + "_tcl"
+                exec "value = self.saved_state['%s']" % name
                 
             # Exclude the outputs w/''    
-            if value == '': continue    
-            
+            if value == '':
+                continue    
             # Error outputs
             if item_split[max_ind] == 'err':
-                state += "+- %s "%format_number(value)
-                
+                state += "+- %s " % format_number(value)
             # Percentage outputs
             elif item_split[max_ind] == 'percent':
                 try:
-                    value = float(value)*100
+                    value = float(value) * 100
                 except:
                     pass
-                state += "(%s %s)"%(format_number(value),'%')
+                state += "(%s %s)" % (format_number(value), '%')
             # Outputs
             else:
-                state += "\n%s:   %s "%(item[1],format_number(value,high=True))
+                state += "\n%s:   %s " % (item[1], 
+                                        format_number(value, high=True))
         # Include warning msg
         state += "\n\nNote:\n" + self.container.warning_msg
-        
         return state
 
-    
     def clone_state(self):
         """
@@ -226,5 +236,4 @@
         """
         return copy.deepcopy(self.saved_state)
-    
 
     def toXML(self, file="inv_state.inv", doc=None, entry_node=None):
@@ -234,12 +243,14 @@
         Compatible with standalone writing, or appending to an
         already existing XML document. In that case, the XML document
-        is required. An optional entry node in the XML document may also be given.
+        is required. An optional entry node in the XML document 
+        may also be given.
         
         : param file: file to write to
         : param doc: XML document object [optional]
-        : param entry_node: XML node within the XML document at which we will append the data [optional]   
+        : param entry_node: XML node within the XML document at which 
+            we will append the data [optional]   
         """
         from xml.dom.minidom import getDOMImplementation
-        import time
+        #import time
         timestamp = time.time()
         # Check whether we have to write a standalone XML file
@@ -266,5 +277,5 @@
         # File name
         element = newdoc.createElement("filename")
-        if self.file != None and self.file !='':
+        if self.file != None and self.file != '':
             element.appendChild(newdoc.createTextNode(str(self.file)))
         else:
@@ -293,13 +304,15 @@
         
         for name, value in self.state_list.iteritems():
-            history_element = newdoc.createElement('state_'+str(name))
+            history_element = newdoc.createElement('state_' + str(name))
             for state_name,state_value in value.iteritems():
                 state_element = newdoc.createElement(str(state_name))
-                state_element.appendChild(newdoc.createTextNode(str(state_value)))
+                child = newdoc.createTextNode(str(state_value))
+                state_element.appendChild(child)
                 history_element.appendChild(state_element)
             #history_element.appendChild(state_list_element)
             history.appendChild(history_element)
 
-        # Bookmarks  bookmark_list[self.bookmark_num] = [my_time,date,state,comp_state]
+        # Bookmarks  bookmark_list[self.bookmark_num] = [\
+        #my_time,date,state,comp_state]
         bookmark = newdoc.createElement("bookmark")
         top_element.appendChild(bookmark)
@@ -314,9 +327,10 @@
             state_list_element = newdoc.createElement('state')
             comp_state_list_element = newdoc.createElement('comp_state')
-            for state_name,state_value in value_list[2].iteritems():
+            for state_name, state_value in value_list[2].iteritems():
                 state_element = newdoc.createElement(str(state_name))
-                state_element.appendChild(newdoc.createTextNode(str(state_value)))
+                child = newdoc.createTextNode(str(state_value))
+                state_element.appendChild(child)
                 state_list_element.appendChild(state_element)
-            for comp_name,comp_value in value_list[3].iteritems():
+            for comp_name, comp_value in value_list[3].iteritems():
                 comp_element = newdoc.createElement(str(comp_name))
                 comp_element.appendChild(newdoc.createTextNode(str(comp_value)))
@@ -345,5 +359,7 @@
         """
         if file is not None:
-            raise RuntimeError, "InvariantSate no longer supports non-CanSAS format for invariant files"
+            msg = "InvariantSate no longer supports non-CanSAS"
+            msg += " format for invariant files"
+            raise RuntimeError, msg
         
         if node.get('version')\
@@ -361,10 +377,12 @@
                     timestamp = (entry.get('epoch'))
                 except:
-                    logging.error("InvariantSate.fromXML: Could not read timestamp\n %s" % sys.exc_value)
+                    msg = "InvariantSate.fromXML: Could not read"
+                    msg += " timestamp\n %s" % sys.exc_value
+                    logging.error(msg)
             
             # Parse bookmarks
             entry_bookmark = get_content('ns:bookmark', node)
 
-            for ind in range(1,len(entry_bookmark)+1):
+            for ind in range(1, len(entry_bookmark) + 1):
                 temp_state = {}
                 temp_bookmark = {}
@@ -372,40 +390,38 @@
                                 
                 if entry is not None:
-                    time = get_content('ns:time', entry )
+                    time = get_content('ns:time', entry)
                     val_time = str(time.text.strip())
-                    date = get_content('ns:date', entry )
+                    date = get_content('ns:date', entry)
                     val_date = str(date.text.strip())
-                    state_entry = get_content('ns:state', entry )
+                    state_entry = get_content('ns:state', entry)
                     for item in list:
 
-                        input_field = get_content('ns:%s' % item, state_entry )
-                        val = str(input_field.text.strip())
-
-                        if input_field is not None:
-                            try:
-                                exec "temp_state['%s'] = %s"% (item,val)      
-                            except:
-                                exec "temp_state['%s'] = '%s'"% (item,val)
-                            
-                    comp_entry = get_content('ns:comp_state', entry )
-                    
-                    for item in list:
-                        input_field = get_content('ns:%s' % item, comp_entry )
+                        input_field = get_content('ns:%s' % item, state_entry)
                         val = str(input_field.text.strip())
                         if input_field is not None:
                             try:
-                                exec "temp_bookmark['%s'] = %s"% (item,val)      
+                                exec "temp_state['%s'] = %s" % (item, val)      
                             except:
-                                exec "temp_bookmark['%s'] = '%s'"% (item,val)
+                                exec "temp_state['%s'] = '%s'" % (item, val)
+                    comp_entry = get_content('ns:comp_state', entry)
+                    
+                    for item in list:
+                        input_field = get_content('ns:%s' % item, comp_entry)
+                        val = str(input_field.text.strip())
+                        if input_field is not None:
+                            try:
+                                exec "temp_bookmark['%s'] = %s" % (item, val)      
+                            except:
+                                exec "temp_bookmark['%s'] = '%s'" % (item, val)
                     try:
-                        exec "self.bookmark_list[%s] = [val_time,val_date,temp_state,temp_bookmark]"% ind
-
+                        cmd = "self.bookmark_list[%s] = [val_time,"
+                        cmd += "val_date,temp_state,temp_bookmark]"
+                        exec cmd % ind
                     except:
                         raise "missing components of bookmarks..."
-    
             # Parse histories
             entry_history = get_content('ns:history', node)
 
-            for ind in range(0,len(entry_history)):
+            for ind in range(0, len(entry_history)):
                 temp_state = {}
                 entry = get_content('ns:state_%s' % ind, entry_history) 
@@ -418,10 +434,9 @@
                         if input_field is not None:
                             try:
-                                exec "temp_state['%s'] = %s"% (item,val)         
+                                exec "temp_state['%s'] = %s" % (item, val)         
                             except:
-                                exec "temp_state['%s'] = '%s'"% (item,val)
+                                exec "temp_state['%s'] = '%s'" % (item, val)
                             finally:
-                                exec "self.state_list['%s'] = temp_state"% ind 
-            
+                                exec "self.state_list['%s'] = temp_state" % ind 
             # Parse current state (ie, saved_state)
             entry = get_content('ns:state', node)           
@@ -432,5 +447,4 @@
                     if input_field is not None:
                         self.set_saved_state(name=item, value=val)
-                        
             self.file = file_name
             
@@ -442,9 +456,9 @@
     
         # default string values
-        for num in range (1,19):
-            exec "s_%s = 'NA'"% str(num)
+        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)):
+        for line in range(0, len(lines)):
             if line == 1:
                 s_1 = lines[1]
@@ -454,5 +468,5 @@
                 item = lines[line].split(':')
                 item[0] = item[0].strip()
-                if item[0]== "scale":
+                if item[0] == "scale":
                     s_3 = item[1]
                 elif item[0] == "porod constant":
@@ -466,45 +480,45 @@
                     bool_0 = extra[0].split("=")
                     bool_1 = extra[1].split("=")
-                    s_7 = " "+bool_0[0]+"Q region = "+bool_0[1]
-                    s_8 = " "+bool_1[0]+"Q region = "+bool_1[1]
-                elif item[0]=="npts low":
+                    s_7 = " " + bool_0[0] + "Q region = " + bool_0[1]
+                    s_8 = " " + bool_1[0] + "Q region = " + bool_1[1]
+                elif item[0] == "npts low":
                     s_9 = item[1]
-                elif item[0]=="npts high":
+                elif item[0] == " npts high":
                     s_10 = item[1]
                 elif item[0] == "volume fraction":
                     val=item[1].split("+-")[0].strip()
                     error = item[1].split("+-")[1].strip()
-                    s_17 = val+" &plusmn; "+error
+                    s_17 = val + " &plusmn; " + error
                 elif item[0] == "specific surface":
-                    val=item[1].split("+-")[0].strip()
+                    val = item[1].split("+-")[0].strip()
                     error = item[1].split("+-")[1].strip()
-                    s_18 = val+" &plusmn; "+error
-                elif item[0].split("(")[0].strip()=="power high":
+                    s_18 = val + " &plusmn; " + error
+                elif item[0].split("(")[0].strip() == "power high":
                     s_11 = item[0]+" ="+item[1]
-                elif item[0].split("(")[0].strip()=="power low":
+                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":
+                elif item[0].split("[")[0].strip() == "Q* from low Q extrapolation":
                     #looks messy but this way the symbols +_ and % work on html
-                    val=item[1].split("+-")[0].strip()
+                    val = item[1].split("+-")[0].strip()
                     error = item[1].split("+-")[1].strip()
                     err = error.split("%")[0].strip()
                     percent = error.split("%")[1].strip()
-                    s_13 = val+" &plusmn; "+err+"&#37"+percent
-                elif item[0].split("[")[0].strip()=="Q* from data":
-                    val=item[1].split("+-")[0].strip()
+                    s_13 = val + " &plusmn; " + err + "&#37" + percent
+                elif item[0].split("[")[0].strip() == "Q* from data":
+                    val = item[1].split("+-")[0].strip()
                     error = item[1].split("+-")[1].strip()
                     err = error.split("%")[0].strip()
                     percent = error.split("%")[1].strip()
-                    s_14 = val+" &plusmn; "+err+"&#37"+percent
-                elif item[0].split("[")[0].strip()=="Q* from high Q extrapolation":
-                    val=item[1].split("+-")[0].strip()
+                    s_14 = val + " &plusmn; " + err + "&#37" + percent
+                elif item[0].split("[")[0].strip() == "Q* from high Q extrapolation":
+                    val = item[1].split("+-")[0].strip()
                     error = item[1].split("+-")[1].strip()
                     err = error.split("%")[0].strip()
                     percent = error.split("%")[1].strip()
-                    s_15 = val+" &plusmn; "+err+"&#37"+percent
-                elif item[0].split("[")[0].strip()=="total Q*":
-                    val=item[1].split("+-")[0].strip()
+                    s_15 = val + " &plusmn; " + err + "&#37" + percent
+                elif item[0].split("[")[0].strip() == "total Q*":
+                    val = item[1].split("+-")[0].strip()
                     error = item[1].split("+-")[1].strip()
-                    s_16 = val+" &plusmn; "+error
+                    s_16 = val + " &plusmn; " + error
                 else:
                     continue
@@ -513,6 +527,8 @@
         self.set_plot_state(extra_high=bool_0[1],extra_low=bool_1[1])
         # get ready for report with setting all the html strings
-        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,self.file,"%s")
-
+        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, self.file, "%s")
 
     def set_saved_state(self, name, value):
@@ -523,17 +539,18 @@
         : param value: value of the state component
         """
-        rb_list = [['power_law_low','guinier'],['fit_enable_low','fix_enable_low'],['fit_enable_high','fix_enable_high']]
+        rb_list = [['power_law_low','guinier'],
+                   ['fit_enable_low','fix_enable_low'],
+                   ['fit_enable_high','fix_enable_high']]
 
         try:
-            if value == None or value.lstrip().rstrip() =='':
+            if value == None or value.lstrip().rstrip() == '':
                 exec "self.%s = '%s'" % (name, value)
-                exec "self.saved_state['%s'] = '%s'" %  (name, value)
+                exec "self.saved_state['%s'] = '%s'" % (name, value)
             else:
                 exec 'self.%s = %s' % (name, value)
-                exec "self.saved_state['%s'] = %s" %  (name, value)
-
-            
-            # set the count part of radio button clicked False for the saved_state
-            for title,content in rb_list:
+                exec "self.saved_state['%s'] = %s" % (name, value)
+            # set the count part of radio button clicked 
+            # False for the saved_state
+            for title, content in rb_list:
                 if name ==  title:
                     name = content 
@@ -542,15 +559,16 @@
                     name = title
                     value = False 
-            exec "self.saved_state['%s'] = '%s'" %  (name, value)     
+            exec "self.saved_state['%s'] = '%s'" % (name, value)     
             self.state_num = self.saved_state['state_num']
         except:           
             pass
 
-    def set_plot_state(self,extra_high=False,extra_low=False):
+    def set_plot_state(self, extra_high=False, extra_low=False):
         """
         Build image state that wx.html understand
         by plotting, putting it into wx.FileSystem image object
         
-        : extrap_high,extra_low: low/high extrapolations are possible extra-plots
+        : extrap_high,extra_low: low/high extrapolations
+        are possible extra-plots
         """
         # some imports
@@ -583,5 +601,5 @@
         #make python.Image object 
         #size
-        w,h =canvas.get_width_height()
+        w, h = canvas.get_width_height()
         #convert to wx.Image
         wximg = wx.EmptyImage(w,h)
@@ -595,5 +613,5 @@
         self.imgRAM = wx.MemoryFSHandler()
         #AddFile, image can be retrieved with 'memory:filename'
-        self.imgRAM.AddFile('img_inv.png',wximgbmp, wx.BITMAP_TYPE_PNG)
+        self.imgRAM.AddFile('img_inv.png', wximgbmp, wx.BITMAP_TYPE_PNG)
         
         self.wximgbmp = 'memory:img_inv.png'
@@ -611,5 +629,5 @@
             "SANSView file (*.svs)|*.svs"]
     ## List of allowed extensions
-    ext=['.inv', '.INV', '.svs', 'SVS']  
+    ext = ['.inv', '.INV', '.svs', 'SVS']  
     
     def __init__(self, call_back, cansas=True):
@@ -634,5 +652,5 @@
         : return: None
         """
-        if self.cansas==True:
+        if self.cansas == True:
             return self._read_cansas(path)
         else:
@@ -666,11 +684,14 @@
         # Locate the invariant node
         try:
-            nodes = entry.xpath('ns:%s' % INVNODE_NAME, namespaces={'ns': CANSAS_NS})
+            nodes = entry.xpath('ns:%s' % INVNODE_NAME,
+                                namespaces={'ns': CANSAS_NS})
             # Create an empty state
-            if nodes !=[]:
+            if nodes != []:
                 state = InvariantState()
                 state.fromXML(node=nodes[0])
         except:
-            logging.info("XML document does not contain invariant information.\n %s" % sys.exc_value)  
+            msg = "XML document does not contain invariant"
+            msg += " information.\n %s" % sys.exc_value
+            logging.info(msg)  
         return state
     
@@ -696,8 +717,10 @@
        
                 # Check the format version number
-                # Specifying the namespace will take care of the file format version 
+                # Specifying the namespace will take care of 
+                # the file format version 
                 root = tree.getroot()
                 
-                entry_list = root.xpath('/ns:SASroot/ns:SASentry', namespaces={'ns': CANSAS_NS})
+                entry_list = root.xpath('/ns:SASroot/ns:SASentry',
+                                        namespaces={'ns': CANSAS_NS})
                 
                 for entry in entry_list:
@@ -716,10 +739,11 @@
 
         # Return output consistent with the loader's api
-        if len(output)==0:
+        if len(output) == 0:
             return None
-        elif len(output)==1:
+        elif len(output) == 1:
             # Call back to post the new state
 
-            self.call_back(state=output[0].meta_data['invstate'], datainfo = output[0])
+            self.call_back(state=output[0].meta_data['invstate'],
+                           datainfo = output[0])
             return output[0]
         else:
@@ -754,17 +778,18 @@
             datainfo = DataLoader.data_info.Data1D(x=[], y=[])    
         elif not issubclass(datainfo.__class__, DataLoader.data_info.Data1D):
-            raise RuntimeError, "The cansas writer expects a Data1D instance: %s" % str(datainfo.__class__.__name__)
+            msg = "The cansas writer expects a Data1D"
+            msg += " instance: %s" % str(datainfo.__class__.__name__)
+            raise RuntimeError, msg
         #make sure title and data run is filled up.
-        if datainfo.title == None or datainfo.title=='': datainfo.title = datainfo.name
-        if datainfo.run_name == None or datainfo.run_name=={}: 
+        if datainfo.title == None or datainfo.title == '':
+            datainfo.title = datainfo.name
+        if datainfo.run_name == None or datainfo.run_name == {}: 
             datainfo.run = [str(datainfo.name)]
             datainfo.run_name[0] = datainfo.name
-
         # Create basic XML document
         doc, sasentry = self._to_xml_doc(datainfo)
-    
         # Add the invariant information to the XML document
         if state is not None:
             state.toXML(datainfo.name,doc=doc, entry_node=sasentry)
-            
         return doc
+
Index: invariantview/perspectives/invariant/invariant_widgets.py
===================================================================
--- invariantview/perspectives/invariant/invariant_widgets.py	(revision 4e1c362faa5def12383a4fd3550db72d838ee262)
+++ invariantview/perspectives/invariant/invariant_widgets.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -14,7 +14,7 @@
 
 import wx
-import os
-from invariant_state import InvariantState as IState
-import copy
+#import os
+#from invariant_state import InvariantState as IState
+#import copy
 
 class InvTextCtrl(wx.TextCtrl):
@@ -25,5 +25,6 @@
     def __init__(self, *args, **kwds):
         wx.TextCtrl.__init__(self, *args, **kwds)
-        ## Set to True when the mouse is clicked while the whole string is selected
+        ## Set to True when the mouse is clicked while 
+        #the whole string is selected
         self.full_selection = False
         ## Call back for EVT_SET_FOCUS events
@@ -60,9 +61,8 @@
                 # if not, select the whole string
                 (start, end) = control.GetSelection()
-                if start==end:
-                    control.SetSelection(-1,-1)
+                if start == end:
+                    control.SetSelection(-1, -1)
            
 
-    
 class OutputTextCtrl(wx.TextCtrl):
     """
Index: invariantview/perspectives/invariant/report_dialog.py
===================================================================
--- invariantview/perspectives/invariant/report_dialog.py	(revision 5b031223a262b0709ad65c0585c105472958a8de)
+++ invariantview/perspectives/invariant/report_dialog.py	(revision 4a2b054ce1972d8c903cf87a9d285cad450d5353)
@@ -11,11 +11,13 @@
 
 """
-Dialog report panel to show and summarize the results of the invariant calculation.
+Dialog report panel to show and summarize the results of 
+the invariant calculation.
 """
 import wx
-import sys,os
+import sys
+import os
 import wx.html as html
 
-if sys.platform.count("win32")>0:
+if sys.platform.count("win32") > 0:
     _STATICBOX_WIDTH = 450
     PANEL_WIDTH = 500 
@@ -39,5 +41,6 @@
         Initialization. The parameters added to Dialog are:
         
-        :param list: report_list (list of html_str, text_str, image) from invariant_state
+        :param list: report_list (list of html_str, text_str, image)
+        from invariant_state
         """
         kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE
@@ -51,7 +54,7 @@
         self.SetWindowVariant(variant=FONT_VARIANT)
         # report string
-        self.report_list =list
+        self.report_list = list
         # put image path in the report string
-        self.report_html = self.report_list[0]% "memory:img_inv.png"
+        self.report_html = self.report_list[0] % "memory:img_inv.png"
         # layout
         self._setup_layout()
@@ -74,5 +77,6 @@
         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()) 
+        button_preview.Bind(wx.EVT_BUTTON, self.onPreview,
+                            id=button_preview.GetId()) 
         hbox.Add(button_preview)
 
@@ -80,5 +84,6 @@
         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()) 
+        button_print.Bind(wx.EVT_BUTTON, self.onPrint,
+                          id=button_print.GetId()) 
         hbox.Add(button_print)
         
@@ -91,5 +96,5 @@
         # panel for report page
         panel = wx.Panel(self, -1)
-        vbox= wx.BoxSizer(wx.VERTICAL)
+        vbox = wx.BoxSizer(wx.VERTICAL)
         # html window
         self.hwindow = html.HtmlWindow(panel,style=wx.BORDER,size=(700,500))
@@ -98,6 +103,6 @@
         
         # add panels to boxsizers
-        vbox.Add(hbox,30)
-        vbox.Add(panel,500, wx.EXPAND|wx.ALL)
+        vbox.Add(hbox, 30)
+        vbox.Add(panel, 500, wx.EXPAND|wx.ALL)
 
         self.SetSizerAndFit(vbox)
@@ -105,18 +110,18 @@
         self.Show(True)
 
-    def onSave(self,event=None):
+    def onSave(self, event=None):
         """
         Save
         """
         #todo: complete saving fig file and as a txt file
-        dlg = wx.FileDialog(self, "Choose a file",\
-                            wildcard ='HTML files (*.html)|*.html|'+
+        dlg = wx.FileDialog(self, "Choose a file",
+                            wildcard='HTML files (*.html)|*.html|'+
                             'Text files (*.txt)|*.txt',
-                            style = wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
+                            style=wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
         dlg.SetFilterIndex(0) #Set .html files to be default
 
         if dlg.ShowModal() != wx.ID_OK:
-          dlg.Destroy()
-          return
+            dlg.Destroy()
+            return
         
         fName = dlg.GetPath()
@@ -126,10 +131,11 @@
         if ext_num == 0:
             ext = '.html'
-            img_ext= '_img4html.png'
+            img_ext = '_img4html.png'
             report_frame = self.report_list[0]
         elif ext_num == 1:
             ext = '.txt'   
-            # changing the image extension actually changes the image format on saving
-            img_ext= '_img4txt.pdf'
+            # changing the image extension actually changes the image
+            # format on saving
+            img_ext = '_img4txt.pdf'
             report = self.report_list[1]
         else:
@@ -142,5 +148,6 @@
         pic_fname = os.path.splitext(fName)[0] + img_ext
         #put the image path in html string
-        if ext_num == 0: report = report_frame % pic_fname
+        if ext_num == 0:
+            report = report_frame % pic_fname
         f = open(fName, 'w')
         f.write(report)
@@ -150,5 +157,5 @@
         
             
-    def onPreview(self,event=None):
+    def onPreview(self, event=None):
         """
         Preview
@@ -156,8 +163,10 @@
         : event: Preview button event
         """
-        previewh=html.HtmlEasyPrinting(name="Printing", parentWindow=self)
+        previewh = html.HtmlEasyPrinting(name="Printing", parentWindow=self)
         previewh.PreviewText(self.report_html)
-    
-    def onPrint(self,event=None):
+        if event is not None:
+            event.Skip()
+    
+    def onPrint(self, event=None):
         """
         Print
@@ -165,7 +174,8 @@
         : event: Print button event
         """
-        printh=html.HtmlEasyPrinting(name="Printing", parentWindow=self)
+        printh = html.HtmlEasyPrinting(name="Printing", parentWindow=self)
         printh.PrintText(self.report_html)
-
+        if event is not None:
+            event.Skip()
 
     def OnClose(self,event=None):
@@ -175,5 +185,4 @@
         : event: Close button event
         """
-        
         self.Close()
     
@@ -188,6 +197,7 @@
         f = file(filename, "wb")
         # pisa requires some extra packages, see their web-site
-        pdf = pisa.CreatePDF(data,f)
-        # close the file here otherwise it will be open until quitting the application.
+        pdf = pisa.CreatePDF(data, f)
+        # close the file here otherwise it will be open until quitting
+        #the application.
         f.close()
 
