Index: fittingview/src/sans/perspectives/fitting/basepage.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/basepage.py	(revision 2a66329a67cdab67934484b81d17000811710b2f)
+++ fittingview/src/sans/perspectives/fitting/basepage.py	(revision df7a7e3fc9ea2f467d069e36f0552fc12e622178)
@@ -2,4 +2,5 @@
 Base Page for fitting
 """
+
 import sys
 import os
@@ -10,4 +11,7 @@
 import math
 import string
+import cPickle as pickle
+import shutil
+from collections import defaultdict
 from wx.lib.scrolledpanel import ScrolledPanel
 from sans.guiframe.panel_base import PanelBase
@@ -22,4 +26,7 @@
 from sans.dataloader.data_info import Source
 from sans.perspectives.fitting.pagestate import PageState
+from sans.guiframe.CategoryInstaller import CategoryInstaller
+
+
 
 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent()
@@ -130,4 +137,6 @@
         self.sld_axes = None
         self.multi_factor = None
+        self.model_name = None
+        self.model_dict = {}
        
         self.disp_cb_dict = {}
@@ -161,4 +170,8 @@
         self.disp_list = []
         self.disp_name = ""
+
+        ## category stuff
+        self.category_box = None
+        self.model_box = None
         
         ## list of orientation parameters
@@ -213,4 +226,6 @@
         ## layout
         self.set_layout()
+
+
     
     def set_index_model(self, index):
@@ -459,5 +474,5 @@
         self.model_list_box = page_info.model_list_box
         ## Data member to store the dispersion object created
-        self.populate_box(dict=self.model_list_box)
+
         
     def onContextMenu(self, event):
@@ -562,5 +577,5 @@
         self.state.manager = manager
         
-    def populate_box(self, dict):
+    def populate_box(self, m_dict):
         """
         Store list of model
@@ -569,8 +584,16 @@
         
         """
-        self.model_list_box = dict
-        self.state.model_list_box = self.model_list_box
-        self.initialize_combox()
-        
+        self.model_list_box = m_dict
+        # self.state.model_list_box = self.model_list_box
+        # self.initialize_combox()
+        
+    def set_model_dictionary(self, model_dict):
+        """
+        Store a dictionary linking model name -> model object
+
+        :param model_dict: dictionary containing list of models
+        """
+        self.model_dict = model_dict
+
     def initialize_combox(self):
         """
@@ -580,7 +603,4 @@
         if self.model_list_box is None:
             return
-        if len(self.model_list_box) > 0:
-            self._populate_box(self.formfactorbox,
-                               self.model_list_box["Shapes"])
        
         if len(self.model_list_box) > 0:
@@ -881,15 +901,16 @@
                         self.state.structurecombobox = self.structurebox.\
                         GetString(s_select)
-            if self.formfactorbox != None:
-                f_select = self.formfactorbox.GetSelection()
-                if f_select > 0:
-                        self.state.formfactorcombobox = self.formfactorbox.\
-                        GetString(f_select)
+            # if self.formfactorbox != None:
+            #     f_select = self.formfactorbox.GetSelection()
+            #     if f_select > 0:
+            self.state.formfactorcombobox = \
+                self.model_box.GetStringSelection()
                         
         #save radiobutton state for model selection
-        self.state.shape_rbutton = self.shape_rbutton.GetValue()
-        self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue()
-        self.state.struct_rbutton = self.struct_rbutton.GetValue()
-        self.state.plugin_rbutton = self.plugin_rbutton.GetValue()
+        # ILL
+        # self.state.shape_rbutton = self.shape_rbutton.GetValue()
+        # self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue()
+        # self.state.struct_rbutton = self.struct_rbutton.GetValue()
+        # self.state.plugin_rbutton = self.plugin_rbutton.GetValue()
         
         self.state.enable2D = copy.deepcopy(self.enable2D)
@@ -1040,26 +1061,17 @@
         self.disp_list = state.disp_list
       
-        ## set the state of the radio box
-        self.shape_rbutton.SetValue(state.shape_rbutton)
-        self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton)
-        self.struct_rbutton.SetValue(state.struct_rbutton)
-        self.plugin_rbutton.SetValue(state.plugin_rbutton)
-        
-        ## fill model combobox
         self._show_combox_helper()
-        #select the current model
-        try:
-            # to support older version
-            formfactor_pos = int(state.formfactorcombobox)
-        except:
-            formfactor_pos = 0
-            for ind_form in range(self.formfactorbox.GetCount()):
-                if self.formfactorbox.GetString(ind_form) == \
-                                        state.formfactorcombobox:
-                    formfactor_pos = int(ind_form)
-                    break
-            
-        self.formfactorbox.Select(formfactor_pos)
-        
+
+        # select the model in the gui
+        self._regenerate_model_dict()
+        if(len(self.by_model_dict[state.formfactorcombobox]) == 0):
+            self.category_box.SetStringSelection('Uncategorized')
+            self.model_box.SetStringSelection(state.formfactorcombobox)
+        else:
+            self.category_box.SetStringSelection(\
+                self.by_model_dict[state.formfactorcombobox][0] )
+            self.model_box.SetStringSelection(state.formfactorcombobox)
+        
+
         try:
             # to support older version
@@ -1106,5 +1118,6 @@
                                                     state.disp_cb_dict[item])
                         # Create the dispersion objects
-                        from sans.models.dispersion_models import ArrayDispersion
+                        from sans.models.dispersion_models \
+                            import ArrayDispersion
                         disp_model = ArrayDispersion()
                         if hasattr(state, "values") and \
@@ -1205,26 +1218,19 @@
         self.disp_list = state.disp_list
       
-        ## set the state of the radio box
-        self.shape_rbutton.SetValue(state.shape_rbutton)
-        self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton)
-        self.struct_rbutton.SetValue(state.struct_rbutton)
-        self.plugin_rbutton.SetValue(state.plugin_rbutton)
         
         ## fill model combobox
         self._show_combox_helper()
         #select the current model
-        try:
-            # to support older version
-            formfactor_pos = int(state.formfactorcombobox)
-        except:
-            formfactor_pos = 0
-            for ind_form in range(self.formfactorbox.GetCount()):
-                if self.formfactorbox.GetString(ind_form) == \
-                                                    (state.formfactorcombobox):
-                    formfactor_pos = int(ind_form)
-                    break
-            
-        self.formfactorbox.Select(formfactor_pos)
-        
+
+
+        self._regenerate_model_dict()
+        if(len(self.by_model_dict[state.formfactorcombobox]) == 0):
+            self.category_box.SetStringSelection('Uncategorized')
+            self.model_box.SetStringSelection(state.formfactorcombobox)
+        else:
+            self.category_box.SetStringSelection(\
+                self.by_model_dict[state.formfactorcombobox][0] )
+            self.model_box.SetStringSelection(state.formfactorcombobox)
+
         try:
             # to support older version
@@ -1426,10 +1432,10 @@
         save radiobutton containing the type model that can be selected
         """
-        self.state.shape_rbutton = self.shape_rbutton.GetValue()
-        self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue()
-        self.state.struct_rbutton = self.struct_rbutton.GetValue()
-        self.state.plugin_rbutton = self.plugin_rbutton.GetValue()
+        # self.state.shape_rbutton = self.shape_rbutton.GetValue()
+        # self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue()
+        # self.state.struct_rbutton = self.struct_rbutton.GetValue()
+        # self.state.plugin_rbutton = self.plugin_rbutton.GetValue()
         self.state.structurecombobox = self.structurebox.GetLabel()
-        self.state.formfactorcombobox = self.formfactorbox.GetLabel()
+        self.state.formfactorcombobox = self.model_box.GetStringSelection()
        
         ## post state to fit panel
@@ -1766,45 +1772,45 @@
             class_name = model.p_model.__class__
             name = model.p_model.name
-            self.formfactorbox.Clear()
+#            self.formfactorbox.Clear()
             
             for k, list in self.model_list_box.iteritems():
                 if k in["P(Q)*S(Q)", "Shapes"] and \
                     class_name in self.model_list_box["Shapes"]:
-                    self.shape_rbutton.SetValue(True)
+#                    self.shape_rbutton.SetValue(True)
                     ## fill the form factor list with new model
-                    self._populate_box(self.formfactorbox,
-                                       self.model_list_box["Shapes"])
-                    items = self.formfactorbox.GetItems()
-                    ## set comboxbox to the selected item
-                    for i in range(len(items)):
-                        if items[i] == str(name):
-                            self.formfactorbox.SetSelection(i)
-                            break
+                    # self._populate_box(self.formfactorbox,
+                    #                    self.model_list_box["Shapes"])
+                    # items = self.formfactorbox.GetItems()
+                    # ## set comboxbox to the selected item
+                    # for i in range(len(items)):
+                    #     if items[i] == str(name):
+                    #         self.formfactorbox.SetSelection(i)
+                    #         break
                     return
-                elif k == "Shape-Independent":
-                    self.shape_indep_rbutton.SetValue(True)
-                elif k == "Structure Factors":
-                    self.struct_rbutton.SetValue(True)
-                elif k == "Multi-Functions":
-                    continue
-                else:
-                    self.plugin_rbutton.SetValue(True)
+                # elif k == "Shape-Independent":
+                #     self.shape_indep_rbutton.SetValue(True)
+                # elif k == "Structure Factors":
+                #     self.struct_rbutton.SetValue(True)
+                # elif k == "Multi-Functions":
+                #     continue
+                # else:
+                #     self.plugin_rbutton.SetValue(True)
                
-                if class_name in list:
-                    ## fill the form factor list with new model
-                    self._populate_box(self.formfactorbox, list)
-                    items = self.formfactorbox.GetItems()
-                    ## set comboxbox to the selected item
-                    for i in range(len(items)):
-                        if items[i] == str(name):
-                            self.formfactorbox.SetSelection(i)
-                            break
-                    break
-        else:
+                # if class_name in list:
+                #     # ## fill the form factor list with new model
+                #     # self._populate_box(self.formfactorbox, list)
+                #     # items = self.formfactorbox.GetItems()
+                #     # ## set comboxbox to the selected item
+                #     # for i in range(len(items)):
+                #     #     if items[i] == str(name):
+                #     #         self.formfactorbox.SetSelection(i)
+                #     #         break
+                #     # break
+                #     else:
             ## Select the model from the menu
             class_name = model.__class__
             name = model.name
-            self.formfactorbox.Clear()
-            items = self.formfactorbox.GetItems()
+##            self.formfactorbox.Clear()
+#            items = self.formfactorbox.GetItems()
     
             for k, list in self.model_list_box.iteritems():
@@ -1824,23 +1830,23 @@
                         self.text2.Disable()
                         
-                    self.shape_rbutton.SetValue(True)
+#                    self.shape_rbutton.SetValue(True)
                     ## fill the form factor list with new model
-                    self._populate_box(self.formfactorbox,
-                                       self.model_list_box["Shapes"])
-                    items = self.formfactorbox.GetItems()
-                    ## set comboxbox to the selected item
-                    for i in range(len(items)):
-                        if items[i] == str(name):
-                            self.formfactorbox.SetSelection(i)
-                            break
+                    # self._populate_box(self.formfactorbox,
+                    #                    self.model_list_box["Shapes"])
+                    # items = self.formfactorbox.GetItems()
+                    # ## set comboxbox to the selected item
+                    # for i in range(len(items)):
+                    #     if items[i] == str(name):
+                    #         self.formfactorbox.SetSelection(i)
+                    #         break
                     return
-                elif k == "Shape-Independent":
-                    self.shape_indep_rbutton.SetValue(True)
-                elif k == "Structure Factors":
-                    self.struct_rbutton.SetValue(True)
-                elif k == "Multi-Functions":
-                    continue
-                else:
-                    self.plugin_rbutton.SetValue(True)
+                # elif k == "Shape-Independent":
+                #     self.shape_indep_rbutton.SetValue(True)
+                # elif k == "Structure Factors":
+                #     self.struct_rbutton.SetValue(True)
+                # elif k == "Multi-Functions":
+                #     continue
+                # else:
+                #     self.plugin_rbutton.SetValue(True)
                 if class_name in list:
                     self.structurebox.SetSelection(0)
@@ -1848,11 +1854,11 @@
                     self.text2.Disable()
                     ## fill the form factor list with new model
-                    self._populate_box(self.formfactorbox, list)
-                    items = self.formfactorbox.GetItems()
+                    # self._populate_box(self.formfactorbox, list)
+                    # items = self.formfactorbox.GetItems()
                     ## set comboxbox to the selected item
-                    for i in range(len(items)):
-                        if items[i] == str(name):
-                            self.formfactorbox.SetSelection(i)
-                            break
+                    # for i in range(len(items)):
+                    #     if items[i] == str(name):
+                    #         self.formfactorbox.SetSelection(i)
+                    #         break
                     break
                 
@@ -1952,31 +1958,31 @@
         Fill panel's combo box according to the type of model selected
         """
-        if self.shape_rbutton.GetValue():
-            ##fill the combobox with form factor list
-            self.structurebox.SetSelection(0)
-            self.structurebox.Disable()
-            self.formfactorbox.Clear()
-            self._populate_box(self.formfactorbox,
-                               self.model_list_box["Shapes"])
-        if self.shape_indep_rbutton.GetValue():
-            ##fill the combobox with shape independent  factor list
-            self.structurebox.SetSelection(0)
-            self.structurebox.Disable()
-            self.formfactorbox.Clear()
-            self._populate_box(self.formfactorbox,
-                             self.model_list_box["Shape-Independent"])
-        if self.struct_rbutton.GetValue():
-            ##fill the combobox with structure factor list
-            self.structurebox.SetSelection(0)
-            self.structurebox.Disable()
-            self.formfactorbox.Clear()
-            self._populate_box(self.formfactorbox,
-                               self.model_list_box["Structure Factors"])
-        if self.plugin_rbutton.GetValue():
-            ##fill the combobox with form factor list
-            self.structurebox.Disable()
-            self.formfactorbox.Clear()
-            self._populate_box(self.formfactorbox,
-                               self.model_list_box["Customized Models"])
+#         if self.shape_rbutton.GetValue():
+#             ##fill the combobox with form factor list
+#             self.structurebox.SetSelection(0)
+#             self.structurebox.Disable()
+#             # self.formfactorbox.Clear()
+#             # self._populate_box(self.formfactorbox,
+#             #                    self.model_list_box["Shapes"])
+#         if self.shape_indep_rbutton.GetValue():
+#             ##fill the combobox with shape independent  factor list
+#             self.structurebox.SetSelection(0)
+#             self.structurebox.Disable()
+# #            self.formfactorbox.Clear()
+#             self._populate_box(self.formfactorbox,
+#                              self.model_list_box["Shape-Independent"])
+#         if self.struct_rbutton.GetValue():
+#             ##fill the combobox with structure factor list
+#             self.structurebox.SetSelection(0)
+#             self.structurebox.Disable()
+#  #           self.formfactorbox.Clear()
+#             self._populate_box(self.formfactorbox,
+#                                self.model_list_box["Structure Factors"])
+#         if self.plugin_rbutton.GetValue():
+#             ##fill the combobox with form factor list
+#             self.structurebox.Disable()
+#   #          self.formfactorbox.Clear()
+#             self._populate_box(self.formfactorbox,
+#                                self.model_list_box["Customized Models"])
         
     def _show_combox(self, event=None):
@@ -1994,5 +2000,5 @@
         self.Refresh()
   
-    def _populate_box(self, combobox, list):
+    def _populate_box(self, combobox, model_list):
         """
         fill combox box with dict item
@@ -2002,5 +2008,5 @@
         """
         mlist = []
-        for models in list:
+        for models in model_list:
             model = models()
             name = model.__class__.__name__
@@ -2133,12 +2139,12 @@
         """
         ## reset dictionary containing reference to dispersion
+        if self.model_name == None:
+            return
+
         self._disp_obj_dict = {}
         self.disp_cb_dict = {}
         self.temp_multi_functional = False
-        f_id = self.formfactorbox.GetCurrentSelection()
-        #For MAC
-        form_factor = None
-        if f_id >= 0:
-            form_factor = self.formfactorbox.GetClientData(f_id)
+
+        form_factor = self.model_dict[self.model_name]
 
         if not form_factor in  self.model_list_box["multiplication"]:
@@ -2154,4 +2160,6 @@
             self.text2.Enable()
             
+
+
         if form_factor != None:
             # set multifactor for Mutifunctional models
@@ -2331,8 +2339,8 @@
         return flag
     
-    def _check_value_enter(self, list, modified):
-        """
-        :param list: model parameter and panel info
-        :Note: each item of the list should be as follow:
+    def _check_value_enter(self, m_list, modified):
+        """
+        :param m_list: model parameter and panel info
+        :Note: each item of the m_list should be as follow:
             item=[check button state, parameter's name,
                 paramater's value, string="+/-",
@@ -2343,7 +2351,7 @@
         """
         is_modified = modified
-        if len(list) == 0:
+        if len(m_list) == 0:
             return is_modified
-        for item in list:
+        for item in m_list:
             #skip angle parameters for 1D
             if not self.enable2D:
@@ -2895,23 +2903,22 @@
         if self.model == None:
             name = 'FuncHelp'
-        else:
-            name = self.formfactorbox.GetValue()
+
         frame = HelpWindow(None, -1, pageToOpen=model_path)
         # If model name exists and model is not a custom model
-        if frame.rhelp.HasAnchor(name) and not self.plugin_rbutton.GetValue():
-            frame.Show(True)
-            frame.rhelp.ScrollToAnchor(name)
-        else:
-            if self.model != None:
-                frame.Destroy()
-                msg = 'Model description:\n'
-                if str(self.model.description).rstrip().lstrip() == '':
-                    msg += "Sorry, no information is available for this model."
-                else:
-                    msg += self.model.description + '\n'
-                info = "Info"
-                wx.MessageBox(msg, info)
-            else:
-                frame.Show(True)
+        # if frame.rhelp.HasAnchor(name) and not self.plugin_rbutton.GetValue():
+        #     frame.Show(True)
+        #     frame.rhelp.ScrollToAnchor(name)
+        # else:
+        #     if self.model != None:
+        #         frame.Destroy()
+        #         msg = 'Model description:\n'
+        #         if str(self.model.description).rstrip().lstrip() == '':
+        #             msg += "Sorry, no information is available for this model."
+        #         else:
+        #             msg += self.model.description + '\n'
+        #         info = "Info"
+        #         wx.MessageBox(msg, info)
+        #     else:
+        #         frame.Show(True)
     
     def on_pd_help_clicked(self, event):
@@ -3290,8 +3297,91 @@
         return
 
+    def _read_category_info(self):
+        """
+        Reads the categories in from file
+        """
+
+        # # ILL mod starts here - July 2012 kieranrcampbell@gmail.com
+        self.master_category_dict = defaultdict(list)
+        self.by_model_dict = defaultdict(list)
+        self.model_enabled_dict = defaultdict(bool)
+
+        categorization_file = CategoryInstaller.get_user_file()
+
+
+        try:
+            cat_file = open(categorization_file, 'rb')
+                            
+            self.master_category_dict = pickle.load(cat_file)
+            self._regenerate_model_dict()
+
+        except IOError:
+            print 'Problem reading in category file.'
+            print 'We even looked for it, made sure it was there.'
+            print 'An existential crisis if there ever was one.'
+
+    def _regenerate_model_dict(self):
+        """
+        regenerates self.by_model_dict which has each model name as the 
+        key and the list of categories belonging to that model
+        along with the enabled mapping
+        """
+
+        self.by_model_dict = defaultdict(list)
+        for category in self.master_category_dict:
+            for (model,enabled) in self.master_category_dict[category]:
+                self.by_model_dict[model].append(category)
+                self.model_enabled_dict[model] = enabled
+    
+    def _populate_listbox(self):
+        """
+        fills out the category list box
+        """
+        self._read_category_info()
+
+        self.category_box.Clear()
+        cat_list = sorted(self.master_category_dict.keys())
+        cat_list.append('Customized')
+
+        for category in cat_list:
+            if category != '':
+                self.category_box.Append(category)
+
+        if self.category_box.GetSelection() == wx.NOT_FOUND:
+            self.category_box.SetSelection(0)
+        else:
+            self.category_box.SetSelection( \
+                self.category_box.GetSelection())
+
+        self._on_change_cat(None)
+
+
+    def _on_change_cat(self, event):
+        """
+        Callback for category change action
+        """
+        self.model_name = None
+        category = self.category_box.GetStringSelection()
+        if category == None:
+            return
+        self.model_box.Clear()
+
+        if category == 'Customized':
+            for model in self.model_list_box["Customized Models"]:
+                str_m = str(model).split(".")[0]
+                self.model_box.Append(str_m)
+            print 'but not here'
+
+        else:
+            for (model,enabled) in sorted(self.master_category_dict[category],
+                                      key = lambda name: name[0]):
+                if(enabled):
+                    self.model_box.Append(model)
+
     def _fill_model_sizer(self, sizer):
         """
         fill sizer containing model info
         """
+
         ##Add model function Details button in fitpanel.
         ##The following 3 lines are for Mac. Let JHC know before modifying...
@@ -3311,36 +3401,43 @@
         hint = "toggle view of model from 1D to 2D  or 2D to 1D"
         self.model_view.SetToolTipString(hint)
-      
-        self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes',
-                                             style=wx.RB_GROUP)
-        self.shape_indep_rbutton = wx.RadioButton(self, -1,
-                                                  "Shape-Independent")
-        self.struct_rbutton = wx.RadioButton(self, -1, "Structure Factor ")
-        self.plugin_rbutton = wx.RadioButton(self, -1, "Customized Models")
-                
-        self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,
-                            id=self.shape_rbutton.GetId())
-        self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,
-                            id=self.shape_indep_rbutton.GetId())
-        self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,
-                            id=self.struct_rbutton.GetId())
-        self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,
-                            id=self.plugin_rbutton.GetId())
-        #MAC needs SetValue
-        self.shape_rbutton.SetValue(True)
-      
+
+        
+        # ILL mod starts here - Aug 2012
+
+
+        cat_text = wx.StaticText(self, -1, 'Category')
+        mod_text = wx.StaticText(self, -1, 'Model')
+        
+        id = wx.NewId()
+        self.category_box = wx.ListBox(self, size=(150, 100))
+        self.category_box.Bind(wx.EVT_LISTBOX, self._on_change_cat)
+        self.model_box = wx.ListBox(self, -1, size=(150, 100))
+        self.model_box.Bind(wx.EVT_LISTBOX, self._on_select_model)
+
         sizer_radiobutton = wx.GridSizer(2, 3, 5, 5)
-        sizer_radiobutton.Add(self.shape_rbutton)
-        sizer_radiobutton.Add(self.shape_indep_rbutton)
-        sizer_radiobutton.Add(self.model_view, 1, wx.LEFT, 20)
-        sizer_radiobutton.Add(self.plugin_rbutton)
-        sizer_radiobutton.Add(self.struct_rbutton)
-        sizer_radiobutton.Add(self.model_help, 1, wx.LEFT, 20)
-        
+        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
+        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
+        vbox1 = wx.BoxSizer(wx.VERTICAL)
+        vbox2 = wx.BoxSizer(wx.VERTICAL)
+        vbox3 = wx.BoxSizer(wx.VERTICAL)
+
+        vbox1.Add(cat_text, border = 5, flag = wx.EXPAND | wx.ALL)
+        vbox2.Add(mod_text, border=5, flag = wx.EXPAND | wx.ALL)
+        vbox3.Add(self.model_view, flag= wx.ALL | wx.ALIGN_LEFT
+                  , border =5)
+        vbox1.Add(self.category_box, border = 5, flag = wx.EXPAND | wx.ALL)
+        vbox2.Add(self.model_box, flag = wx.EXPAND | wx.ALL, border = 5)
+        vbox3.Add(self.model_help, border = 5, 
+                  flag = wx.LEFT | wx.ALIGN_LEFT )
+
+        hbox1.Add(vbox1, border = 5, flag = wx.EXPAND | wx.ALL)
+        hbox1.Add(vbox2, border = 5, flag = wx.EXPAND | wx.ALL)
+        hbox1.Add(vbox3, border = 5, flag = wx.EXPAND | wx.ALL)
+
         sizer_selection = wx.BoxSizer(wx.HORIZONTAL)
         mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL)
         
         self.text1 = wx.StaticText(self, -1, "")
-        self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q)")
+        self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q) ")
         self.mutifactor_text = wx.StaticText(self, -1, "No. of Shells: ")
         self.mutifactor_text1 = wx.StaticText(self, -1, "")
@@ -3348,25 +3445,21 @@
         self.show_sld_button.Bind(wx.EVT_BUTTON, self._on_show_sld)
 
-        self.formfactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
-        if self.model != None:
-            self.formfactorbox.SetValue(self.model.name)
         self.structurebox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         self.multifactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
         self.initialize_combox()
-        wx.EVT_COMBOBOX(self.formfactorbox, -1, self._on_select_model)
 
         wx.EVT_COMBOBOX(self.structurebox, -1, self._on_select_model)
         wx.EVT_COMBOBOX(self.multifactorbox, -1, self._on_select_model)
         ## check model type to show sizer
+
+        hbox2.Add(self.text2, border = 5, flag = wx.EXPAND | wx.ALL )
+        hbox2.Add(self.structurebox, border = 5, flag = wx.EXPAND | \
+                      wx.ALL )
+        
         if self.model != None:
             self._set_model_sizer_selection(self.model)
         
-        sizer_selection.Add(self.text1)
-        sizer_selection.Add((5, 5))
-        sizer_selection.Add(self.formfactorbox)
-        sizer_selection.Add((5, 5))
-        sizer_selection.Add(self.text2)
-        sizer_selection.Add((5, 5))
-        sizer_selection.Add(self.structurebox)
+        self._populate_listbox()
+        
        
         mutifactor_selection.Add((10, 5))
@@ -3378,8 +3471,8 @@
         mutifactor_selection.Add(self.show_sld_button)
 
-        boxsizer1.Add(sizer_radiobutton)
+        boxsizer1.Add(hbox1, flag = wx.EXPAND)
+        boxsizer1.Add(hbox2, flag = wx.EXPAND)
         boxsizer1.Add((10, 10))
-        boxsizer1.Add(sizer_selection)
-        boxsizer1.Add((10, 10))
+
         boxsizer1.Add(mutifactor_selection)
         
Index: fittingview/src/sans/perspectives/fitting/fitpage.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitpage.py	(revision e4cd34ca7a658db43d05a7d8b2048b1ad3779bb8)
+++ fittingview/src/sans/perspectives/fitting/fitpage.py	(revision df7a7e3fc9ea2f467d069e36f0552fc12e622178)
@@ -36,10 +36,11 @@
     """
 
-    def __init__(self, parent, color='rand'):
+    def __init__(self, parent, m_dict, color='rand'):
         """
         Initialization of the Panel
         """
         BasicPage.__init__(self, parent, color=color)
-        
+        self.populate_box(m_dict)
+
         ## draw sizer
         self._fill_data_sizer()
@@ -67,5 +68,5 @@
         #create a default data for an empty panel
         self.create_default_data()
-    
+
     def enable_fit_button(self):
         """
@@ -1087,15 +1088,22 @@
         call back for model selection
         """
+        # if we're just clearing the box then do nothing
+        if self.model_box.GetCount() == 0 or \
+                self.model_box.GetStringSelection() == '':
+            return
+
+
         self.Show(False)
         copy_flag = False
         is_poly_enabled = None
         if event != None:
-            if (event.GetEventObject() == self.formfactorbox\
-                        and self.structurebox.GetLabel() != 'None')\
-                        or event.GetEventObject() == self.structurebox\
-                        or event.GetEventObject() == self.multifactorbox:
-                copy_flag = self.get_copy_params()
-                is_poly_enabled = self.enable_disp.GetValue()
-
+            # if (event.GetEventObject() == self.formfactorbox\
+            #             and self.structurebox.GetLabel() != 'None')\
+            #             or event.GetEventObject() == self.structurebox\
+            #             or event.GetEventObject() == self.multifactorbox:
+            copy_flag = self.get_copy_params()
+            is_poly_enabled = self.enable_disp.GetValue()
+
+        self.model_name = self.model_box.GetStringSelection()
         self._on_select_model_helper()
         self.set_model_param_sizer(self.model)
@@ -1116,5 +1124,5 @@
     
         self.state.structurecombobox = self.structurebox.GetLabel()
-        self.state.formfactorcombobox = self.formfactorbox.GetLabel()
+        self.state.formfactorcombobox = self.model_box.GetStringSelection()
         self.enable_fit_button()
         if self.model != None:
@@ -1175,13 +1183,13 @@
             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.GetLabel()
-                    pos = self.formfactorbox.GetSelection()
-                    self._show_combox_helper()
-                    self.formfactorbox.SetSelection(pos)
-                    self.formfactorbox.SetValue(current_val)
+            # if self.plugin_rbutton.GetValue():
+            #     temp = self.parent.update_model_list()
+            #     if temp:
+            #         self.model_list_box = temp
+                    # current_val = self.formfactorbox.GetLabel()
+                    # pos = self.formfactorbox.GetSelection()
+                    # self._show_combox_helper()
+                    # self.formfactorbox.SetSelection(pos)
+                    # self.formfactorbox.SetValue(current_val)
             # when select a model only from guictr/button
             if is_poly_enabled != None:
@@ -1814,5 +1822,5 @@
             self.dI_idata.Enable(True)
               
-            self.formfactorbox.Enable()
+#            self.formfactorbox.Enable()
             self.structurebox.Enable()
             data_name = self.data.name
Index: fittingview/src/sans/perspectives/fitting/fitpanel.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitpanel.py	(revision f32d144d174cb53c8dbffe9c43bb830e97f32b7b)
+++ fittingview/src/sans/perspectives/fitting/fitpanel.py	(revision df7a7e3fc9ea2f467d069e36f0552fc12e622178)
@@ -48,4 +48,5 @@
         self.menu_mng = models.ModelManager()
         self.model_list_box = self.menu_mng.get_model_list()
+        self.model_dictionary = self.menu_mng.get_model_dictionary()
         #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING
         self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE
@@ -304,13 +305,20 @@
                 page.set_manager(self._manager)
 
-    def set_model_list(self, dict):
+    def set_model_list(self, m_dict):
         """
         copy a dictionary of model into its own dictionary
         
-        :param dict: dictionnary made of model name as key and model class
+        :param m_dict: dictionnary made of model name as key and model class
         as value
         """
-        self.model_list_box = dict
-        
+        self.model_list_box = m_dict
+        
+    def set_model_dict(self, m_dict):
+        """
+        copy a dictionary of model name -> model object
+
+        :param m_dict: dictionary linking model name -> model object
+        """
+
     def get_current_page(self):
         """
@@ -360,6 +368,8 @@
         else:
         """
+
         from fitpage import FitPage
-        panel = FitPage(parent=self)
+        panel = FitPage(parent=self, m_dict = self.model_list_box)
+
         if self.batch_on:
             self.batch_page_index += 1
@@ -373,5 +383,5 @@
         panel.batch_on = self.batch_on
         panel._set_save_flag(not panel.batch_on)
-        panel.populate_box(dict=self.model_list_box)
+        panel.set_model_dictionary(self.model_dictionary)
         panel.set_manager(self._manager)
         panel.window_caption = caption
Index: fittingview/src/sans/perspectives/fitting/fitting.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/fitting.py	(revision 162c778c191ab7f0b9cc96401f4c38ce4d8254ab)
+++ fittingview/src/sans/perspectives/fitting/fitting.py	(revision df7a7e3fc9ea2f467d069e36f0552fc12e622178)
@@ -52,4 +52,5 @@
 else:
     ON_MAC = True
+
 
 
Index: fittingview/src/sans/perspectives/fitting/models.py
===================================================================
--- fittingview/src/sans/perspectives/fitting/models.py	(revision f40f7432151711f8d260e3e0059586c096026c26)
+++ fittingview/src/sans/perspectives/fitting/models.py	(revision df7a7e3fc9ea2f467d069e36f0552fc12e622178)
@@ -18,6 +18,10 @@
 # as the base class of plug-in models.
 from sans.models.pluginmodel import Model1DPlugin
+from sans.models.BaseComponent import BaseComponent
    
 PLUGIN_DIR = 'plugin_models'
+
+def get_model_python_path():
+    return os.path.dirname(__file__)
 
 
@@ -261,4 +265,5 @@
         """
         """
+        self.model_dictionary = {}
         self.stored_plugins = {}
         self._getModelList()
@@ -283,7 +288,10 @@
         
         """
+
+
         # regular model names only
         self.model_name_list = []
         from sans.models.SphereModel import SphereModel
+        self.model_dictionary[SphereModel.__name__] = SphereModel
         self.shape_list.append(SphereModel)
         self.multiplication_factor.append(SphereModel)
@@ -291,8 +299,10 @@
         
         from sans.models.BinaryHSModel import BinaryHSModel
+        self.model_dictionary[BinaryHSModel.__name__] = BinaryHSModel
         self.shape_list.append(BinaryHSModel)
         self.model_name_list.append(BinaryHSModel.__name__)
                         
         from sans.models.FuzzySphereModel import FuzzySphereModel
+        self.model_dictionary[FuzzySphereModel.__name__] = FuzzySphereModel
         self.shape_list.append(FuzzySphereModel)
         self.multiplication_factor.append(FuzzySphereModel)
@@ -300,8 +310,10 @@
                         
         from sans.models.RaspBerryModel import RaspBerryModel
+        self.model_dictionary[RaspBerryModel.__name__] = RaspBerryModel
         self.shape_list.append(RaspBerryModel)
         self.model_name_list.append(RaspBerryModel.__name__)
                 
         from sans.models.CoreShellModel import CoreShellModel
+        self.model_dictionary[CoreShellModel.__name__] = CoreShellModel
         self.shape_list.append(CoreShellModel)
         self.multiplication_factor.append(CoreShellModel)
@@ -309,8 +321,10 @@
         
         from sans.models.Core2ndMomentModel import Core2ndMomentModel
+        self.model_dictionary[Core2ndMomentModel.__name__] = Core2ndMomentModel
         self.shape_list.append(Core2ndMomentModel)
         self.model_name_list.append(Core2ndMomentModel.__name__)
         
         from sans.models.CoreMultiShellModel import CoreMultiShellModel
+        self.model_dictionary[CoreMultiShellModel.__name__] = CoreMultiShellModel
         self.shape_list.append(CoreMultiShellModel)
         self.multiplication_factor.append(CoreMultiShellModel)
@@ -318,4 +332,5 @@
 
         from sans.models.VesicleModel import VesicleModel
+        self.model_dictionary[VesicleModel.__name__] = VesicleModel
         self.shape_list.append(VesicleModel)
         self.multiplication_factor.append(VesicleModel)
@@ -323,4 +338,5 @@
         
         from sans.models.MultiShellModel import MultiShellModel
+        self.model_dictionary[MultiShellModel.__name__] = MultiShellModel
         self.shape_list.append(MultiShellModel)
         self.multiplication_factor.append(MultiShellModel)
@@ -328,4 +344,5 @@
         
         from sans.models.OnionExpShellModel import OnionExpShellModel
+        self.model_dictionary[OnionExpShellModel.__name__] = OnionExpShellModel
         self.shape_list.append(OnionExpShellModel)
         self.multiplication_factor.append(OnionExpShellModel)
@@ -333,4 +350,5 @@
                          
         from sans.models.SphericalSLDModel import SphericalSLDModel
+        self.model_dictionary[SphericalSLDModel.__name__] = SphericalSLDModel
         self.shape_list.append(SphericalSLDModel)
         self.multiplication_factor.append(SphericalSLDModel)
@@ -339,8 +357,10 @@
         
         from sans.models.LinearPearlsModel import LinearPearlsModel
+        self.model_dictionary[LinearPearlsModel.__name__] = LinearPearlsModel
         self.shape_list.append(LinearPearlsModel)
         self.model_name_list.append(LinearPearlsModel.__name__)
           
         from sans.models.PearlNecklaceModel import PearlNecklaceModel
+        self.model_dictionary[PearlNecklaceModel.__name__] = PearlNecklaceModel
         self.shape_list.append(PearlNecklaceModel)
         self.model_name_list.append(PearlNecklaceModel.__name__)
@@ -348,4 +368,5 @@
         
         from sans.models.CylinderModel import CylinderModel
+        self.model_dictionary[CylinderModel.__name__] = CylinderModel
         self.shape_list.append(CylinderModel)
         self.multiplication_factor.append(CylinderModel)
@@ -353,4 +374,5 @@
         
         from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
+        self.model_dictionary[CoreShellCylinderModel.__name__] = CoreShellCylinderModel
         self.shape_list.append(CoreShellCylinderModel)
         self.multiplication_factor.append(CoreShellCylinderModel)
@@ -358,4 +380,5 @@
         
         from sans.models.CoreShellBicelleModel import CoreShellBicelleModel
+        self.model_dictionary[CoreShellBicelleModel.__name__] = CoreShellBicelleModel
         self.shape_list.append(CoreShellBicelleModel)
         self.multiplication_factor.append(CoreShellBicelleModel)
@@ -363,4 +386,5 @@
                 
         from sans.models.HollowCylinderModel import HollowCylinderModel
+        self.model_dictionary[HollowCylinderModel.__name__] = HollowCylinderModel
         self.shape_list.append(HollowCylinderModel)
         self.multiplication_factor.append(HollowCylinderModel)
@@ -368,12 +392,15 @@
               
         from sans.models.FlexibleCylinderModel import FlexibleCylinderModel
+        self.model_dictionary[FlexibleCylinderModel.__name__] = FlexibleCylinderModel
         self.shape_list.append(FlexibleCylinderModel)
         self.model_name_list.append(FlexibleCylinderModel.__name__)
 
         from sans.models.FlexCylEllipXModel import FlexCylEllipXModel
+        self.model_dictionary[FlexCylEllipXModel.__name__] = FlexCylEllipXModel
         self.shape_list.append(FlexCylEllipXModel)
         self.model_name_list.append(FlexCylEllipXModel.__name__)
         
         from sans.models.StackedDisksModel import StackedDisksModel
+        self.model_dictionary[StackedDisksModel.__name__] = StackedDisksModel
         self.shape_list.append(StackedDisksModel)
         self.multiplication_factor.append(StackedDisksModel)
@@ -381,4 +408,5 @@
         
         from sans.models.ParallelepipedModel import ParallelepipedModel
+        self.model_dictionary[ParallelepipedModel.__name__] = ParallelepipedModel
         self.shape_list.append(ParallelepipedModel)
         self.multiplication_factor.append(ParallelepipedModel)
@@ -386,4 +414,5 @@
         
         from sans.models.CSParallelepipedModel import CSParallelepipedModel
+        self.model_dictionary[CSParallelepipedModel.__name__] = CSParallelepipedModel
         self.shape_list.append(CSParallelepipedModel)
         self.multiplication_factor.append(CSParallelepipedModel)
@@ -391,4 +420,5 @@
         
         from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
+        self.model_dictionary[EllipticalCylinderModel.__name__] = EllipticalCylinderModel
         self.shape_list.append(EllipticalCylinderModel)
         self.multiplication_factor.append(EllipticalCylinderModel)
@@ -396,4 +426,5 @@
         
         from sans.models.BarBellModel import BarBellModel
+        self.model_dictionary[BarBellModel.__name__] = BarBellModel
         self.shape_list.append(BarBellModel)
         self.model_name_list.append(BarBellModel.__name__)
@@ -402,4 +433,5 @@
         
         from sans.models.CappedCylinderModel import CappedCylinderModel
+        self.model_dictionary[CappedCylinderModel.__name__] = CappedCylinderModel
         self.shape_list.append(CappedCylinderModel)
         self.model_name_list.append(CappedCylinderModel.__name__)
@@ -408,4 +440,5 @@
         
         from sans.models.EllipsoidModel import EllipsoidModel
+        self.model_dictionary[EllipsoidModel.__name__] = EllipsoidModel
         self.shape_list.append(EllipsoidModel)
         self.multiplication_factor.append(EllipsoidModel)
@@ -413,4 +446,5 @@
       
         from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel
+        self.model_dictionary[CoreShellEllipsoidModel.__name__] = CoreShellEllipsoidModel
         self.shape_list.append(CoreShellEllipsoidModel)
         self.multiplication_factor.append(CoreShellEllipsoidModel)
@@ -418,4 +452,5 @@
          
         from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
+        self.model_dictionary[TriaxialEllipsoidModel.__name__] = TriaxialEllipsoidModel
         self.shape_list.append(TriaxialEllipsoidModel)
         self.multiplication_factor.append(TriaxialEllipsoidModel)
@@ -423,32 +458,40 @@
         
         from sans.models.LamellarModel import LamellarModel
+        self.model_dictionary[LamellarModel.__name__] = LamellarModel
         self.shape_list.append(LamellarModel)
         self.model_name_list.append(LamellarModel.__name__)
         
         from sans.models.LamellarFFHGModel import LamellarFFHGModel
+        self.model_dictionary[LamellarFFHGModel.__name__] = LamellarFFHGModel
         self.shape_list.append(LamellarFFHGModel)
         self.model_name_list.append(LamellarFFHGModel.__name__)
         
         from sans.models.LamellarPSModel import LamellarPSModel
+        self.model_dictionary[LamellarPSModel.__name__] = LamellarPSModel
         self.shape_list.append(LamellarPSModel)
         self.model_name_list.append(LamellarPSModel.__name__)
      
         from sans.models.LamellarPSHGModel import LamellarPSHGModel
+        self.model_dictionary[LamellarPSHGModel.__name__] = LamellarPSHGModel
         self.shape_list.append(LamellarPSHGModel)
         self.model_name_list.append(LamellarPSHGModel.__name__)
         
         from sans.models.LamellarPCrystalModel import LamellarPCrystalModel
+        self.model_dictionary[LamellarPCrystalModel.__name__] = LamellarPCrystalModel
         self.shape_list.append(LamellarPCrystalModel)
         self.model_name_list.append(LamellarPCrystalModel.__name__)
         
         from sans.models.SCCrystalModel import SCCrystalModel
+        self.model_dictionary[SCCrystalModel.__name__] = SCCrystalModel
         self.shape_list.append(SCCrystalModel)
         self.model_name_list.append(SCCrystalModel.__name__)
         
         from sans.models.FCCrystalModel import FCCrystalModel
+        self.model_dictionary[FCCrystalModel.__name__] = FCCrystalModel
         self.shape_list.append(FCCrystalModel)
         self.model_name_list.append(FCCrystalModel.__name__)
         
         from sans.models.BCCrystalModel import BCCrystalModel
+        self.model_dictionary[BCCrystalModel.__name__] = BCCrystalModel
         self.shape_list.append(BCCrystalModel)
         self.model_name_list.append(BCCrystalModel.__name__)
@@ -456,16 +499,20 @@
         ## Structure factor
         from sans.models.SquareWellStructure import SquareWellStructure
+        self.model_dictionary[SquareWellStructure.__name__] = SquareWellStructure
         self.struct_list.append(SquareWellStructure)
         self.model_name_list.append(SquareWellStructure.__name__)
         
         from sans.models.HardsphereStructure import HardsphereStructure
+        self.model_dictionary[HardsphereStructure.__name__] = HardsphereStructure
         self.struct_list.append(HardsphereStructure)
         self.model_name_list.append(HardsphereStructure.__name__)
          
         from sans.models.StickyHSStructure import StickyHSStructure
+        self.model_dictionary[StickyHSStructure.__name__] = StickyHSStructure
         self.struct_list.append(StickyHSStructure)
         self.model_name_list.append(StickyHSStructure.__name__)
         
         from sans.models.HayterMSAStructure import HayterMSAStructure
+        self.model_dictionary[HayterMSAStructure.__name__] = HayterMSAStructure
         self.struct_list.append(HayterMSAStructure)
         self.model_name_list.append(HayterMSAStructure.__name__)
@@ -474,8 +521,10 @@
         ##shape-independent models
         from sans.models.PowerLawAbsModel import PowerLawAbsModel
+        self.model_dictionary[PowerLawAbsModel.__name__] = PowerLawAbsModel
         self.shape_indep_list.append(PowerLawAbsModel)
         self.model_name_list.append(PowerLawAbsModel.__name__)
         
         from sans.models.BEPolyelectrolyte import BEPolyelectrolyte
+        self.model_dictionary[BEPolyelectrolyte.__name__] = BEPolyelectrolyte
         self.shape_indep_list.append(BEPolyelectrolyte)
         self.model_name_list.append(BEPolyelectrolyte.__name__)
@@ -483,115 +532,148 @@
         
         from sans.models.BroadPeakModel import BroadPeakModel
+        self.model_dictionary[BroadPeakModel.__name__] = BroadPeakModel
         self.shape_indep_list.append(BroadPeakModel)
         self.model_name_list.append(BroadPeakModel.__name__)
         
         from sans.models.CorrLengthModel import CorrLengthModel
+        self.model_dictionary[CorrLengthModel.__name__] = CorrLengthModel
         self.shape_indep_list.append(CorrLengthModel)
         self.model_name_list.append(CorrLengthModel.__name__)
         
         from sans.models.DABModel import DABModel
+        self.model_dictionary[DABModel.__name__] = DABModel
         self.shape_indep_list.append(DABModel)
         self.model_name_list.append(DABModel.__name__)
         
         from sans.models.DebyeModel import DebyeModel
+        self.model_dictionary[DebyeModel.__name__] = DebyeModel
         self.shape_indep_list.append(DebyeModel)
         self.model_name_list.append(DebyeModel.__name__)
         
         from sans.models.FractalModel import FractalModel
+        self.model_dictionary[FractalModel.__name__] = FractalModel
         self.shape_indep_list.append(FractalModel)
         self.model_name_list.append(FractalModel.__name__)
         
         from sans.models.FractalCoreShellModel import FractalCoreShellModel
+        self.model_dictionary[FractalCoreShellModel.__name__] = FractalCoreShellModel
         self.shape_indep_list.append(FractalCoreShellModel)
         self.model_name_list.append(FractalCoreShellModel.__name__)
         
         from sans.models.GaussLorentzGelModel import GaussLorentzGelModel
+        self.model_dictionary[GaussLorentzGelModel.__name__] = GaussLorentzGelModel
         self.shape_indep_list.append(GaussLorentzGelModel)
         self.model_name_list.append(GaussLorentzGelModel.__name__)
                 
         from sans.models.GuinierModel import GuinierModel
+        self.model_dictionary[GuinierModel.__name__] = GuinierModel
         self.shape_indep_list.append(GuinierModel)
         self.model_name_list.append(GuinierModel.__name__)
         
         from sans.models.GuinierPorodModel import GuinierPorodModel
+        self.model_dictionary[GuinierPorodModel.__name__] = GuinierPorodModel
         self.shape_indep_list.append(GuinierPorodModel)
         self.model_name_list.append(GuinierPorodModel.__name__)
 
         from sans.models.LorentzModel import LorentzModel
+        self.model_dictionary[LorentzModel.__name__] = LorentzModel
         self.shape_indep_list.append(LorentzModel)
         self.model_name_list.append(LorentzModel.__name__)
 
         from sans.models.MassFractalModel import MassFractalModel
+        self.model_dictionary[MassFractalModel.__name__] = MassFractalModel
         self.shape_indep_list.append(MassFractalModel)
         self.model_name_list.append(MassFractalModel.__name__)
         
         from sans.models.MassSurfaceFractal import MassSurfaceFractal
+        self.model_dictionary[MassSurfaceFractal.__name__] = MassSurfaceFractal
         self.shape_indep_list.append(MassSurfaceFractal)
         self.model_name_list.append(MassSurfaceFractal.__name__)
         
         from sans.models.PeakGaussModel import PeakGaussModel
+        self.model_dictionary[PeakGaussModel.__name__] = PeakGaussModel
         self.shape_indep_list.append(PeakGaussModel)
         self.model_name_list.append(PeakGaussModel.__name__)
         
         from sans.models.PeakLorentzModel import PeakLorentzModel
+        self.model_dictionary[PeakLorentzModel.__name__] = PeakLorentzModel
         self.shape_indep_list.append(PeakLorentzModel)
         self.model_name_list.append(PeakLorentzModel.__name__)
         
         from sans.models.Poly_GaussCoil import Poly_GaussCoil
+        self.model_dictionary[Poly_GaussCoil.__name__] = Poly_GaussCoil
         self.shape_indep_list.append(Poly_GaussCoil)
         self.model_name_list.append(Poly_GaussCoil.__name__)
         
         from sans.models.PolymerExclVolume import PolymerExclVolume
+        self.model_dictionary[PolymerExclVolume.__name__] = PolymerExclVolume
         self.shape_indep_list.append(PolymerExclVolume)
         self.model_name_list.append(PolymerExclVolume.__name__)
         
         from sans.models.PorodModel import PorodModel
+        self.model_dictionary[PorodModel.__name__] = PorodModel
         self.shape_indep_list.append(PorodModel)
         self.model_name_list.append(PorodModel.__name__)
         
         from sans.models.RPA10Model import RPA10Model
+        self.model_dictionary[RPA10Model.__name__] = RPA10Model
         self.shape_indep_list.append(RPA10Model)
         self.multi_func_list.append(RPA10Model)
 
         from sans.models.StarPolymer import StarPolymer
+        self.model_dictionary[StarPolymer.__name__] = StarPolymer
         self.shape_indep_list.append(StarPolymer)
         self.model_name_list.append(StarPolymer.__name__)
 
         from sans.models.SurfaceFractalModel import SurfaceFractalModel
+        self.model_dictionary[SurfaceFractalModel.__name__] = SurfaceFractalModel
         self.shape_indep_list.append(SurfaceFractalModel)
         self.model_name_list.append(SurfaceFractalModel.__name__)
         
         from sans.models.TeubnerStreyModel import TeubnerStreyModel
+        self.model_dictionary[TeubnerStreyModel.__name__] = TeubnerStreyModel
         self.shape_indep_list.append(TeubnerStreyModel)
         self.model_name_list.append(TeubnerStreyModel.__name__)
 
         from sans.models.TwoLorentzianModel import TwoLorentzianModel
+        self.model_dictionary[TwoLorentzianModel.__name__] = TwoLorentzianModel
         self.shape_indep_list.append(TwoLorentzianModel)
         self.model_name_list.append(TwoLorentzianModel.__name__)
         
         from sans.models.TwoPowerLawModel import TwoPowerLawModel
+        self.model_dictionary[TwoPowerLawModel.__name__] = TwoPowerLawModel
         self.shape_indep_list.append(TwoPowerLawModel)
         self.model_name_list.append(TwoPowerLawModel.__name__)
         
         from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel
+        self.model_dictionary[UnifiedPowerRgModel.__name__] = UnifiedPowerRgModel
         self.shape_indep_list.append(UnifiedPowerRgModel)
         self.multi_func_list.append(UnifiedPowerRgModel)
 
         from sans.models.LineModel import LineModel
+        self.model_dictionary[LineModel.__name__] = LineModel
         self.shape_indep_list.append(LineModel)
         self.model_name_list.append(LineModel.__name__)
         
         from sans.models.ReflectivityModel import ReflectivityModel
+        self.model_dictionary[ReflectivityModel.__name__] = ReflectivityModel
         self.shape_indep_list.append(ReflectivityModel)
         self.multi_func_list.append(ReflectivityModel)
         
         from sans.models.ReflectivityIIModel import ReflectivityIIModel
+        self.model_dictionary[ReflectivityIIModel.__name__] = ReflectivityIIModel
         self.shape_indep_list.append(ReflectivityIIModel)
         self.multi_func_list.append(ReflectivityIIModel)
         
         from sans.models.GelFitModel import GelFitModel
+        self.model_dictionary[GelFitModel.__name__] = GelFitModel
         self.shape_indep_list.append(GelFitModel)
         self.model_name_list.append(GelFitModel.__name__)
 
+        #from sans.models.FractalO_Z import FractalO_Z
+        #self.model_dictionary[FractalO_Z.__name__] = FractalO_Z
+        #self.shape_indep_list.append(FractalO_Z)
+        #self.model_name_list.append(FractalO_Z.__name__)
+    
         #Looking for plugins
         self.stored_plugins = self.findModels()
@@ -792,4 +874,5 @@
         if int(evt.GetId()) in self.form_factor_dict.keys():
             from sans.models.MultiplicationModel import MultiplicationModel
+            self.model_dictionary[MultiplicationModel.__name__] = MultiplicationModel
             model1, model2 = self.form_factor_dict[int(evt.GetId())]
             model = MultiplicationModel(model1, model2)
@@ -836,4 +919,10 @@
         """
         return self.model_name_list
+
+    def get_model_dictionary(self):
+        """
+        return dictionary linking model names to objects
+        """
+        return self.model_dictionary
   
         
@@ -873,2 +962,5 @@
     def get_model_name_list(self):
         return self.__modelmanager.get_model_name_list()
+
+    def get_model_dictionary(self):
+        return self.__modelmanager.get_model_dictionary()
