Index: src/sas/perspectives/calculator/image_viewer.py
===================================================================
--- src/sas/perspectives/calculator/image_viewer.py	(revision 7a04dbb34bb699a5460b3ad23209d05b641f3265)
+++ src/sas/perspectives/calculator/image_viewer.py	(revision eec63a8510b9e95652aeb0169dd434d2357ee878)
@@ -59,5 +59,4 @@
                 plot_frame = ImageFrame(parent, -1, basename, img)
                 plot_frame.Show(False)
-                #plot_frame.im_show(img)
                 ax = plot_frame.plotpanel
                 if not is_png:
@@ -73,5 +72,4 @@
             except:
                 print "parent", parent
-                raise
                 err_msg += "Failed to load '%s'.\n"% basename
         if err_msg:
@@ -80,5 +78,4 @@
             else:
                 print err_msg
-
         
     def choose_data_file(self, location=None):
@@ -86,24 +83,9 @@
         Open a file dialog to allow loading a file
         """
-        parent = self.parent
         path = None
         if location == None:
             location = os.getcwd()
-        wlist = ''
-        elist = ["All images (*.png, *.bmp, *.gif, *.jpg, *.tif, *.tiff) | \
-                *.png; *.bmp; *.gif; *.jpg; *.tif; *.tiff", 
-                "PNG files (*.PNG, *.png) | *.png", 
-                "BMP files (*.BMP, *.bmp) | *.bmp", 
-                "GIF files (*.GIF, *.gif) | *.gif",
-                "JPG files (*.JPG, *.jpg) | *.jpg",
-                "TIF files (*.TIF, *.tif) | *.tif",
-                "TIFF files (*.TIFF, *.tiff) | *.tiff"]
-        if not IS_WIN:
-            del elist[0]
-        elist.append("All files (*.*) | *.*")
-        wlist = '|'.join(elist)        
-        style = wx.OPEN|wx.FD_MULTIPLE
-        dlg = wx.FileDialog(parent, "Image Viewer: Choose a image file", 
-                            location, "", wlist, style=style)
+        dlg = wx.FileDialog(self.parent, "Image Viewer: Choose a image file", 
+                            location, "", "", style=wx.FD_OPEN|wx.FD_MULTIPLE)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPaths()
Index: src/sas/perspectives/calculator/media/data_operator_help.rst
===================================================================
--- src/sas/perspectives/calculator/media/data_operator_help.rst	(revision 98b30b46ac241d857a5698740991daae2c25c3c2)
+++ src/sas/perspectives/calculator/media/data_operator_help.rst	(revision 684fadea996acb945349f183745ff53188353534)
@@ -9,9 +9,10 @@
 Description
 -----------
-This dialog panel provides arithmetic operations between two data sets (the 
-last data set could be a number).
 
-When data1 and data2 are selected, their x (or qx and qy for 2D) value(s)
-must match with each other.
+This tool permits arithmetic operations between two data sets. Alternatively, 
+the last data set can be a number.
+
+*NOTE! When* Data1 *and* Data2 *are both data, their Q (or Qx and Qy for 2D) 
+value(s) must match with each other UNLESS using the 'append' operator.*
 
 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
@@ -19,21 +20,36 @@
 How To
 ------
-1. Type the data name resulted from an operation.
 
-2) Select a data/theory in the drop down menus. When data2 is set to number, 
-   type a number in the text control box.
+1) Enure you have loaded data into the *Data Explorer* (see :ref:`Load_Data`).
 
-3) Select an arithmetic operator symbol; + (for addition), - (for subtraction), 
-   * (for multiplication), / (for division), and | (for combination of two data
-   sets).
+2) Select *Data Operation* from the *Tool* menu on the SasView toolbar.
 
-   If two data sets do not match, the operation will fail and the background color
-   of the combo box items will turn to red (WIN only).
+3) Select a dataset/theory in the drop-down menu *Data1*. A mini-plot of the
+   data will appear underneath.
 
-4) If the operation is successful, hit the Apply button to make the new data.
-   Then the data name will be shown up in the data box in the data explorer.
+4) Select a dataset/theory in the drop-down menu *Data2* or select *Number* 
+   and enter a number in the box that appears alongside.
 
-Note: Any errors and warnings will be displayed at the bottom of the SasView
-window.
+5) Select an arithmetic operator symbol from the *Operator* drop-down. The 
+   available operators are:
+   
+*  + (for addition)
+*  - (for subtraction), 
+*  * (for multiplication)
+*  / (for division)
+*  | (for combination of two data sets)
+
+   If two data sets do not match, the operation will fail and the background 
+   color of the combo box items will turn to red (WIN only).
+
+6) If the operation is successful, hit the Apply button to make the new dataset.
+   The new dataset will appear in the *Data Explorer*.
+
+*NOTE! Any errors and warnings will be displayed at the bottom of the SasView
+window.*
 
 .. image:: data_oper_pic.png
+
+.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
+
+.. note::  This help document was last changed by Steve King, 18Feb2015 
Index: src/sas/perspectives/calculator/media/density_calculator_help.rst
===================================================================
--- src/sas/perspectives/calculator/media/density_calculator_help.rst	(revision ec392464eef959a5c2e87e6a72ed72fd7e947a07)
+++ src/sas/perspectives/calculator/media/density_calculator_help.rst	(revision 054a3adbdd801eeb581a05fa28b4d54492c8e75a)
@@ -10,5 +10,5 @@
 -----------
 
-This tool is to calculate the mass density from the molar volume or vice 
+This tool calculates the mass density from the molar volume or vice 
 versa. To calculate the mass density, the chemical formula and molar volume 
 should be provided.
@@ -19,15 +19,15 @@
 ------
 
-1. Molecular Formula: The chemical formula of ONE molecule or ONE atom. For 
-mixtures, the ratio of the each molecules should be used; for example, 
-(H2O)0.5(D2O)0.5.
+1) Enter the empirical formula of a molecule. For mixtures, the ratio of each 
+   of the molecules should be used, for example, (H2O)0.5(D2O)0.5.
 
-2. Select input (molar volume or mass density) from combobox. Then type in the 
-input value.
+2) Use the input combo box to choose between molar volume or mass density and 
+   then type in an input value.
 
-3. Click the 'Calculate' button to perform the calculation.
-
-4. Outputs also include the molar mass (weight) that depends only on the 
-chemical formula
+3) Click the 'Calculate' button to perform the calculation.
 
 .. image:: density_tutor.gif
+
+.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
+
+.. note::  This help document was last changed by Steve King, 18Feb2015
Index: src/sas/perspectives/fitting/batchfitpage.py
===================================================================
--- src/sas/perspectives/fitting/batchfitpage.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/perspectives/fitting/batchfitpage.py	(revision fa09d62cc24b9425dc926fced79d5ba20fa6fcd3)
@@ -17,4 +17,5 @@
 from sas.models.qsmearing import smear_selection
 from sas.perspectives.fitting.fitpage import FitPage
+from sas.perspectives.fitting.fitpage import check_data_validity
 
 class BatchFitPage(FitPage):
@@ -30,337 +31,371 @@
         """
         FitPage.__init__(self, parent, color=color)
-        self.window_name = "BatchFit"
-        self.window_caption  = "BatchFit"
-        self._set_save_flag(False)
-        self._set_bookmark_flag(False)
-        
-    def _fill_range_sizer(self):
+        
+        ## draw sizer
+        
+    def _fill_data_sizer(self):
         """
-        Fill the sizer containing the plotting range
-        add  access to npts
+        fill sizer 0 with data info
         """
-        is_2Ddata = False
-        
-        # Check if data is 2D
-        if self.data.__class__.__name__ ==  "Data2D" or \
-                        self.enable2D:
-            is_2Ddata = True
-            
-        title = "Fitting"     
-        self._get_smear_info()
-        
-        #Sizers
-        box_description_range = wx.StaticBox(self, -1, str(title))
-        boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL)      
-        self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL)
-        #sizer_smearer = wx.BoxSizer(wx.HORIZONTAL)
-        self.sizer_new_smear = wx.BoxSizer(wx.HORIZONTAL)
-        self.sizer_set_masking = wx.BoxSizer(wx.HORIZONTAL)
-        sizer_chi2 = wx.BoxSizer(wx.VERTICAL)
-
-        sizer_fit = wx.GridSizer(2, 4, 2, 6)
-        #Fit button
-        self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25))
-        self.default_bt_colour =  self.btFit.GetDefaultAttributes()
-        self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id= self.btFit.GetId())
-        self.btFit.SetToolTipString("Start fitting.")
-
-        # Update and Draw button
-        self.draw_button = wx.Button(self, wx.NewId(), 'Compute', size=(88, 24))
-        self.draw_button.Bind(wx.EVT_BUTTON, \
-                              self._onDraw,id=self.draw_button.GetId())
-        self.draw_button.SetToolTipString("Compute and Draw.")  
-        sizer_fit.Add(self.draw_button, 0, 0)
-        sizer_fit.Add(self.btFit, 0, 0) 
-        sizer_chi2.Add((-1, 5))
-        # get smear_selection
-        self.current_smearer = smear_selection( self.data, self.model )
-        boxsizer_range.Add(self.sizer_set_masking)
-         #2D data? default
-        is_2Ddata = False
-        
-        #check if it is 2D data
-        if self.data.__class__.__name__ ==  "Data2D" or \
-                        self.enable2D:
-            is_2Ddata = True
-            
-        self.sizer5.Clear(True)
-     
-        self.qmin  = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
-                                          style=wx.TE_PROCESS_ENTER, 
-                                    text_enter_callback = self._onQrangeEnter)
-        self.qmin.SetValue(str(self.qmin_x))
-        self.qmin.SetToolTipString("Minimun value of Q in linear scale.")
-     
-        self.qmax  = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
-                                          style=wx.TE_PROCESS_ENTER, 
-                                        text_enter_callback=self._onQrangeEnter)
-        self.qmax.SetValue(str(self.qmax_x))
-        self.qmax.SetToolTipString("Maximum value of Q in linear scale.")
-        
-        id = wx.NewId()
-        self.reset_qrange =wx.Button(self, id, 'Reset', size=(77, 20))
-      
-        self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=id)
-        self.reset_qrange.SetToolTipString(\
-                                    "Reset Q range to the default values")
-     
-        sizer_horizontal = wx.BoxSizer(wx.HORIZONTAL)
-        sizer = wx.GridSizer(2, 4, 2, 6)
-
-        self.btEditMask = wx.Button(self, wx.NewId(),'Editor', size=(88, 23))
-        self.btEditMask.Bind(wx.EVT_BUTTON, 
-                             self._onMask,id=self.btEditMask.GetId())
-        self.btEditMask.SetToolTipString("Edit Mask.")
-        self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)')
-
-        sizer.Add(wx.StaticText(self, -1, 'Q range'))     
-        sizer.Add(wx.StaticText(self, -1, ' Min[1/A]'))
-        sizer.Add(wx.StaticText(self, -1, ' Max[1/A]'))
-        sizer.Add(self.EditMask_title)
- 
-        sizer.Add(self.reset_qrange)   
-        sizer.Add(self.qmin)
-        sizer.Add(self.qmax)
-
-        sizer.Add(self.btEditMask)
-        boxsizer_range.Add(sizer_chi2) 
-        boxsizer_range.Add((10, 10))
-        boxsizer_range.Add(sizer)
-        
-        boxsizer_range.Add((10, 15))
-        boxsizer_range.Add(sizer_fit)
-        if is_2Ddata:
-            self.btEditMask.Enable()  
-            self.EditMask_title.Enable() 
+        self.data_box_description = wx.StaticBox(self, -1, 'I(q) Data Source')
+        if check_data_validity(self.data):
+            dname_color = wx.BLUE
         else:
-            self.btEditMask.Disable()  
-            self.EditMask_title.Disable()
-
-        ## save state
-        #self.save_current_state()
-
-        self.sizer5.Add(boxsizer_range, 0, wx.EXPAND | wx.ALL, 10)
-        self.sizer5.Layout()
-       
-    def _on_select_model(self, event=None): 
-        """
-        call back for model selection
-        """  
-        
-        self.Show(False)    
-        self._on_select_model_helper() 
-        self.set_model_param_sizer(self.model)                   
-        if self.model is None:
-            self._set_bookmark_flag(False)
-            self._keep.Enable(False)
-            self._set_save_flag(False)
-        self.enable_disp.SetValue(False)
-        self.disable_disp.SetValue(True)
-        try:
-            self.set_dispers_sizer()
-        except:
-            pass
-        self.state.structurecombobox = self.structurebox.GetCurrentSelection()
-        self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection()
-      
-        if self.model != None:
-            self._set_copy_flag(True)
-            self._set_paste_flag(True)
-            if self.data != None:
-                self._set_bookmark_flag(False)
-                self._keep.Enable(False)
-                
-            temp_smear = None
-            ## event to post model to fit to fitting plugins
-            (ModelEventbox, _) = wx.lib.newevent.NewEvent()
-         
-            ## set smearing value whether or not 
-            #    the data contain the smearing info
-            evt = ModelEventbox(model=self.model, 
-                                        smearer=temp_smear, 
-                                        qmin=float(self.qmin_x),
-                                        uid=self.uid,
-                                     qmax=float(self.qmax_x)) 
-   
-            self._manager._on_model_panel(evt=evt)
-            self.mbox_description.SetLabel("Model [%s]" % str(self.model.name))
-            self.state.model = self.model.clone()
-            self.state.model.name = self.model.name
-
-            
-        if event != None:
-            ## post state to fit panel
-            new_event = PageInfoEvent(page = self)
-            wx.PostEvent(self.parent, new_event) 
-            #update list of plugins if new plugin is available
-            if self.plugin_rbutton.GetValue():
-                temp = self.parent.update_model_list()
-                if temp:
-                    self.model_list_box = temp
-                    current_val = self.formfactorbox.GetValue()
-                    pos = self.formfactorbox.GetSelection()
-                    self._show_combox_helper()
-                    self.formfactorbox.SetSelection(pos)
-                    self.formfactorbox.SetValue(current_val)
-            self._onDraw(event=None)
-        else:
-            self._draw_model()
-        self.SetupScrolling()
-        self.Show(True)   
-        
-    def _update_paramv_on_fit(self):
-        """
-        make sure that update param values just before the fitting
-        """
-        #flag for qmin qmax check values
-        flag = True
-        self.fitrange = True
-        is_modified = False
-
-        if self.model != None:           
-            ##Check the values
-            self._check_value_enter( self.fittable_param, is_modified)
-            self._check_value_enter( self.fixed_param, is_modified)
-            self._check_value_enter( self.parameters, is_modified)
-
-            # If qmin and qmax have been modified, update qmin and qmax and 
-             # Here we should check whether the boundaries have been modified.
-            # If qmin and qmax have been modified, update qmin and qmax and 
-            # set the is_modified flag to True
-            self.fitrange = self._validate_qrange(self.qmin, self.qmax)
-            if self.fitrange:
-                tempmin = float(self.qmin.GetValue())
-                if tempmin != self.qmin_x:
-                    self.qmin_x = tempmin
-                tempmax = float(self.qmax.GetValue())
-                if tempmax != self.qmax_x:
-                    self.qmax_x = tempmax
-                if tempmax == tempmin:
-                    flag = False    
-                #temp_smearer = None
-                if self._is_2D():
-                    # only 2D case set mask  
-                    flag = self._validate_Npts()
-                    if not flag:
-                        return flag
-            else: flag = False
-        else: 
-            flag = False
-
-        #For invalid q range, disable the mask editor and fit button, vs.    
-        if not self.fitrange:
-            #self.btFit.Disable()
-            if self._is_2D():
-                self.btEditMask.Disable()
-        else:
-            #self.btFit.Enable(True)
-            if self._is_2D() and  self.data != None:
-                self.btEditMask.Enable(True)
-
-        if not flag:
-            msg = "Cannot Plot or Fit :Must select a "
-            msg += " model or Fitting range is not valid!!!  "
-            wx.PostEvent(self.parent.parent, StatusEvent(status=msg))
-        
-        self.save_current_state()
-   
-        return flag  
-    def save_current_state(self):
-        """
-        Currently no save option implemented for batch page
-        """
-        pass 
-    def save_current_state_fit(self):
-        """
-        Currently no save option implemented for batch page
-        """
-        pass
-    def set_data(self, data):
-        """
-        reset the current data 
-        """
-        #id = None
-        group_id = None
-        flag = False
-        if self.data is None and data is not None:
-            flag = True
-        if data is not None:
-            #id = data.id
-            group_id = data.group_id
-            if self.data is not None:
-                flag = (data.id != self.data.id)
-        self.data = data
-        if self.data is None:
-            data_min = ""
-            data_max = ""
-            data_name = ""
-            self._set_bookmark_flag(False)
-            self._keep.Enable(False)
-            self._set_save_flag(False)
-        else:
-            if self.model != None:
-                self._set_bookmark_flag(False)
-                self._keep.Enable(False)
-            self._set_save_flag(False)
-            self._set_preview_flag(True)
-  
-            self.formfactorbox.Enable()
-            self.structurebox.Enable()
-            data_name = self.data.name
-            #set maximum range for x in linear scale
-            if not hasattr(self.data,"data"): #Display only for 1D data fit
-                # Minimum value of data   
-                data_min = min(self.data.x)
-                # Maximum value of data  
-                data_max = max(self.data.x)
-                self.btEditMask.Disable()  
-                self.EditMask_title.Disable()
-            else:
-                
-                ## Minimum value of data 
-                data_min = 0
-                x = max(math.fabs(self.data.xmin), math.fabs(self.data.xmax)) 
-                y = max(math.fabs(self.data.ymin), math.fabs(self.data.ymax))
-                ## Maximum value of data  
-                data_max = math.sqrt(x*x + y*y)
-                self.btEditMask.Enable()  
-                self.EditMask_title.Enable() 
-
-        self.dataSource.SetValue(data_name)
-        self.qmin_x = data_min
-        self.qmax_x = data_max
-        #self.minimum_q.SetValue(str(data_min))
-        #self.maximum_q.SetValue(str(data_max))
-        self.qmin.SetValue(str(data_min))
-        self.qmax.SetValue(str(data_max))
-        self.qmin.SetBackgroundColour("white")
-        self.qmax.SetBackgroundColour("white")
-        self.state.data = data
-        self.state.qmin = self.qmin_x
-        self.state.qmax = self.qmax_x
-        
-        #update model plot with new data information
-        if flag:
-            #set model view button
-            if self.data.__class__.__name__ == "Data2D":
-                self.enable2D = True
-                self.model_view.SetLabel("2D Mode")
-            else:
-                self.enable2D = False
-                self.model_view.SetLabel("1D Mode")
-                
-            self.model_view.Disable()
-            
-            wx.PostEvent(self._manager.parent, 
-                             NewPlotEvent(group_id=group_id,
-                                               action="delete"))
-            #plot the current selected data
-            wx.PostEvent(self._manager.parent, NewPlotEvent(plot=self.data, 
-                                                    title=str(self.data.title)))
-            self._manager.store_data(uid=self.uid, data=data,
-                                     data_list=self.data_list,
-                                      caption=self.window_name)
-            self._draw_model()
+            dname_color = wx.RED
+        self.data_box_description.SetForegroundColour(dname_color)
+        boxsizer1 = wx.StaticBoxSizer(self.data_box_description, wx.VERTICAL)
+        #----------------------------------------------------------
+        sizer_data = wx.BoxSizer(wx.VERTICAL)
+        text1 = wx.StaticText(self, -1, ' - Choose a file to set initial fit parameters -')
+        text1.SetForegroundColour(wx.RED)
+        sizer_data.Add(text1)
+        text2 = wx.StaticText(self, -1, ' - This panel is not designed to view individual fits. - ')
+        text2.SetForegroundColour(wx.RED)
+        sizer_data.Add(text2)
+        
+        combo = wx.BoxSizer(wx.HORIZONTAL)
+        self.dataSource = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        wx.EVT_COMBOBOX(self.dataSource, -1, self.on_select_data)
+        self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1))
+        
+        combo.Add(wx.StaticText(self, -1, 'Name : '))
+        combo.Add((0,5))
+        combo.Add(self.dataSource)
+        
+        sizer_data.Add(combo, 0, wx.ALL, 10)
+        boxsizer1.Add(sizer_data, 0, wx.ALL, 0)
+        self.sizer0.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10)
+        self.sizer0.Layout()
+
+#    COMMENTED OUT TO USE METHODS INHERITED FROM fitpage.py
+        
+#     def _fill_range_sizer(self):
+#         """
+#         Fill the sizer containing the plotting range
+#         add  access to npts
+#         """
+#         is_2Ddata = False
+#         
+#         # Check if data is 2D
+#         if self.data.__class__.__name__ ==  "Data2D" or \
+#                         self.enable2D:
+#             is_2Ddata = True
+#             
+#         title = "Fitting"     
+#         self._get_smear_info()
+#         
+#         #Sizers
+#         box_description_range = wx.StaticBox(self, -1, str(title))
+#         boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL)      
+#         self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL)
+#         #sizer_smearer = wx.BoxSizer(wx.HORIZONTAL)
+#         self.sizer_new_smear = wx.BoxSizer(wx.HORIZONTAL)
+#         self.sizer_set_masking = wx.BoxSizer(wx.HORIZONTAL)
+#         sizer_chi2 = wx.BoxSizer(wx.VERTICAL)
+# 
+#         sizer_fit = wx.GridSizer(2, 4, 2, 6)
+#         #Fit button
+#         self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25))
+#         self.default_bt_colour =  self.btFit.GetDefaultAttributes()
+#         self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id= self.btFit.GetId())
+#         self.btFit.SetToolTipString("Start fitting.")
+# 
+#         # Update and Draw button
+#         self.draw_button = wx.Button(self, wx.NewId(), 'Compute', size=(88, 24))
+#         self.draw_button.Bind(wx.EVT_BUTTON, \
+#                               self._onDraw,id=self.draw_button.GetId())
+#         self.draw_button.SetToolTipString("Compute and Draw.")  
+#         sizer_fit.Add(self.draw_button, 0, 0)
+#         sizer_fit.Add(self.btFit, 0, 0) 
+#         sizer_chi2.Add((-1, 5))
+#         # get smear_selection
+#         self.current_smearer = smear_selection( self.data, self.model )
+#         boxsizer_range.Add(self.sizer_set_masking)
+#          #2D data? default
+#         is_2Ddata = False
+#         
+#         #check if it is 2D data
+#         if self.data.__class__.__name__ ==  "Data2D" or \
+#                         self.enable2D:
+#             is_2Ddata = True
+#             
+#         self.sizer5.Clear(True)
+#      
+#         self.qmin  = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
+#                                           style=wx.TE_PROCESS_ENTER, 
+#                                     text_enter_callback = self._onQrangeEnter)
+#         self.qmin.SetValue(str(self.qmin_x))
+#         self.qmin.SetToolTipString("Minimun value of Q in linear scale.")
+#      
+#         self.qmax  = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
+#                                           style=wx.TE_PROCESS_ENTER, 
+#                                         text_enter_callback=self._onQrangeEnter)
+#         self.qmax.SetValue(str(self.qmax_x))
+#         self.qmax.SetToolTipString("Maximum value of Q in linear scale.")
+#         
+#         id = wx.NewId()
+#         self.reset_qrange =wx.Button(self, id, 'Reset', size=(77, 20))
+#       
+#         self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=id)
+#         self.reset_qrange.SetToolTipString(\
+#                                     "Reset Q range to the default values")
+#      
+#         sizer_horizontal = wx.BoxSizer(wx.HORIZONTAL)
+#         sizer = wx.GridSizer(2, 4, 2, 6)
+# 
+#         self.btEditMask = wx.Button(self, wx.NewId(),'Editor', size=(88, 23))
+#         self.btEditMask.Bind(wx.EVT_BUTTON, 
+#                              self._onMask,id=self.btEditMask.GetId())
+#         self.btEditMask.SetToolTipString("Edit Mask.")
+#         self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)')
+# 
+#         sizer.Add(wx.StaticText(self, -1, 'Q range'))     
+#         sizer.Add(wx.StaticText(self, -1, ' Min[1/A]'))
+#         sizer.Add(wx.StaticText(self, -1, ' Max[1/A]'))
+#         sizer.Add(self.EditMask_title)
+#  
+#         sizer.Add(self.reset_qrange)   
+#         sizer.Add(self.qmin)
+#         sizer.Add(self.qmax)
+# 
+#         sizer.Add(self.btEditMask)
+#         boxsizer_range.Add(sizer_chi2) 
+#         boxsizer_range.Add((10, 10))
+#         boxsizer_range.Add(sizer)
+#         
+#         boxsizer_range.Add((10, 15))
+#         boxsizer_range.Add(sizer_fit)
+#         if is_2Ddata:
+#             self.btEditMask.Enable()  
+#             self.EditMask_title.Enable() 
+#         else:
+#             self.btEditMask.Disable()  
+#             self.EditMask_title.Disable()
+# 
+#         ## save state
+#         #self.save_current_state()
+# 
+#         self.sizer5.Add(boxsizer_range, 0, wx.EXPAND | wx.ALL, 10)
+#         self.sizer5.Layout()
+#        
+#     def _on_select_model(self, event=None): 
+#         """
+#         call back for model selection
+#         """  
+#         
+#         self.Show(False)    
+#         self._on_select_model_helper() 
+#         self.set_model_param_sizer(self.model)                   
+#         if self.model is None:
+#             self._set_bookmark_flag(False)
+#             self._keep.Enable(False)
+#             self._set_save_flag(False)
+#         self.enable_disp.SetValue(False)
+#         self.disable_disp.SetValue(True)
+#         try:
+#             self.set_dispers_sizer()
+#         except:
+#             pass
+#         self.state.structurecombobox = self.structurebox.GetCurrentSelection()
+#         self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection()
+#       
+#         if self.model != None:
+#             self._set_copy_flag(True)
+#             self._set_paste_flag(True)
+#             if self.data != None:
+#                 self._set_bookmark_flag(False)
+#                 self._keep.Enable(False)
+#                 
+#             temp_smear = None
+#             ## event to post model to fit to fitting plugins
+#             (ModelEventbox, _) = wx.lib.newevent.NewEvent()
+#          
+#             ## set smearing value whether or not 
+#             #    the data contain the smearing info
+#             evt = ModelEventbox(model=self.model, 
+#                                         smearer=temp_smear, 
+#                                         qmin=float(self.qmin_x),
+#                                         uid=self.uid,
+#                                      qmax=float(self.qmax_x)) 
+#    
+#             self._manager._on_model_panel(evt=evt)
+#             self.mbox_description.SetLabel("Model [%s]" % str(self.model.name))
+#             self.state.model = self.model.clone()
+#             self.state.model.name = self.model.name
+# 
+#             
+#         if event != None:
+#             ## post state to fit panel
+#             new_event = PageInfoEvent(page = self)
+#             wx.PostEvent(self.parent, new_event) 
+#             #update list of plugins if new plugin is available
+#             if self.plugin_rbutton.GetValue():
+#                 temp = self.parent.update_model_list()
+#                 if temp:
+#                     self.model_list_box = temp
+#                     current_val = self.formfactorbox.GetValue()
+#                     pos = self.formfactorbox.GetSelection()
+#                     self._show_combox_helper()
+#                     self.formfactorbox.SetSelection(pos)
+#                     self.formfactorbox.SetValue(current_val)
+#             self._onDraw(event=None)
+#         else:
+#             self._draw_model()
+#         self.SetupScrolling()
+#         self.Show(True)   
+#         
+#     def _update_paramv_on_fit(self):
+#         """
+#         make sure that update param values just before the fitting
+#         """
+#         #flag for qmin qmax check values
+#         flag = True
+#         self.fitrange = True
+#         is_modified = False
+# 
+#         if self.model != None:           
+#             ##Check the values
+#             self._check_value_enter( self.fittable_param, is_modified)
+#             self._check_value_enter( self.fixed_param, is_modified)
+#             self._check_value_enter( self.parameters, is_modified)
+# 
+#             # If qmin and qmax have been modified, update qmin and qmax and 
+#              # Here we should check whether the boundaries have been modified.
+#             # If qmin and qmax have been modified, update qmin and qmax and 
+#             # set the is_modified flag to True
+#             self.fitrange = self._validate_qrange(self.qmin, self.qmax)
+#             if self.fitrange:
+#                 tempmin = float(self.qmin.GetValue())
+#                 if tempmin != self.qmin_x:
+#                     self.qmin_x = tempmin
+#                 tempmax = float(self.qmax.GetValue())
+#                 if tempmax != self.qmax_x:
+#                     self.qmax_x = tempmax
+#                 if tempmax == tempmin:
+#                     flag = False    
+#                 #temp_smearer = None
+#                 if self._is_2D():
+#                     # only 2D case set mask  
+#                     flag = self._validate_Npts()
+#                     if not flag:
+#                         return flag
+#             else: flag = False
+#         else: 
+#             flag = False
+# 
+#         #For invalid q range, disable the mask editor and fit button, vs.    
+#         if not self.fitrange:
+#             #self.btFit.Disable()
+#             if self._is_2D():
+#                 self.btEditMask.Disable()
+#         else:
+#             #self.btFit.Enable(True)
+#             if self._is_2D() and  self.data != None:
+#                 self.btEditMask.Enable(True)
+# 
+#         if not flag:
+#             msg = "Cannot Plot or Fit :Must select a "
+#             msg += " model or Fitting range is not valid!!!  "
+#             wx.PostEvent(self.parent.parent, StatusEvent(status=msg))
+#         
+#         self.save_current_state()
+#    
+#         return flag  
+#     def save_current_state(self):
+#         """
+#         Currently no save option implemented for batch page
+#         """
+#         pass 
+#     def save_current_state_fit(self):
+#         """
+#         Currently no save option implemented for batch page
+#         """
+#         pass
+#     def set_data(self, data):
+#         """
+#         reset the current data 
+#         """
+#         #id = None
+#         group_id = None
+#         flag = False
+#         if self.data is None and data is not None:
+#             flag = True
+#         if data is not None:
+#             #id = data.id
+#             group_id = data.group_id
+#             if self.data is not None:
+#                 flag = (data.id != self.data.id)
+#         self.data = data
+#         if self.data is None:
+#             data_min = ""
+#             data_max = ""
+#             data_name = ""
+#             self._set_bookmark_flag(False)
+#             self._keep.Enable(False)
+#             self._set_save_flag(False)
+#         else:
+#             if self.model != None:
+#                 self._set_bookmark_flag(False)
+#                 self._keep.Enable(False)
+#             self._set_save_flag(False)
+#             self._set_preview_flag(True)
+#   
+#             self.formfactorbox.Enable()
+#             self.structurebox.Enable()
+#             data_name = self.data.name
+#             #set maximum range for x in linear scale
+#             if not hasattr(self.data,"data"): #Display only for 1D data fit
+#                 # Minimum value of data   
+#                 data_min = min(self.data.x)
+#                 # Maximum value of data  
+#                 data_max = max(self.data.x)
+#                 self.btEditMask.Disable()  
+#                 self.EditMask_title.Disable()
+#             else:
+#                 
+#                 ## Minimum value of data 
+#                 data_min = 0
+#                 x = max(math.fabs(self.data.xmin), math.fabs(self.data.xmax)) 
+#                 y = max(math.fabs(self.data.ymin), math.fabs(self.data.ymax))
+#                 ## Maximum value of data  
+#                 data_max = math.sqrt(x*x + y*y)
+#                 self.btEditMask.Enable()  
+#                 self.EditMask_title.Enable() 
+# 
+#         self.dataSource.SetValue(data_name)
+#         self.qmin_x = data_min
+#         self.qmax_x = data_max
+#         #self.minimum_q.SetValue(str(data_min))
+#         #self.maximum_q.SetValue(str(data_max))
+#         self.qmin.SetValue(str(data_min))
+#         self.qmax.SetValue(str(data_max))
+#         self.qmin.SetBackgroundColour("white")
+#         self.qmax.SetBackgroundColour("white")
+#         self.state.data = data
+#         self.state.qmin = self.qmin_x
+#         self.state.qmax = self.qmax_x
+#         
+#         #update model plot with new data information
+#         if flag:
+#             #set model view button
+#             if self.data.__class__.__name__ == "Data2D":
+#                 self.enable2D = True
+#                 self.model_view.SetLabel("2D Mode")
+#             else:
+#                 self.enable2D = False
+#                 self.model_view.SetLabel("1D Mode")
+#                 
+#             self.model_view.Disable()
+#             
+#             wx.PostEvent(self._manager.parent, 
+#                              NewPlotEvent(group_id=group_id,
+#                                                action="delete"))
+#             #plot the current selected data
+#             wx.PostEvent(self._manager.parent, NewPlotEvent(plot=self.data, 
+#                                                     title=str(self.data.title)))
+#             self._manager.store_data(uid=self.uid, data=data,
+#                                      data_list=self.data_list,
+#                                       caption=self.window_name)
+#             self._draw_model()
     
 
Index: src/sas/perspectives/fitting/fitpanel.py
===================================================================
--- src/sas/perspectives/fitting/fitpanel.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/perspectives/fitting/fitpanel.py	(revision fa09d62cc24b9425dc926fced79d5ba20fa6fcd3)
@@ -371,6 +371,7 @@
         """
         from fitpage import FitPage
-        panel = FitPage(parent=self)
+        from batchfitpage import BatchFitPage
         if self.batch_on:
+            panel = BatchFitPage(parent=self)
             self.batch_page_index += 1
             caption = "BatchPage" + str(self.batch_page_index)
@@ -378,4 +379,5 @@
         else:
             #Increment index of fit page
+            panel = FitPage(parent=self)
             self.fit_page_index += 1
             caption = "FitPage" + str(self.fit_page_index)
@@ -467,5 +469,5 @@
         if data_1d_list and data_2d_list:
             # need to warning the user that this batch is a special case
-            from sas import BatchDataDialog
+            from sas.perspectives.fitting.fitting_widgets import BatchDataDialog
             dlg = BatchDataDialog(self)
             if dlg.ShowModal() == wx.ID_OK:
Index: src/sas/perspectives/fitting/report_dialog.py
===================================================================
--- src/sas/perspectives/fitting/report_dialog.py	(revision 4ec242ef37ff5f92d91a892156e04d092559af32)
+++ src/sas/perspectives/fitting/report_dialog.py	(revision e8bb5b62d717c7b44481a4b621030699e4efdaf4)
@@ -14,61 +14,35 @@
 
 import wx
-import sys
 import os
 import wx.html as html
-import logging
 
-_STATICBOX_WIDTH = 480
-PANEL_WIDTH = 530
-PANEL_HEIGHT = 700
-FONT_VARIANT = 1
-ISMAC = False
-ISPDF = False
-if sys.platform == "win32":
-    _STATICBOX_WIDTH = 450
-    PANEL_WIDTH = 500
-    PANEL_HEIGHT = 700
-    FONT_VARIANT = 0
-    ISMAC = False
-    ISPDF = True
-elif sys.platform == "darwin":
-    ISMAC = True
-    ISPDF = True
+from sas.guiframe.report_dialog import BaseReportDialog
 
-        
-class ReportDialog(wx.Dialog):
+class ReportDialog(BaseReportDialog):
     """
     The report dialog box.
     """
     
-    def __init__(self, list, *args, **kwds):
+    def __init__(self, report_list, *args, **kwds):
         """
         Initialization. The parameters added to Dialog are:
         
-        :param list: report_list (list of html_str, text_str, image)
+        :param report_list: list of html_str, text_str, image
         from invariant_state
         """
-        kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE
-        wx.Dialog.__init__(self, *args, **kwds)
-        kwds["image"] = 'Dynamic Image'
+        super(ReportDialog, self).__init__(report_list, *args, **kwds)
+
         # title
         self.SetTitle("Report: Fitting")
-        # size
-        self.SetSize((720, 650))
-        # font size
-        self.SetWindowVariant(variant=FONT_VARIANT)
-        # check if tit is MAC
-        self.is_pdf = ISPDF
-        # report string
-        self.report_list = list
+
         # number of images of plot
-        self.nimages = len(list[2])
+        self.nimages = len(self.report_list[2])
         
-        if list[2] != None:
+        if self.report_list[2] != None:
             # put image path in the report string
-            if len(list[2]) == 1:
+            if len(self.report_list[2]) == 1:
                 self.report_html = self.report_list[0] % \
                                     "memory:img_fit0.png"
-            elif len(list[2]) == 2:
+            elif len(self.report_list) == 2:
                 self.report_html = self.report_list[0] % \
                                     ("memory:img_fit0.png",
@@ -85,71 +59,11 @@
         self._setup_layout()
         
-    def _setup_layout(self):
-        """
-        Set up layout
-        """
-        hbox = wx.BoxSizer(wx.HORIZONTAL)
-        
-        # buttons
-        id = wx.ID_OK
-        button_close = wx.Button(self, id, "Close")
-        button_close.SetToolTipString("Close this report window.")
-        #hbox.Add((5,10), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0)
-        hbox.Add(button_close)
-        button_close.SetFocus()
-
-        id = wx.NewId()
-        button_preview = wx.Button(self, id, "Preview")
-        button_preview.SetToolTipString("Print preview this report.")
-        button_preview.Bind(wx.EVT_BUTTON, self.onPreview,
-                            id=button_preview.GetId()) 
-        hbox.Add(button_preview)
-
-        id = wx.NewId()
-        button_print = wx.Button(self, id, "Print")
-        button_print.SetToolTipString("Print this report.")
-        button_print.Bind(wx.EVT_BUTTON, self.onPrint,
-                          id=button_print.GetId())
-        hbox.Add(button_print)
-        
-        id = wx.NewId()
-        button_save = wx.Button(self, id, "Save")
-        button_save.SetToolTipString("Save this report.")
-        button_save.Bind(wx.EVT_BUTTON, self.onSave, id=button_save.GetId())
-        hbox.Add(button_save)
-        
-        # panel for report page
-        #panel = wx.Panel(self, -1)
-        vbox = wx.BoxSizer(wx.VERTICAL)
-        # html window
-        self.hwindow = html.HtmlWindow(self, style=wx.BORDER)
-        # set the html page with the report string
-        self.hwindow.SetPage(self.report_html)
-        
-        # add panels to boxsizers
-        vbox.Add(hbox)
-        vbox.Add(self.hwindow, 1, wx.EXPAND|wx.ALL,0)
-
-        self.SetSizer(vbox)
-        self.Centre()
-        self.Show(True)
-
     def onSave(self, event=None):
         """
         Save
         """
-        # pdf supporting only on MAC, not on exe
-        if self.is_pdf:
-            wild_card = ' PDF files (*.pdf)|*.pdf|'
-            ind_cor = 0
-        else:
-            wild_card = ''
-            ind_cor = 1
-        wild_card += 'HTML files (*.html)|*.html|'
-        wild_card += 'Text files (*.txt)|*.txt'
-
         #todo: complete saving fig file and as a txt file
         dlg = wx.FileDialog(self, "Choose a file",
-                            wildcard=wild_card,
+                            wildcard=self.wild_card,
                             style=wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
         dlg.SetFilterIndex(0)  # Set .html files to be default
@@ -166,5 +80,5 @@
         pic_fname = []
         #PDF
-        if ext_num == (0 + 2 * ind_cor):
+        if ext_num == (0 + 2 * self.index_offset):
             # TODO: Sort this case out
             ext = '.pdf'
@@ -216,5 +130,5 @@
             return
         #HTML + png(graph)
-        elif ext_num == (1 - ind_cor):
+        elif ext_num == (1 - self.index_offset):
             ext = '.html'
             for num in range(self.nimages):
@@ -222,5 +136,5 @@
             report_frame = self.report_list[0]
         #TEXT + pdf(graph)
-        elif ext_num == (2 - ind_cor):
+        elif ext_num == (2 - self.index_offset):
             ext = '.txt'
             # changing the image extension actually changes the image
@@ -241,5 +155,5 @@
             pic_fname.append(pic_name)
         #put the image path in html string
-        if ext_num == (1 - ind_cor):
+        if ext_num == (1 - self.index_offset):
             if self.nimages == 1:
                 report = report_frame % os.path.basename(pic_fname[0])
@@ -259,59 +173,2 @@
             self.report_list[2][num].savefig(pic_fname[num])
         
-    def onPreview(self, event=None):
-        """
-        Preview
-        
-        : event: Preview button event
-        """
-        previewh = html.HtmlEasyPrinting(name="Printing", parentWindow=self)
-        previewh.PreviewText(self.report_html)
-        if event is not None:
-            event.Skip()
-        self.Update()
-    
-    def onPrint(self, event=None):
-        """
-        Print
-        
-        : event: Print button event
-        """
-        printh = html.HtmlEasyPrinting(name="Printing", parentWindow=self)
-        printh.PrintText(self.report_html)
-        if event is not None:
-            event.Skip()
-        self.Update()
-        
-    def OnClose(self, event=None):
-        """
-        Close the Dialog
-        
-        : event: Close button event
-        """
-        self.Close()
-        # Reset memory
-        #wx.MemoryFSHandler()
-        if event is not None:
-            event.Skip()
-    
-    def HTML2PDF(self, data, filename):
-        """
-        Create a PDF file from html source string.
-        Returns True is the file creation was successful. 
-        
-        : data: html string
-        : filename: name of file to be saved
-        """
-        try:
-            from xhtml2pdf import pisa
-            # open output file for writing (truncated binary)
-            resultFile = open(filename, "w+b")
-            # convert HTML to PDF
-            pisaStatus = pisa.CreatePDF(data, dest=resultFile)
-            # close output file
-            resultFile.close()
-            self.Update()
-            return pisaStatus.err
-        except:
-            logging.error("Error creating pdf: %s" % sys.exc_value)
-        return False
Index: src/sas/perspectives/invariant/report_dialog.py
===================================================================
--- src/sas/perspectives/invariant/report_dialog.py	(revision 4ec242ef37ff5f92d91a892156e04d092559af32)
+++ src/sas/perspectives/invariant/report_dialog.py	(revision e8bb5b62d717c7b44481a4b621030699e4efdaf4)
@@ -15,116 +15,30 @@
 """
 import wx
-import sys
 import os
 import wx.html as html
-import logging
-ISPDF = False
-if sys.platform == "win32":
-    _STATICBOX_WIDTH = 450
-    PANEL_WIDTH = 500 
-    PANEL_HEIGHT = 700
-    FONT_VARIANT = 0
-    ISMAC = False
-    ISPDF = True
-elif sys.platform == "darwin":
-    _STATICBOX_WIDTH = 480
-    PANEL_WIDTH = 530
-    PANEL_HEIGHT = 700
-    FONT_VARIANT = 1
-    ISMAC = True
-    ISPDF = True
-  
-class ReportDialog(wx.Dialog):
+ 
+from sas.guiframe.report_dialog import BaseReportDialog
+
+class ReportDialog(BaseReportDialog):
     """
     The report dialog box. 
     """
     
-    def __init__(self,  list, *args, **kwds):
+    def __init__(self,  report_list, *args, **kwds):
         """
         Initialization. The parameters added to Dialog are:
         
-        :param list: report_list (list of html_str, text_str, image)
+        :param report_list: list of html_str, text_str, image
         from invariant_state
         """
-        kwds["style"] = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE
-        wx.Dialog.__init__(self, *args, **kwds)
-        kwds["image"] = 'Dynamic Image'
+        super(ReportDialog, self).__init__(report_list, *args, **kwds)
+
         # title
         self.SetTitle("Report: Invariant computaion")
-        # size
-        self.SetSize((720, 650))
-        # font size 
-        self.SetWindowVariant(variant=FONT_VARIANT)
 
-        # check if tit is MAC
-        self.is_pdf = ISPDF
-        
-        # report string
-        self.report_list = list
         # put image path in the report string
         self.report_html = self.report_list[0] % "memory:img_inv.png"
         # layout
         self._setup_layout()
-        # wild card
-        # pdf supporting only on MAC
-        if self.is_pdf:
-        	self.wild_card = ' PDF files (*.pdf)|*.pdf|'
-        else:
-        	self.wild_card = ''
-        self.wild_card += 'HTML files (*.html)|*.html|'
-        self.wild_card += 'Text files (*.txt)|*.txt'
-  
-        
-        
-    def _setup_layout(self):
-        """
-        Set up layout
-        """
-        hbox = wx.BoxSizer(wx.HORIZONTAL)
-        
-        # buttons
-        id = wx.ID_OK
-        button_close = wx.Button(self, id, "Close")
-        button_close.SetToolTipString("Close this report window.") 
-        #hbox.Add((5,10), 1 , wx.EXPAND|wx.ADJUST_MINSIZE,0)
-        hbox.Add(button_close)
-        button_close.SetFocus()
-
-        id = wx.NewId()
-        button_preview = wx.Button(self, id, "Preview")
-        button_preview.SetToolTipString("Print preview this report.")
-        button_preview.Bind(wx.EVT_BUTTON, self.onPreview,
-                            id=button_preview.GetId()) 
-        hbox.Add(button_preview)
-
-        id = wx.NewId()
-        button_print = wx.Button(self, id, "Print")
-        button_print.SetToolTipString("Print this report.")
-        button_print.Bind(wx.EVT_BUTTON, self.onPrint,
-                          id=button_print.GetId()) 
-        hbox.Add(button_print)
-        
-        id = wx.NewId()
-        button_save = wx.Button(self, id, "Save" )
-        button_save.SetToolTipString("Save this report.")
-        button_save.Bind(wx.EVT_BUTTON, self.onSave, id = button_save.GetId()) 
-        hbox.Add(button_save)     
-        
-        # panel for report page
-        #panel = wx.Panel(self, -1)
-        vbox = wx.BoxSizer(wx.VERTICAL)
-        # html window
-        self.hwindow = html.HtmlWindow(self,style=wx.BORDER)
-        # set the html page with the report string
-        self.hwindow.SetPage(self.report_html)
-        
-        # add panels to boxsizers
-        vbox.Add(hbox)
-        vbox.Add(self.hwindow, 1, wx.EXPAND|wx.ALL,0)
-
-        self.SetSizer(vbox)
-        self.Centre()
-        self.Show(True)
-		
 
     def onSave(self, event=None):
@@ -144,12 +58,7 @@
         fName = dlg.GetPath()
         ext_num = dlg.GetFilterIndex()  
-        # index correction 
-        if not self.is_pdf:
-        	ind_cor = 1 
-        else:
-        	ind_cor = 0 
         #set file extensions  
-        if ext_num == (0 + 2 * ind_cor):
-			# TODO: Sort this case out
+        if ext_num == (0 + 2 * self.index_offset):
+            # TODO: Sort this case out
             ext = '.pdf'
             img_ext = '_img.png'
@@ -186,9 +95,9 @@
             os.remove(pic_fname)
             return
-        elif ext_num == (1 - ind_cor):
+        elif ext_num == (1 - self.index_offset):
             ext = '.html'
             img_ext = '_img4html.png'
             report_frame = self.report_list[0]
-        elif ext_num == (2 - ind_cor):
+        elif ext_num == (2 - self.index_offset):
             ext = '.txt'   
             # changing the image extension actually changes the image
@@ -205,5 +114,5 @@
         pic_fname = os.path.splitext(fName)[0] + img_ext
         #put the image path in html string
-        if ext_num == (1 - ind_cor):
+        if ext_num == (1 - self.index_offset):
             report = report_frame % os.path.basename(pic_fname)
 
@@ -214,54 +123,2 @@
         self.report_list[2].savefig(pic_fname)
         
-            
-    def onPreview(self, event=None):
-        """
-        Preview
-        
-        : event: Preview button event
-        """
-        previewh = html.HtmlEasyPrinting(name="Printing", parentWindow=self)
-        previewh.PreviewText(self.report_html)
-        if event is not None:
-            event.Skip()
-    
-    def onPrint(self, event=None):
-        """
-        Print
-        
-        : event: Print button event
-        """
-        printh = html.HtmlEasyPrinting(name="Printing", parentWindow=self)
-        printh.PrintText(self.report_html)
-        if event is not None:
-            event.Skip()
-
-    def OnClose(self,event=None):
-        """
-        Close the Dialog
-        
-        : event: Close button event
-        """
-        self.Close()
-    
-    def HTML2PDF(self, data, filename):
-        """
-        Create a PDF file from html source string.
-        Returns True is the file creation was successful. 
-        
-        : data: html string
-        : filename: name of file to be saved
-        """
-        try:
-            from xhtml2pdf import pisa
-            # open output file for writing (truncated binary)
-            resultFile = open(filename, "w+b")
-            # convert HTML to PDF
-            pisaStatus = pisa.CreatePDF(data, dest=resultFile)
-            # close output file
-            resultFile.close()
-            self.Update()
-            return pisaStatus.err
-        except:
-            logging.error("Error creating pdf: %s" % sys.exc_value)
-        return False
