Changeset 6592f56 in sasmodels for sasmodels/generate.py


Ignore:
Timestamp:
Sep 12, 2016 1:37:18 AM (5 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
b217c71
Parents:
7b68dc5
Message:

view plugin model docs from sasview console

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/generate.py

    r52ec91e r6592f56  
    706706    Iq_units = "The returned value is scaled to units of |cm^-1| |sr^-1|, absolute scale." 
    707707    Sq_units = "The returned value is a dimensionless structure factor, $S(q)$." 
    708     docs = convert_section_titles_to_boldface(model_info.docs) 
     708    docs = model_info.docs if model_info.docs is not None else "" 
     709    docs = convert_section_titles_to_boldface(docs) 
    709710    pars = make_partable(model_info.parameters.COMMON 
    710711                         + model_info.parameters.kernel_parameters) 
     
    718719 
    719720 
     721# TODO: need a single source for rst_prolog; it is also in doc/rst_prolog 
     722RST_PROLOG = """\ 
     723.. |Ang| unicode:: U+212B 
     724.. |Ang^-1| replace:: |Ang|\ :sup:`-1` 
     725.. |Ang^2| replace:: |Ang|\ :sup:`2` 
     726.. |Ang^-2| replace:: |Ang|\ :sup:`-2` 
     727.. |1e-6Ang^-2| replace:: 10\ :sup:`-6`\ |Ang|\ :sup:`-2` 
     728.. |Ang^3| replace:: |Ang|\ :sup:`3` 
     729.. |Ang^-3| replace:: |Ang|\ :sup:`-3` 
     730.. |Ang^-4| replace:: |Ang|\ :sup:`-4` 
     731.. |cm^-1| replace:: cm\ :sup:`-1` 
     732.. |cm^2| replace:: cm\ :sup:`2` 
     733.. |cm^-2| replace:: cm\ :sup:`-2` 
     734.. |cm^3| replace:: cm\ :sup:`3` 
     735.. |1e15cm^3| replace:: 10\ :sup:`15`\ cm\ :sup:`3` 
     736.. |cm^-3| replace:: cm\ :sup:`-3` 
     737.. |sr^-1| replace:: sr\ :sup:`-1` 
     738.. |P0| replace:: P\ :sub:`0`\ 
     739 
     740.. |equiv| unicode:: U+2261 
     741.. |noteql| unicode:: U+2260 
     742.. |TM| unicode:: U+2122 
     743 
     744.. |cdot| unicode:: U+00B7 
     745.. |deg| unicode:: U+00B0 
     746.. |g/cm^3| replace:: g\ |cdot|\ cm\ :sup:`-3` 
     747.. |mg/m^2| replace:: mg\ |cdot|\ m\ :sup:`-2` 
     748.. |fm^2| replace:: fm\ :sup:`2` 
     749.. |Ang*cm^-1| replace:: |Ang|\ |cdot|\ cm\ :sup:`-1` 
     750""" 
     751 
     752# TODO: make a better fake reference role 
     753RST_ROLES = """\ 
     754.. role:: ref 
     755 
     756.. role:: numref 
     757 
     758""" 
     759 
    720760def make_html(model_info): 
    721761    """ 
     
    723763    """ 
    724764    from . import rst2html 
    725     return rst2html.convert(make_doc(model_info)) 
     765 
     766    rst = make_doc(model_info) 
     767    return rst2html.rst2html("".join((RST_ROLES, RST_PROLOG, rst))) 
     768 
     769def view_html(model_name): 
     770    from . import rst2html 
     771    from . import modelinfo 
     772    kernel_module = load_kernel_module(model_name) 
     773    info = modelinfo.make_model_info(kernel_module) 
     774    url = "file://"+dirname(info.filename)+"/" 
     775    rst2html.wxview(make_html(info), url=url) 
    726776 
    727777def demo_time(): 
Note: See TracChangeset for help on using the changeset viewer.