Index: prview/perspectives/pr/explore_dialog.py
===================================================================
--- prview/perspectives/pr/explore_dialog.py	(revision 7116b6e08b4906240b8a779bf2f7c0f6e2623f6f)
+++ prview/perspectives/pr/explore_dialog.py	(revision 3e41f43f7d0b8c4264182203e33d8cbf55977c98)
@@ -68,5 +68,5 @@
  
         # Plot area
-        self.plot = Model1D(self.x,y=y,dy=dy)
+        self.plot = Model1D(self.x, y=y, dy=dy)
         self.plot.name = DEFAULT_OUTPUT
 
@@ -89,5 +89,5 @@
         id = wx.NewId()
         slicerpop = wx.Menu()
-        slicerpop.Append(id,'&Save image', 'Save image as PNG')
+        slicerpop.Append(id, '&Save image', 'Save image as PNG')
         wx.EVT_MENU(self, id, self.onSaveImage)
         
@@ -126,5 +126,6 @@
         self.outputs['Oscillation parameter'] = ["Osc", "a.u.", self.osc]    
         self.outputs['Positive fraction'] = ["P^+", "a.u.", self.pos]    
-        self.outputs['1-sigma positive fraction'] = ["P^+_{1\ \sigma}", "a.u.", self.pos_err]    
+        self.outputs['1-sigma positive fraction'] = ["P^+_{1\ \sigma}", 
+                                                     "a.u.", self.pos_err]    
         self.outputs['Rg'] = ["R_g", "A", self.rg]    
         self.outputs['I(q=0)'] = ["I(q=0)", "1/A", self.iq0]    
@@ -157,9 +158,12 @@
         
         # Control for number of points
-        self.npts_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
+        self.npts_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                   size=(60,20))
         # Control for the minimum value of D_max
-        self.dmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
+        self.dmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                   size=(60,20))
         # Control for the maximum value of D_max
-        self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
+        self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                   size=(60,20))
 
         # Output selection box for the y axis
@@ -167,5 +171,6 @@
 
         # Create the plot object
-        self.plotpanel = OutputPlot(self._default_min, self._default_max, self, -1, style=wx.RAISED_BORDER)
+        self.plotpanel = OutputPlot(self._default_min, self._default_max,
+                                    self, -1, style=wx.RAISED_BORDER)
         
         # Create the layout of the dialog
@@ -258,5 +263,7 @@
             self.plotpanel.plot.y = self.results.outputs[output_type][2]
             self.plotpanel.plot.name = '_nolegend_'
-            self.plotpanel.graph.yaxis("\\rm{%s}" % self.results.outputs[output_type][0], self.results.outputs[output_type][1])
+            y_label = "\\rm{%s}" % self.results.outputs[output_type][0]
+            self.plotpanel.graph.yaxis(y_label,
+                                       self.results.outputs[output_type][1])
             
             # Redraw
@@ -264,6 +271,8 @@
             self.plotpanel.subplot.figure.canvas.draw_idle()
         else:
-            msg =  "ExploreDialog: the Results object's dictionary does not contain "
-            msg += "the [%s] output type. This must be indicative of a change in the " % str(output_type)
+            msg =  "ExploreDialog: the Results object's dictionary "
+            msg += "does not contain "
+            msg += "the [%s] output type. This must be indicative of "
+            msg += "a change in the " % str(output_type)
             msg += "ExploreDialog code."
             logging.error(msg)
@@ -279,12 +288,14 @@
         sizer_main = wx.BoxSizer(wx.VERTICAL)
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
-        sizer_params = wx.GridBagSizer(5,5)
+        sizer_params = wx.GridBagSizer(5, 5)
 
         iy = 0
         ix = 0
         label_npts  = wx.StaticText(self, -1, "Npts")
-        sizer_params.Add(label_npts, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(label_npts, (iy, ix), (1, 1), 
+                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        sizer_params.Add(self.npts_ctl,   (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer_params.Add(self.npts_ctl,   (iy, ix), (1, 1), 
+                         wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.npts_ctl.SetValue("%g" % DEFAULT_NPTS)
         self.npts_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc)
@@ -292,7 +303,9 @@
         ix += 1
         label_dmin   = wx.StaticText(self, -1, "Min Distance [A]")
-        sizer_params.Add(label_dmin, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(label_dmin, (iy, ix), (1, 1),
+                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        sizer_params.Add(self.dmin_ctl,   (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer_params.Add(self.dmin_ctl, (iy, ix), (1, 1),
+                         wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.dmin_ctl.SetValue(str(self._default_min))
         self.dmin_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc)
@@ -300,7 +313,9 @@
         ix += 1
         label_dmax = wx.StaticText(self, -1, "Max Distance [A]")
-        sizer_params.Add(label_dmax, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        sizer_params.Add(label_dmax, (iy, ix), (1, 1),
+                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         ix += 1
-        sizer_params.Add(self.dmax_ctl,   (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+        sizer_params.Add(self.dmax_ctl,   (iy, ix), (1, 1),
+                         wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         self.dmax_ctl.SetValue(str(self._default_max))
         self.dmax_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc)
@@ -314,13 +329,15 @@
         self.output_box.SetStringSelection(DEFAULT_OUTPUT)
         
-        output_sizer = wx.GridBagSizer(5,5)
-        output_sizer.Add(selection_msg, (0,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
-        output_sizer.Add(self.output_box, (0,1), (1,2), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
-        
-        wx.EVT_COMBOBOX(self.output_box,-1, self._plot_output) 
+        output_sizer = wx.GridBagSizer(5, 5)
+        output_sizer.Add(selection_msg, (0, 0), (1, 1),
+                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
+        output_sizer.Add(self.output_box, (0, 1), (1, 2),
+                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
+        
+        wx.EVT_COMBOBOX(self.output_box, -1, self._plot_output) 
         sizer_main.Add(output_sizer, 0, wx.EXPAND | wx.ALL, 10)
         
         sizer_main.Add(self.plotpanel, 0, wx.EXPAND | wx.ALL, 10)
-        sizer_main.SetItemMinSize(self.plotpanel, 400,400)
+        sizer_main.SetItemMinSize(self.plotpanel, 400, 400)
         
         sizer_main.Add(sizer_params, 0, wx.EXPAND|wx.ALL, 10)
@@ -357,6 +374,8 @@
         
         # Loop over d_max values
-        for i in range(content.npts):    
-            d = content.dmin + i * (content.dmax - content.dmin)/(content.npts-1.0)
+        for i in range(content.npts): 
+            temp = (content.dmax - content.dmin)/(content.npts - 1.0)   
+            d = content.dmin + i * temp
+                
             self.pr_state.d_max = d
             try:
@@ -380,5 +399,7 @@
             except:
                 # This inversion failed, skip this D_max value
-                logging.error("ExploreDialog: inversion failed for D_max=%s\n%s" % (str(d), sys.exc_value))
+                msg = "ExploreDialog: inversion failed "
+                msg += "for D_max=%s\n%s" % (str(d), sys.exc_value)
+                logging.error(msg)
             
         self.results = results            
Index: prview/perspectives/pr/inversion_panel.py
===================================================================
--- prview/perspectives/pr/inversion_panel.py	(revision b35d3d1fd21996b7e3eed67f36661a33aeccb11d)
+++ prview/perspectives/pr/inversion_panel.py	(revision 3e41f43f7d0b8c4264182203e33d8cbf55977c98)
@@ -12,5 +12,7 @@
 from sans.guicomm.events import StatusEvent    
 from inversion_state import InversionState
-from pr_widgets import PrTextCtrl, DataFileTextCtrl, OutputTextCtrl
+from pr_widgets import PrTextCtrl
+from pr_widgets import DataFileTextCtrl
+from pr_widgets import OutputTextCtrl
 
 
@@ -28,8 +30,9 @@
     oscillation_max = 1.5
     
-    def __init__(self, parent, id = -1, plots = None, standalone=False, **kwargs):
-        """
-        """
-        ScrolledPanel.__init__(self, parent, id = id, **kwargs)
+    def __init__(self, parent, id=-1, plots=None, 
+                 standalone=False, **kwargs):
+        """
+        """
+        ScrolledPanel.__init__(self, parent, id=id, **kwargs)
         self.SetupScrolling()
         
@@ -91,35 +94,35 @@
         Allow direct hooks to text boxes
         """
-        if name=='nfunc':
+        if name == 'nfunc':
             self.nfunc_ctl.SetValue(str(int(value)))
-        elif name=='d_max':
+        elif name == 'd_max':
             self.dmax_ctl.SetValue(str(value))
-        elif name=='alpha':
+        elif name == 'alpha':
             self.alpha_ctl.SetValue(str(value))
-        elif name=='chi2':
+        elif name == 'chi2':
             self.chi2_ctl.SetValue("%-5.2g" % value)
-        elif name=='bck':
+        elif name == 'bck':
             self.bck_ctl.SetValue("%-5.2g" % value)
-        elif name=='q_min':
+        elif name == 'q_min':
             self.qmin_ctl.SetValue("%-5.2g" % value)
-        elif name=='q_max':
+        elif name == 'q_max':
             self.qmax_ctl.SetValue("%-5.2g" % value)
-        elif name=='elapsed':
+        elif name == 'elapsed':
             self.time_ctl.SetValue("%-5.2g" % value)
-        elif name=='rg':
+        elif name ==' rg':
             self.rg_ctl.SetValue("%-5.2g" % value)
-        elif name=='iq0':
+        elif name == 'iq0':
             self.iq0_ctl.SetValue("%-5.2g" % value)
-        elif name=='oscillation':
+        elif name == 'oscillation':
             self.osc_ctl.SetValue("%-5.2g" % value)
-        elif name=='slit_width':
+        elif name == 'slit_width':
             self.swidth_ctl.SetValue("%-5.2g" % value)
-        elif name=='slit_height':
+        elif name == 'slit_height':
             self.sheight_ctl.SetValue("%-5.2g" % value)
-        elif name=='positive':
+        elif name == 'positive':
             self.pos_ctl.SetValue("%-5.2g" % value)
-        elif name=='pos_err':
+        elif name == 'pos_err':
             self.pos_err_ctl.SetValue("%-5.2g" % value)
-        elif name=='alpha_estimate':
+        elif name == 'alpha_estimate':
             self.alpha_estimate_ctl.SetToolTipString("Click to accept value.")
             self.alpha_estimate_ctl.Enable(True)
@@ -127,12 +130,12 @@
             #self.alpha_estimate_ctl.Show()
             #self.label_sugg.Show()
-        elif name=='nterms_estimate':
+        elif name == 'nterms_estimate':
             self.nterms_estimate_ctl.SetToolTipString("Click to accept value.")
             self.nterms_estimate_ctl.Enable(True)
             self.nterms_estimate_ctl.SetLabel("%-g" % value)
-        elif name=='plotname':
+        elif name == 'plotname':
             self.plot_data.SetValue(str(value))
             self._on_pars_changed(None)
-        elif name=='datafile':
+        elif name == 'datafile':
             self.plot_data.SetValue(str(value))
             self._on_pars_changed(None)
@@ -144,30 +147,30 @@
         Allow direct hooks to text boxes
         """
-        if name=='nfunc':
+        if name == 'nfunc':
             try:
                 return int(self.nfunc_ctl.GetValue())
             except:
                 return -1
-        elif name=='d_max':
+        elif name == 'd_max':
             try:
                 return self.dmax_ctl.GetValue()
             except:
                 return -1.0
-        elif name=='alpha':
+        elif name == 'alpha':
             try:
                 return self.alpha_ctl.GetValue()
             except:
                 return -1.0
-        elif name=='chi2':
+        elif name == 'chi2':
             try:
                 return float(self.chi2_ctl.GetValue())
             except:
                 return None
-        elif name=='bck':
+        elif name == 'bck':
             try:
                 return float(self.bck_ctl.GetValue())
             except:
                 return None
-        elif name=='q_min':
+        elif name == 'q_min':
             try:
                 return float(self.qmin_ctl.GetValue())
@@ -179,10 +182,10 @@
             except:
                 return 0.0
-        elif name=='elapsed':
+        elif name == 'elapsed':
             try:
                 return float(self.time_ctl.GetValue())
             except:
                 return None
-        elif name=='rg':
+        elif name == 'rg':
             try:
                 return float(self.rg_ctl.GetValue())
@@ -194,10 +197,10 @@
             except:
                 return None
-        elif name=='oscillation':
+        elif name == 'oscillation':
             try:
                 return float(self.osc_ctl.GetValue())
             except:
                 return None
-        elif name=='slit_width':
+        elif name == 'slit_width':
             try:
                 return float(self.swidth_ctl.GetValue())
@@ -209,27 +212,27 @@
             except:
                 return None
-        elif name=='pos':
+        elif name == 'pos':
             try:
                 return float(self.pos_ctl.GetValue())
             except:
                 return None
-        elif name=='pos_err':
+        elif name == 'pos_err':
             try:
                 return float(self.pos_err_ctl.GetValue())
             except:
                 return None
-        elif name=='alpha_estimate':
+        elif name == 'alpha_estimate':
             try:
                 return float(self.alpha_estimate_ctl.GetLabel())
             except:
                 return None
-        elif name=='nterms_estimate':
+        elif name == 'nterms_estimate':
             try:
                 return int(self.nterms_estimate_ctl.GetLabel())
             except:
                 return None
-        elif name=='plotname':
+        elif name == 'plotname':
             return self.plot_data.GetValue()
-        elif name=='datafile':
+        elif name == 'datafile':
             return self.plot_data.GetValue()
         else:
@@ -244,5 +247,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, "", "*.prv", wx.SAVE)
+        dlg = wx.FileDialog(self, "Choose a file",
+                            self._default_save_location, "", "*.prv", wx.SAVE)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
@@ -372,22 +376,28 @@
         
         boxsizer1 = wx.StaticBoxSizer(databox, wx.VERTICAL)
-        boxsizer1.SetMinSize((self._default_width,50))
-        pars_sizer = wx.GridBagSizer(5,5)
+        boxsizer1.SetMinSize((self._default_width, 50))
+        pars_sizer = wx.GridBagSizer(5, 5)
 
         iy = 0
         self.file_radio = wx.StaticText(self, -1, "Data:")
-        pars_sizer.Add(self.file_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        pars_sizer.Add(self.file_radio, (iy, 0), (1, 1),
+                       wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         
         self.plot_data = DataFileTextCtrl(self, -1, size=(260,20))
         
-        pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 15)
+        pars_sizer.Add(self.plot_data, (iy, 1), (1, 1),
+                       wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 15)
         
         self.bck_chk = wx.CheckBox(self, -1, "Estimate background level")
-        self.bck_chk.SetToolTipString("Check box to let the fit estimate the constant background level.")
+        hint_msg = "Check box to let the fit estimate "
+        hint_msg += "the constant background level."
+        self.bck_chk.SetToolTipString(hint_msg)
         self.bck_chk.Bind(wx.EVT_CHECKBOX, self._on_pars_changed)
         iy += 1
-        pars_sizer.Add(self.bck_chk, (iy,0), (1,2), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        pars_sizer.Add(self.bck_chk, (iy, 0), (1, 2),
+                       wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         boxsizer1.Add(pars_sizer, 0, wx.EXPAND)  
-        vbox.Add(boxsizer1, (iy_vb,0), (1,1), wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE|wx.TOP, 5)
+        vbox.Add(boxsizer1, (iy_vb, 0), (1, 1),
+                 wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE|wx.TOP, 5)
         
         # ----- Add slit parameters -----
@@ -395,30 +405,40 @@
             sbox = wx.StaticBox(self, -1, "Slit parameters")
             sboxsizer = wx.StaticBoxSizer(sbox, wx.VERTICAL)
-            sboxsizer.SetMinSize((self._default_width,20))
+            sboxsizer.SetMinSize((self._default_width, 20))
             
-            sizer_slit = wx.GridBagSizer(5,5)
-    
-            label_sheight = wx.StaticText(self, -1, "Height", size=(40,20))
-            label_swidth = wx.StaticText(self, -1, "Width", size=(40,20))
+            sizer_slit = wx.GridBagSizer(5, 5)
+    
+            label_sheight = wx.StaticText(self, -1, "Height", size=(40, 20))
+            label_swidth = wx.StaticText(self, -1, "Width", size=(40, 20))
             #label_sunits1 = wx.StaticText(self, -1, "[A^(-1)]")
             label_sunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(55,20))
-            self.sheight_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
-            self.swidth_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
-            self.sheight_ctl.SetToolTipString("Enter slit height in units of Q or leave blank.")
-            self.swidth_ctl.SetToolTipString("Enter slit width in units of Q or leave blank.")
+            self.sheight_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                          size=(60,20))
+            self.swidth_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                         size=(60,20))
+            hint_msg = "Enter slit height in units of Q or leave blank."
+            self.sheight_ctl.SetToolTipString(hint_msg)
+            hint_msg = "Enter slit width in units of Q or leave blank."
+            self.swidth_ctl.SetToolTipString(hint_msg)
             #self.sheight_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)
             #self.swidth_ctl.Bind(wx.EVT_TEXT,  self._on_pars_changed)
             
             iy = 0
-            sizer_slit.Add(label_sheight,    (iy,0), (1,1), wx.LEFT|wx.EXPAND, 5)
-            sizer_slit.Add(self.sheight_ctl, (iy,1), (1,1), wx.LEFT|wx.EXPAND, 5)
-            #sizer_slit.Add(label_sunits1,    (iy,2), (1,1), wx.LEFT|wx.EXPAND, 10)
-            sizer_slit.Add(label_swidth,     (iy,2), (1,1), wx.LEFT|wx.EXPAND, 5)
-            sizer_slit.Add(self.swidth_ctl,  (iy,3), (1,1), wx.LEFT|wx.EXPAND, 5)
-            sizer_slit.Add(label_sunits2,    (iy,4), (1,1), wx.LEFT|wx.EXPAND, 5)
+            sizer_slit.Add(label_sheight,    (iy, 0), (1, 1),
+                           wx.LEFT|wx.EXPAND, 5)
+            sizer_slit.Add(self.sheight_ctl, (iy, 1), (1, 1),
+                           wx.LEFT|wx.EXPAND, 5)
+    
+            sizer_slit.Add(label_swidth,     (iy, 2), (1, 1),
+                           wx.LEFT|wx.EXPAND, 5)
+            sizer_slit.Add(self.swidth_ctl,  (iy, 3), (1, 1),
+                           wx.LEFT|wx.EXPAND, 5)
+            sizer_slit.Add(label_sunits2,    (iy, 4), (1, 1),
+                           wx.LEFT|wx.EXPAND, 5)
             
             sboxsizer.Add(sizer_slit, wx.TOP, 15)
             iy_vb += 1
-            vbox.Add(sboxsizer, (iy_vb,0), (1,1), wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
+            vbox.Add(sboxsizer, (iy_vb, 0), (1, 1),
+                     wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
         
         
@@ -426,34 +446,36 @@
         qbox = wx.StaticBox(self, -1, "Q range")
         qboxsizer = wx.StaticBoxSizer(qbox, wx.VERTICAL)
-        qboxsizer.SetMinSize((self._default_width,20))
-        
-        sizer_q = wx.GridBagSizer(5,5)
-
-        label_qmin = wx.StaticText(self, -1, "Q min", size=(40,20))
-        label_qmax = wx.StaticText(self, -1, "Q max", size=(40,20))
+        qboxsizer.SetMinSize((self._default_width, 20))
+        
+        sizer_q = wx.GridBagSizer(5, 5)
+
+        label_qmin = wx.StaticText(self, -1, "Q min", size=(40, 20))
+        label_qmax = wx.StaticText(self, -1, "Q max", size=(40, 20))
         #label_qunits1 = wx.StaticText(self, -1, "[A^(-1)]")
-        label_qunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(55,20))
-        self.qmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
-        self.qmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
-        self.qmin_ctl.SetToolTipString("Select a lower bound for Q or leave blank.")
-        self.qmax_ctl.SetToolTipString("Select an upper bound for Q or leave blank.")
+        label_qunits2 = wx.StaticText(self, -1, "[A^(-1)]", size=(55, 20))
+        self.qmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                   size=(60,20))
+        self.qmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                   size=(60,20))
+        hint_msg = "Select a lower bound for Q or leave blank."
+        self.qmin_ctl.SetToolTipString(hint_msg)
+        hint_msg = "Select an upper bound for Q or leave blank."
+        self.qmax_ctl.SetToolTipString(hint_msg)
         self.qmin_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)
         self.qmax_ctl.Bind(wx.EVT_TEXT, self._on_pars_changed)
         
         iy = 0
-        sizer_q.Add(label_qmin,    (iy,0), (1,1), wx.LEFT|wx.EXPAND, 5)
-        sizer_q.Add(self.qmin_ctl, (iy,1), (1,1), wx.LEFT|wx.EXPAND, 5)
+        sizer_q.Add(label_qmin,    (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 5)
+        sizer_q.Add(self.qmin_ctl, (iy, 1), (1, 1), wx.LEFT|wx.EXPAND, 5)
         #sizer_q.Add(label_qunits1, (iy,2), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_q.Add(label_qmax,    (iy,2), (1,1), wx.LEFT|wx.EXPAND, 5)
-        sizer_q.Add(self.qmax_ctl, (iy,3), (1,1), wx.LEFT|wx.EXPAND, 5)
-        sizer_q.Add(label_qunits2, (iy,4), (1,1), wx.LEFT|wx.EXPAND, 5)
+        sizer_q.Add(label_qmax,    (iy, 2), (1, 1), wx.LEFT|wx.EXPAND, 5)
+        sizer_q.Add(self.qmax_ctl, (iy, 3), (1, 1), wx.LEFT|wx.EXPAND, 5)
+        sizer_q.Add(label_qunits2, (iy, 4), (1, 1), wx.LEFT|wx.EXPAND, 5)
         qboxsizer.Add(sizer_q, wx.TOP, 15)
 
         iy_vb += 1
-        vbox.Add(qboxsizer, (iy_vb,0), (1,1), wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
-        
-        
-        
-
+        vbox.Add(qboxsizer, (iy_vb,0), (1,1),
+                 wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
+    
         # ----- Parameters -----
         parsbox = wx.StaticBox(self, -1, "Parameters")
@@ -461,9 +483,10 @@
         boxsizer2.SetMinSize((self._default_width,50))
         
-        explanation  = "P(r) is found by fitting a set of base functions to I(Q). "
-        explanation += "The minimization involves a regularization term to ensure "
-        explanation += "a smooth P(r). The regularization constant gives the size of that "  
-        explanation += "term. The suggested value is the value above which the "
-        explanation += "output P(r) will have only one peak."
+        explanation  = "P(r) is found by fitting a set of base functions"
+        explanation += " to I(Q). The minimization involves"
+        explanation += " a regularization term to ensure a smooth P(r)."
+        explanation += " The regularization constant gives the size of that "  
+        explanation += "term. The suggested value is the value above which the"
+        explanation += " output P(r) will have only one peak."
         label_explain = wx.StaticText(self, -1, explanation, size=(280,120))
         boxsizer2.Add(label_explain,  wx.LEFT|wx.BOTTOM, 5)
@@ -472,5 +495,5 @@
         
         label_nfunc = wx.StaticText(self, -1, "Number of terms")
-        label_nfunc.SetMinSize((120,20))
+        label_nfunc.SetMinSize((120, 20))
         label_alpha = wx.StaticText(self, -1, "Regularization constant")
         label_dmax  = wx.StaticText(self, -1, "Max distance [A]")
@@ -478,10 +501,15 @@
         #self.label_sugg.Hide()
         
-        self.nfunc_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
+        self.nfunc_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                    size=(60,20))
         self.nfunc_ctl.SetToolTipString("Number of terms in the expansion.")
-        self.alpha_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
-        self.alpha_ctl.SetToolTipString("Control parameter for the size of the regularization term.")
-        self.dmax_ctl  = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20))
-        self.dmax_ctl.SetToolTipString("Maximum distance between any two points in the system.")
+        self.alpha_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                    size=(60,20))
+        hint_msg = "Control parameter for the size of the regularization term."
+        self.alpha_ctl.SetToolTipString(hint_msg)
+        self.dmax_ctl  = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER,
+                                    size=(60,20))
+        hint_msg = "Maximum distance between any two points in the system."
+        self.dmax_ctl.SetToolTipString(hint_msg)
         id = wx.NewId()
         self.alpha_estimate_ctl  = wx.Button(self, id, "")
@@ -498,6 +526,5 @@
         self.Bind(wx.EVT_BUTTON, self._on_accept_nterms, id = id)   
         self.nterms_estimate_ctl.Enable(False)
-        #self.nterms_estimate_ctl.SetBackgroundColour('#ffdf85')
-        #self.nterms_estimate_ctl.SetBackgroundColour(self.GetBackgroundColour())
+      
         self.nterms_estimate_ctl.SetToolTipString("Waiting for estimate...")
         
@@ -515,22 +542,24 @@
 
         iy = 0
-        sizer_params.Add(self.label_sugg,       (iy,2), (1,1), wx.LEFT, 15)
+        sizer_params.Add(self.label_sugg, (iy, 2), (1, 1), wx.LEFT, 15)
         iy += 1
-        sizer_params.Add(label_nfunc,      (iy,0), (1,1), wx.LEFT, 15)
-        sizer_params.Add(self.nfunc_ctl,   (iy,1), (1,1), wx.RIGHT, 0)
-        sizer_params.Add(self.nterms_estimate_ctl, (iy,2), (1,1), wx.LEFT, 15)
+        sizer_params.Add(label_nfunc,      (iy, 0), (1, 1), wx.LEFT, 15)
+        sizer_params.Add(self.nfunc_ctl,   (iy, 1), (1, 1), wx.RIGHT, 0)
+        sizer_params.Add(self.nterms_estimate_ctl, (iy, 2), (1, 1), wx.LEFT, 15)
         iy += 1
-        sizer_params.Add(label_alpha,      (iy,0), (1,1), wx.LEFT, 15)
-        sizer_params.Add(self.alpha_ctl,   (iy,1), (1,1), wx.RIGHT, 0)
-        sizer_params.Add(self.alpha_estimate_ctl, (iy,2), (1,1), wx.LEFT, 15)
+        sizer_params.Add(label_alpha,      (iy, 0), (1, 1), wx.LEFT, 15)
+        sizer_params.Add(self.alpha_ctl,   (iy, 1), (1, 1), wx.RIGHT, 0)
+        sizer_params.Add(self.alpha_estimate_ctl, (iy, 2), (1, 1), wx.LEFT, 15)
         iy += 1
-        sizer_params.Add(label_dmax, (iy,0), (1,1), wx.LEFT, 15)
-        sizer_params.Add(self.dmax_ctl,   (iy,1), (1,1), wx.RIGHT, 0)
-        sizer_params.Add(self.distance_explorator_ctl,   (iy,2), (1,1), wx.LEFT, 15)
+        sizer_params.Add(label_dmax, (iy, 0), (1, 1), wx.LEFT, 15)
+        sizer_params.Add(self.dmax_ctl,   (iy, 1), (1, 1), wx.RIGHT, 0)
+        sizer_params.Add(self.distance_explorator_ctl, (iy, 2),
+                         (1, 1), wx.LEFT, 15)
 
         boxsizer2.Add(sizer_params, 0)
         
         iy_vb += 1
-        vbox.Add(boxsizer2, (iy_vb,0), (1,1), wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
+        vbox.Add(boxsizer2, (iy_vb, 0), (1, 1),
+                 wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
 
 
@@ -538,5 +567,5 @@
         resbox = wx.StaticBox(self, -1, "Outputs")
         ressizer = wx.StaticBoxSizer(resbox, wx.VERTICAL)
-        ressizer.SetMinSize((self._default_width,50))
+        ressizer.SetMinSize((self._default_width, 50))
         
         label_rg       = wx.StaticText(self, -1, "Rg")
@@ -547,7 +576,9 @@
         label_bck_unit = wx.StaticText(self, -1, "[A^(-1)]")
         self.rg_ctl    = OutputTextCtrl(self, -1, size=(60,20))
-        self.rg_ctl.SetToolTipString("Radius of gyration for the computed P(r).")
+        hint_msg = "Radius of gyration for the computed P(r)."
+        self.rg_ctl.SetToolTipString(hint_msg)
         self.iq0_ctl   = OutputTextCtrl(self, -1, size=(60,20))
-        self.iq0_ctl.SetToolTipString("Scattering intensity at Q=0 for the computed P(r).")
+        hint_msg = "Scattering intensity at Q=0 for the computed P(r)."
+        self.iq0_ctl.SetToolTipString(hint_msg)
         self.bck_ctl   = OutputTextCtrl(self, -1, size=(60,20))
         self.bck_ctl.SetToolTipString("Value of estimated constant background.")
@@ -562,5 +593,6 @@
         
         self.time_ctl = OutputTextCtrl(self, -1, size=(60,20))
-        self.time_ctl.SetToolTipString("Computation time for the last inversion, in seconds.")
+        hint_msg = "Computation time for the last inversion, in seconds."
+        self.time_ctl.SetToolTipString(hint_msg)
         
         self.chi2_ctl = OutputTextCtrl(self, -1, size=(60,20))
@@ -569,54 +601,61 @@
         # Oscillation parameter
         self.osc_ctl = OutputTextCtrl(self, -1, size=(60,20))
-        self.osc_ctl.SetToolTipString("Oscillation parameter. P(r) for a sphere has an oscillation parameter of 1.1.")
+        hint_msg = "Oscillation parameter. P(r) for a sphere has an "
+        hint_msg += " oscillation parameter of 1.1."
+        self.osc_ctl.SetToolTipString(hint_msg)
         
         # Positive fraction figure of merit
         self.pos_ctl = OutputTextCtrl(self, -1, size=(60,20))
-        self.pos_ctl.SetToolTipString("Fraction of P(r) that is positive. Theoretically, P(r) is defined positive.")
+        hint_msg = "Fraction of P(r) that is positive. "
+        hint_msg += "Theoretically, P(r) is defined positive."
+        self.pos_ctl.SetToolTipString(hint_msg)
         
         # 1-simga positive fraction figure of merit
         self.pos_err_ctl = OutputTextCtrl(self, -1, size=(60,20))
-        message  = "Fraction of P(r) that is at least 1 standard deviation greater than zero.\n"
-        message += "This figure of merit tells you about the size of the P(r) errors.\n"
-        message += "If it is close to 1 and the other figures of merit are bad, consider changing "
-        message += "the maximum distance."
+        message  = "Fraction of P(r) that is at least 1 standard deviation"
+        message += " greater than zero.\n"
+        message += "This figure of merit tells you about the size of the "
+        message += "P(r) errors.\n"
+        message += "If it is close to 1 and the other figures of merit are bad,"
+        message += " consider changing the maximum distance."
         self.pos_err_ctl.SetToolTipString(message)
         
-        sizer_res = wx.GridBagSizer(5,5)
+        sizer_res = wx.GridBagSizer(5, 5)
 
         iy = 0
-        sizer_res.Add(label_rg, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.rg_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
-        sizer_res.Add(label_rg_unit,   (iy,2), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_rg, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.rg_ctl,   (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_rg_unit,   (iy, 2), (1, 1), wx.RIGHT|wx.EXPAND, 15)
         iy += 1
-        sizer_res.Add(label_iq0, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.iq0_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
-        sizer_res.Add(label_iq0_unit,   (iy,2), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_iq0, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.iq0_ctl,   (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_iq0_unit, (iy, 2), (1, 1), wx.RIGHT|wx.EXPAND, 15)
         iy += 1
-        sizer_res.Add(label_bck, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.bck_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
-        sizer_res.Add(label_bck_unit,   (iy,2), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_bck, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.bck_ctl, (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_bck_unit, (iy, 2), (1, 1), wx.RIGHT|wx.EXPAND, 15)
         iy += 1
-        sizer_res.Add(label_time, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.time_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
-        sizer_res.Add(label_time_unit,   (iy,2), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_time, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.time_ctl,   (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_time_unit, (iy, 2), (1, 1), wx.RIGHT|wx.EXPAND, 15)
         iy += 1
-        sizer_res.Add(label_chi2, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.chi2_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_chi2, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.chi2_ctl,   (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
         iy += 1
-        sizer_res.Add(label_osc, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.osc_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_osc, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.osc_ctl,   (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
 
         iy += 1
-        sizer_res.Add(label_pos, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.pos_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_pos, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.pos_ctl, (iy, 1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
 
         iy += 1
-        sizer_res.Add(label_pos_err, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
-        sizer_res.Add(self.pos_err_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
+        sizer_res.Add(label_pos_err, (iy, 0), (1, 1), wx.LEFT|wx.EXPAND, 15)
+        sizer_res.Add(self.pos_err_ctl,  (iy,1), (1, 1), wx.RIGHT|wx.EXPAND, 15)
 
         ressizer.Add(sizer_res, 0)
         iy_vb += 1
-        vbox.Add(ressizer, (iy_vb,0), (1,1), wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
+        vbox.Add(ressizer, (iy_vb, 0), (1, 1),
+                 wx.LEFT|wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)
 
         # ----- Buttons -----
@@ -635,5 +674,5 @@
         button_Save = wx.Button(self, id, "Save")
         button_Save.SetToolTipString("Save the current P(r) work to file.")
-        self.Bind(wx.EVT_BUTTON, self._save_state, id = id)   
+        self.Bind(wx.EVT_BUTTON, self._save_state, id=id)   
         
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
@@ -642,7 +681,8 @@
         sizer_button.Add(button_Reset, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
         sizer_button.Add(button_OK, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
-        #sizer_button.Add(button_Cancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
+       
         iy_vb += 1
-        vbox.Add(sizer_button, (iy_vb,0), (1,1), wx.EXPAND|wx.BOTTOM|wx.TOP|wx.RIGHT, 10)
+        vbox.Add(sizer_button, (iy_vb, 0), (1, 1),
+                 wx.EXPAND|wx.BOTTOM|wx.TOP|wx.RIGHT, 10)
 
         self.Bind(wx.EVT_TEXT_ENTER, self._on_invert)
@@ -661,5 +701,5 @@
         except:
             # No estimate or bad estimate, either do nothing
-            import sys
+            #import sys
             print "InversionControl._on_accept_alpha: %s" % sys.exc_value
             pass
@@ -742,5 +782,5 @@
         try:
             height_str = self.sheight_ctl.GetValue()
-            if len(height_str.lstrip().rstrip())==0:
+            if len(height_str.lstrip().rstrip()) == 0:
                 height = 0
             else:
@@ -791,6 +831,7 @@
             nfunc = int(self.nfunc_ctl.GetValue())
             npts = self.manager.get_npts()
-            if npts>0 and nfunc>npts:
-                message = "Number of function terms should be smaller than the number of points"
+            if npts > 0 and nfunc > npts:
+                message = "Number of function terms should be smaller "
+                message += "than the number of points"
                 wx.PostEvent(self.manager.parent, StatusEvent(status=message))
                 raise ValueError, message
@@ -805,5 +846,5 @@
         try:
             qmin_str = self.qmin_ctl.GetValue()
-            if len(qmin_str.lstrip().rstrip())==0:
+            if len(qmin_str.lstrip().rstrip()) == 0:
                 qmin = None
             else:
@@ -819,5 +860,5 @@
         try:
             qmax_str = self.qmax_ctl.GetValue()
-            if len(qmax_str.lstrip().rstrip())==0:
+            if len(qmax_str.lstrip().rstrip()) == 0:
                 qmax = None
             else:
@@ -861,5 +902,6 @@
             dataset = self.plot_data.GetValue()
             if dataset==None or len(dataset.strip())==0:
-                message = "No data to invert. Select a data set before proceeding with P(r) inversion."
+                message = "No data to invert. Select a data set before"
+                message += " proceeding with P(r) inversion."
                 wx.PostEvent(self.manager.parent, StatusEvent(status=message))
             else:
@@ -871,5 +913,6 @@
                                                   width=width)
         else:
-            message = "The P(r) form contains invalid values: please submit it again."
+            message = "The P(r) form contains invalid values: "
+            message += "please submit it again."
             wx.PostEvent(self.parent, StatusEvent(status=message))
         
@@ -893,5 +936,6 @@
                 except:
                     # Invalid data
-                    logging.error("InversionControl._change_file: %s" % sys.exc_value)                    
+                    msg = "InversionControl._change_file: %s" % sys.exc_value
+                    logging.error(msg)                    
 
 class HelpDialog(wx.Dialog):
@@ -924,5 +968,5 @@
         sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         sizer_button.Add(button_OK, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
-        #sizer_button.Add(button_Cancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
+        
         vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
 
@@ -967,5 +1011,6 @@
         sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         sizer_button.Add(button_OK, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)
-        sizer_button.Add(button_Cancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
+        sizer_button.Add(button_Cancel, 0,
+                         wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)        
         vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
 
Index: prview/perspectives/pr/inversion_state.py
===================================================================
--- prview/perspectives/pr/inversion_state.py	(revision b35d3d1fd21996b7e3eed67f36661a33aeccb11d)
+++ prview/perspectives/pr/inversion_state.py	(revision 3e41f43f7d0b8c4264182203e33d8cbf55977c98)
@@ -11,10 +11,11 @@
 
 
-import time, os, sys
+import time
+import os
+import sys
 import logging
-import DataLoader
 from xml.dom.minidom import parse
 from lxml import etree
-
+import DataLoader
 from DataLoader.readers.cansas_reader import Reader as CansasReader
 from DataLoader.readers.cansas_reader import get_content
@@ -136,5 +137,6 @@
         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
@@ -188,5 +190,6 @@
         for item in in_list:
             element = newdoc.createElement(item[0])
-            exec "element.appendChild(newdoc.createTextNode(str(self.%s)))" % item[1]
+            cmd = "element.appendChild(newdoc.createTextNode(str(self.%s)))"
+            exec  cmd % item[1]
             inputs.appendChild(element)
               
@@ -197,5 +200,6 @@
         for item in out_list:
             element = newdoc.createElement(item[0])
-            exec "element.appendChild(newdoc.createTextNode(str(self.%s)))" % item[1]
+            cmd = "element.appendChild(newdoc.createTextNode(str(self.%s)))"
+            exec  cmd % item[1]
             outputs.appendChild(element)
                     
@@ -226,8 +230,9 @@
         """
         if file is not None:
-            raise RuntimeError, "InversionState no longer supports non-CanSAS format for P(r) files"
-            
-        if node.get('version')\
-            and node.get('version') == '1.0':
+            msg = "InversionState no longer supports non-CanSAS"
+            msg += " format for P(r) files"
+            raise RuntimeError, msg
+            
+        if node.get('version') and node.get('version') == '1.0':
             
             # Get file name
@@ -242,5 +247,7 @@
                     self.timestamp = float(entry.get('epoch'))
                 except:
-                    logging.error("InversionState.fromXML: Could not read timestamp\n %s" % sys.exc_value)
+                    msg = "InversionState.fromXML: Could not read "
+                    msg += "timestamp\n %s" % sys.exc_value
+                    logging.error(msg)
             
             # Parse inversion inputs
@@ -251,5 +258,6 @@
                     if input_field is not None:
                         try:
-                            exec 'self.%s = float(input_field.text.strip())' % item[1]
+                            cmd = 'self.%s = float(input_field.text.strip())' 
+                            exec  cmd % item[1]
                         except:
                             exec 'self.%s = None' % item[1]
@@ -269,5 +277,6 @@
                     if input_field is not None:
                         try:
-                            exec 'self.%s = float(input_field.text.strip())' % item[1]
+                            cmd = 'self.%s = float(input_field.text.strip())'
+                            exec  cmd % item[1]
                         except:
                             exec 'self.%s = None' % item[1]
@@ -292,7 +301,10 @@
                     # Sanity check
                     if not len(self.coefficients) == self.nfunc:
-                        # Inconsistent number of coefficients. Don't keep the data.
-                        err_msg = "InversionState.fromXML: inconsistant number of coefficients: "
-                        err_msg += "%d %d" % (len(self.coefficients), self.nfunc)
+                        # Inconsistent number of coefficients.
+                        # Don't keep the data.
+                        err_msg = "InversionState.fromXML: inconsistant "
+                        err_msg += "number of coefficients: "
+                        err_msg += "%d %d" % (len(self.coefficients),
+                                              self.nfunc)
                         logging.error(err_msg)
                         self.coefficients = None
@@ -328,5 +340,7 @@
                         # Inconsistent dimensions of the covariance matrix.
                         # Don't keep the data.
-                        err_msg = "InversionState.fromXML: inconsistant dimensions of the covariance matrix: "
+                        err_msg = "InversionState.fromXML: "
+                        err_msg += "inconsistant dimensions of the "
+                        err_msg += " covariance matrix: "
                         err_msg += "%d %d" % (len(self.covariance), self.nfunc)
                         logging.error(err_msg)
@@ -344,5 +358,5 @@
             "SANSView files (*.svs)|*.svs"]
     ## List of allowed extensions
-    ext=['.prv', '.PRV', '.svs', '.SVS']  
+    ext = ['.prv', '.PRV', '.svs', '.SVS']  
     
     def __init__(self, call_back, cansas=True):
@@ -406,5 +420,6 @@
         # Locate the P(r) node
         try:
-            nodes = entry.xpath('ns:%s' % PRNODE_NAME, namespaces={'ns': CANSAS_NS})
+            nodes = entry.xpath('ns:%s' % PRNODE_NAME,
+                                namespaces={'ns': CANSAS_NS})
             if nodes !=[]:
                 # Create an empty state
@@ -412,5 +427,7 @@
                 state.fromXML(node=nodes[0])
         except:
-            logging.info("XML document does not contain P(r) information.\n %s" % sys.exc_value)
+            msg = "XML document does not contain P(r) "
+            msg += "information.\n %s" % sys.exc_value
+            logging.info(msg)
             
         return state
@@ -437,13 +454,14 @@
             #TODO: eventually remove the check for .xml once
             # the P(r) writer/reader is truly complete.
-            if  extension.lower() in self.ext or \
-                extension.lower() == '.xml':
+            if  extension.lower() in self.ext or extension.lower() == '.xml':
                 
                 tree = etree.parse(path, parser=etree.ETCompatXMLParser())
                 # 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:
@@ -460,7 +478,7 @@
         
         # 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(output[0].meta_data['prstate'], datainfo = output[0])
@@ -498,5 +516,7 @@
             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
     
         # Create basic XML document
Index: prview/perspectives/pr/pr.py
===================================================================
--- prview/perspectives/pr/pr.py	(revision b35d3d1fd21996b7e3eed67f36661a33aeccb11d)
+++ prview/perspectives/pr/pr.py	(revision 3e41f43f7d0b8c4264182203e33d8cbf55977c98)
@@ -38,6 +38,7 @@
 (NewPrFileEvent, EVT_PR_FILE) = wx.lib.newevent.NewEvent()
 
-
-class Plugin:
+from sans.guiframe.plugin_base import PluginBase
+
+class Plugin(PluginBase):
     """
     """
@@ -47,18 +48,8 @@
     
     def __init__(self, standalone=True):
-        """
-        """
-        ## Plug-in name
-        self.sub_menu = "Pr inversion"
-        
-        ## Reference to the parent window
-        self.parent = None
-        
+        PluginBase.__init__(self, name="Pr inversion", standalone=standalone)
         ## Simulation window manager
         self.simview = None
-        
-        ## List of panels for the simulation perspective (names)
-        self.perspective = []
-        
+       
         ## State data
         self.alpha      = self.DEFAULT_ALPHA
@@ -1288,19 +1279,5 @@
         """
         self.control_panel._change_file(None)
-    
-    def get_perspective(self):
-        """
-            Get the list of panel names for this perspective
-        """
-        return self.perspective
-    
-    def on_perspective(self, event):
-        """
-            Call back function for the perspective menu item.
-            We notify the parent window that the perspective
-            has changed.
-        """
-        self.parent.set_perspective(self.perspective)
-    
+
     def post_init(self):
         """
@@ -1308,5 +1285,5 @@
             [Somehow openGL needs this call]
         """
-        if self.standalone==True:
+        if self.standalone:
             self.parent.set_perspective(self.perspective)
   
