Changeset 990d8df in sasmodels for sasmodels/rst2html.py


Ignore:
Timestamp:
May 7, 2017 11:20:44 PM (7 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:
2e66ef5
Parents:
8ae8532
Message:

move polydispersity and resolution docs into sasmodels; write installation instructions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/rst2html.py

    r8ae8532 r990d8df  
    211211    sys.exit(app.exec_()) 
    212212 
     213def can_use_qt(): 
     214    """ 
     215    Return True if QWebView exists. 
     216 
     217    Checks first in PyQt5 then in PyQt4 
     218    """ 
     219    try: 
     220        from PyQt5.QtWebKitWidgets import QWebView 
     221        return True 
     222    except ImportError: 
     223        try: 
     224            from PyQt4.QtWebkit import QWebView 
     225            return True 
     226        except ImportError: 
     227            return False 
     228 
    213229def view_help(filename, qt=False): 
    214230    import os 
    215     url="file:///"+os.path.abspath(filename).replace("\\","/") 
     231 
     232    if qt: 
     233        qt = can_use_qt() 
     234 
     235    url = "file:///"+os.path.abspath(filename).replace("\\", "/") 
    216236    if filename.endswith('.rst'): 
    217237        html = load_rst_as_html(filename) 
Note: See TracChangeset for help on using the changeset viewer.