Changeset 234c532 in sasmodels for sasmodels/compare.py


Ignore:
Timestamp:
Oct 10, 2016 2:56:16 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
e4bf271
Parents:
689b7c4
Message:

add -html option to sascomp to show the model help

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    rbb2d187 r234c532  
    8080    -edit starts the parameter explorer 
    8181    -default/-demo* use demo vs default parameters 
     82    -html shows the model docs instead of running the model 
    8283 
    8384Any two calculation engines can be selected for comparison: 
     
    736737    'linear', 'log', 'q4', 
    737738    'hist', 'nohist', 
    738     'edit', 
     739    'edit', 'html', 
    739740    'demo', 'default', 
    740741    ]) 
     
    845846        'use_demo'  : True, 
    846847        'zero'      : False, 
     848        'html'      : False, 
    847849    } 
    848850    engines = [] 
     
    886888        elif arg == '-demo':    opts['use_demo'] = True 
    887889        elif arg == '-default':    opts['use_demo'] = False 
     890        elif arg == '-html':    opts['html'] = True 
    888891    # pylint: enable=bad-whitespace 
    889892 
     
    961964    return opts 
    962965 
     966def show_docs(opts): 
     967    # type: (Dict[str, Any]) -> None 
     968    """ 
     969    show html docs for the model 
     970    """ 
     971    import wx  # type: ignore 
     972    from .generate import view_html_from_info 
     973    app = wx.App() if wx.GetApp() is None else None 
     974    view_html_from_info(opts['def']) 
     975    if app: app.MainLoop() 
     976 
     977 
    963978def explore(opts): 
    964979    # type: (Dict[str, Any]) -> None 
    965980    """ 
    966     Explore the model using the Bumps GUI. 
     981    explore the model using the bumps gui. 
    967982    """ 
    968983    import wx  # type: ignore 
     
    10571072    opts = parse_opts(argv) 
    10581073    if opts is not None: 
    1059         if opts['explore']: 
     1074        if opts['html']: 
     1075            show_docs(opts) 
     1076        elif opts['explore']: 
    10601077            explore(opts) 
    10611078        else: 
Note: See TracChangeset for help on using the changeset viewer.