Index: prview/perspectives/pr/inversion_panel.py
===================================================================
--- prview/perspectives/pr/inversion_panel.py	(revision 302510b94a1969619835d9674d7f9fbc28081be1)
+++ prview/perspectives/pr/inversion_panel.py	(revision 0d88a09546e87b5b7c7eeaa6e86e52f9b6d0a1ae)
@@ -205,11 +205,9 @@
             self.nterms_estimate_ctl.SetLabel("%-g" % value)
         elif name=='plotname':
-            if self.standalone==False:
-                self.plot_data.SetValue(str(value))
-                self._on_pars_changed(None)
+            self.plot_data.SetValue(str(value))
+            self._on_pars_changed(None)
         elif name=='datafile':
-            if self.standalone==True:
-                self.data_file.SetValue(str(value))
-                self._on_pars_changed(None)
+            self.plot_data.SetValue(str(value))
+            self._on_pars_changed(None)
         else:
             wx.Panel.__setattr__(self, name, value)
@@ -305,13 +303,7 @@
                 return None
         elif name=='plotname':
-            if self.standalone==False:
-                return self.plot_data.GetValue()
-            else:
-                return None
+            return self.plot_data.GetValue()
         elif name=='datafile':
-            if self.standalone==True:
-                return self.data_file.GetValue()
-            else:
-                return None
+            return self.plot_data.GetValue()
         else:
             wx.Panel.__getattr__(self, name)
@@ -329,4 +321,7 @@
             path = dlg.GetPath()
             self._default_save_location = os.path.dirname(path)
+        else:
+            return None
+        
         dlg.Destroy()
                 
@@ -347,8 +342,5 @@
         
         # Data file
-        if self.manager.standalone==True:
-            state.file = self.data_file.GetValue()
-        else:
-            state.file = self.plot_data.GetValue()
+        state.file = self.plot_data.GetValue()
         
         # Background evaluation checkbox
@@ -369,8 +361,5 @@
         state.bck     = self.bck
             
-        if self.manager.standalone==True:
-            state.toXML(path)
-        else:
-            self.manager.save_data(filepath=path, prstate=state)
+        self.manager.save_data(filepath=path, prstate=state)
         
         return state
@@ -401,8 +390,5 @@
         
         # Data file
-        if self.standalone==True:
-            self.data_file.SetValue(str(state.file))
-        else:
-            self.plot_data.SetValue(str(state.file))
+        self.plot_data.SetValue(str(state.file))
     
         # Background evaluation checkbox
@@ -434,22 +420,10 @@
             self.bck     = state.bck
 
-        # Check whether the file is accessible, if so,
-        # load it a recompute P(r) using the new parameters
-        if self.standalone==True:
-            if os.path.isfile(state.file):
-                self._change_file(filepath=state.file)
-                self._on_invert(None)    
-            else:
-                message = "Could not find [%s] on the file system." % state.file
-                wx.PostEvent(self.manager.parent, StatusEvent(status=message))
-        else:
+        # Perform inversion
+        if self.standalone == False:
             self._on_invert(None)    
         
     def set_manager(self, manager):
         self.manager = manager
-        # Get data
-        
-        # Push data to form
-        
         
     def _do_layout(self):
@@ -468,13 +442,7 @@
         pars_sizer.Add(self.file_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         
-        if self.standalone==True:
-            self.data_file = wx.TextCtrl(self, -1, size=(220,20))
-            self.data_file.SetEditable(False)
-            self.data_file.SetValue("")
-            pars_sizer.Add(self.data_file, (iy,1), (1,1), wx.ADJUST_MINSIZE, 15)
-        else:
-            self.plot_data = wx.TextCtrl(self, -1, size=(220,20))
-            self.plot_data.SetEditable(False)
-            pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15)
+        self.plot_data = wx.TextCtrl(self, -1, size=(220,20))
+        self.plot_data.SetEditable(False)
+        pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         
         self.bck_chk = wx.CheckBox(self, -1, "Estimate background level")
@@ -814,21 +782,11 @@
             self.alpha_estimate_ctl.Enable(False)
             
-            if self.standalone==False:
-                dataset = self.plot_data.GetValue()
-                self.manager.estimate_plot_inversion(alpha=alpha, nfunc=nfunc, 
-                                                     d_max=dmax,
-                                                     q_min=qmin, q_max=qmax,
-                                                     bck=has_bck, 
-                                                     height=height,
-                                                     width=width)
-            else:
-                path = self.data_file.GetValue()
-                self.manager.estimate_file_inversion(alpha=alpha, nfunc=nfunc, 
-                                                     d_max=dmax, path=path,
-                                                     q_min=qmin, q_max=qmax,
-                                                     bck=has_bck,
-                                                     height=height,
-                                                     width=width)
-        
+            dataset = self.plot_data.GetValue()
+            self.manager.estimate_plot_inversion(alpha=alpha, nfunc=nfunc, 
+                                                 d_max=dmax,
+                                                 q_min=qmin, q_max=qmax,
+                                                 bck=has_bck, 
+                                                 height=height,
+                                                 width=width)
         
     def _read_pars(self, evt=None):    
@@ -949,29 +907,15 @@
         
         if flag:
-            if self.standalone==False:
-                dataset = self.plot_data.GetValue()
-                if len(dataset.strip())==0:
-                    message = "No data to invert. Select a data set before proceeding with P(r) inversion."
-                    wx.PostEvent(self.manager.parent, StatusEvent(status=message))
-                else:
-                    self.manager.setup_plot_inversion(alpha=alpha, nfunc=nfunc, 
-                                                      d_max=dmax,
-                                                      q_min=qmin, q_max=qmax,
-                                                      bck=has_bck,
-                                                      height=height,
-                                                      width=width)
+            dataset = self.plot_data.GetValue()
+            if len(dataset.strip())==0:
+                message = "No data to invert. Select a data set before proceeding with P(r) inversion."
+                wx.PostEvent(self.manager.parent, StatusEvent(status=message))
             else:
-                path = self.data_file.GetValue()
-                if len(path.strip())==0:
-                    message = "No data to invert. Select a data set before proceeding with P(r) inversion."
-                    wx.PostEvent(self.manager.parent, StatusEvent(status=message))
-                else:
-                    self.manager.setup_file_inversion(alpha=alpha, nfunc=nfunc, 
-                                                      d_max=dmax, path=path,
-                                                      q_min=qmin, q_max=qmax,
-                                                      bck=has_bck,
-                                                      height=height,
-                                                      width=width)
-                
+                self.manager.setup_plot_inversion(alpha=alpha, nfunc=nfunc, 
+                                                  d_max=dmax,
+                                                  q_min=qmin, q_max=qmax,
+                                                  bck=has_bck,
+                                                  height=height,
+                                                  width=width)
         else:
             message = "The P(r) form contains invalid values: please submit it again."
@@ -987,7 +931,11 @@
             
             if path and os.path.isfile(path):
-                self.data_file.SetValue(str(path))
+                self.plot_data.SetValue(str(path))
                 self.manager.show_data(path, reset=True)
                 self._on_pars_changed(None)
+            
+                # Perform inversion
+                if self.standalone == True:
+                    self._on_invert(None)
 
 class HelpDialog(wx.Dialog):
Index: prview/perspectives/pr/inversion_state.py
===================================================================
--- prview/perspectives/pr/inversion_state.py	(revision 302510b94a1969619835d9674d7f9fbc28081be1)
+++ prview/perspectives/pr/inversion_state.py	(revision 0d88a09546e87b5b7c7eeaa6e86e52f9b6d0a1ae)
@@ -339,5 +339,5 @@
     ext=['.prv', '.PRV']  
     
-    def __init__(self, call_back, cansas=False):
+    def __init__(self, call_back, cansas=True):
         """
             Initialize the call-back method to be called
@@ -345,5 +345,5 @@
             @param call_back: call-back method
             @param cansas:  True = files will be written/read in CanSAS format
-                            False = standalone mode
+                            False = write CanSAS format
             
         """
Index: prview/perspectives/pr/pr.py
===================================================================
--- prview/perspectives/pr/pr.py	(revision 302510b94a1969619835d9674d7f9fbc28081be1)
+++ prview/perspectives/pr/pr.py	(revision 0d88a09546e87b5b7c7eeaa6e86e52f9b6d0a1ae)
@@ -7,9 +7,12 @@
 import logging
 import time
-from danse.common.plottools import Data1D, Theory1D
+from sans.guiframe.dataFitting import Data1D
+from danse.common.plottools import Theory1D
 from sans.guicomm.events import NewPlotEvent, StatusEvent    
 import math, numpy
 from sans.pr.invertor import Invertor
 from DataLoader.loader import Loader
+
+import copy
 
 PR_FIT_LABEL       = r"$P_{fit}(r)$"
@@ -89,6 +92,6 @@
         from inversion_state import Reader
          
-        #TODO: get rid of the cansas flag 
-        self.state_reader = Reader(self.set_state, cansas = not self.standalone)
+        # Create a CanSAS/Pr reader
+        self.state_reader = Reader(self.set_state)
         l = Loader()
         l.associate_file_reader('.prv', self.state_reader)
@@ -106,20 +109,22 @@
         """
         try:
-            # If we are not in standalone mode, the panel will not
-            # load any data file and we need to keep track of the
-            # data here.
-            if self.standalone == False:
-                if datainfo is None:
-                    raise RuntimeError, "Pr.set_state: datainfo parameter cannot be None in standalone mode"
-
-                # Ensuring that plots are coordinated correctly
-                t = time.localtime(datainfo.meta_data['prstate'].timestamp)
-                time_str = time.strftime("%b %d %H:%M", t)
-                datainfo.meta_data['prstate'].file = datainfo.meta_data['prstate'].file +' [' + time_str + ']'
-                datainfo.filename = datainfo.meta_data['prstate'].file
-                    
-                self.current_plottable = datainfo
-                self.current_plottable.group_id = datainfo.meta_data['prstate'].file
-                
+            if datainfo is None:
+                raise RuntimeError, "Pr.set_state: datainfo parameter cannot be None in standalone mode"
+
+            # Ensuring that plots are coordinated correctly
+            t = time.localtime(datainfo.meta_data['prstate'].timestamp)
+            time_str = time.strftime("%b %d %H:%M", t)
+            
+            # Check that no time stamp is already appended
+            max_char = datainfo.meta_data['prstate'].file.find("[")
+            if max_char < 0:
+                max_char = len(datainfo.meta_data['prstate'].file)
+            
+            datainfo.meta_data['prstate'].file = datainfo.meta_data['prstate'].file[0:max_char] +' [' + time_str + ']'
+            datainfo.filename = datainfo.meta_data['prstate'].file
+                
+            self.current_plottable = datainfo
+            self.current_plottable.group_id = datainfo.meta_data['prstate'].file
+            
             # Load the P(r) results
             self.control_panel.set_state(state)
@@ -849,4 +854,8 @@
         wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="I(q)", reset=reset))
         
+        self.current_plottable = new_plot
+        self.current_plottable.group_id = IQ_DATA_LABEL
+        
+        
         # Get Q range
         self.control_panel.q_min = self.pr.x.min()
