Index: eoryview/docs/sphinx/Makefile
===================================================================
--- theoryview/docs/sphinx/Makefile	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,130 +1,0 @@
-# Makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS    =
-SPHINXBUILD   = sphinx-build
-PAPER         =
-BUILDDIR      = _build
-
-# Internal variables.
-PAPEROPT_a4     = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
-
-help:
-	@echo "Please use \`make <target>' where <target> is one of"
-	@echo "  html       to make standalone HTML files"
-	@echo "  dirhtml    to make HTML files named index.html in directories"
-	@echo "  singlehtml to make a single large HTML file"
-	@echo "  pickle     to make pickle files"
-	@echo "  json       to make JSON files"
-	@echo "  htmlhelp   to make HTML files and a HTML help project"
-	@echo "  qthelp     to make HTML files and a qthelp project"
-	@echo "  devhelp    to make HTML files and a Devhelp project"
-	@echo "  epub       to make an epub"
-	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
-	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
-	@echo "  text       to make text files"
-	@echo "  man        to make manual pages"
-	@echo "  changes    to make an overview of all changed/added/deprecated items"
-	@echo "  linkcheck  to check all external links for integrity"
-	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
-
-clean:
-	-rm -rf $(BUILDDIR)/*
-
-html:
-	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
-	@echo
-	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-dirhtml:
-	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
-	@echo
-	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-singlehtml:
-	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
-	@echo
-	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-pickle:
-	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
-	@echo
-	@echo "Build finished; now you can process the pickle files."
-
-json:
-	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
-	@echo
-	@echo "Build finished; now you can process the JSON files."
-
-htmlhelp:
-	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
-	@echo
-	@echo "Build finished; now you can run HTML Help Workshop with the" \
-	      ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-qthelp:
-	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
-	@echo
-	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
-	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
-	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/theoryview.qhcp"
-	@echo "To view the help file:"
-	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/theoryview.qhc"
-
-devhelp:
-	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
-	@echo
-	@echo "Build finished."
-	@echo "To view the help file:"
-	@echo "# mkdir -p $$HOME/.local/share/devhelp/theoryview"
-	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/theoryview"
-	@echo "# devhelp"
-
-epub:
-	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
-	@echo
-	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-latex:
-	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
-	@echo
-	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
-	@echo "Run \`make' in that directory to run these through (pdf)latex" \
-	      "(use \`make latexpdf' here to do that automatically)."
-
-latexpdf: latex
-	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
-	@echo "Running LaTeX files through pdflatex..."
-	make -C $(BUILDDIR)/latex all-pdf
-	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-text:
-	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
-	@echo
-	@echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-man:
-	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
-	@echo
-	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-changes:
-	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
-	@echo
-	@echo "The overview file is in $(BUILDDIR)/changes."
-
-linkcheck:
-	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
-	@echo
-	@echo "Link check complete; look for any errors in the above output " \
-	      "or in $(BUILDDIR)/linkcheck/output.txt."
-
-doctest:
-	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
-	@echo "Testing of doctests in the sources finished, look at the " \
-	      "results in $(BUILDDIR)/doctest/output.txt."
Index: eoryview/docs/sphinx/_extensions/only_directives.py
===================================================================
--- theoryview/docs/sphinx/_extensions/only_directives.py	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#
-# A pair of directives for inserting content that will only appear in
-# either html or latex.
-#
-
-from docutils.nodes import Body, Element
-from docutils.parsers.rst import directives
-
-class only_base(Body, Element):
-    def dont_traverse(self, *args, **kwargs):
-        return []
-
-class html_only(only_base):
-    pass
-
-class latex_only(only_base):
-    pass
-
-def run(content, node_class, state, content_offset):
-    text = '\n'.join(content)
-    node = node_class(text)
-    state.nested_parse(content, content_offset, node)
-    return [node]
-
-def html_only_directive(name, arguments, options, content, lineno,
-                        content_offset, block_text, state, state_machine):
-    return run(content, html_only, state, content_offset)
-
-def latex_only_directive(name, arguments, options, content, lineno,
-                         content_offset, block_text, state, state_machine):
-    return run(content, latex_only, state, content_offset)
-
-def builder_inited(app):
-    if app.builder.name == 'html':
-        latex_only.traverse = only_base.dont_traverse
-    else:
-        html_only.traverse = only_base.dont_traverse
-
-def setup(app):
-    app.add_directive('htmlonly', html_only_directive, True, (0, 0, 0))
-    app.add_directive('latexonly', latex_only_directive, True, (0, 0, 0))
-    app.add_node(html_only)
-    app.add_node(latex_only)
-
-    # This will *really* never see the light of day As it turns out,
-    # this results in "broken" image nodes since they never get
-    # processed, so best not to do this.
-    # app.connect('builder-inited', builder_inited)
-
-    # Add visit/depart methods to HTML-Translator:
-    def visit_perform(self, node):
-        pass
-    def depart_perform(self, node):
-        pass
-    def visit_ignore(self, node):
-        node.children = []
-    def depart_ignore(self, node):
-        node.children = []
-
-    app.add_node(html_only, html=(visit_perform, depart_perform))
-    app.add_node(html_only, latex=(visit_ignore, depart_ignore))
-    app.add_node(latex_only, latex=(visit_perform, depart_perform))
-    app.add_node(latex_only, html=(visit_ignore, depart_ignore))
Index: eoryview/docs/sphinx/api/basepage.rst
===================================================================
--- theoryview/docs/sphinx/api/basepage.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-basepage
-******************************************************************************
-
-:mod:`sans.perspectives.theory.basepage`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.basepage
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/api/help_panel.rst
===================================================================
--- theoryview/docs/sphinx/api/help_panel.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-help_panel
-******************************************************************************
-
-:mod:`sans.perspectives.theory.help_panel`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.help_panel
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/api/index.rst
===================================================================
--- theoryview/docs/sphinx/api/index.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,22 +1,0 @@
-.. Autogenerated by genmods.py
-
-.. _api-index:
-
-##############################################################################
-   Reference
-##############################################################################
-
-.. only:: html
-
-   :Release: |version|
-   :Date: |today|
-
-.. toctree::
-
-   help_panel.rst
-   basepage.rst
-   model_panel.rst
-   model_thread.rst
-   models.rst
-   pagestate.rst
-   theory.rst
Index: eoryview/docs/sphinx/api/model_panel.rst
===================================================================
--- theoryview/docs/sphinx/api/model_panel.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-model_panel
-******************************************************************************
-
-:mod:`sans.perspectives.theory.model_panel`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.model_panel
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/api/model_thread.rst
===================================================================
--- theoryview/docs/sphinx/api/model_thread.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-model_thread
-******************************************************************************
-
-:mod:`sans.perspectives.theory.model_thread`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.model_thread
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/api/models.rst
===================================================================
--- theoryview/docs/sphinx/api/models.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-models
-******************************************************************************
-
-:mod:`sans.perspectives.theory.models`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.models
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/api/pagestate.rst
===================================================================
--- theoryview/docs/sphinx/api/pagestate.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-pagestate
-******************************************************************************
-
-:mod:`sans.perspectives.theory.pagestate`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.pagestate
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/api/theory.rst
===================================================================
--- theoryview/docs/sphinx/api/theory.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-.. Autogenerated by genmods.py
-
-******************************************************************************
-theory
-******************************************************************************
-
-:mod:`sans.perspectives.theory.theory`
-==============================================================================
-
-.. automodule:: sans.perspectives.theory.theory
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
Index: eoryview/docs/sphinx/conf.py
===================================================================
--- theoryview/docs/sphinx/conf.py	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,219 +1,0 @@
-# -*- coding: utf-8 -*-
-#
-# theoryview documentation build configuration file, created by
-# sphinx-quickstart on Wed Jun 02 10:01:38 2010.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys, os
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.append(os.path.abspath(os.path.dirname('../../theoryview')))
-sys.path.append(os.path.abspath('_extensions'))
-
-# -- General configuration -----------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
-              'sphinx.ext.coverage', 'sphinx.ext.pngmath',
-              'only_directives',             
-             ]
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8-sig'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'theoryview'
-copyright = u'2010, sans group'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '0.1'
-# The full version, including alpha/beta/rc tags.
-release = '0.1.0'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-exclude_patterns = ['_build']
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------------
-
-# The theme to use for HTML and HTML Help pages.  Major themes that come with
-# Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'default'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further.  For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
-
-# The name for this set of Sphinx documents.  If None, it defaults to
-# "<project> v<release> documentation".
-#html_title = None
-
-# A shorter title for the navigation bar.  Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-#html_logo = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-#html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_domain_indices = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it.  The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'theoryviewdoc'
-
-
-# -- Options for LaTeX output --------------------------------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
-  ('index', 'theoryview.tex', u'theoryview Documentation',
-   u'sans group', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# If true, show page references after internal links.
-#latex_show_pagerefs = False
-
-# If true, show URL addresses after external links.
-#latex_show_urls = False
-
-# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-#latex_domain_indices = True
-
-
-# -- Options for manual page output --------------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
-    ('index', 'theoryview', u'theoryview Documentation',
-     [u'sans group'], 1)
-]
Index: eoryview/docs/sphinx/genmods.py
===================================================================
--- theoryview/docs/sphinx/genmods.py	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-from __future__ import with_statement
-import os.path
-
-MODULE_TEMPLATE=""".. Autogenerated by genmods.py
-
-******************************************************************************
-%(name)s
-******************************************************************************
-
-:mod:`%(package)s.%(module)s`
-==============================================================================
-
-.. automodule:: %(package)s.%(module)s
-   :members:
-   :undoc-members:
-   :inherited-members:
-   :show-inheritance:
-
-"""
-
-INDEX_TEMPLATE=""".. Autogenerated by genmods.py
-
-.. _api-index:
-
-##############################################################################
-   %(package_name)s
-##############################################################################
-
-.. only:: html
-
-   :Release: |version|
-   :Date: |today|
-
-.. toctree::
-
-   %(rsts)s
-"""
-
-
-def genfiles(package, package_name, modules, dir='api'):
-
-    if not os.path.exists(dir):
-        os.makedirs(dir)
-
-    for module,name in modules:
-        with open(os.path.join(dir,module+'.rst'), 'w') as f:
-            f.write(MODULE_TEMPLATE%locals())
-
-    rsts = "\n   ".join(module+'.rst' for module,name in modules)
-    with open(os.path.join(dir,'index.rst'),'w') as f:
-        f.write(INDEX_TEMPLATE%locals())
-
-
-modules=[
-    ('help_panel', 'help_panel'),
-    ('basepage', 'basepage'),
-    ('model_panel', 'model_panel'),
-    ('model_thread', 'model_thread'),
-    ('models', 'models'),
-    ('pagestate', 'pagestate'),
-    ('theory', 'theory'),
-]
-package="sans.perspectives.theory"
-package_name='Reference'
-
-if __name__ == "__main__":
-    genfiles(package, package_name, modules, dir='api')
-   
-    print "Sphinx: generate .rst files complete..."
Index: eoryview/docs/sphinx/index.rst
===================================================================
--- theoryview/docs/sphinx/index.rst	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,22 +1,0 @@
-.. theoryview documentation master file, created by
-   sphinx-quickstart on Wed Jun 02 10:01:38 2010.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
-
-Welcome to theoryview's documentation!
-======================================
-
-Contents:
-
-.. toctree::
-   :maxdepth: 2
-
-   api/index.rst
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
-
Index: eoryview/docs/sphinx/make.bat
===================================================================
--- theoryview/docs/sphinx/make.bat	(revision 74755ffa1ce766f8db2e7443abc981f716782e5c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-@ECHO OFF
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
-	set SPHINXBUILD=sphinx-build
-)
-set BUILDDIR=_build
-set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
-if NOT "%PAPER%" == "" (
-	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
-)
-
-if "%1" == "" goto help
-
-if "%1" == "help" (
-	:help
-	echo.Please use `make ^<target^>` where ^<target^> is one of
-	echo.  html       to make standalone HTML files
-	echo.  dirhtml    to make HTML files named index.html in directories
-	echo.  singlehtml to make a single large HTML file
-	echo.  pickle     to make pickle files
-	echo.  json       to make JSON files
-	echo.  htmlhelp   to make HTML files and a HTML help project
-	echo.  qthelp     to make HTML files and a qthelp project
-	echo.  devhelp    to make HTML files and a Devhelp project
-	echo.  epub       to make an epub
-	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
-	echo.  text       to make text files
-	echo.  man        to make manual pages
-	echo.  changes    to make an overview over all changed/added/deprecated items
-	echo.  linkcheck  to check all external links for integrity
-	echo.  doctest    to run all doctests embedded in the documentation if enabled
-	goto end
-)
-
-if "%1" == "clean" (
-	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
-	del /q /s %BUILDDIR%\*
-	goto end
-)
-
-if "%1" == "html" (
-	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
-	echo.
-	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
-	goto end
-)
-
-if "%1" == "dirhtml" (
-	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
-	echo.
-	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
-	goto end
-)
-
-if "%1" == "singlehtml" (
-	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
-	echo.
-	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
-	goto end
-)
-
-if "%1" == "pickle" (
-	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
-	echo.
-	echo.Build finished; now you can process the pickle files.
-	goto end
-)
-
-if "%1" == "json" (
-	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
-	echo.
-	echo.Build finished; now you can process the JSON files.
-	goto end
-)
-
-if "%1" == "htmlhelp" (
-	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
-	echo.
-	echo.Build finished; now you can run HTML Help Workshop with the ^
-.hhp project file in %BUILDDIR%/htmlhelp.
-	goto end
-)
-
-if "%1" == "qthelp" (
-	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
-	echo.
-	echo.Build finished; now you can run "qcollectiongenerator" with the ^
-.qhcp project file in %BUILDDIR%/qthelp, like this:
-	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\theoryview.qhcp
-	echo.To view the help file:
-	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\theoryview.ghc
-	goto end
-)
-
-if "%1" == "devhelp" (
-	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
-	echo.
-	echo.Build finished.
-	goto end
-)
-
-if "%1" == "epub" (
-	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
-	echo.
-	echo.Build finished. The epub file is in %BUILDDIR%/epub.
-	goto end
-)
-
-if "%1" == "latex" (
-	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
-	echo.
-	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
-	goto end
-)
-
-if "%1" == "text" (
-	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
-	echo.
-	echo.Build finished. The text files are in %BUILDDIR%/text.
-	goto end
-)
-
-if "%1" == "man" (
-	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
-	echo.
-	echo.Build finished. The manual pages are in %BUILDDIR%/man.
-	goto end
-)
-
-if "%1" == "changes" (
-	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
-	echo.
-	echo.The overview file is in %BUILDDIR%/changes.
-	goto end
-)
-
-if "%1" == "linkcheck" (
-	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
-	echo.
-	echo.Link check complete; look for any errors in the above output ^
-or in %BUILDDIR%/linkcheck/output.txt.
-	goto end
-)
-
-if "%1" == "doctest" (
-	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
-	echo.
-	echo.Testing of doctests in the sources finished, look at the ^
-results in %BUILDDIR%/doctest/output.txt.
-	goto end
-)
-
-:end
Index: eoryview/perspectives/theory/__init__.py
===================================================================
--- theoryview/perspectives/theory/__init__.py	(revision 0277d084dedd5afcedd8dd067ab01cf0fee53b12)
+++ 	(revision )
@@ -1,2 +1,0 @@
-PLUGIN_ID = "theory plug-in 1.0"
-from theory import *
Index: eoryview/perspectives/theory/basepage.py
===================================================================
--- theoryview/perspectives/theory/basepage.py	(revision 01b6bd08f11fd74e3dcb6881617f495881dee060)
+++ 	(revision )
@@ -1,1890 +1,0 @@
-
-import sys
-import os
-import wx
-import numpy
-import time
-import copy 
-import math
-import string
-from wx.lib.scrolledpanel import ScrolledPanel
-from sans.guiframe.utils import format_number
-from sans.guiframe.utils import check_float
-from sans.guiframe.events import StatusEvent
-import pagestate
-from pagestate import PageState
-
-(PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent()
-(PreviousStateEvent, EVT_PREVIOUS_STATE)= wx.lib.newevent.NewEvent()
-(NextStateEvent, EVT_NEXT_STATE) = wx.lib.newevent.NewEvent()
-
-_BOX_WIDTH = 76
-_QMIN_DEFAULT = 0.001
-_QMAX_DEFAULT = 0.13
-_NPTS_DEFAULT = 50
-#Control panel width 
-if sys.platform.count("darwin") == 0:
-    PANEL_WIDTH = 450
-    FONT_VARIANT = 0
-    ON_MAC = False
-else:
-    PANEL_WIDTH = 500
-    FONT_VARIANT = 1
-    ON_MAC = True
-    
-class BasicPage(ScrolledPanel):
-    """
-    This class provide general structure of  fitpanel page
-    
-    """
-     ## Internal name for the AUI manager
-    window_name = "Basic Page"
-    ## Title to appear on top of the window
-    window_caption = "Basic page "
-    
-    def __init__(self,parent, page_info=None, model_list_box=None):
-        ScrolledPanel.__init__(self, parent)
-        self.SetupScrolling()
-        #Set window's font size 
-        self.SetWindowVariant(variant=FONT_VARIANT)
-        ## parent of the page
-        self.parent = parent
-        self.model_list_box = model_list_box
-        self.model = None
-        self.manager = None
-        self.data = None
-        ## owner of the page (fitting plugin)
-        self.event_owner = None
-        if page_info is not None:
-            ## manager is the fitting plugin
-            self.manager = page_info.manager
-            ## owner of the page (fitting plugin)
-            self.event_owner = page_info.event_owner
-             ## current model
-            self.model = page_info.model
-            ## data
-            self.data = page_info.data
-            ## dictionary containing list of models
-            self.model_list_box = page_info.model_list_box
-            ##window_name
-            self.window_name = page_info.window_name
-            ##window_caption
-            self.window_caption = page_info.window_caption
-        ## Data member to store the dispersion object created
-        self._disp_obj_dict = {}
-        ## selected parameters to apply dispersion
-        self.disp_cb_dict = {}
-        ## smearer object
-        self.smearer = None
-        ##list of model parameters. each item must have same length
-        ## each item related to a given parameters
-        ##[cb state, name, value, "+/-", error of fit, min, max , units]
-        self.parameters = []
-        # non-fittable parameter whose value is astring
-        self.str_parameters = []
-        ## list of parameters to fit , must be like self.parameters
-        self.param_toFit = []
-        ## list of looking like parameters but with non fittable parameters info
-        self.fixed_param = []
-        ## list of looking like parameters but with  fittable parameters info
-        self.fittable_param = []
-        ##list of dispersion parameters
-        self.disp_list = []
-        self.disp_name = ""
-        ## list of orientation parameters
-        self.orientation_params = []
-        self.orientation_params_disp = []
-        if self.model != None:
-            self.disp_list = self.model.getDispParamList()
-        self.multi_factor = None
-        ##enable model 2D draw
-        self.enable2D = False
-        ## check that the fit range is correct to plot the model again
-        self.fitrange = True
-        ## Q range
-        self.qmin_x = _QMIN_DEFAULT
-        self.qmax_x = _QMAX_DEFAULT
-        self.num_points = _NPTS_DEFAULT
-        ## Create memento to save the current state
-        self.state = PageState(parent=self.parent,
-                               model=self.model, data=self.data)
-        ## flag to determine if state has change
-        self.state_change = False
-        ## save customized array
-        self.values = []
-        self.weights = []
-        ## retrieve saved state
-        self.number_saved_state = 0
-        ## dictionary of saved state
-        self.saved_states = {} 
-        
-        ## Create context menu for page
-        self.popUpMenu = wx.Menu()
-        #id = wx.NewId()
-        #self._undo = wx.MenuItem(self.popUpMenu,id, "Undo"
-        #,"cancel the previous action")
-        #self.popUpMenu.AppendItem(self._undo)
-        #self._undo.Enable(False)
-        #wx.EVT_MENU(self, id, self.onUndo)
-        
-        #id = wx.NewId()
-        #self._redo = wx.MenuItem(self.popUpMenu,id,"Redo",
-        #" Restore the previous action")
-        #self.popUpMenu.AppendItem(self._redo)
-        #self._redo.Enable(False)
-        #wx.EVT_MENU(self, id, self.onRedo)       
-        #self.popUpMenu.AppendSeparator()
-        #if sys.platform.count("win32")>0:        
-        id = wx.NewId()
-        self._keep = wx.MenuItem(self.popUpMenu, id, "BookMark",
-                                 " Keep the panel status to recall it later")
-        self.popUpMenu.AppendItem(self._keep)
-        self._keep.Enable(True)
-        wx.EVT_MENU(self, id, self.onSave)
-        self.popUpMenu.AppendSeparator()
-        ## Default locations
-        self._default_save_location = os.getcwd()     
-        ## save initial state on context menu
-        #self.onSave(event=None)
-        self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu)
-        
-        ## create the basic structure of the panel with empty sizer
-        self.define_page_structure()
-        ## drawing Initial dispersion parameters sizer 
-        self.set_dispers_sizer()
-        self._fill_save_sizer()
-        ## layout
-        self.set_layout()
-       
-    class ModelTextCtrl(wx.TextCtrl):
-        """
-        Text control for model and fit parameters.
-        Binds the appropriate events for user interactions.
-        Default callback methods can be overwritten on initialization
-        
-        :param kill_focus_callback: callback method for EVT_KILL_FOCUS event
-        :param set_focus_callback:  callback method for EVT_SET_FOCUS event
-        :param mouse_up_callback:   callback method for EVT_LEFT_UP event
-        :param text_enter_callback: callback method for EVT_TEXT_ENTER event
-        
-        """
-        ## Set to True when the mouse is clicked 
-        #while the whole string is selected
-        full_selection = False
-        ## Call back for EVT_SET_FOCUS events
-        _on_set_focus_callback = None
-        
-        def __init__(self, parent, id=-1, value=wx.EmptyString,
-                      pos=wx.DefaultPosition, 
-                     size=wx.DefaultSize, style=0, 
-                     validator=wx.DefaultValidator, name=wx.TextCtrlNameStr,
-                     kill_focus_callback=None, set_focus_callback=None,
-                     mouse_up_callback=None, text_enter_callback=None):
-             
-            wx.TextCtrl.__init__(self, parent, id, value, pos, size, style,
-                                 validator, name)
-            
-            # Bind appropriate events
-            self._on_set_focus_callback = parent.onSetFocus \
-                      if set_focus_callback is None else set_focus_callback
-            self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus)
-            self.Bind(wx.EVT_KILL_FOCUS, parent._onparamEnter \
-                      if kill_focus_callback is None else kill_focus_callback)                
-            self.Bind(wx.EVT_TEXT_ENTER, parent._onparamEnter \
-                      if text_enter_callback is None else text_enter_callback)
-            if not ON_MAC :
-                self.Bind(wx.EVT_LEFT_UP,    self._highlight_text \
-                          if mouse_up_callback is None else mouse_up_callback)
-            
-        def _on_set_focus(self, event):
-            """
-            Catch when the text control is set in focus to highlight the whole
-            text if necessary
-            
-            :param event: mouse event
-            """
-            event.Skip()
-            self.full_selection = True
-            return self._on_set_focus_callback(event)
-
-        def _highlight_text(self, event):
-            """
-            Highlight text of a TextCtrl only of no text has be selected
-            
-            :param event: mouse event
-            
-            """
-            # Make sure the mouse event is available to other listeners
-            event.Skip()
-            control  = event.GetEventObject()
-            if self.full_selection:
-                self.full_selection = False
-                # Check that we have a TextCtrl
-                if issubclass(control.__class__, wx.TextCtrl):
-                    # Check whether text has been selected, 
-                    # if not, select the whole string
-                    (start, end) = control.GetSelection()
-                    if start==end:
-                        control.SetSelection(-1, -1)
-                 
-    def onContextMenu(self, event): 
-        """
-        Retrieve the state selected state
-        
-        """
-        pos = event.GetPosition()
-        pos = self.ScreenToClient(pos)
-        self.PopupMenu(self.popUpMenu, pos) 
-      
-    def onUndo(self, event):
-        """
-        Cancel the previous action
-        
-        """
-        event = PreviousStateEvent(page=self)
-        wx.PostEvent(self.parent, event)
-    
-    def onRedo(self, event):
-        """
-        Restore the previous action canceled 
-        
-        """
-        event = NextStateEvent(page=self)
-        wx.PostEvent(self.parent, event)
-    
-    def define_page_structure(self):
-        """
-        Create empty sizer for a panel
-        
-        """
-        self.vbox  = wx.BoxSizer(wx.VERTICAL)
-        self.sizer0 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer1 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer2 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer3 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer4 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer5 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer6 = wx.BoxSizer(wx.VERTICAL)
-        self.sizer0.SetMinSize((PANEL_WIDTH,-1))
-        self.sizer1.SetMinSize((PANEL_WIDTH,-1))
-        self.sizer2.SetMinSize((PANEL_WIDTH,-1))
-        self.sizer3.SetMinSize((PANEL_WIDTH,-1))
-        self.sizer4.SetMinSize((PANEL_WIDTH,-1))
-        self.sizer5.SetMinSize((PANEL_WIDTH,-1))
-        #self.sizer6.SetMinSize((375,-1))
-        self.vbox.Add(self.sizer0)
-        self.vbox.Add(self.sizer1)
-        self.vbox.Add(self.sizer2)
-        self.vbox.Add(self.sizer3)
-        self.vbox.Add(self.sizer4)
-        self.vbox.Add(self.sizer5)
-        #self.vbox.Add(self.sizer6)
-        
-    def set_layout(self):
-        """
-         layout
-         
-        """
-        self.vbox.Layout()
-        self.vbox.Fit(self) 
-        self.SetSizer(self.vbox)
-       
-        self.Centre()
-  
-    def set_owner(self, owner):
-        """ 
-        set owner of fitpage
-        @param owner: the class responsible of plotting
-        """
-        self.event_owner = owner    
-        self.state.event_owner = owner
-  
-    def set_manager(self, manager):
-        """
-        set panel manager
-        
-        :param manager: instance of plugin fitting
-        """
-        self.manager = manager  
-        self.state.manager = manager
-        
-    def populate_box(self, dict):
-        """
-        Store list of model
-        
-        :param dict: dictionary containing list of models
-        
-        """
-        self.model_list_box = dict
-        self.state.model_list_box = self.model_list_box
-            
-    def set_dispers_sizer(self):
-        """
-        fill sizer containing dispersity info
-        
-        """
-        self.sizer4.Clear(True)
-        name = "Polydispersity and Orientational Distribution"
-        box_description= wx.StaticBox(self, -1, name)
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        #----------------------------------------------------
-        self.disable_disp = wx.RadioButton(self, -1, 'Off', (10, 10), 
-                                           style=wx.RB_GROUP)
-        self.enable_disp = wx.RadioButton(self, -1, 'On', (10, 30))
-       
-        self.Bind(wx.EVT_RADIOBUTTON, self._set_dipers_Param, 
-                  id=self.disable_disp.GetId())
-        self.Bind(wx.EVT_RADIOBUTTON, self._set_dipers_Param, 
-                  id=self.enable_disp.GetId())
-        #MAC needs SetValue
-        self.disable_disp.SetValue(True)
-        sizer_dispersion = wx.BoxSizer(wx.HORIZONTAL)
-        sizer_dispersion.Add((20, 20))
-        name=""#Polydispersity and \nOrientational Distribution "
-        sizer_dispersion.Add(wx.StaticText(self, -1, name))
-        sizer_dispersion.Add(self.enable_disp )
-        sizer_dispersion.Add((20, 20))
-        sizer_dispersion.Add(self.disable_disp)
-        sizer_dispersion.Add((10, 10))
-        
-        ## fill a sizer with the combobox to select dispersion type
-        sizer_select_dispers = wx.BoxSizer(wx.HORIZONTAL)  
-        self.model_disp = wx.StaticText(self, -1, 'Distribution Function ')
-            
-        import sans.models.dispersion_models 
-        self.polydisp= sans.models.dispersion_models.models
-        self.disp_box = wx.ComboBox(self, -1)
-
-        for key, value in self.polydisp.iteritems():
-            name = str(key)
-            self.disp_box.Append(name,value)
-        self.disp_box.SetStringSelection("gaussian") 
-        wx.EVT_COMBOBOX(self.disp_box, -1, self._on_select_Disp) 
-             
-        sizer_select_dispers.Add((10, 10)) 
-        sizer_select_dispers.Add(self.model_disp) 
-        sizer_select_dispers.Add(self.disp_box, 0,
-                wx.TOP|wx.BOTTOM|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, border=5)
-        self.model_disp.Hide()
-        self.disp_box.Hide()
-        boxsizer1.Add(sizer_dispersion, 0,
-                wx.TOP|wx.BOTTOM|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, border=5)
-        #boxsizer1.Add((10, 10))
-        boxsizer1.Add(sizer_select_dispers)
-        self.sizer4_4 = wx.GridBagSizer(5, 5)
-        boxsizer1.Add(self.sizer4_4)
-        #-----------------------------------------------------
-        self.sizer4.Add(boxsizer1, 0, wx.EXPAND|wx.ALL, 10)
-        self.sizer4_4.Layout()
-        self.sizer4.Layout()
-        self.Layout()
-        self.SetupScrolling()
-        self.Refresh()
-        ## saving the state of enable dispersity button
-        self.state.enable_disp= self.enable_disp.GetValue()
-        self.state.disable_disp= self.disable_disp.GetValue()
-    
-    def select_disp_angle(self, event): 
-        """
-        Event for when a user select a parameter to average over.
-        
-        :param event: radiobutton event
-        """
-        self.values = []
-        self.weights = []
-        if event.GetEventObject() == self.noDisper_rbox:
-            if self.noDisper_rbox.GetValue():
-                #No array dispersity apply yet
-                self._reset_dispersity()
-                ## Redraw the model ???
-                self._draw_model()
-        # Go through the list of dispersion check boxes to 
-        #identify which one has changed 
-        for p in self.disp_cb_dict:
-            self.state.disp_cb_dict[p] = self.disp_cb_dict[p].GetValue()
-            # Catch which one of the box was just checked or unchecked.
-            if event.GetEventObject() == self.disp_cb_dict[p]:              
-                if self.disp_cb_dict[p].GetValue() == True:
-                    ##Temp. FIX for V1.0 regarding changing 
-                    #checkbox to radiobutton.
-                    ##This (self._reset_dispersity) should be removed 
-                    #when the array dispersion is fixed.                
-                    self._reset_dispersity()
-                    # The user wants this parameter to be averaged. 
-                    # Pop up the file selection dialog.
-                    path = self._selectDlg()
-                    # If nothing was selected, just return
-                    if path is None:
-                        self.disp_cb_dict[p].SetValue(False)
-                        self.noDisper_rbox.SetValue(True)
-                        return
-                    try:
-                        self._default_save_location = os.path.dirname(path)
-                    except:
-                        pass 
-                    try:
-                        self.values, self.weights = self.read_file(path)
-                    except:
-                        msg = "Could not read input file"
-                        wx.PostEvent(self.parent, StatusEvent(status=msg))
-                        return
-                    # If any of the two arrays is empty, notify the user 
-                    # that we won't proceed 
-                    if self.values is None or self.weights is None or \
-                         self.values == [] or self.weights == []:
-                        msg = "The loaded %s distrubtion is corrupted"
-                        msg += " or empty" % p
-                        wx.PostEvent(self.parent, StatusEvent(status=msg))
-                        return
-                    # Tell the user that we are about to apply the distribution
-                    msg = "Applying loaded %s distribution: %s" % (p, path)
-                    wx.PostEvent(self.parent, StatusEvent(status=msg))  
-                    
-                    # Create the dispersion objects
-                    from sans.models.dispersion_models import ArrayDispersion
-                    disp_model = ArrayDispersion()
-                    disp_model.set_weights(self.values, self.weights)
-                   
-                    # Store the object to make it persist outside the scope 
-                    #of this method
-                    #TODO: refactor model to clean this up?
-                    self._disp_obj_dict[p] = disp_model
-                    self.state._disp_obj_dict [p] = disp_model
-                    self.state.values = []
-                    self.state.weights = []
-                    self.state.values = copy.deepcopy(self.values)
-                    self.state.weights = copy.deepcopy(self.weights)
-                    # Set the new model as the dispersion object for the 
-                    #selected parameter
-                    self.model.set_dispersion(p, disp_model)
-                    # Store a reference to the weights in the model object 
-                    #so that
-                    # it's not lost when we use the model within another thread.
-                    #TODO: total hack - fix this
-                    self.state.model= self.model.clone()
-
-                    self.model._persistency_dict = {}
-                    self.model._persistency_dict[p] = [self.values,
-                                                       self.weights]
-                    self.state.model._persistency_dict[p] = [self.values, 
-                                                             self.weights]
-                else:
-                    self._reset_dispersity()
-              
-                ## Redraw the model
-                self._draw_model()
-        
-        ## post state to fit panel
-        event = PageInfoEvent(page=self)
-        wx.PostEvent(self.parent, event)
-       
-    def onResetModel(self, event):
-        """
-        Reset model state
-        
-        """
-        ## post help message for the selected model 
-        msg = self.popUpMenu.GetHelpString(event.GetId())
-        msg += " reloaded"
-        wx.PostEvent(self.parent, StatusEvent(status=msg))
-        
-        name = self.popUpMenu.GetLabel(event.GetId())
-        self._on_select_model_helper()
-        
-        if name in self.saved_states.keys():
-            previous_state = self.saved_states[name]
-            ## reset state of checkbox,textcrtl  and  regular parameters value
-            self.reset_page(previous_state)      
-  
-    def onSave(self, event):
-        """
-        save history of the data and model
-        
-        """
-        if self.model == None:
-            return 
-        self.save_current_state()
-        """
-        if hasattr(self,"enable_disp"):
-            self.state.enable_disp = copy.deepcopy(self.enable_disp.GetValue())
-        if hasattr(self, "disp_box"):
-            self.state.disp_box = copy.deepcopy(self.disp_box.GetSelection())
-
-        self.state.model.name= self.model.name
-        """
-        new_state = self.state.clone()
-        new_state.model.name = self.state.model.name
-        
-        new_state.enable2D = copy.deepcopy(self.enable2D)
-        ##Add model state on context menu
-        self.number_saved_state += 1
-        #name= self.model.name+"[%g]"%self.number_saved_state 
-        name = self.model.__class__.__name__ + "[%g]" % self.number_saved_state 
-        self.saved_states[name] = new_state
-        ## Add item in the context menu
-        year, month, day, hour, minute, second, _, _, _ = time.localtime()
-        my_time = str(hour) + " : " + str(minute) + " : " + str(second) + " "
-        date = str( month) + "|" + str(day) + "|" + str(year)
-        msg = "Model saved at %s on %s" % (my_time, date)
-         ## post help message for the selected model 
-        msg += " Saved! right click on this page to retrieve this model"
-        wx.PostEvent(self.parent, StatusEvent(status=msg))
-        
-        id = wx.NewId()
-        self.popUpMenu.Append(id, name, str(msg))
-        wx.EVT_MENU(self, id, self.onResetModel)
-        
-    def onSetFocus(self, evt):
-        """
-        highlight the current textcrtl and hide the error text control shown 
-        after fitting
-        :Not implemented.
-        """
-        return
-    
-    def read_file(self, path):
-        """
-        Read two columns file
-        
-        :param path: the path to the file to read
-        """
-        try:
-            if path == None:
-                msg = " Selected Distribution was not loaded: %s" % path
-                wx.PostEvent(self.parent, StatusEvent(status=msg))
-                return None, None
-            input_f = open(path, 'r')
-            buff = input_f.read()
-            lines = buff.split('\n')
-            angles = []
-            weights = []
-            for line in lines:
-                toks = line.split()
-                try:
-                    angle = float(toks[0])
-                    weight = float(toks[1])
-                except:
-                    # Skip non-data lines
-                    pass
-                angles.append(angle)
-                weights.append(weight)
-            return numpy.array(angles), numpy.array(weights)
-        except:
-            raise 
-    
-    def createMemento(self):
-        """
-        return the current state of the page
-        """
-        return self.state.clone()
-    
-    def save_current_state(self):
-        """
-        Store current state
-        
-        """
-        ## save model option
-        if self.model != None:
-            self.disp_list = self.model.getDispParamList()
-            self.state.disp_list = copy.deepcopy(self.disp_list)
-            self.state.model = self.model.clone()
-        self.state.enable2D = copy.deepcopy(self.enable2D)
-        self.state.values = copy.deepcopy(self.values)
-        self.state.weights = copy.deepcopy( self.weights)
-        ## save data    
-        self.state.data = copy.deepcopy(self.data)
-        try:
-            n = self.disp_box.GetCurrentSelection()
-            dispersity= self.disp_box.GetClientData(n)
-            name = dispersity.__name__
-            self.disp_name = name
-            if name == "GaussianDispersion":
-               if hasattr(self,"cb1"):
-                   self.state.cb1 = self.cb1.GetValue()
-        except:
-            pass
-        if hasattr(self, "enable_disp"):
-            self.state.enable_disp = self.enable_disp.GetValue()
-            self.state.disable_disp = self.disable_disp.GetValue()
-        self.state.smearer = copy.deepcopy(self.smearer)
-        if hasattr(self, "enable_smearer"):
-            self.state.enable_smearer = copy.deepcopy(self.enable_smearer.GetValue())
-            self.state.disable_smearer = copy.deepcopy(self.disable_smearer.GetValue())
-        if hasattr(self, "disp_box"):
-            self.state.disp_box = self.disp_box.GetCurrentSelection()
-            if len(self.disp_cb_dict) > 0:
-                for k, v in self.disp_cb_dict.iteritems():
-                    if v == None :
-                        self.state.disp_cb_dict[k] = v
-                    else:
-                        try:
-                            self.state.disp_cb_dict[k] = v.GetValue()
-                        except:
-                            self.state.disp_cb_dict[k] = None
-            if len(self._disp_obj_dict) > 0:
-                for k, v in self._disp_obj_dict.iteritems():
-                    self.state._disp_obj_dict[k] = v
-            self.state.values = copy.deepcopy(self.values)
-            self.state.weights = copy.deepcopy(self.weights)
-        ## save plotting range
-        self._save_plotting_range()
-        self.state.orientation_params = []
-        self.state.orientation_params_disp = []
-        self.state.parameters = []
-        self.state.fittable_param = []
-        self.state.fixed_param = []
-        ## save checkbutton state and txtcrtl values
-        self._copy_parameters_state(self.orientation_params,
-                                     self.state.orientation_params)
-        self._copy_parameters_state(self.orientation_params_disp,
-                                     self.state.orientation_params_disp)
-        self._copy_parameters_state(self.parameters, self.state.parameters)
-        self._copy_parameters_state(self.fittable_param, 
-                                    self.state.fittable_param)
-        self._copy_parameters_state(self.fixed_param, self.state.fixed_param)
-  
-    def reset_page_helper(self, state):
-        """
-        Use page_state and change the state of existing page
-        
-        :precondition: the page is already drawn or created
-        
-        :postcondition: the state of the underlying data change as well as the
-            state of the graphic interface
-        """
-        if state == None:
-            #self._undo.Enable(False)
-            return 
-        self.model = state.model
-        self.data = state.data
-        if self.data != None:
-            from DataLoader.qsmearing import smear_selection
-            self.smearer= smear_selection(self.data)
-        self.enable2D = state.enable2D
-        self.engine_type = state.engine_type
-        self.disp_cb_dict = state.disp_cb_dict
-        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)
-        ##draw sizer containing model parameters value for the current model
-        self._set_model_sizer_selection(self.model)
-        self.set_model_param_sizer(self.model)
-        ## reset value of combox box
-        self.structurebox.SetSelection(state.structurecombobox)
-        self.formfactorbox.SetSelection(state.formfactorcombobox)
-        if state.multi_factor != None:
-            self.multifactorbox.SetSelection(state.multi_factor)
-        #draw the pnael according to the new model parameter 
-        self._on_select_model(event=None)
-        ## enable the view 2d button if this is a modelpage type
-        if hasattr(self, "model_view"):
-            if self.enable2D:
-                self.model_view.Disable()
-            else:
-                self.model_view.Enable()
-        ## set the select all check box to the a given state
-        if hasattr(self, "cb1"):   
-            self.cb1.SetValue(state.cb1)
-        ## reset state of checkbox,textcrtl  and  regular parameters value
-        self._reset_parameters_state(self.orientation_params_disp,
-                                     state.orientation_params_disp)
-        self._reset_parameters_state(self.orientation_params,
-                                     state.orientation_params)
-        self._reset_parameters_state(self.str_parameters,
-                                     state.str_parameters)
-        self._reset_parameters_state(self.parameters, state.parameters)    
-         ## display dispersion info layer        
-        self.enable_disp.SetValue(state.enable_disp)
-        self.disable_disp.SetValue(state.disable_disp)
-        if hasattr(self, "disp_box"):
-            self.disp_box.SetSelection(state.disp_box) 
-            n = self.disp_box.GetCurrentSelection()
-            dispersity = self.disp_box.GetClientData(n)
-            name = dispersity.__name__     
-            self._set_dipers_Param(event=None)
-            if name == "ArrayDispersion":
-                for item in self.disp_cb_dict.keys():
-                    if hasattr(self.disp_cb_dict[item], "SetValue") :
-                        self.disp_cb_dict[item].SetValue(state.disp_cb_dict[item])
-                        # Create the dispersion objects
-                        from sans.models.dispersion_models import ArrayDispersion
-                        disp_model = ArrayDispersion()
-                        if hasattr(state, "values") and \
-                            self.disp_cb_dict[item].GetValue() == True:
-                            if len(state.values) > 0:
-                                self.values = state.values
-                                self.weights = state.weights
-                                disp_model.set_weights(self.values, 
-                                                       state.weights)
-                            else:
-                                self._reset_dispersity()
-                        self._disp_obj_dict[item] = disp_model
-                        # Set the new model as the dispersion object for 
-                        #the selected parameter
-                        self.model.set_dispersion(item, disp_model)
-                        self.model._persistency_dict[item] = [state.values, 
-                                                              state.weights]
-            else:
-                keys = self.model.getParamList()
-                for item in keys:
-                    if item in self.disp_list and \
-                        not self.model.details.has_key(item):
-                        self.model.details[item]=["", None, None]
-                for k, v in self.state.disp_cb_dict.iteritems():
-                    self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 
-                    self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict)
-        ##plotting range restore    
-        self._reset_plotting_range(state)
-        ## smearing info  restore
-        if hasattr(self, "enable_smearer"):
-            ## set smearing value whether or not the data contain 
-            #the smearing info
-            self.enable_smearer.SetValue(state.enable_smearer)
-            self.disable_smearer.SetValue(state.disable_smearer)
-            self.onSmear(event=None)           
-        ## reset state of checkbox,textcrtl  and dispersity parameters value
-        self._reset_parameters_state(self.fittable_param, state.fittable_param)
-        self._reset_parameters_state(self.fixed_param, state.fixed_param)
-        ## draw the model with previous parameters value
-        self._onparamEnter_helper()
-        ## reset context menu items
-        self._reset_context_menu()
-        ## set the value of the current state to the state given as parameter
-        self.state = state.clone() 
-        self._draw_model()
-
-    def _selectDlg(self):
-        """
-        open a dialog file to selected the customized dispersity 
-        
-        """
-        #import os
-        dlg = wx.FileDialog(self, "Choose a weight file",
-                            self._default_save_location, "", "*.*", wx.OPEN)
-        path = None
-        if dlg.ShowModal() == wx.ID_OK:
-            path = dlg.GetPath()
-        dlg.Destroy()
-        return path
-    
-    def _reset_context_menu(self):
-        """
-        reset the context menu
-        
-        """
-        for name, state in self.state.saved_states.iteritems():
-            self.number_saved_state += 1
-            ## Add item in the context menu
-            id = wx.NewId()
-            hint_msg = 'Save model and state %g' % self.number_saved_state
-            self.popUpMenu.Append(id, name, hint_msg)
-            wx.EVT_MENU(self, id, self.onResetModel)
-
-    def _reset_plotting_range(self, state):
-        """
-        Reset the plotting range to a given state
-        
-        """
-        self.qmin.SetValue(str(state.qmin))
-        self.qmax.SetValue(str(state.qmax)) 
-        if self.state.npts != None:
-            self.npts.SetValue(str(state.npts)) 
-            
-    def _save_typeOfmodel(self):
-        """
-        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.structurebox = self.structurebox.GetCurrentSelection()
-        self.state.formfactorbox = self.formfactorbox.GetCurrentSelection()
-        #self._undo.Enable(True)
-        ## post state to fit panel
-        event = PageInfoEvent(page=self)
-        wx.PostEvent(self.parent, event)
-        
-    def _save_plotting_range(self):
-        """
-        save the state of plotting range 
-        
-        """
-        self.state.qmin = self.qmin_x
-        self.state.qmax = self.qmax_x 
-        if self.npts != None:
-            self.state.npts = self.num_points
-            
-    def _onparamEnter_helper(self):
-        """
-        check if values entered by the user are changed and valid to replot 
-        model
-        use : _check_value_enter 
-        
-        """
-        # Flag to register when a parameter has changed.      
-        is_modified = False
-        #self._undo.Enable(True)
-        if self.model != None:
-            try:
-                is_modified = self._check_value_enter(self.fittable_param,
-                                                     is_modified)
-                is_modified = self._check_value_enter(self.fixed_param,
-                                                     is_modified)
-                is_modified = self._check_value_enter(self.parameters,
-                                                      is_modified) 
-            except:
-                pass
-            #if is_modified:
-            # 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
-            if self._validate_qrange(self.qmin, self.qmax):
-                tempmin = float(self.qmin.GetValue())
-                if tempmin != self.qmin_x:
-                    self.qmin_x = tempmin
-                    is_modified = True
-                tempmax = float(self.qmax.GetValue())
-                if tempmax != self.qmax_x:
-                    self.qmax_x = tempmax
-                    is_modified = True
-                self.fitrange = True
-            else:
-                self.fitrange = False
-            if self.npts != None:
-                if check_float(self.npts):
-                    temp_npts = float(self.npts.GetValue())
-                    if temp_npts !=  self.num_points:
-                        self.num_points = temp_npts
-                        is_modified = True
-                else:
-                    msg = "Cannot Plot :Must enter a number!!!  "
-                    wx.PostEvent(self.parent, StatusEvent(status=msg))
-            ## if any value is modify draw model with new value
-            if is_modified:
-                self.state_change = True
-                self._draw_model() 
-                self.Refresh()
-        return is_modified
-                      
-    def _is_modified(self, is_modified):
-        """
-        return to self._is_modified
-        
-        """
-        return is_modified
-                       
-    def _reset_parameters_state(self, listtorestore, statelist):
-        """
-        Reset the parameters at the given state
-        
-        """
-        if len(statelist) == 0 or  len(listtorestore) == 0:
-            return
-        if len(statelist) != len(listtorestore):
-            return
-
-        for j in range(len(listtorestore)):
-            item_page = listtorestore[j]
-            item_page_info = statelist[j]
-            ##change the state of the check box for simple parameters
-            if item_page[0] != None:               
-                item_page[0].SetValue(item_page_info[0])
-            if item_page[2] != None:
-                item_page[2].SetValue(item_page_info[2])
-            if item_page[3] != None:
-                ## show or hide text +/-
-                if item_page_info[2]:
-                    item_page[3].Show(True)
-                else:
-                    item_page[3].Hide()
-            if item_page[4] != None:
-                ## show of hide the text crtl for fitting error
-                if item_page_info[4][0]:
-                    item_page[4].Show(True)
-                    item_page[4].SetValue(item_page_info[4][1])
-                else:
-                    item_page[3].Hide()
-            if item_page[5] != None:
-                ## show of hide the text crtl for fitting error
-                if item_page_info[5][0]:
-                    item_page[5].Show(True)
-                    item_page[5].SetValue(item_page_info[5][1])
-                else:
-                    item_page[5].Hide()
-            if item_page[6] != None:
-                ## show of hide the text crtl for fitting error
-                if item_page_info[6][0]:
-                    item_page[6].Show(True)
-                    item_page[6].SetValue(item_page_info[6][1])
-                else:
-                    item_page[6].Hide()
-                                  
-    def _copy_parameters_state(self, listtocopy, statelist):
-        """
-        copy the state of button 
-        
-        :param listtocopy: the list of widgets 's state to copy
-        :param statelist: container for the state of widgets that must be copied
-        
-        """
-        if len(listtocopy) == 0:
-            return
-        for item in listtocopy:
-            checkbox_state = None
-            if item[0] != None:
-                checkbox_state = item[0].GetValue()
-            parameter_name = item[1]
-            parameter_value = None
-            if item[2] != None:
-                parameter_value = item[2].GetValue()
-            static_text = None
-            if item[3] != None:
-                static_text = item[3].IsShown()
-            error_value = None
-            error_state = None
-            if item[4] != None:
-                error_value = item[4].GetValue()
-                error_state = item[4].IsShown()
-            min_value = None
-            min_state = None
-            if item[5] != None:
-                min_value = item[5].GetValue()
-                min_state = item[5].IsShown()
-            max_value = None
-            max_state = None
-            if item[6] != None:
-                max_value = item[6].GetValue()
-                max_state = item[6].IsShown()
-            unit = None
-            if item[7] != None:
-                unit = item[7].GetLabel()
-            statelist.append([checkbox_state, parameter_name, parameter_value,
-                              static_text , [error_state, error_value],
-                        [min_state, min_value], [max_state, max_value], unit])
-           
-    def _set_model_sizer_selection(self, model):
-        """
-        Display the sizer according to the type of the current model
-        
-        """
-        if model == None:
-            return
-        if hasattr(model, "s_model"):
-            class_name = model.s_model.__class__
-            name = model.s_model.name
-            flag = (name != "NoStructure")
-            if flag and (class_name in self.model_list_box["Structure Factors"]):
-                self.structurebox.Show()
-                self.text2.Show()                
-                self.structurebox.Enable()
-                self.text2.Enable()
-                items = self.structurebox.GetItems()
-                self.sizer1.Layout()
-                self.SetupScrolling()
-                for i in range(len(items)):
-                    if items[i] == str(name):
-                        self.structurebox.SetSelection(i)
-                        break
-        if hasattr(model, "p_model"):
-            class_name = model.p_model.__class__
-            name = model.p_model.name
-            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)
-                    ## 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
-                    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)
-                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()
-    
-            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"]:
-                    if class_name in self.model_list_box["P(Q)*S(Q)"]:
-                        self.structurebox.Show()
-                        self.text2.Show()
-                        self.structurebox.Enable()
-                        self.structurebox.SetSelection(0)
-                        self.text2.Enable()
-                    else:
-                        self.structurebox.Hide()
-                        self.text2.Hide()
-                        self.structurebox.Disable()
-                        self.structurebox.SetSelection(0)
-                        self.text2.Disable()
-                        
-                    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
-                    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)
-                if class_name in list:
-                    self.structurebox.SetSelection(0)
-                    self.structurebox.Disable()
-                    self.text2.Disable()                    
-                    ## 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
-    
-    def _draw_model(self):
-        """
-        Method to draw or refresh a plotted model.
-        The method will use the data member from the model page
-        to build a call to the fitting perspective manager.
-        
-        :Note to coder: This way future changes will be done in only one place.
-         
-        """
-        if self.model != None:
-            temp_smear = None
-            if hasattr(self, "enable_smearer"):
-                if self.enable_smearer.GetValue():
-                    temp_smear= self.smearer
-            
-            self.manager.draw_model(self.model, data=self.data,
-                                    smearer= temp_smear,
-                                    qmin=float(self.qmin_x), 
-                                    qmax=float(self.qmax_x),
-                                    qstep= float(self.num_points),
-                                    enable2D=self.enable2D) 
-        
-    def _set_model_sizer(self,sizer, box_sizer, title="", object=None):
-        """
-        Use lists to fill a sizer for model info
-        
-        """
-       
-        sizer.Clear(True)
-        ##For MAC, this should defined here.
-        if box_sizer == None:
-            box_description = wx.StaticBox(self, -1, str(title))
-            boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        else:
-            boxsizer1 = box_sizer
-        sizer_buttons = wx.BoxSizer(wx.HORIZONTAL)        
-        #--------------------------------------------------------
-        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)
-        sizer_radiobutton = wx.GridSizer(2, 2, 5, 5)
-        sizer_radiobutton.Add(self.shape_rbutton)
-        sizer_radiobutton.Add(self.shape_indep_rbutton)
-        sizer_radiobutton.Add(self.plugin_rbutton)
-        sizer_radiobutton.Add(self.struct_rbutton)
-        sizer_buttons.Add(sizer_radiobutton)
-        # detail button
-        if object != None:
-            sizer_buttons.Add((50, 0))
-            sizer_buttons.Add(object)
-        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.mutifactor_text = wx.StaticText(self, -1, "No. of Shells: ")
-        self.mutifactor_text1 = wx.StaticText(self, -1, "")
-        self.show_sld_button = wx.Button(self, -1, "Show SLD Profile")
-        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)
-        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)
-        ## fill combox box
-        if len(self.model_list_box) > 0:
-            self._populate_box(self.formfactorbox, 
-                               self.model_list_box["Shapes"])
-        if len(self.model_list_box) > 0:
-            self._populate_box(self.structurebox,
-                                self.model_list_box["Structure Factors"])
-            self.structurebox.Insert("None", 0, None)
-            self.structurebox.SetSelection(0)
-            self.structurebox.Hide()
-            self.text2.Hide()
-            self.structurebox.Disable()
-            self.text2.Disable()
-            if self.model.__class__ in self.model_list_box["P(Q)*S(Q)"]:
-                self.structurebox.Show()
-                self.text2.Show()
-                self.structurebox.Enable()
-                self.text2.Enable()            
-        ## check model type to show sizer
-        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)
-        #sizer_selection.Add((5, 5))
-        mutifactor_selection.Add((10, 5))
-        mutifactor_selection.Add(self.mutifactor_text)
-        mutifactor_selection.Add(self.multifactorbox)
-        mutifactor_selection.Add((5, 5))
-        mutifactor_selection.Add(self.mutifactor_text1)
-        mutifactor_selection.Add((10, 5))
-        mutifactor_selection.Add(self.show_sld_button)
-        boxsizer1.Add(sizer_buttons)
-        boxsizer1.Add((15, 15))
-        boxsizer1.Add(sizer_selection)
-        boxsizer1.Add((10,10))
-        boxsizer1.Add(mutifactor_selection)
-        self._set_multfactor_combobox()
-        self.multifactorbox.SetSelection(1)
-        self.show_sld_button.Hide()
-        #--------------------------------------------------------
-        sizer.Add(boxsizer1, 0, wx.EXPAND|wx.ALL, 10)
-        sizer.Layout()
-        self.SetupScrolling()
-        
-    def _on_show_sld(self, event=None):
-    	"""
-    	Plot SLD profile
-    	"""
-        # get profile data
-        x, y = self.model.getProfile()
-        from danse.common.plottools import Data1D
-        #from profile_dialog import SLDPanel
-        from sans.guiframe.local_perspectives.plotting.profile_dialog \
-        import SLDPanel
-        sld_data = Data1D(x, y)
-        sld_data.name = 'SLD'
-        sld_data.axes = self.sld_axes
-        self.panel = SLDPanel(self, data=sld_data, axes=self.sld_axes, id=-1)
-        self.panel.ShowModal()
-
-    def _set_multfactor_combobox(self, multiplicity=10):   
-        """
-        Set comboBox for muitfactor of CoreMultiShellModel
-        :param multiplicit: no. of multi-functionality
-        """
-        # build content of the combobox
-        for idx in range(0, multiplicity):
-            self.multifactorbox.Append(str(idx), int(idx))
-            #self.multifactorbox.SetSelection(1) 
-        self._hide_multfactor_combobox()
-        
-    def _show_multfactor_combobox(self):   
-        """
-        Show the comboBox of muitfactor of CoreMultiShellModel
-        """ 
-        if not self.mutifactor_text.IsShown():
-            self.mutifactor_text.Show(True)
-            self.mutifactor_text1.Show(True)
-        if not self.multifactorbox.IsShown():
-            self.multifactorbox.Show(True)  
-             
-    def _hide_multfactor_combobox(self):   
-        """
-        Hide the comboBox of muitfactor of CoreMultiShellModel
-        """ 
-        if self.mutifactor_text.IsShown():
-            self.mutifactor_text.Hide()
-            self.mutifactor_text1.Hide()
-        if self.multifactorbox.IsShown():
-            self.multifactorbox.Hide()   
-     
-    def _show_combox(self, event):
-        """
-        Show combox box associate with type of model selected
-        
-        """
-        ## Don't want to populate combo box again if the event comes from check box
-        if self.shape_rbutton.GetValue() and \
-             event.GetEventObject() == self.shape_rbutton:
-            ##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() and \
-             event.GetEventObject() == self.shape_indep_rbutton:
-            ##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() and \
-             event.GetEventObject() == self.struct_rbutton:
-            ##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() and \
-             event.GetEventObject() == self.plugin_rbutton:
-            ##fill the combobox with form factor list
-            self.structurebox.Disable()
-            self.formfactorbox.Clear()
-            self._populate_box(self.formfactorbox,
-                                self.model_list_box["Customized Models"])
-        self._on_select_model(event=None)
-        self._save_typeOfmodel()
-        self.sizer4_4.Layout()
-        self.sizer4.Layout()
-        self.Layout()
-        self.Refresh()
-        self.SetupScrolling()
-            
-    def _populate_box(self, combobox, list):
-        """
-        fill combox box with dict item
-        
-        :param list: contains item to fill the combox
-            item must model class
-        """
-        for models in list:
-            model = models()
-            name = model.__class__.__name__
-            if models.__name__!="NoStructure":
-                if hasattr(model, "name"):
-                    name = model.name
-                combobox.Append(name, models)
-        return 0
-    
-    def _onparamEnter(self,event):
-        """ 
-        when enter value on panel redraw model according to changed
-        
-        """
-        tcrtl = event.GetEventObject()
-        #Clear msg if previously shown.
-        msg = ""
-        wx.PostEvent(self.parent, StatusEvent(status=msg))
-        ## save current state
-        self.save_current_state()
-        if event != None:
-            #self._undo.Enable(True)
-            event = PageInfoEvent(page=self)
-            wx.PostEvent(self.parent, event)
-        if check_float(tcrtl):
-            self._onparamEnter_helper()
-            #event.Skip()
-        else:
-            msg = "Cannot Plot :Must enter a number!!!  "
-            wx.PostEvent(self.parent, StatusEvent(status=msg))
-            #event.Skip()
-            return 
-   
-    def _onQrangeEnter(self, event):
-        """
-        Check validity of value enter in the Q range field
-        
-        """
-        tcrtl = event.GetEventObject()
-        #Clear msg if previously shown.
-        msg = ""
-        wx.PostEvent(self.parent, StatusEvent(status=msg))
-        # Flag to register when a parameter has changed.
-        is_modified = False
-        if tcrtl.GetValue().lstrip().rstrip() != "":
-            try:
-                value = float(tcrtl.GetValue())
-                tcrtl.SetBackgroundColour(wx.WHITE)
-                # If qmin and qmax have been modified, update qmin and qmax
-                if self._validate_qrange(self.qmin, self.qmax):
-                    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
-                else:
-                    tcrtl.SetBackgroundColour("pink")
-                    msg = "Model Error:wrong value entered : %s" % sys.exc_value
-                    wx.PostEvent(self.parent, StatusEvent(status=msg))
-                    return 
-            except:
-                tcrtl.SetBackgroundColour("pink")
-                msg = "Model Error:wrong value entered : %s" % sys.exc_value
-                wx.PostEvent(self.parent, StatusEvent(status=msg))
-                return 
-            #Check if # of points for theory model are valid(>0).
-            if self.npts != None:
-                if check_float(self.npts):
-                    temp_npts = float(self.npts.GetValue())
-                    if temp_npts !=  self.num_points:
-                        self.num_points = temp_npts
-                        is_modified = True
-                else:
-                    msg = "Cannot Plot :No npts in that Qrange!!!  "
-                    wx.PostEvent(self.parent, StatusEvent(status=msg))
-        else:
-           tcrtl.SetBackgroundColour("pink")
-           msg = "Model Error:wrong value entered!!!"
-           wx.PostEvent(self.parent, StatusEvent(status=msg))
-        #self._undo.Enable(True)
-        self.save_current_state()
-        event = PageInfoEvent(page=self)
-        wx.PostEvent(self.parent, event)
-        self.state_change = False
-        #Draw the model for a different range
-        self._draw_model()
-                   
-    def _on_select_model_helper(self): 
-        """
-        call back for model selection
-        
-        """
-        ## reset dictionary containing reference to dispersion
-        self._disp_obj_dict = {}
-        self.disp_cb_dict = {}
-        f_id = self.formfactorbox.GetCurrentSelection()
-        #For MAC
-        form_factor = None
-        if f_id >= 0:
-            form_factor = self.formfactorbox.GetClientData(f_id)
-        if not form_factor in  self.model_list_box["multiplication"]:
-            self.structurebox.Hide()
-            self.text2.Hide()           
-            self.structurebox.Disable()
-            self.structurebox.SetSelection(0)
-            self.text2.Disable()
-        else:
-            self.structurebox.Show()
-            self.text2.Show()
-            self.structurebox.Enable()
-            self.text2.Enable()
-        if form_factor != None:    
-            # set multifactor for Mutifunctional models    
-            if form_factor().__class__ in self.model_list_box["Multi-Functions"]:
-                m_id = self.multifactorbox.GetCurrentSelection()
-                multiplicity = form_factor().multiplicity_info[0]
-                self.multifactorbox.Clear()
-                #self.mutifactor_text.SetLabel(form_factor().details[])
-                self._set_multfactor_combobox(multiplicity)
-                self._show_multfactor_combobox()
-                text = form_factor().multiplicity_info[1]#'No. of Shells: '
-
-                #self.mutifactor_text.Clear()
-                self.mutifactor_text.SetLabel(text)
-
-                # Check max value
-                if m_id > multiplicity - 1:
-                    # default value
-                    m_id = 1
-                self.multi_factor = self.multifactorbox.GetClientData(m_id)
-                if self.multi_factor == None:
-                    self.multi_factor =1
-                form_factor = form_factor(int(self.multi_factor))
-                self.multifactorbox.SetSelection(m_id)
-                # Check len of the text1 and max_multiplicity
-                text = ''
-                if form_factor.multiplicity_info[0] == len(form_factor.multiplicity_info[2]):
-                    text = form_factor.multiplicity_info[2][self.multi_factor]
-                self.mutifactor_text1.SetLabel(text)
-                # Check if model has  get sld profile.
-                if len(form_factor.multiplicity_info[3]) > 0:
-                    self.sld_axes = form_factor.multiplicity_info[3]
-                    self.show_sld_button.Show(True)
-                else:
-                    self.sld_axes = ""
-            else:
-                self._hide_multfactor_combobox()
-                self.show_sld_button.Hide()
-                form_factor = form_factor()
-                self.multi_factor = None
-        else:
-            self._hide_multfactor_combobox()
-            self.show_sld_button.Hide()
-            self.multi_factor = None  
-        s_id = self.structurebox.GetCurrentSelection()
-        struct_factor = self.structurebox.GetClientData(s_id)
-        if struct_factor != None:
-            from sans.models.MultiplicationModel import MultiplicationModel
-            self.model = MultiplicationModel(form_factor, struct_factor())
-        else:
-            if form_factor != None:
-                self.model = form_factor
-            else:
-                self.model = None
-                return self.model
-        ## post state to fit panel
-        self.state.parameters = []
-        self.state.model = self.model
-        self.state.qmin = self.qmin_x
-        self.state.multi_factor = self.multi_factor
-        self.disp_list = self.model.getDispParamList()
-        self.state.disp_list = self.disp_list
-        self.Layout()     
-        
-    def _validate_qrange(self, qmin_ctrl, qmax_ctrl):
-        """
-        Verify that the Q range controls have valid values
-        and that Qmin < Qmax.
-        
-        :param qmin_ctrl: text control for Qmin
-        :param qmax_ctrl: text control for Qmax
-        
-        :return: True is the Q range is value, False otherwise 
-        
-        """
-        qmin_validity = check_float(qmin_ctrl)
-        qmax_validity = check_float(qmax_ctrl)
-        if not (qmin_validity and qmax_validity):
-            return False
-        else:
-            qmin = float(qmin_ctrl.GetValue())
-            qmax = float(qmax_ctrl.GetValue())
-            if qmin < qmax:
-                #Make sure to set both colours white.  
-                qmin_ctrl.SetBackgroundColour(wx.WHITE)
-                qmin_ctrl.Refresh()
-                qmax_ctrl.SetBackgroundColour(wx.WHITE)
-                qmax_ctrl.Refresh()
-            else:
-                qmin_ctrl.SetBackgroundColour("pink")
-                qmin_ctrl.Refresh()
-                qmax_ctrl.SetBackgroundColour("pink")
-                qmax_ctrl.Refresh()
-                msg= "Invalid Q range: Q min must be smaller than Q max"
-                wx.PostEvent(self.parent, StatusEvent(status=msg))
-                return False
-        return True
-
-    def _check_value_enter(self, list, modified):
-        """
-        :param list: model parameter and panel info
-        each item of the list should be as follow: ::
-        
-         item = [cb state, name, value, "+/-", error of fit, min, max , units]
-         
-        """  
-        is_modified =  modified
-        if len(list) == 0:
-            return is_modified
-        for item in list:
-            #skip angle parameters for 1D
-            if not self.enable2D:
-                if item in self.orientation_params:
-                    continue
-            #try:
-            name = str(item[1])
-            try:     
-                value = float(item[2].GetValue())
-                # If the value of the parameter has changed,
-                # +update the model and set the is_modified flag
-                if value != self.model.getParam(name) and numpy.isfinite(value):
-                    self.model.setParam(name,value)
-                    is_modified = True   
-            except:
-                msg = "Wrong parameter value entered "
-                wx.PostEvent(self.parent, StatusEvent(status=msg))
-        return is_modified 
-    
-    def _set_dipers_Param(self, event):
-        """
-        respond to self.enable_disp and self.disable_disp radio box.
-        The dispersity object is reset inside the model into Gaussian. 
-        When the user select yes , this method display a combo box 
-        for more selection
-        when the user selects No,the combo box disappears.
-        Redraw the model with the default dispersity (Gaussian)
-        
-        """
-        self._reset_dispersity()
-        if self.model == None:
-            self.model_disp.Hide()
-            self.disp_box.Hide()
-            self.sizer4_4.Clear(True)
-            return
-        if self.enable_disp.GetValue():
-            self.model_disp.Show(True)
-            self.disp_box.Show(True)
-            ## layout for model containing no dispersity parameters
-            self.disp_list = self.model.getDispParamList()
-            if len(self.disp_list) == 0 and len(self.disp_cb_dict) == 0:
-                self._layout_sizer_noDipers()  
-            else:
-                ## set gaussian sizer 
-                self._on_select_Disp(event=None)
-        else:
-            self.model_disp.Hide()
-            self.disp_box.Hide()
-            self.disp_box.SetSelection(0) 
-            self.sizer4_4.Clear(True)
-        ## post state to fit panel 
-        self.save_current_state()
-        if event != None:
-            #self._undo.Enable(True)
-            event = PageInfoEvent(page=self)
-            wx.PostEvent(self.parent, event)
-        #draw the model with the current dispersity
-        self._draw_model()
-        self.sizer4_4.Layout()
-        self.sizer5.Layout()
-        self.Layout()
-        self.Refresh()      
-          
-    def _layout_sizer_noDipers(self):
-        """
-        Draw a sizer with no dispersity info
-        
-        """
-        ix = 0
-        iy = 1
-        self.fittable_param = []
-        self.fixed_param = []
-        self.orientation_params_disp = []
-        self.model_disp.Hide()
-        self.disp_box.Hide()
-        self.sizer4_4.Clear(True)
-        text = "No polydispersity available for this model"
-        model_disp = wx.StaticText(self, -1, text)
-        self.sizer4_4.Add(model_disp,(iy, ix), (1,1), 
-                          wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        self.sizer4_4.Layout()
-        self.sizer4.Layout()
-        self.SetupScrolling()
-      
-    def _reset_dispersity(self):
-        """
-         put gaussian dispersity into current model
-         
-        """
-        if len(self.param_toFit) > 0:
-            for item in self.fittable_param:
-                if item in self.param_toFit:
-                    self.param_toFit.remove(item)
-            for item in self.orientation_params_disp:
-                if item in self.param_toFit:
-                    self.param_toFit.remove(item)
-        self.fittable_param = []
-        self.fixed_param = []
-        self.orientation_params_disp = []
-        self.values = []
-        self.weights = []
-        from sans.models.dispersion_models import GaussianDispersion
-        from sans.models.dispersion_models import ArrayDispersion
-        if len(self.disp_cb_dict) == 0:
-            self.save_current_state()
-            self.sizer4_4.Clear(True)
-            self.Layout()
-            return 
-        if (len(self.disp_cb_dict) > 0) :
-            for p in self.disp_cb_dict:
-                # The parameter was un-selected.
-                # Go back to Gaussian model (with 0 pts)                    
-                disp_model = GaussianDispersion()
-                self._disp_obj_dict[p] = disp_model
-                # Set the new model as the dispersion object 
-                # for the selected parameter
-                try:
-                   self.model.set_dispersion(p, disp_model)
-                except:
-                    pass
-        ## save state into
-        self.save_current_state()
-        self.Layout()  
-        self.Refresh()
-                  
-    def _on_select_Disp(self, event):
-        """
-        allow selecting different dispersion
-        self.disp_list should change type later .now only gaussian
-        
-        """
-        n = self.disp_box.GetCurrentSelection()
-        name = self.disp_box.GetValue()
-        dispersity = self.disp_box.GetClientData(n)
-        self.disp_name = name
-        if name.lower() == "array":
-            self._set_sizer_arraydispersion()
-        else:
-            self._set_sizer_dispersion(dispersity=dispersity)
-        self.state.disp_box = n
-        ## Redraw the model
-        self._draw_model() 
-        #self._undo.Enable(True)
-        event = PageInfoEvent(page=self)
-        wx.PostEvent(self.parent, event)
-        self.sizer4_4.Layout()
-        self.sizer4.Layout()
-        self.SetupScrolling()
-        
-    def _set_sizer_arraydispersion(self):
-        """
-        draw sizer with array dispersity  parameters
-        """
-        if len(self.param_toFit) > 0:
-            for item in self.fittable_param:
-                if item in self.param_toFit:
-                    self.param_toFit.remove(item)
-            for item in self.orientation_params_disp:
-                if item in self.param_toFit:
-                    self.param_toFit.remove(item)
-        for item in self.model.details.keys():
-            if item in self.model.fixed:
-                del self.model.details [item]                           
-        self.fittable_param = []
-        self.fixed_param = []
-        self.orientation_params_disp = []
-        self.sizer4_4.Clear(True) 
-        self._reset_dispersity()
-        ix = 0
-        iy = 1     
-        disp1 = wx.StaticText(self, -1, 'Array Dispersion')
-        self.sizer4_4.Add(disp1, (iy, ix), (1, 1),  
-                          wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        # Look for model parameters to which we can apply 
-        # an ArrayDispersion model
-        # Add a check box for each parameter.
-        self.disp_cb_dict = {}
-        ix+=1 
-        self.noDisper_rbox = wx.RadioButton(self, -1, "None", 
-                                            (10, 10), style=wx.RB_GROUP)
-        self.Bind(wx.EVT_RADIOBUTTON, self.select_disp_angle, 
-                  id=self.noDisper_rbox.GetId())
-        #MAC needs SetValue
-        self.noDisper_rbox.SetValue(True)
-        self.sizer4_4.Add(self.noDisper_rbox, (iy, ix),
-                           (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        for p in self.model.dispersion.keys():
-            if not p in self.model.orientation_params:
-                ix += 1 
-                self.disp_cb_dict[p] = wx.RadioButton(self, -1, p, (10, 10))
-                self.state.disp_cb_dict[p] = self.disp_cb_dict[p].GetValue()
-                self.Bind(wx.EVT_RADIOBUTTON, self.select_disp_angle, 
-                          id=self.disp_cb_dict[p].GetId())
-                self.sizer4_4.Add(self.disp_cb_dict[p], (iy, ix), (1,1), 
-                                  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        for p in self.model.dispersion.keys():
-            if p in self.model.orientation_params:
-                ix += 1 
-                self.disp_cb_dict[p] = wx.RadioButton(self, -1, p, (10, 10))
-                self.state.disp_cb_dict[p] = self.disp_cb_dict[p].GetValue()
-                if not (self.enable2D or \
-                        self.data.__class__.__name__ == "Data2D"):
-                    self.disp_cb_dict[p].Hide()
-                else:
-                    self.disp_cb_dict[p].Show(True)
-                self.Bind(wx.EVT_RADIOBUTTON, self.select_disp_angle, 
-                          id=self.disp_cb_dict[p].GetId())
-                self.sizer4_4.Add(self.disp_cb_dict[p], (iy, ix), (1,1),
-                                   wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix = 0
-        iy += 1 
-        self.sizer4_4.Add((20, 20), (iy, ix), (1, 1), 
-                          wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)        
-        self.Layout()
-        self.state.orientation_params = []
-        self.state.orientation_params_disp = []
-        self.state.parameters = []
-        self.state.fittable_param = []
-        self.state.fixed_param = []
-        ## save checkbutton state and txtcrtl values
-        self._copy_parameters_state(self.orientation_params,
-                                     self.state.orientation_params)
-        self._copy_parameters_state(self.orientation_params_disp,
-                                     self.state.orientation_params_disp)
-        self._copy_parameters_state(self.parameters, self.state.parameters)
-        self._copy_parameters_state(self.fittable_param, 
-                                    self.state.fittable_param)
-        self._copy_parameters_state(self.fixed_param, self.state.fixed_param)
-        ## post state to fit panel
-        event = PageInfoEvent(page=self)
-        wx.PostEvent(self.parent, event)
-        
-    def _set_range_sizer(self, title, box_sizer=None, object1=None,object=None):
-        """
-        Fill the Q range sizer
-        
-        """
-        self.sizer5.Clear(True)
-        #--------------------------------------------------------------
-        if box_sizer == None:
-            box_description= wx.StaticBox(self, -1, str(title))
-            boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        else:
-            #for MAC
-            boxsizer1 = box_sizer
-
-        self.qmin = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH, 20),
-                                       style=wx. TE_PROCESS_ENTER,
-                                    kill_focus_callback=self._onQrangeEnter,
-                                    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,
-                                    kill_focus_callback=self._onQrangeEnter,
-                                    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=(70, 23))
-        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(3, 3, 2, 5)
-        sizer.Add(wx.StaticText(self, -1, '    Q range'))     
-        sizer.Add(wx.StaticText(self, -1, ' Min'))
-        sizer.Add(wx.StaticText(self, -1, ' Max'))
-        sizer.Add(self.reset_qrange)   
-        sizer.Add(self.qmin)
-        sizer.Add(self.qmax)
-        sizer_horizontal.Add(sizer)
-        if object != None:
-            sizer_horizontal.Add(object)
-        if object1 != None:
-           boxsizer1.Add(object1) 
-           boxsizer1.Add((10, 10))
-        boxsizer1.Add(sizer_horizontal)
-        ## save state
-        self.save_current_state()
-        #----------------------------------------------------------------
-        self.sizer5.Add(boxsizer1, 0, wx.EXPAND|wx.ALL, 10)
-        self.sizer5.Layout()
-
-    def _fill_save_sizer(self):
-        """
-        Draw the layout for saving option
-        
-        """
-        # Skipping save state functionality for release 0.9.0
-        return
-        self.sizer6.Clear(True)
-        box_description= wx.StaticBox(self, -1, "Save Model")
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        sizer_save = wx.BoxSizer(wx.HORIZONTAL)
-        
-        self.btSave_title = wx.StaticText(self, -1, 'Save the current Model')
-        self.btSave = wx.Button(self,wx.NewId(),'Save')
-        self.btSave.Bind(wx.EVT_BUTTON, self.onSave,id=self.btSave.GetId())
-        self.btSave.SetToolTipString("Save the current Model")
-        sizer_save.Add(self.btSave_title)  
-        sizer_save.Add((20, 20), 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 45)  
-        sizer_save.Add(self.btSave)     
-        boxsizer1.Add(sizer_save)
-        self.sizer6.Add(boxsizer1, 0, wx.EXPAND|wx.ALL, 10)
-        self.sizer6.Layout()
-        self.SetupScrolling()
-        
-    def _lay_out(self):
-        """
-        returns self.Layout
-        
-        :Note: Mac seems to like this better when self.Layout 
-            is called after fitting.
-            
-        """
-        self._sleep4sec()
-        self.Layout()
-        #self._sleep4sec()
-        return 
-    
-    def _sleep4sec(self):
-        """
-        sleep for 1 sec only applied on Mac
-        
-        :Note: This 1sec helps for Mac not to crash on 
-            self.layout after self._draw_model
-            
-        """
-        if ON_MAC == True:
-            time.sleep(1)
-             
-    def on_reset_clicked(self, event):
-        """
-        On 'Reset' button  for Q range clicked
-        
-        """
-        ##For 3 different cases: Data2D, Data1D, and theory
-        if self.data.__class__.__name__ == "Data2D":
-            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))
-            self.qmin_x = data_min
-            self.qmax_x = math.sqrt(x * x + y * y)
-        elif self.data.__class__.__name__ == "Data1D":
-            self.qmin_x = min(self.data.x)
-            self.qmax_x = max(self.data.x)
-        else:
-            self.qmin_x = _QMIN_DEFAULT
-            self.qmax_x = _QMAX_DEFAULT
-            self.num_points = _NPTS_DEFAULT            
-            self.state.npts = self.num_points
-        self.state.qmin = self.qmin_x
-        self.state.qmax = self.qmax_x
-        #reset the q range values
-        self._reset_plotting_range(self.state)
-        #Re draw plot
-        self._draw_model()
Index: eoryview/perspectives/theory/help_panel.py
===================================================================
--- theoryview/perspectives/theory/help_panel.py	(revision 18cdddb97a2eaa0aff943d5572d195a50a4448e0)
+++ 	(revision )
@@ -1,117 +1,0 @@
-#!/usr/bin/python
-import wx
-import wx.html as html
-from wx.lib.splitter import MultiSplitterWindow
-import os
-
-
-class HelpWindow(wx.Frame):
-    def __init__(self, parent, id, title= 'HelpWindow', pageToOpen=None):
-        wx.Frame.__init__(self, parent, id, title, size=(850, 500))
-        """
-        Windows containing html documentation for theory application
-        
-        """
-      
-        splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE)
-        rpanel = wx.Panel(splitter, -1)
-        lpanel = wx.Panel(splitter, -1, style=wx.BORDER_SUNKEN)
-        
-        vbox = wx.BoxSizer(wx.VERTICAL)
-        header = wx.Panel(rpanel, -1)
-        header.SetBackgroundColour('#6666FF')
-        header.SetForegroundColour('WHITE')
-        hbox = wx.BoxSizer(wx.HORIZONTAL)
-        st = wx.StaticText(header, -1, 'Contents', (5, 5))
-        font = st.GetFont()
-        font.SetPointSize(10)
-        st.SetFont(font)
-        hbox.Add(st, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5)
-        header.SetSizer(hbox)
-        vbox.Add(header, 0, wx.EXPAND)
-       
-        vboxl= wx.BoxSizer(wx.VERTICAL)
-        headerl = wx.Panel(lpanel, -1, size=(-1, 20))
-       
-        headerl.SetBackgroundColour('#6666FF')
-        headerl.SetForegroundColour('WHITE')
-        hboxl = wx.BoxSizer(wx.HORIZONTAL)
-        lst = wx.StaticText(headerl, -1, 'Menu', (5, 5))
-        fontl = lst.GetFont()
-        fontl.SetPointSize(10)
-        lst.SetFont(fontl)
-        hboxl.Add(lst, 1, wx.TOP | wx.BOTTOM | wx.LEFT, 5)
-        headerl.SetSizer(hboxl)
-        vboxl.Add(headerl, 0, wx.EXPAND)
-        self.lhelp = html.HtmlWindow(lpanel, -1, style=wx.NO_BORDER)
-        self.rhelp = html.HtmlWindow(rpanel, -1, style=wx.NO_BORDER, size=(500,-1))
-        
-        import sans.models as models 
-        # get the media path
-        path = models.get_data_path(media='media')
-        self.path = os.path.join(path,"model_functions.html")
-
-        page1="""<html>
-            <body>
-             <p>Select topic on Menu</p>
-            </body>
-            </html>"""
-        page="""<html>
-            <body>
-            <ul>
-            <li><a href ="%s" target ="showframe">Model Functions</a><br></li>
-            </ul>
-            </body>
-            </html>""" % self.path
-        
-        self.rhelp.SetPage(page1)
-        self.lhelp.SetPage(page)
-        self.lhelp.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.OnLinkClicked )
-        
-        #open the help frame a the current page
-        if  pageToOpen!= None:
-            self.rhelp.LoadPage(str( pageToOpen))
-            
-        vbox.Add(self.rhelp,1, wx.EXPAND)
-        vboxl.Add(self.lhelp, 1, wx.EXPAND)
-        rpanel.SetSizer(vbox)
-        lpanel.SetSizer(vboxl)
-        lpanel.SetFocus()
-        
-        vbox1 = wx.BoxSizer(wx.HORIZONTAL)
-        vbox1.Add(splitter,1,wx.EXPAND)
-        splitter.AppendWindow(lpanel, 200)
-        splitter.AppendWindow(rpanel)
-        self.SetSizer(vbox1)
-       
-        self.Centre()
-        self.Show(True)
-        
-    def OnButtonClicked(self, event):
-        """
-        Function to diplay html page related to the hyperlinktext selected
-        
-        """
-        self.rhelp.LoadPage(self.path)#"media/modelfunction.html")
-        
-    def OnLinkClicked(self, event):
-        """
-        Function to diplay html page related to the hyperlinktext selected
-        
-        """
-        link= event.GetLinkInfo().GetHref()
-        self.rhelp.LoadPage(link)
-
-
-class ViewApp(wx.App):
-    def OnInit(self):
-        frame = HelpWindow(None, -1, 'HelpWindow')    
-        frame.Show(True)
-        self.SetTopWindow(frame)
-        
-        return True
-        
-
-if __name__ == "__main__": 
-    app = ViewApp(0)
-    app.MainLoop()     
Index: eoryview/perspectives/theory/model_panel.py
===================================================================
--- theoryview/perspectives/theory/model_panel.py	(revision 243a8d4730dc8cf456953ad595b2e87e0e520bba)
+++ 	(revision )
@@ -1,793 +1,0 @@
-import os
-import wx
-import wx.lib.newevent
-import numpy
-import copy
-import math
-from sans.guiframe.panel_base import PanelBase
-from sans.models.dispersion_models import ArrayDispersion
-from sans.models.dispersion_models import GaussianDispersion
-from sans.guiframe.events import StatusEvent   
-from sans.guiframe.utils import format_number
-import basepage
-from basepage import BasicPage
-from basepage import PageInfoEvent
-(ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent()
-
-_BOX_WIDTH = 76
-
-
-class ModelPanel(BasicPage, PanelBase):
-    """
-    FitPanel class contains fields allowing to display results when
-    fitting  a model and one data
-    
-    :note: For Fit to be performed the user should check at least 
-        one parameter on fit Panel window.
-    """
-    ## Flag to tell the AUI manager to put this panel in the center pane
-    CENTER_PANE = True
-    ## Internal name for the AUI manager
-    window_name = "Theory model"
-    ## Title to appear on top of the window
-    window_caption = "Theory Model"
-    
-    def __init__(self, parent, page_info, model_list_box):
-        BasicPage.__init__(self, parent, page_info, model_list_box)
-        PanelBase.__init__(self, parent)
-        """ 
-        Initialization of the Panel
-        """
-        self._fill_model_sizer( self.sizer1)  
-        self._fill_range_sizer()
-        self.engine_type = None 
-        description = ""
-        if self.model != None:
-            description = self.model.description
-            self.select_model(self.model)
-            self.set_model_description(description, self.sizer2)
-            
-    def _on_display_description(self, event):
-        """
-        Show or Hide description
-        
-        :param event: wx.EVT_RADIOBUTTON
-        
-        """
-        self._on_display_description_helper()
-        self.SetupScrolling()
-        self.Refresh()
-
-    def _on_display_description_helper(self):
-        """
-        Show or Hide description
-        
-        :param event: wx.EVT_RADIOBUTTON
-        
-        """
-        ## Show description
-        if self.description_hide.GetValue():
-            self.sizer_description.Clear(True)
-        else:
-            description="Model contains no description"
-            if self.model != None:
-                description = self.model.description
-            if description.lstrip().rstrip() == "": 
-                description="Model contains no description"
-            self.description = wx.StaticText(self, -1, str(description))
-            self.sizer_description.Add(self.description, 1, 
-                                       wx.EXPAND|wx.ALL, 10)
-        self.Layout()
-    
-    def _fill_range_sizer(self):
-        """
-        Fill the sizer containing the plotting range
-        add  access to npts
-        
-        """
-        ##The following 3 lines are for Mac. Let JHC know before modifying..
-        title = "Plotted Q Range"
-        box_description = wx.StaticBox(self, -1, str(title))
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-
-        sizer_npts= wx.GridSizer(1, 1, 5, 5)    
-        self.npts    = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
-                                          style=wx.TE_PROCESS_ENTER)
-        self.npts.SetValue(format_number(self.num_points))
-        self.npts.SetToolTipString("Number of point to plot.")
-        sizer_npts.Add(wx.StaticText(self, -1, 'Npts'), 1, 
-                       wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 13)        
-        sizer_npts.Add(self.npts, 1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
-        self._set_range_sizer(title=title, box_sizer=boxsizer1, 
-                              object=sizer_npts)
-    
-    def _on_select_model(self, event): 
-        """
-        call back for model selection
-        
-        """    
-        self._on_select_model_helper() 
-        #Reset dispersity that was not done in _on_select_model_helper() 
-        self._reset_dispersity()
-        self.select_model(self.model)
-        
-    def _fill_model_sizer(self, sizer):
-        """
-        fill sizer containing model info
-        
-        """
-        ##The following 3 lines are for Mac. Let JHC know before modifying..
-        title = "Model"
-        box_description = wx.StaticBox(self, -1, str(title))
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        id = wx.NewId()
-        self.model_view = wx.Button(self, id,'View 2D', size=(80, 23))
-        self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D, id=id)
-        self.model_view.SetToolTipString("View model in 2D")
-        ## class base method  to add view 2d button   
-        self._set_model_sizer(sizer=sizer, box_sizer=boxsizer1, 
-                              title=title, object=self.model_view)    
-    
-    #def _set_sizer_gaussian(self):
-    def _set_sizer_dispersion(self, dispersity):
-        """
-        draw sizer with gaussian, log or schulz dispersity parameters
-        
-        """
-        self.fittable_param = []
-        self.fixed_param = []
-        self.orientation_params_disp = []
-        #self.temp=[]
-        self.sizer4_4.Clear(True)
-        if self.model == None:
-            ##no model is selected
-            return
-        if not self.enable_disp.GetValue():
-            ## the user didn't select dispersity display
-            return 
-        self._reset_dispersity()
-        # Create the dispersion objects
-        for item in self.model.dispersion.keys():
-            #disp_model =  GaussianDispersion()
-            disp_model = dispersity()
-            self._disp_obj_dict[item] = disp_model
-            self.model.set_dispersion(item, disp_model)
-            self.state._disp_obj_dict[item] = disp_model
-        ix = 0
-        iy = 1
-        disp = wx.StaticText(self, -1, ' ')
-        self.sizer4_4.Add(disp,(iy, ix), (1, 1), 
-                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix += 1 
-        values = wx.StaticText(self, -1, 'PD[ratio] ')
-        polytext = "Polydispersity (= STD/mean); "
-        polytext +=  "the standard deviation over the mean value."
-        values.SetToolTipString(polytext)
-        
-        self.sizer4_4.Add(values, (iy, ix), (1, 1), 
-                          wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix += 1 
-        npts = wx.StaticText(self, -1, 'Npts')
-        hint_msg = "Number of sampling points for the numerical\n"
-        hint_msg += "integration over the distribution function."
-        npts.SetToolTipString(hint_msg)
-        self.sizer4_4.Add(npts, (iy, ix), (1, 1),
-                          wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        ix += 1 
-        nsigmas = wx.StaticText(self, -1, 'Nsigmas')
-        hint_msg = "Number of sigmas between which the range\n"
-        hint_msg += "of the distribution function will be used for "
-        hint_msg += "weighting.\n The value '3' covers 99.5% for Gaussian "
-        hint_msg += "  distribution \n function. "
-        hint_msg += "Note: Not recommended to change this value."
-        nsigmas.SetToolTipString(hint_msg)
-        self.sizer4_4.Add(nsigmas, (iy, ix), 
-                          (1, 1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-        for item in self.model.dispersion.keys():
-            if not item in self.model.orientation_params:
-                self.disp_cb_dict[item] = None
-                name0 = "Distribution of " + item
-                name1 = item + ".width"
-                name2=item+".npts"
-                name3=item+".nsigmas"
-                iy += 1
-                for p in self.model.dispersion[item].keys():
-                    if p == "width":
-                        ix = 0
-                        name = wx.StaticText(self, -1,  name0)
-                        self.sizer4_4.Add( name,( iy, ix),(1,1),  
-                                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                        ix = 1
-                        value= self.model.getParam(name1)
-                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
-                                            style=wx.TE_PROCESS_ENTER)
-                        ctl1.SetLabel('PD[ratio]')
-                        poly_text = "Polydispersity (STD/mean) of %s\n" % item
-                        poly_text += "STD: the standard deviation"
-                        poly_text += " from the mean value."
-                        ctl1.SetToolTipString(poly_text)
-                        ctl1.SetValue(str (format_number(value)))
-                        self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
-                        self.fittable_param.append([None,name1,ctl1,None,
-                                                    None, None, None,None])
-                    elif p=="npts":
-                            ix =2
-                            value= self.model.getParam(name2)
-                            Tctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
-                                                style=wx.TE_PROCESS_ENTER)
-                            
-                            Tctl1.SetValue(str (format_number(value)))
-                            self.sizer4_4.Add(Tctl1, (iy,ix),(1,1),
-                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                            self.fixed_param.append([None,name2, Tctl1,None,None,
-                                                      None, None,None])
-                    elif p=="nsigmas":
-                            ix =3 
-                            value= self.model.getParam(name3)
-                            Tctl2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
-                                                style=wx.TE_PROCESS_ENTER)
-                            
-                            Tctl2.SetValue(str (format_number(value)))
-                            self.sizer4_4.Add(Tctl2, (iy,ix),(1,1),
-                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                            ix +=1
-                            self.sizer4_4.Add((20,20), (iy,ix),(1,1),
-                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                            self.fixed_param.append([None,name3, Tctl2,
-                                                     None,None, None, None,None])
-        first_orient  = True
-        for item in self.model.dispersion.keys():
-            if item in self.model.orientation_params:
-                self.disp_cb_dict[item]= None
-                name0="Distribution of " + item
-                name1=item+".width"
-                name2=item+".npts"
-                name3=item+".nsigmas"
-                iy += 1
-                for p in self.model.dispersion[item].keys():
-                    if p=="width":
-                        ix = 0
-                        name = wx.StaticText(self, -1,  name0)
-                        self.sizer4_4.Add( name,( iy, ix),(1,1),  
-                                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                        if not self.enable2D:
-                            name.Hide()
-                        else:
-                            name.Show(True)
-                        ix = 1
-                        value= self.model.getParam(name1)
-                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
-                                            style=wx.TE_PROCESS_ENTER)
-                        poly_tip = "Absolute Sigma for %s." % item
-                        ctl1.SetToolTipString(poly_tip)
-                        ctl1.SetValue(str (format_number(value)))
-                        if not self.enable2D:
-                            ctl1.Hide()
-                            ctl1.Disable()
-                        else:
-                            # in the case of 2D and angle parameter
-                            if first_orient:
-                                values.SetLabel('PD[ratio], Sig[deg]')
-                                poly_text = "PD(polydispersity for lengths):\n"
-                                poly_text +=  "It should be a value between"
-                                poly_text +=  "0 and 1\n"
-                                poly_text += "Sigma for angles: \n"
-                                poly_text += "It is the STD (ratio*mean)"
-                                poly_text += " of the distribution.\n " 
-                            
-                                values.SetToolTipString(poly_text)
-                                first_orient = False 
-                            ctl1.Show(True)
-                            ctl1.Enable()
-                        self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
-                        self.fittable_param.append([None,name1,ctl1,None,
-                                                    None, None, None,None])
-                        self.orientation_params_disp.append([None,name1,ctl1,None,
-                                                    None, None, None,None])
-                    elif p=="npts":
-                            ix =2
-                            value= self.model.getParam(name2)
-                            Tctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
-                                                style=wx.TE_PROCESS_ENTER)
-
-                            Tctl1.SetValue(str (format_number(value)))
-                            if not self.enable2D:
-                                Tctl1.Hide()
-                                Tctl1.Disable()
-                            else:
-                                Tctl1.Show(True)
-                                Tctl1.Enable()
-                            self.sizer4_4.Add(Tctl1, (iy,ix),(1,1),
-                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                            self.fixed_param.append([None,name2, Tctl1,None,None,
-                                                      None, None,None])
-                            self.orientation_params_disp.append([None,name2, Tctl1,None,None,
-                                                      None, None,None])
-                    elif p=="nsigmas":
-                            ix =3 
-                            value= self.model.getParam(name3)
-                            Tctl2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
-                                                style=wx.TE_PROCESS_ENTER)
-                            
-                            Tctl2.SetValue(str (format_number(value)))
-                            if not self.enable2D:
-                                Tctl2.Hide()
-                                Tctl2.Disable()
-                            else:
-                                Tctl2.Show(True)
-                                Tctl2.Enable()
-                            self.sizer4_4.Add(Tctl2, (iy,ix),(1,1),
-                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                            ix +=1
-                            #self.sizer4_4.Add((20,20), (iy,ix),(1,1),
-                                               #wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                            self.fixed_param.append([None,name3, Tctl2,
-                                                     None,None, None, None,None])
-                            self.orientation_params_disp.append([None,name3, Tctl2,
-                                                     None,None, None, None,None])
-          
-        msg = " Selected Distribution: Gaussian"        
-        wx.PostEvent(self.parent, StatusEvent( status= msg )) 
-        self.state.disp_cb_dict = copy.deepcopy(self.disp_cb_dict)   
-        ix =0
-        iy +=1 
-        #self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)   
-        self.sizer4_4.Layout()
-        self.sizer4.Layout()
-        self.SetupScrolling()
-             
- 
-    def _onModel2D(self, event):
-        """
-        call manager to plot model in 2D
-        
-        """
-        # If the 2D display is not currently enabled, plot the model in 2D 
-        # and set the enable2D flag.
-
-        if self.fitrange:
-            self.enable2D = True
- 
-        if self.enable2D:
-            self._draw_model()
-            self.model_view.Disable()
-           
-            n = self.disp_box.GetCurrentSelection()
-            dispersity= self.disp_box.GetClientData(n)
-            #TODO:Find a better way to reinitialize the parameters containers 
-            # when resetting the page and 2D view is enable
-            #self.set_model_param_sizer(self.model): called here is using a lot
-            #of for loops and redraw the sizer again .How to avoid it?
-            self.set_model_param_sizer(self.model)
-            
-            if len(self.orientation_params)>0:
-                for item in self.orientation_params:
-                    if item[2]!=None:      
-                        item[2].Enable()
-            # same as above why do we have to redraw the sizer of dispersity to get
-            # the appropriate value of parameters containers on reset page?
-            # Reset containers of dispersity parameters for the appropriate dispersity
-            #and model
-            if  self.disp_name.lower()in ["array","arraydispersion"]:                
-                self._set_sizer_arraydispersion()  
-            else:
-                self._set_sizer_dispersion(dispersity)
-                if len(self.orientation_params_disp)>0:
-                   
-                    for item in self.orientation_params_disp:
-                        if item[2]!=None:
-                            item[2].Enable()
-                            
-        self.state.enable2D =  copy.deepcopy(self.enable2D)
-        self.Layout()
-        ## post state to fit panel
-        #self._undo.Enable(True)
-        event = PageInfoEvent(page = self)
-        wx.PostEvent(self.parent, event)
-        
-    def _set_fun_box_list(self,fun_box):
-        """
-        Set the list of func for multifunctional models
-        
-        :param fun_box: function combo box
-        """
-        # Check if it is multi_functional model
-        if self.model.__class__ not in self.model_list_box["Multi-Functions"]:
-            return None
-        # Get the func name list
-        list = self.model.fun_list
-       
-        if len(list) == 0:
-            return None
-
-        # build function (combo)box
-        ind = 0
-        while(ind < len(list)):
-            for key, val in list.iteritems():
-                if (val == ind):
-                    fun_box.Append(key,val)
-                    break
-            ind += 1
-            
-    def _on_fun_box(self,event):
-        """
-        Select an func: Erf,Rparabola,LParabola...
-        """
-        fun_val = None
-        fun_box = event.GetEventObject()
-        name = fun_box.Name
-        value = fun_box.GetValue()
-        if self.model.fun_list.has_key(value):
-            fun_val = self.model.fun_list[value]
-        
-        self.model.setParam(name,fun_val)
-        # save state
-        self._copy_parameters_state(self.str_parameters, self.state.str_parameters)
-        # update params
-        #self._update_paramv_on_fit() 
-
-        # draw
-        self._draw_model()
-        self.Refresh()
-        # get ready for new event
-        event.Skip()
-              
-    def set_data(self, list=[], state=None):
-        """
-        Receive  a list of data from gui_manager to plot theory
-        """
-        pass
-      
-    def reset_page(self, state):
-        """
-        reset the state
-        
-        """
-        self.reset_page_helper(state)
-        
-        
-    def select_model(self, model):
-        """
-        Select a new model
-        
-        :param model: model object 
-        
-        """
-        self.model = model
-        if self.model !=None:
-            self.disp_list= self.model.getDispParamList()
-        self.set_model_param_sizer(self.model)
-        ## keep the sizer view consistent with the model menu selecting
-        self._set_model_sizer_selection( self.model )
-        self.enable_disp.SetValue(False)
-        self.disable_disp.SetValue(True)
-        self.set_dispers_sizer()
-        
-        self.model_view.SetFocus()
-        if self.model !=None:
-            self._draw_model()
-        self.state.structurecombobox = self.structurebox.GetCurrentSelection()
-        self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection()
-       
-        ## post state to fit panel
-        #self._undo.Enable(True)
-        event = PageInfoEvent(page = self)
-        wx.PostEvent(self.parent, event)               
-    
-    
-    def set_model_description(self,description,sizer):
-        """
-        fill a sizer with description
-        
-        :param description: of type string
-        :param sizer: wx.BoxSizer()
-        
-        """
-    
-        sizer.Clear(True)
-        box_description= wx.StaticBox(self, -1, 'Model Description')
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-
-        sizer_selection=wx.BoxSizer(wx.HORIZONTAL)
-        self.description_hide = wx.RadioButton(self, -1, 'Hide', 
-                                               style=wx.RB_GROUP)
-        self.description_show = wx.RadioButton(self, -1, 'Show')
-       
-        
-        if description == "":
-            self.description_hide.SetValue(True)
-            description = " Description unavailable. Click for details"
-            
-        self.description = wx.StaticText( self,-1,str(description) )
-        
-        self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description,
-                   id=self.description_hide.GetId() )
-        
-        self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description,
-                   id=self.description_show.GetId() )
-        #MAC needs SetValue
-        self.description_hide.SetValue(True)
-        
-        self.model_description = wx.Button(self,-1, label="Details", size=(80,23))
-        
-        self.model_description.Bind(wx.EVT_BUTTON,self.on_button_clicked)
-        self.model_description.SetToolTipString("Click Model Functions in HelpWindow...")
-        self.model_description.SetFocus()
-        sizer_selection.Add( self.description_show )
-        sizer_selection.Add( (20,20)) 
-        sizer_selection.Add( self.description_hide )
-        sizer_selection.Add((20,20),0, wx.LEFT|wx.RIGHT|wx.EXPAND,75)
-        sizer_selection.Add( self.model_description )
-                     
-         
-        self.sizer_description=wx.BoxSizer(wx.HORIZONTAL)
-        self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 )
-        boxsizer1.Add( sizer_selection) 
-        boxsizer1.Add( (20,20)) 
-        boxsizer1.Add( self.sizer_description) 
-    
-        self._on_display_description(event=None)
-        sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
-        sizer.Layout()
-   
-    def on_button_clicked(self,event):
-        """
-        On 'More details' button
-        """
-        from help_panel import  HelpWindow
-        import sans.models as models 
-        # Get models help model_function path
-        path = models.get_data_path(media='media')
-        model_path = os.path.join(path,"model_functions.html")
-        
-        if self.model == None:
-            name = 'FuncHelp'
-        else:
-            name = self.model.name
-        frame = HelpWindow(None, -1,  pageToOpen=model_path)    
-        frame.Show(True)
-        if frame.rhelp.HasAnchor(name):
-            frame.rhelp.ScrollToAnchor(name)
-        else:
-           msg= "Model does not contains an available description "
-           msg +="Please.Search in the Help window"
-           wx.PostEvent(self.parent, StatusEvent(status = msg ))
-
-                     
-    def set_range(self, qmin_x, qmax_x, npts):
-        """
-        Set the range for the plotted models
-        
-        :param qmin: minimum Q
-        :param qmax: maximum Q
-        :param npts: number of Q bins
-        
-        """
-        # Set the data members
-        self.qmin_x = qmin_x
-        self.qmax_x = qmax_x
-        self.num_points = npts
-        # Set the controls
-        #For qmin and qmax, do not use format_number.(If do, qmin and max could be different from what is in the data.)
-        self.qmin.SetValue(str(self.qmin_x))
-        self.qmax.SetValue(str(self.qmax_x))
-        self.npts.SetValue(format_number(self.num_points))
-        
-    def set_model_param_sizer(self, model):
-        """
-        Build the panel from the model content
-        
-        :param model: the model selected in combo box for fitting purpose
-        
-        """
-        self.sizer3.Clear(True)
-        self.parameters = []
-        self.str_parameters = []
-        self.param_toFit=[]
-        self.fixed_param=[]
-        self.orientation_params=[]
-        self.orientation_params_disp=[]
-        #self.temp=[]
-        if model ==None:
-            ##no model avaiable to draw sizer 
-            self.sizer3.Layout()
-            self.SetupScrolling()
-            return
-        box_description= wx.StaticBox(self, -1,str("Model Parameters"))
-        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
-        sizer = wx.GridBagSizer(5,5)
-        
-        self.model = model
-        self.set_model_description(self.model.description,self.sizer2)
-       
-        keys = self.model.getParamList()
-        ##list of dispersion parameters
-        self.disp_list=self.model.getDispParamList()
-       
-        def custom_compare(a,b):
-            """
-            Custom compare to order, first by alphabets then second by number.
-            """ 
-            # number at the last digit
-            a_last = a[len(a)-1]
-            b_last = b[len(b)-1]
-            # default
-            num_a = None
-            num_b = None
-            # split the names
-            a2 = a.lower().split('_')
-            b2 = b.lower().split('_')
-            # check length of a2, b2
-            len_a2 = len(a2)
-            len_b2 = len(b2)
-            # check if it contains a int number(<10)
-            try: 
-                num_a = int(a_last)
-            except: pass
-            try:
-                num_b = int(b_last)
-            except: pass
-            # Put 'scale' near the top; happens 
-            # when numbered param name exists
-            if a == 'scale':
-                return -1
-            # both have a number    
-            if num_a != None and num_b != None:
-                if num_a > num_b: return -1
-                # same number
-                elif num_a == num_b: 
-                    # different last names
-                    if a2[len_a2-1] != b2[len_b2-1] and num_a != 0:
-                        return -cmp(a2[len_a2-1], b2[len_b2-1])
-                    else: 
-                        return cmp(a, b) 
-                else: return 1
-            # one of them has a number
-            elif num_a != None: return 1
-            elif num_b != None: return -1
-            # no numbers
-            else: return cmp(a.lower(), b.lower())
-
-        keys.sort(custom_compare)
-
-    
-        iy = 0
-        ix = 0
-        self.text1_2 = wx.StaticText(self, -1, 'Names')
-        sizer.Add(self.text1_2,(iy, ix),(1,1),\
-                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        ix +=1
-        self.text2_2 = wx.StaticText(self, -1, 'Values')
-        sizer.Add(self.text2_2,(iy, ix),(1,1),\
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        ix +=1
-        self.text2_4 = wx.StaticText(self, -1, '[Units]')
-        sizer.Add(self.text2_4,(iy, ix),(1,1),\
-                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
-        self.text2_4.Hide()
-        
-        for item in keys:
-            if not item in self.disp_list and not item in self.model.orientation_params:
-                iy += 1
-                ix = 0
-                if self.model.__class__ in self.model_list_box["Multi-Functions"]\
-                            and item in self.model.non_fittable:
-                    non_fittable_name = wx.StaticText(self, -1, item )
-                    sizer.Add(non_fittable_name,(iy, ix),(1,1),\
-                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                    ## add parameter value
-                    ix += 1
-                    value= self.model.getParam(item)
-                    if len(self.model.fun_list) > 0:
-                        num = item.split('_')[1][5:7]
-                        fun_box = wx.ComboBox(self, -1,size=(100,-1),style=wx.CB_READONLY, name = '%s'% item)
-                        self._set_fun_box_list(fun_box)
-                        fun_box.SetSelection(0)
-                        #self.fun_box.SetToolTipString("A function describing the interface")
-                        wx.EVT_COMBOBOX(fun_box,-1, self._on_fun_box)
-                    else:
-                        fun_box = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
-                                        style=wx.TE_PROCESS_ENTER, name ='%s'% item)
-                        fun_box.SetToolTipString("Hit 'Enter' after typing.")
-                        fun_box.SetValue(format_number(value))
-                    sizer.Add(fun_box, (iy,ix),(1,1), wx.EXPAND)
-                    ##[cb state, name, value, "+/-", error of fit, min, max , units]
-                    self.str_parameters.append([None,item, fun_box, \
-                                                None,None,None,None,None])
-                else:
-                    name = wx.StaticText(self, -1,item)
-                    sizer.Add( name,( iy, ix),(1,1),
-                                 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-    
-                    ix += 1
-                    value= self.model.getParam(item)
-                    ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
-                        style=wx.TE_PROCESS_ENTER)
-                    
-                    ctl1.SetValue(str (format_number(value)))
-                    
-                    sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
-                    ix +=1
-                    # Units
-                    if self.model.details.has_key(item):
-                        units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-                    else:
-                        units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
-                    sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                    ##[cb state, name, value, "+/-", error of fit, min, max , units]
-                    self.parameters.append([None,item, ctl1,
-                                            None,None, None, None,None])
-        iy+=1
-        sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-        iy += 1
-        ix = 0
-        
-        #Add tile for orientational angle parameters
-        for item in keys:
-            if item in self.model.orientation_params:        
-                orient_angle = wx.StaticText(self, -1, '[For 2D only]:')
-                sizer.Add(orient_angle,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
-                if not self.enable2D:
-                    orient_angle.Hide()
-                else:
-                    orient_angle.Show(True)
-                break
-                                          
-        for item  in self.model.orientation_params:
-            if not item in self.disp_list and item in keys:
-                iy += 1
-                ix = 0
-                name = wx.StaticText(self, -1,item)
-                sizer.Add( name,( iy, ix),(1,1),
-                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
-                if not self.enable2D:
-                    name.Hide()
-                else:
-                    name.Show(True)
-
-                ix += 1
-                value= self.model.getParam(item)
-                ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
-                    style=wx.TE_PROCESS_ENTER)
-                
-                ctl1.SetValue(str (format_number(value)))
-                if not self.enable2D:
-                    ctl1.Hide()
-                    ctl1.Disable()
-                else:
-                    ctl1.Show(True)
-                    ctl1.Enable()
-                
-                sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
-                ix +=1
-                # Units
-                if self.model.details.has_key(item):
-                    units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-                else:
-                    units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
-                if not self.enable2D:
-                    units.Hide()
-                else:
-                    units.Show(True)
-   
-                sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                #Save 2D orient. params
-                #self.temp.append([name,ctl1,units,orient_angle])
-                
-                               
-                ##[cb state, name, value, "+/-", error of fit, min, max , units]
-                self.parameters.append([None,item, ctl1,
-                                        None,None, None, None,None])
-                self.orientation_params.append([None,item, ctl1,
-                                        None,None, None, None,None])  
-        iy += 1
-        
-        #Display units text on panel
-        for item in keys:   
-            self.text2_4.Show()
-
-        boxsizer1.Add(sizer)
-        self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
-        self.sizer3.Layout()
-        self.SetupScrolling()
-                
Index: eoryview/perspectives/theory/model_thread.py
===================================================================
--- theoryview/perspectives/theory/model_thread.py	(revision f53444be67a3ecdd469504391b3a25e5f27fe368)
+++ 	(revision )
@@ -1,202 +1,0 @@
-
-import time
-import sys
-import numpy
-import math
-from data_util.calcthread import CalcThread
-
-class Calc2D(CalcThread):
-    """
-    Compute 2D model
-    This calculation assumes a 2-fold symmetry of the model
-    where points are computed for one half of the detector
-    and I(qx, qy) = I(-qx, -qy) is assumed.
-    
-    """
-    
-    def __init__(self, x, y, data,model,qmin, qmax,qstep,
-                 completefn = None,
-                 updatefn   = None,
-                 yieldtime  = 0.01,
-                 worktime   = 0.01
-                 ):
-        CalcThread.__init__(self,completefn,
-                 updatefn,
-                 yieldtime,
-                 worktime)
-        self.qmin= qmin
-        self.qmax= qmax
-        self.qstep= qstep
-
-        self.x = x
-        self.y = y
-        self.data= data
-        self.model = model
-        self.starttime = 0  
-        
-    def compute(self):
-        """
-        Compute the data given a model function
-        
-        """
-        self.starttime = time.time()
-        # Determine appropriate q range
-        if self.qmin==None:
-            self.qmin = 0
-        if self.qmax== None:
-            if self.data !=None:
-                newx= math.pow(max(math.fabs(self.data.xmax),math.fabs(self.data.xmin)),2)
-                newy= math.pow(max(math.fabs(self.data.ymax),math.fabs(self.data.ymin)),2)
-                self.qmax=math.sqrt( newx + newy )
-        
-        if self.data != None:
-            self.I_data = self.data.data
-            self.qx_data = self.data.qx_data
-            self.qy_data = self.data.qy_data
-            self.mask    = self.data.mask
-        else:          
-            xbin =  numpy.linspace(start= -1*self.qmax,
-                                   stop= self.qmax,
-                                   num= self.qstep,
-                                   endpoint=True )  
-            ybin = numpy.linspace(start= -1*self.qmax,
-                                   stop= self.qmax,
-                                   num= self.qstep,
-                                   endpoint=True )            
-            
-            new_xbin = numpy.tile(xbin, (len(ybin),1))
-            new_ybin = numpy.tile(ybin, (len(xbin),1))
-            new_ybin = new_ybin.swapaxes(0,1)
-            new_xbin = new_xbin.flatten()
-            new_ybin = new_ybin.flatten()
-            self.qy_data = new_ybin
-            self.qx_data = new_xbin
-            # fake data
-            self.I_data = numpy.ones(len(self.qx_data))
-            
-            self.mask = numpy.ones(len(self.qx_data),dtype=bool)
-            
-        # Define matrix where data will be plotted    
-        radius= numpy.sqrt( self.qx_data*self.qx_data + self.qy_data*self.qy_data )
-        index_data= (self.qmin<= radius)&(self.mask)
-        
-        # For theory, qmax is based on 1d qmax 
-        # so that must be mulitified by sqrt(2) to get actual max for 2d
-        index_model = ((self.qmin <= radius)&(radius<= self.qmax))
-        self.mask = (index_model)&(self.mask)
-        self.mask = (self.mask)&(numpy.isfinite(self.I_data))
-        if self.data ==None:
-            # Only qmin value will be consider for the detector
-            self.mask = index_data  
-             
-        value = self.model.evalDistribution([self.qx_data[self.mask],self.qy_data[self.mask]] )
-
-        output = numpy.zeros(len(self.mask))
-                
-        # output default is None
-        # This method is to distinguish between masked point and data point = 0.
-        output = output/output
-        # set value for self.mask==True, else still None to Plottools
-        output[self.mask] = value 
-
-        elapsed = time.time()-self.starttime
-        self.complete( image = output,
-                       data = self.data , 
-                       model = self.model,
-                       elapsed = elapsed,
-                       qmin = self.qmin,
-                       qmax = self.qmax,
-                       qstep = self.qstep )
-        
-class Calc1D(CalcThread):
-    """
-    Compute 1D data
-    
-    """
-    
-    def __init__(self, x, model,
-                 data=None,
-                 qmin=None,
-                 qmax=None,
-                 smearer=None,
-                 completefn = None,
-                 updatefn   = None,
-                 yieldtime  = 0.01,
-                 worktime   = 0.01
-                 ):
-        CalcThread.__init__(self,completefn,
-                 updatefn,
-                 yieldtime,
-                 worktime)
-        self.x = numpy.array(x)
-        self.data= data
-        self.qmin= qmin
-        self.qmax= qmax
-        self.model = model
-        self.smearer= smearer
-        self.starttime = 0
-        
-    def compute(self):
-        """
-        Compute model 1d value given qmin , qmax , x value 
-        
-        """
-        
-        self.starttime = time.time()
-        output = numpy.zeros((len(self.x)))
-        index= (self.qmin <= self.x)& (self.x <= self.qmax)
-     
-        ##smearer the ouput of the plot    
-        if self.smearer!=None:
-            first_bin, last_bin = self.smearer.get_bin_range(self.qmin, self.qmax)
-            output[first_bin:last_bin] = self.model.evalDistribution(self.x[first_bin:last_bin])
-            output = self.smearer(output, first_bin, last_bin) 
-        else:
-            output[index] = self.model.evalDistribution(self.x[index])
-         
-        elapsed = time.time()-self.starttime
-       
-        self.complete(x= self.x[index], y= output[index], 
-                      elapsed=elapsed, model= self.model, data=self.data)
-"""
-Example of use of Calc2D ::
-
-class CalcCommandline:
-    
-    def __init__(self, n=20000):
-        #print thread.get_ident()
-        from sans.models.CylinderModel import CylinderModel
-        
-        model = CylinderModel()
-        print model.runXY([0.01, 0.02])
-        
-        qmax = 0.01
-        qstep = 0.0001
-        self.done = False
-        
-        x = numpy.arange(-qmax, qmax+qstep*0.01, qstep)
-        y = numpy.arange(-qmax, qmax+qstep*0.01, qstep)
-    
-        calc_thread_2D = Calc2D(x, y, None, model.clone(),-qmax, qmax,qstep,
-                                        completefn=self.complete,
-                                        updatefn=self.update ,
-                                        yieldtime=0.0)
-     
-        calc_thread_2D.queue()
-        calc_thread_2D.ready(2.5)
-        
-        while not self.done:
-            time.sleep(1)
-
-    def update(self,output):
-        print "update"
-
-    def complete(self, image, data, model, elapsed, qmin, qmax, qstep ):
-        print "complete"
-        self.done = True
-
-if __name__ == "__main__":
-    CalcCommandline()
-   
-"""  
-
Index: eoryview/perspectives/theory/models.py
===================================================================
--- theoryview/perspectives/theory/models.py	(revision f53444be67a3ecdd469504391b3a25e5f27fe368)
+++ 	(revision )
@@ -1,433 +1,0 @@
-
-"""
-This module collects models from sans.models packages and orders theses models 
-by categories that GUI application understands and uses.
-
-"""
-
-import imp
-import os
-import sys
-import math
-# Time is needed by the log method
-import time
-import os.path
-import wx
-import wx.lib.newevent
-from sans.guiframe.events import StatusEvent  
-# Explicitly import from the pluginmodel module so that py2exe
-# places it in the distribution. The Model1DPlugin class is used
-# as the base class of plug-in models.
-from sans.models.pluginmodel import Model1DPlugin
-
-(ModelEvent, EVT_MODEL) = wx.lib.newevent.NewEvent()
-
-
-def log(message):
-    """
-    """
-    out = open("plugins.log", 'a')
-    out.write("%10g:  %s\n" % (time.clock(), message))
-    out.close()
-
-def findModels():
-    """
-    """
-    log("looking for models in: %s/plugins" % os.getcwd())
-    if os.path.isdir('plugins'):
-        return _findModels('plugins')
-    return []
-    
-def _check_plugin(model, name):
-    """
-    Do some checking before model adding plugins in the list
-    
-    :param model: class model to add into the plugin list
-    :param name: name of the module plugin
-    
-    :return model: model if valid model or None if not valid
-    
-    """
-    #Check is the plugin is of type Model1DPlugin
-    if not issubclass(model, Model1DPlugin):
-        msg= "Plugin %s must be of type Model1DPlugin \n"%str(name)
-        log(msg)
-        return None
-    if model.__name__!="Model":
-        msg= "Plugin %s class name must be Model \n"%str(name)
-        log(msg)
-        return None
-    try:
-        new_instance= model()
-    except:
-        msg="Plugin %s error in __init__ \n\t: %s %s\n"%(str(name),
-                                    str(sys.exc_type),sys.exc_value)
-        log(msg)
-        return None
-   
-    new_instance= model() 
-    if hasattr(new_instance,"function"):
-        try:
-           value=new_instance.function()
-        except:
-           msg="Plugin %s: error writing function \n\t :%s %s\n "%(str(name),
-                                    str(sys.exc_type),sys.exc_value)
-           log(msg)
-           return None
-    else:
-       msg="Plugin  %s needs a method called function \n"%str(name)
-       log(msg)
-       return None
-    return model
-  
-  
-def _findModels(dir):
-    """
-    """
-    # List of plugin objects
-    plugins = []
-    # Go through files in plug-in directory
-    try:
-        list = os.listdir(dir)
-        for item in list:
-            toks = os.path.splitext(os.path.basename(item))
-            if toks[1]=='.py' and not toks[0]=='__init__':
-                name = toks[0]
-            
-                path = [os.path.abspath(dir)]
-                file = None
-                try:
-                    (file, path, info) = imp.find_module(name, path)
-                    module = imp.load_module( name, file, item, info )
-                    if hasattr(module, "Model"):
-                        try:
-                            if _check_plugin(module.Model, name)!=None:
-                                plugins.append(module.Model)
-                        except:
-                            msg="Error accessing Model"
-                            msg+="in %s\n  %s %s\n" % (name,
-                                    str(sys.exc_type), sys.exc_value)
-                            log(msg)
-                except:
-                    msg="Error accessing Model"
-                    msg +=" in %s\n  %s %s \n" %(name,
-                                    str(sys.exc_type), sys.exc_value)
-                    log(msg)
-                finally:
-              
-                    if not file==None:
-                        file.close()
-    except:
-        # Don't deal with bad plug-in imports. Just skip.
-        pass
-    return plugins
-
-class ModelList(object):
-    """
-    Contains dictionary of model and their type
-    
-    """
-    def __init__(self):
-        self.mydict={}
-        
-    def set_list(self, name, mylist):
-        """
-        
-        :param name: the type of the list
-        :param mylist: the list to add
-        
-        """
-        if name not in self.mydict.keys():
-            self.mydict[name] = mylist
-            
-            
-    def get_list(self):
-        """
-        return all the list stored in a dictionary object
-        """
-        return self.mydict
-        
-class ModelManager:
-    """
-    ModelManager collected model classes object of available into a 
-    dictionary of models' names and models' classes.
-    
-    """
-    ## external dict for models
-    model_combobox = ModelList()
-    ## Dictionary of form models
-    form_factor_dict = {}
-    ## dictionary of other
-    struct_factor_dict = {}
-    ##list of form factors
-    shape_list =[]
-    ## independent shape model list
-    shape_indep_list = []
-    ##list of structure factors 
-    struct_list= []
-    ##list of model allowing multiplication
-    multiplication_factor=[]
-    ##list of multifunctional shapes
-    multi_func_list =[]
-    ## list of added models
-    plugins=[]
-    ## Event owner (guiframe)
-    event_owner = None
-    
-    def _getModelList(self):
-        """
-        Fill up lists of models available by default
-        for the current application
-    
-        :return: the next free event ID following the new menu events
-        
-        """
-        ## form factor
-        from sans.models.SphereModel import SphereModel
-        self.shape_list.append(SphereModel)
-        self.multiplication_factor.append(SphereModel)
-              
-        from sans.models.BinaryHSModel import BinaryHSModel
-        self.shape_list.append(BinaryHSModel)
-        
-        from sans.models.FuzzySphereModel import FuzzySphereModel
-        self.shape_list.append(FuzzySphereModel)
-        self.multiplication_factor.append(FuzzySphereModel)
-           
-        from sans.models.CoreShellModel import CoreShellModel
-        self.shape_list.append(CoreShellModel)
-        self.multiplication_factor.append(CoreShellModel)
-        
-        from sans.models.CoreMultiShellModel import CoreMultiShellModel
-        self.shape_list.append(CoreMultiShellModel)
-        self.multiplication_factor.append(CoreMultiShellModel)
-        self.multi_func_list.append(CoreMultiShellModel)
-
-        from sans.models.VesicleModel import VesicleModel
-        self.shape_list.append(VesicleModel)
-        self.multiplication_factor.append(VesicleModel)
-        
-        from sans.models.MultiShellModel import MultiShellModel
-        self.shape_list.append(MultiShellModel)
-        self.multiplication_factor.append(MultiShellModel)
-        
-        from sans.models.OnionExpShellModel import OnionExpShellModel
-        self.shape_list.append(OnionExpShellModel)
-        self.multiplication_factor.append(OnionExpShellModel)
-        self.multi_func_list.append(OnionExpShellModel)  
-        
-        from sans.models.SphericalSLDModel import SphericalSLDModel
-        self.shape_list.append(SphericalSLDModel)
-        self.multiplication_factor.append(SphericalSLDModel)
-        self.multi_func_list.append(SphericalSLDModel)
-        
-        
-        from sans.models.CylinderModel import CylinderModel
-        self.shape_list.append(CylinderModel)
-        self.multiplication_factor.append(CylinderModel)
-        
-        from sans.models.CoreShellCylinderModel import CoreShellCylinderModel
-        self.shape_list.append(CoreShellCylinderModel)
-        self.multiplication_factor.append(CoreShellCylinderModel)
-        
-        from sans.models.HollowCylinderModel import HollowCylinderModel
-        self.shape_list.append(HollowCylinderModel)
-        self.multiplication_factor.append(HollowCylinderModel)
-              
-        from sans.models.FlexibleCylinderModel import FlexibleCylinderModel
-        self.shape_list.append(FlexibleCylinderModel)
-
-        from sans.models.FlexCylEllipXModel import FlexCylEllipXModel
-        self.shape_list.append(FlexCylEllipXModel)
-        
-        from sans.models.StackedDisksModel import StackedDisksModel
-        self.shape_list.append(StackedDisksModel)
-        self.multiplication_factor.append(StackedDisksModel)
-        
-        from sans.models.ParallelepipedModel import ParallelepipedModel
-        self.shape_list.append(ParallelepipedModel)
-        self.multiplication_factor.append(ParallelepipedModel)
-        
-        from sans.models.CSParallelepipedModel import CSParallelepipedModel
-        self.shape_list.append(CSParallelepipedModel)
-        self.multiplication_factor.append(CSParallelepipedModel)
-        
-        from sans.models.EllipticalCylinderModel import EllipticalCylinderModel
-        self.shape_list.append(EllipticalCylinderModel)
-        self.multiplication_factor.append(EllipticalCylinderModel)
-        
-        from sans.models.BarBellModel import BarBellModel
-        self.shape_list.append(BarBellModel)
-        # not implemeted yet!
-        #self.multiplication_factor.append(BarBellModel)
-        
-        from sans.models.CappedCylinderModel import CappedCylinderModel
-        self.shape_list.append(CappedCylinderModel)
-        # not implemeted yet!
-        #self.multiplication_factor.append(CappedCylinderModel)
-        
-        from sans.models.EllipsoidModel import EllipsoidModel
-        self.shape_list.append(EllipsoidModel)
-        self.multiplication_factor.append(EllipsoidModel)
-      
-        from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel
-        self.shape_list.append(CoreShellEllipsoidModel)
-        self.multiplication_factor.append(CoreShellEllipsoidModel)
-         
-        from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel
-        self.shape_list.append(TriaxialEllipsoidModel)
-        self.multiplication_factor.append(TriaxialEllipsoidModel)
-        
-        from sans.models.LamellarModel import LamellarModel
-        self.shape_list.append(LamellarModel)
-        
-        from sans.models.LamellarFFHGModel import LamellarFFHGModel
-        self.shape_list.append(LamellarFFHGModel)
-        
-        from sans.models.LamellarPSModel import LamellarPSModel
-        self.shape_list.append(LamellarPSModel)
-     
-        from sans.models.LamellarPSHGModel import LamellarPSHGModel
-        self.shape_list.append(LamellarPSHGModel)
-        
-        from sans.models.LamellarPCrystalModel import LamellarPCrystalModel
-        self.shape_list.append(LamellarPCrystalModel)
-        
-        from sans.models.SCCrystalModel import SCCrystalModel
-        self.shape_list.append(SCCrystalModel)
-        
-        from sans.models.FCCrystalModel import FCCrystalModel
-        self.shape_list.append(FCCrystalModel)
-        
-        from sans.models.BCCrystalModel import BCCrystalModel
-        self.shape_list.append(BCCrystalModel)
-      
-        ## Structure factor 
-        from sans.models.SquareWellStructure import SquareWellStructure
-        self.struct_list.append(SquareWellStructure)
-        
-        from sans.models.HardsphereStructure import HardsphereStructure
-        self.struct_list.append(HardsphereStructure)
-         
-        from sans.models.StickyHSStructure import StickyHSStructure
-        self.struct_list.append(StickyHSStructure)
-        
-        from sans.models.HayterMSAStructure import HayterMSAStructure
-        self.struct_list.append(HayterMSAStructure)
-        
-        
-        ##shape-independent models
-            
-        from sans.models.PowerLawAbsModel import PowerLawAbsModel
-        self.shape_indep_list.append( PowerLawAbsModel )
-        
-        from sans.models.BEPolyelectrolyte import BEPolyelectrolyte
-        self.shape_indep_list.append(BEPolyelectrolyte )
-        self.form_factor_dict[str(wx.NewId())] =  [SphereModel]
-        
-        from sans.models.BroadPeakModel import BroadPeakModel
-        self.shape_indep_list.append(BroadPeakModel)
-        
-        from sans.models.CorrLengthModel import CorrLengthModel
-        self.shape_indep_list.append(CorrLengthModel)
-        
-        from sans.models.DABModel import DABModel
-        self.shape_indep_list.append(DABModel )
-        
-        from sans.models.DebyeModel import DebyeModel
-        self.shape_indep_list.append(DebyeModel )
-        
-        #FractalModel (a c-model)is now being used instead of FractalAbsModel.
-        from sans.models.FractalModel import FractalModel
-        self.shape_indep_list.append(FractalModel )
-        
-        from sans.models.FractalCoreShellModel import FractalCoreShellModel
-        self.shape_indep_list.append(FractalCoreShellModel )
-        
-        from sans.models.GaussLorentzGelModel import GaussLorentzGelModel
-        self.shape_indep_list.append(GaussLorentzGelModel) 
-                
-        from sans.models.GuinierModel import GuinierModel
-        self.shape_indep_list.append(GuinierModel )
-        
-        from sans.models.GuinierPorodModel import GuinierPorodModel
-        self.shape_indep_list.append(GuinierPorodModel )
-
-        from sans.models.LorentzModel import LorentzModel
-        self.shape_indep_list.append( LorentzModel) 
-        
-        from sans.models.PeakGaussModel import PeakGaussModel
-        self.shape_indep_list.append(PeakGaussModel)
-        
-        from sans.models.PeakLorentzModel import PeakLorentzModel
-        self.shape_indep_list.append(PeakLorentzModel)
-        
-        from sans.models.Poly_GaussCoil import Poly_GaussCoil
-        self.shape_indep_list.append(Poly_GaussCoil)
-        
-        from sans.models.PolymerExclVolume import PolymerExclVolume
-        self.shape_indep_list.append(PolymerExclVolume)
-        
-        from sans.models.PorodModel import PorodModel
-        self.shape_indep_list.append(PorodModel )      
-        
-        from sans.models.RPA10Model import RPA10Model
-        self.shape_indep_list.append(RPA10Model)
-        self.multi_func_list.append(RPA10Model)
-        
-        from sans.models.TeubnerStreyModel import TeubnerStreyModel
-        self.shape_indep_list.append(TeubnerStreyModel )
-        
-        from sans.models.TwoLorentzianModel import TwoLorentzianModel
-        self.shape_indep_list.append(TwoLorentzianModel )
-        
-        from sans.models.TwoPowerLawModel import TwoPowerLawModel
-        self.shape_indep_list.append(TwoPowerLawModel )
-        
-        from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel
-        self.shape_indep_list.append(UnifiedPowerRgModel )
-        self.multi_func_list.append(UnifiedPowerRgModel)
-        
-        from sans.models.LineModel import LineModel
-        self.shape_indep_list.append(LineModel)
-        
-        from sans.models.ReflectivityModel import ReflectivityModel
-        self.multi_func_list.append(ReflectivityModel)
-        
-        from sans.models.ReflectivityIIModel import ReflectivityIIModel
-        self.multi_func_list.append(ReflectivityIIModel)
-        
-        #Looking for plugins
-        self.plugins = findModels()
-        self._get_multifunc_models()
-        self.plugins.append(ReflectivityModel)
-        self.plugins.append(ReflectivityIIModel)
-        return 0
-
-    def get_model_list(self):    
-        """ 
-        :return: dictionary of models for fitpanel use 
-        
-        """
-        self._getModelList()
-        self.model_combobox.set_list("Shapes", self.shape_list)
-        self.model_combobox.set_list("Shape-Independent", self.shape_indep_list)
-        self.model_combobox.set_list("Structure Factors", self.struct_list)
-        self.model_combobox.set_list("Customized Models", self.plugins)
-        self.model_combobox.set_list("P(Q)*S(Q)", self.multiplication_factor)
-        self.model_combobox.set_list("multiplication", self.multiplication_factor)
-        self.model_combobox.set_list("Multi-Functions", self.multi_func_list)
-        return self.model_combobox
-        
-    def _get_multifunc_models(self):
-        """
-        Get the multifunctional models
-        """
-        for item in self.plugins:
-            try:
-                # check the multiplicity if any
-                if item.multiplicity_info[0] > 1:
-                    self.multi_func_list.append(item)
-            except:
-                # pass to other items
-                pass
Index: eoryview/perspectives/theory/pagestate.py
===================================================================
--- theoryview/perspectives/theory/pagestate.py	(revision fb59ed90d8d3e021f0f291a9064098aae148158d)
+++ 	(revision )
@@ -1,214 +1,0 @@
-
-
-import copy
-
-class PageState(object):
-    """
-    Contains info to reconstruct a page
-    
-    """
-    def __init__(self, parent,model=None, data=None):
-        
-        """ 
-        Initialization of the Panel
-        
-        """
-        #TODO: remove this once the inheritence is cleaned up
-        ## Data member to store the dispersion object created
-        self._disp_obj_dict = {}
-        ## reset True change the state of exsiting button
-        self.reset = False
-        #Data used for fitting 
-        self.data = data
-        #engine type
-        self.engine_type = None
-        # flag to allow data2D plot
-        self.enable2D = False
-        # model on which the fit would be performed
-        self.model = model
-        #if not hasattr(self.model, "_persistency_dict"):
-        #    self.model._persistency_dict = {}
-        #self.model._persistency_dict = copy.deepcopy(model._persistency_dict)
-        #fit page manager 
-        self.manager = None
-        #Store the parent of this panel parent
-        # For this application fitpanel is the parent
-        self.parent  = parent
-        # Event_owner is the owner of model event
-        self.event_owner = None
-        ##page name
-        self.page_name = ""
-        # Contains link between  model ,all its parameters, and panel organization
-        self.parameters =[]
-        # String parameter list that can not be fitted
-        self.str_parameters = []
-        # Contains list of parameters that cannot be fitted and reference to 
-        #panel objects 
-        self.fixed_param =[]
-        # Contains list of parameters with dispersity and reference to 
-        #panel objects 
-        self.fittable_param =[]
-        ## orientation parameters
-        self.orientation_params=[]
-        ## orientation parmaters for gaussian dispersity
-        self.orientation_params_disp=[]
-        ## smearer info
-        self.smearer=None
-        #list of dispersion paramaters
-        self.disp_list =[]
-        if self.model !=None:
-            self.disp_list = self.model.getDispParamList()
-        self._disp_obj_dict={}
-        self.disp_cb_dict={}
-        self.values=[]
-        self.weights=[]
-                    
-        #contains link between a model and selected parameters to fit 
-        self.param_toFit =[]
-        ##dictionary of model type and model class
-        self.model_list_box = None
-        ## save the state of the context menu
-        self.saved_states={}
-        ## save selection of combobox
-        self.formfactorcombobox = None
-        self.structurecombobox  = None
-        ## radio box to select type of model
-        self.shape_rbutton = False
-        self.shape_indep_rbutton = False
-        self.struct_rbutton = False
-        self.plugin_rbutton = False
-        ## the indice of the current selection
-        self.disp_box = 0
-        ## Qrange
-        ## Q range
-        self.qmin= 0.001
-        self.qmax= 0.1
-        self.npts = None
-        self.name=""
-        self.multi_factor = None
-        ## enable smearering state
-        self.enable_smearer = False
-        self.disable_smearer = True
-        ## disperity selection
-        self.enable_disp= False
-        self.disable_disp= True
-        ## plot 2D data
-        self.enable2D= False
-        ## state of selected all check button
-        self.cb1 = False
-        ## store value of chisqr
-        self.tcChi= None
-    
-    def clone(self):
-        """
-        """
-        model=None
-        if self.model !=None:
-            model = self.model.clone()
-        
-        obj          = PageState( self.parent,model= model )
-        obj.data = copy.deepcopy(self.data)
-        obj.model_list_box = copy.deepcopy(self.model_list_box)
-        obj.engine_type = copy.deepcopy(self.engine_type)
-        
-        obj.formfactorcombobox= self.formfactorcombobox
-        obj.structurecombobox  =self.structurecombobox  
-        
-        obj.shape_rbutton = self.shape_rbutton 
-        obj.shape_indep_rbutton = self.shape_indep_rbutton
-        obj.struct_rbutton = self.struct_rbutton
-        obj.plugin_rbutton = self.plugin_rbutton
-        
-        obj.manager = self.manager
-        obj.event_owner = self.event_owner
-        obj.disp_list = copy.deepcopy(self.disp_list)
-        
-        obj.enable2D = copy.deepcopy(self.enable2D)
-        obj.parameters = copy.deepcopy(self.parameters)
-        obj.str_parameters = copy.deepcopy(self.str_parameters)
-        obj.fixed_param = copy.deepcopy(self.fixed_param)
-        obj.fittable_param = copy.deepcopy(self.fittable_param)
-        obj.orientation_params =  copy.deepcopy(self.orientation_params)
-        obj.orientation_params_disp =  copy.deepcopy(self.orientation_params_disp)
-        obj.enable_disp = copy.deepcopy(self.enable_disp)
-        obj.disable_disp = copy.deepcopy(self.disable_disp)
-        obj.tcChi = self.tcChi
-  
-        if len(self._disp_obj_dict)>0:
-            for k , v in self._disp_obj_dict.iteritems():
-                obj._disp_obj_dict[k]= v
-        if len(self.disp_cb_dict)>0:
-            for k , v in self.disp_cb_dict.iteritems():
-                obj.disp_cb_dict[k]= v
-                
-        obj.values = copy.deepcopy(self.values)
-        obj.weights = copy.deepcopy(self.weights)
-        obj.enable_smearer = copy.deepcopy(self.enable_smearer)
-        obj.disable_smearer = copy.deepcopy(self.disable_smearer)
-       
-        obj.disp_box = copy.deepcopy(self.disp_box)
-        obj.qmin = copy.deepcopy(self.qmin)
-        obj.qmax = copy.deepcopy(self.qmax)
-        obj.multi_factor = copy.deepcopy(self.multi_factor)
-        obj.npts = copy.deepcopy(self.npts )
-        obj.cb1 = copy.deepcopy(self.cb1)
-        obj.smearer = copy.deepcopy(self.smearer)
-        
-        for name, state in self.saved_states.iteritems():
-            copy_name = copy.deepcopy(name)
-            copy_state = state.clone()
-            obj.saved_states[copy_name]= copy_state
-        return obj
-
-      
-    def old__repr__(self):
-        """
-        output string for printing
-        
-        """
-        rep = "\n\nState name: %s\n"%self.name
-        rep +="data : %s\n"% str(self.data)
-        rep += "Plotting Range: min: %s, max: %s, steps: %s\n"%(str(self.qmin),
-                                                str(self.qmax),str(self.npts))
-        rep +="model  : %s\n\n"% str(self.model)
-        rep +="number parameters(self.parameters): %s\n"%len(self.parameters)
-        for item in self.parameters:
-            rep += "parameter name: %s \n"%str(item[1])
-            rep += "value: %s\n"%str(item[2])
-            rep += "selected: %s\n"%str(item[0])
-            rep += "error displayed : %s \n"%str(item[4][0])
-            rep += "error value:%s \n"%str(item[4][1])
-            rep += "minimum displayed : %s \n"%str(item[5][0])
-            rep += "minimum value : %s \n"%str(item[5][1])
-            rep += "maximum displayed : %s \n"%str(item[6][0])
-            rep += "maximum value : %s \n"%str(item[6][1])
-            rep += "parameter unit: %s\n\n"%str(item[7])
-        rep += "number str_parameters(self.str_parameters): %s\n"%len(self.str_parameters)
-        rep +="number orientation parameters"
-        rep +="(self.orientation_params): %s\n"%len(self.orientation_params)
-        for item in self.orientation_params:
-            rep += "parameter name: %s \n"%str(item[1])
-            rep += "value: %s\n"%str(item[2])
-            rep += "selected: %s\n"%str(item[0])
-            rep += "error displayed : %s \n"%str(item[4][0])
-            rep += "error value:%s \n"%str(item[4][1])
-            rep += "minimum displayed : %s \n"%str(item[5][0])
-            rep += "minimum value : %s \n"%str(item[5][1])
-            rep += "maximum displayed : %s \n"%str(item[6][0])
-            rep += "maximum value : %s \n"%str(item[6][1])
-            rep += "parameter unit: %s\n\n"%str(item[7])
-        rep +="number dispersity parameters"
-        rep +="(self.orientation_params_disp): %s\n"%len(self.orientation_params_disp)
-        for item in self.orientation_params_disp:
-            rep += "parameter name: %s \n"%str(item[1])
-            rep += "value: %s\n"%str(item[2])
-            rep += "selected: %s\n"%str(item[0])
-            rep += "error displayed : %s \n"%str(item[4][0])
-            rep += "error value:%s \n"%str(item[4][1])
-            rep += "minimum displayed : %s \n"%str(item[5][0])
-            rep += "minimum value : %s \n"%str(item[5][1])
-            rep += "maximum displayed : %s \n"%str(item[6][0])
-            rep += "maximum value : %s \n"%str(item[6][1])
-            rep += "parameter unit: %s\n\n"%str(item[7])
-        return rep
-  
Index: eoryview/perspectives/theory/profile_dialog.py
===================================================================
--- theoryview/perspectives/theory/profile_dialog.py	(revision b5181f6750efa842c71bba8c1fa01d16cfad1bd2)
+++ 	(revision )
@@ -1,196 +1,0 @@
-
-
-
-import wx
-import sys
-import pylab
-from copy import deepcopy
-from danse.common.plottools.PlotPanel import PlotPanel
-from danse.common.plottools.plottables import Graph
-from sans.guiframe.dataFitting import Theory1D
-
-
-DEFAULT_CMAP = pylab.cm.jet
-
-_BOX_WIDTH = 76
-_STATICBOX_WIDTH = 400
-_SCALE = 1e-6
-
-#SLD panel size 
-if sys.platform.count("win32") > 0:
-    _STATICBOX_WIDTH = 380
-    PANEL_SIZE = 475
-    FONT_VARIANT = 0
-else:
-    _STATICBOX_WIDTH = 410
-    PANEL_SIZE = 505
-    FONT_VARIANT = 1
-    
-
-            
-class SLDPanel(wx.Dialog):
-    """
-    Provides the SLD profile plot panel.
-    """
-    ## Internal nickname for the window, used by the AUI manager
-    window_name = "SLD Profile"
-    ## Name to appear on the window title bar
-    window_caption = "SLD Profile"
-    ## Flag to tell the AUI manager to put this panel in the center pane
-    CENTER_PANE = True
-    def __init__(self, parent=None, base=None ,data=None,
-                 axes =['Radius'], id = -1, *args, **kwds):
-        kwds["style"] =  wx.DEFAULT_DIALOG_STYLE
-        kwds["size"] = wx.Size(_STATICBOX_WIDTH * 1.5,PANEL_SIZE) 
-        wx.Dialog.__init__(self, parent, id=id,  *args, **kwds)
-        
-        if data is not None:
-            #Font size 
-            kwds = []
-            self.SetWindowVariant(variant=FONT_VARIANT)
-            self.SetTitle("Scattering Length Density Profile")
-            self.parent = base
-            self.data = data
-            self.str = self.data.__str__()
-            ## when 2 data have the same id override the 1 st plotted
-            self.name = self.data.name
-            # Panel for plot
-            self.plotpanel = SLDplotpanel(self, axes, -1, 
-                                             style=wx.TRANSPARENT_WINDOW)
-            self.cmap = DEFAULT_CMAP
-            ## Create Artist and bind it
-            self.subplot = self.plotpanel.subplot
-            self._setup_layout()
-            data_plot = deepcopy(self.data)
-            self.newplot=Theory1D(data_plot.x,data_plot.y)
-            self.newplot.name = 'SLD'
-            self.plotpanel.add_image(self.newplot) 
-            self.Centre()
-            self.Layout()
-            
-    def _setup_layout(self):
-        """
-        Set up the layout
-        """
-        #  panel
-        sizer = wx.GridBagSizer(14,14)
-        
-        sizer.Add(self.plotpanel,(0, 0), (13, 13), 
-                  wx.EXPAND|wx.LEFT| wx.RIGHT, 1)
-
-        #-----Button------------1
-        id = wx.NewId()
-        button_reset = wx.Button(self, id, "Close")
-        button_reset.SetToolTipString("Close...")
-        button_reset.Bind(wx.EVT_BUTTON, self._close,
-                           id=button_reset.GetId()) 
-        sizer.Add(button_reset, (13, 12), 
-                  flag=wx.RIGHT|wx.BOTTOM, border=15)
-        sizer.AddGrowableCol(2)
-        sizer.AddGrowableRow(3)
-        self.SetSizerAndFit(sizer)
-        button_reset.SetFocus()
-        self.Centre()
-        self.Show(True)
-
-    def _close(self, event):
-        """
-        Close the dialog
-        """
-        
-        self.Close(True)
-
-    def _draw_model(self,event):
-        """
-         on_close, update the model2d plot
-        """
-        pass
-
-           
-class SLDplotpanel(PlotPanel):
-    """
-    Panel
-    """
-    def __init__(self, parent, axes=[], id=-1, color=None,
-                  dpi=None, **kwargs):
-        """
-        """
-        PlotPanel.__init__(self, parent, id=id, 
-                           color=color, dpi=dpi, **kwargs)
-        # Keep track of the parent Frame
-        self.parent = parent
-        # Internal list of plottable names (because graph 
-        # doesn't have a dictionary of handles for the plottables)
-        self.plots = {}
-        self.graph = Graph()
-        self.axes_label = []
-        for idx in range(0,len(axes)):
-            self.axes_label.append(axes[idx])
-         
-    def add_image(self, plot):
-        """
-        Add image(Theory1D)
-        """
-        self.plots[plot.name] = plot
-        #init graph
-        self.gaph = Graph()
-        #add plot
-        self.graph.add(plot)
-        #add axes
-        x1_label = self.axes_label[0]
-        self.graph.xaxis('\\rm{%s} ' % x1_label, '\\AA')
-        self.graph.yaxis('\\rm{SLD} ', '\\AA^{-2}')
-        #draw
-        self.graph.render(self)
-        self.subplot.figure.canvas.draw_idle()
-        
-    def onContextMenu(self, event):
-        """
-        Default context menu for a plot panel
-        
-        """
-        pass
-    
-    def on_set_focus(self, event):
-        """
-        send to the parenet the current panel on focus
-        
-        """
-        #Not implemented
-        pass
-
-    def on_kill_focus(self, event):
-        """
-        reset the panel color
-        
-        """
-        #Not implemented
-        pass
-
-
-class ViewerFrame(wx.Frame):
-    """
-    Add comment
-    """
-    def __init__(self, parent, id, title):
-        """
-        comment
-        :param parent: parent panel/container
-        """
-        # Initialize the Frame object
-        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition,
-                           wx.Size(950, 850))
-        # Panel for 1D plot
-        self.plotpanel    = SLDplotpanel(self, -1, style=wx.RAISED_BORDER)
-
-class ViewApp(wx.App):
-    def OnInit(self):
-        frame = ViewerFrame(None, -1, 'testView')    
-        frame.Show(True)
-        self.SetTopWindow(frame)
-        
-        return True
-               
-if __name__ == "__main__": 
-    app = ViewApp(0)
-    app.MainLoop()     
Index: eoryview/perspectives/theory/theory.py
===================================================================
--- theoryview/perspectives/theory/theory.py	(revision 946d1b1bf80ce69a36c54a69c4670d58f3a58224)
+++ 	(revision )
@@ -1,442 +1,0 @@
-
-import wx
-import sys
-import numpy
-import math
-import logging
-
-import models
-import model_panel
-from model_panel import ModelPanel
-from sans.guiframe.events import NewPlotEvent
-from sans.guiframe.events import StatusEvent 
-from sans.guiframe.dataFitting import Data2D
-from sans.guiframe.dataFitting import Theory1D
-
-DEFAULT_BEAM = 0.005
-DEFAULT_QMIN = 0.001
-DEFAULT_QMAX = 0.13
-DEFAULT_NPTS = 50
-
-
-class PlotInfo:
-    """
-    store some plotting field
-    
-    """
-    _xunit = 'A^{-1}'
-    _xaxis= "\\rm{Q}"
-    _yunit = "cm^{-1}"
-    _yaxis= "\\rm{Intensity} "
-    id = "Model"
-    group_id = "Model"
-    title= None
-    info= None
-    
-from sans.guiframe.plugin_base import PluginBase  
-
-class Plugin(PluginBase):
-    """
-    This class defines the interface for a Plugin class
-    for calculator perspective
-    
-    """
-    
-    def __init__(self, standalone=True):
-        PluginBase.__init__(self, name="Theory", standalone=standalone)
-        
-        # Log startup
-        logging.info("Theory plug-in started")   
-        
-        #Provide list of models existing in the application
-        self.menu_mng = models.ModelManager()
-        # reference to the current running thread
-        self.calc_2D = None
-        self.calc_1D = None
-   
-    def use_data(self):
-        """
-        return True if these plugin use data
-        """
-        return False
-    
-    def get_panels(self, parent):
-        """
-        Create and return the list of wx.Panels for your plug-in.
-        Define the plug-in perspective.
-        
-        Panels should inherit from DefaultPanel defined below,
-        or should present the same interface. They must define
-        "window_caption" and "window_name".
-        
-        :param parent: parent window
-        
-        :return: list of panels
-        """
-        ## Save a reference to the parent
-        self.parent = parent
-        # Define a panel
-        self.model_panel= ModelPanel(self.parent, page_info =None,
-                model_list_box= self.menu_mng.get_model_list().get_list())
-        self.model_panel.set_manager(self)
-        # If needed, add its name to the perspective list
-        self.perspective.append(self.model_panel.window_name)
-        self.parent.Bind(model_panel.EVT_MODEL_BOX,self._on_model_panel)
-        # Return the list of panels
-        return [self.model_panel]
-    
-   
-    def draw_model(self, model, data= None,smearer= None,
-                   enable1D= True, enable2D= False,
-                   qmin= DEFAULT_QMIN, qmax= DEFAULT_QMAX, qstep= DEFAULT_NPTS):
-        """
-        Draw model.
-         
-        :param model: the model to draw
-        :param name: the name of the model to draw
-        :param data: the data on which the model is based to be drawn
-        :param description: model's description
-        :param enable1D: if true enable drawing model 1D
-        :param enable2D: if true enable drawing model 2D
-        :param qmin:  Range's minimum value to draw model
-        :param qmax:  Range's maximum value to draw model
-        :param qstep: number of step to divide the x and y-axis
-             
-        """
-        ## draw model 1D with no loaded data
-        self._draw_model1D( model= model, data= data,enable1D=enable1D, smearer= smearer,
-                           qmin= qmin, qmax= qmax, qstep= qstep )
-        ## draw model 2D with no initial data
-        self._draw_model2D(model=model,
-                           data = data,
-                           enable2D= enable2D,
-                           qmin=qmin,
-                           qmax=qmax,
-                           qstep=qstep)
-        
-    def _on_model_panel(self, evt):
-        """
-        react to model selection on any combo box or model menu.plot the model 
-         
-        :param evt: wx.combobox event
-        
-        """
-        model = evt.model
-        qmin = evt.qmin
-        qmax = evt.qmax
-        qstep = evt.qstep
-        if model ==None:
-            return
-        # save model name
-        self.draw_model(model=model, qmin=qmin, qmax=qmax, qstep=qstep)
-        
-    def _draw_model2D(self,model,data=None, enable2D=False,
-                      qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, qstep=DEFAULT_NPTS):
-        """
-        draw model in 2D
-        
-        :param model: instance of the model to draw
-        :param enable2D: when True allows to draw model 2D
-        :param qmin: the minimum value to  draw model 2D
-        :param qmax: the maximum value to draw model 2D
-        :param qstep: the number of division of Qx and Qy of the model to draw
-        
-        """
-        x=  numpy.linspace(start= -1*qmax,
-                               stop= qmax,
-                               num= qstep,
-                               endpoint=True )  
-        y = numpy.linspace(start= -1*qmax,
-                               stop= qmax,
-                               num= qstep,
-                               endpoint=True )
-         
-        ## use data info instead
-        if data !=None:
-            ## check if data2D to plot
-            if hasattr(data, "x_bins"):
-                enable2D = True
-                x= data.x_bins
-                y= data.y_bins
-
-        if not enable2D:
-            return
-        try:
-            from model_thread import Calc2D
-            ## If a thread is already started, stop it
-            if self.calc_2D != None and self.calc_2D.isrunning():
-                self.calc_2D.stop()
-            self.calc_2D = Calc2D(  x= x,
-                                    y= y,
-                                    model= model, 
-                                    data = data,
-                                    qmin= qmin,
-                                    qmax= qmax,
-                                    qstep= qstep,
-                                    completefn= self._complete2D,
-                                    updatefn= self._update2D )
-            self.calc_2D.queue()
-            
-        except:
-            raise
-            #msg= " Error occurred when drawing %s Model 2D: "%model.name
-            #msg+= " %s"%sys.exc_value
-            #wx.PostEvent( self.parent, StatusEvent(status= msg ))
-            #return  
-   
-    def _draw_model1D(self, model, data=None, smearer= None,
-                qmin=DEFAULT_QMIN, qmax=DEFAULT_QMAX, qstep= DEFAULT_NPTS,
-                enable1D= True):
-        """
-        Draw model 1D from loaded data1D
-        
-        :param data: loaded data
-        :param model: the model to plot
-        
-        """
-        x=  numpy.linspace(start= qmin,
-                           stop= qmax,
-                           num= qstep,
-                           endpoint=True
-                           )
-        if data!=None:
-            ## check for data2D
-            if hasattr(data,"x_bins"):
-                return
-            x = data.x
-            if qmin == DEFAULT_QMIN :
-                qmin = min(data.x)
-            if qmax == DEFAULT_QMAX:
-                qmax = max(data.x) 
-           
-        
-        if not enable1D:
-            return
-    
-        try:
-            from model_thread import Calc1D
-            ## If a thread is already started, stop it
-            if self.calc_1D!= None and self.calc_1D.isrunning():
-                self.calc_1D.stop()
-            self.calc_1D= Calc1D( x= x,
-                                  data = data,
-                                  model= model, 
-                                  qmin = qmin,
-                                  qmax = qmax,
-                                  smearer = smearer,
-                                  completefn = self._complete1D,
-                                  updatefn = self._update1D  )
-            self.calc_1D.queue()
-            
-        except:
-            msg = " Error occurred when drawing %s Model 1D: "%model.name
-            msg += " %s"%sys.exc_value
-            wx.PostEvent(self.parent, StatusEvent(status=msg))
-            
-    def _update1D(self,x, output):
-        """
-        Update the output of plotting model 1D
-        
-        """
-        wx.PostEvent(self.parent, StatusEvent(status="Plot \
-        #updating ... ",type="update"))
-        self.ready_fit()
-        #self.calc_thread.ready(0.01)
-
-    def _fill_default_model2D(self, theory, qmax,qstep, qmin=None):
-        """
-        fill Data2D with default value 
-        
-        :param theory: Data2D to fill
-        
-        """
-        from DataLoader.data_info import Detector, Source
-        
-        detector = Detector()
-        theory.detector.append(detector)         
-        theory.source= Source()
-        
-        ## Default values    
-        theory.detector[0].distance= 8000   # mm        
-        theory.source.wavelength= 6         # A      
-        theory.detector[0].pixel_size.x= 5  # mm
-        theory.detector[0].pixel_size.y= 5  # mm
-        
-        theory.detector[0].beam_center.x= qmax
-        theory.detector[0].beam_center.y= qmax
-        
-        
-        ## create x_bins and y_bins of the model 2D
-        pixel_width_x = theory.detector[0].pixel_size.x
-        pixel_width_y = theory.detector[0].pixel_size.y
-        center_x      = theory.detector[0].beam_center.x/pixel_width_x
-        center_y      = theory.detector[0].beam_center.y/pixel_width_y
-
-        # theory default: assume the beam center is located at the center of sqr detector
-        xmax = qmax
-        xmin = -qmax
-        ymax = qmax
-        ymin = -qmax
-        
-        x=  numpy.linspace(start= -1*qmax,
-                               stop= qmax,
-                               num= qstep,
-                               endpoint=True )  
-        y = numpy.linspace(start= -1*qmax,
-                               stop= qmax,
-                               num= qstep,
-                               endpoint=True )
-         
-        ## use data info instead
-        new_x = numpy.tile(x, (len(y),1))
-        new_y = numpy.tile(y, (len(x),1))
-        new_y = new_y.swapaxes(0,1)
-        
-        # all data reuire now in 1d array
-        qx_data = new_x.flatten()
-        qy_data = new_y.flatten()
-        
-        q_data = numpy.sqrt(qx_data*qx_data+qy_data*qy_data)
-        # set all True (standing for unmasked) as default
-        mask    = numpy.ones(len(qx_data), dtype = bool)
-        
-        # calculate the range of qx and qy: this way, it is a little more independent
-        x_size = xmax- xmin
-        y_size = ymax -ymin
-        
-        # store x and y bin centers in q space
-        x_bins  = x
-        y_bins  = y 
-        # bin size: x- & y-directions
-        xstep = x_size/len(x_bins-1)
-        ystep = y_size/len(y_bins-1)
-        
-        #theory.data = numpy.zeros(len(mask))
-        theory.err_data = numpy.ones(len(mask))
-        theory.qx_data = qx_data 
-        theory.qy_data = qy_data  
-        theory.q_data = q_data 
-        theory.mask = mask            
-        theory.x_bins = x_bins  
-        theory.y_bins = y_bins   
-        
-        # max and min taking account of the bin sizes
-        theory.xmin= xmin 
-        theory.xmax= xmax 
-        theory.ymin= ymin
-        theory.ymax= ymax 
-        theory.group_id = "Model"
-        theory.id = "Model"
-        
-    def _get_plotting_info(self, data=None):
-        """
-        get plotting info from data if data !=None
-        else use some default
-        
-        """
-        my_info = PlotInfo()
-        if data !=None:
-            if hasattr(data,"info"):
-                x_name, x_units = data.get_xaxis() 
-                y_name, y_units = data.get_yaxis() 
-                
-                my_info._xunit = x_units
-                my_info._xaxis = x_name
-                my_info._yunit = y_units
-                my_info._yaxis = y_name
-                
-            my_info.title= data.name
-            if hasattr(data, "info"):
-                my_info.info= data.info
-            if hasattr(data, "group_id"):
-                my_info.group_id= data.group_id
-        
-        return my_info
-                
-    def _complete1D(self, x,y, elapsed,model,data=None):
-        """
-        Complete plotting 1D data
-        
-        """ 
-       
-        try:
-            new_plot = Theory1D(x=x, y=y)
-            my_info = self._get_plotting_info( data)
-            new_plot.name = model.name
-            new_plot.id = my_info.id
-            new_plot.group_id = my_info.group_id
-            
-            new_plot.xaxis( my_info._xaxis,  my_info._xunit)
-            new_plot.yaxis( my_info._yaxis, my_info._yunit)
-            if data!=None:
-                if new_plot.id == data.id:
-                    new_plot.id += "Model"
-                new_plot.is_data =False 
-           
-            # Pass the reset flag to let the plotting event handler
-            # know that we are replacing the whole plot
-           
-            title = "Analytical model 1D "
-            if data ==None:
-                wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
-                             title= str(title), reset=True ))
-            else:
-                wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot,
-                             title= str(title)))
-            msg = "Plot 1D  complete !"
-            wx.PostEvent( self.parent, StatusEvent( status= msg , type="stop" ))
-        except:
-            msg= " Error occurred when drawing %s Model 1D: "%new_plot.name
-            msg+= " %s"%sys.exc_value
-            wx.PostEvent( self.parent, StatusEvent(status= msg, type="stop"  ))
-            return  
-                  
-    def _update2D(self, output,time=None):
-        """
-        Update the output of plotting model
-        
-        """
-        wx.PostEvent(self.parent, StatusEvent(status="Plot \
-        #updating ... ",type="update"))
-        self.ready_fit()
-        #self.calc_thread.ready(0.01)
-        
-    def _complete2D(self, image,data, model,  elapsed,qmin, qmax,qstep=DEFAULT_NPTS):
-        """
-        Complete get the result of modelthread and create model 2D
-        that can be plot.
-        
-        """
-        err_image = numpy.zeros(numpy.shape(image))
-       
-        theory= Data2D(image= image , err_image= err_image)
-        theory.name= model.name
-
-        if data ==None:
-            self._fill_default_model2D(theory= theory, qmax=qmax,qstep=qstep, qmin= qmin)
-        
-        else:
-            theory.id= data.id+"Model"
-            theory.group_id= data.name+"Model"
-            theory.x_bins= data.x_bins
-            theory.y_bins= data.y_bins
-            theory.detector= data.detector
-            theory.source= data.source
-            theory.is_data =False 
-            theory.qx_data = data.qx_data
-            theory.qy_data = data.qy_data
-            theory.q_data = data.q_data
-            theory.err_data = err_image#numpy.zeros(len(data.err_data))
-            theory.mask = data.mask
-            ## plot boundaries
-            theory.ymin= data.ymin
-            theory.ymax= data.ymax
-            theory.xmin= data.xmin
-            theory.xmax= data.xmax
-       
-        ## plot
-        wx.PostEvent(self.parent, NewPlotEvent(plot=theory,
-                         title="Analytical model 2D ", reset=True ))
-        msg = "Plot 2D complete !"
-        wx.PostEvent( self.parent, StatusEvent( status= msg , type="stop" ))
-     
Index: eoryview/setup.py
===================================================================
--- theoryview/setup.py	(revision 0277d084dedd5afcedd8dd067ab01cf0fee53b12)
+++ 	(revision )
@@ -1,15 +1,0 @@
-"""
-     Installation script for DANSE calculator perspective for SansView
-"""
-
-from distutils.core import setup
-
-setup(
-    name="theory",
-    description = "theory perspective for SansView",
-    package_dir = {"sans.perspectives":"perspectives",
-                   "sans.perspectives.theory":"perspectives/theory"},
-    packages = ["sans.perspectives",
-                "sans.perspectives.theory"],
-    )
-
