Changeset 90662e6 in sasview


Ignore:
Timestamp:
Jun 5, 2015 9:22:28 AM (9 years ago)
Author:
Doucet, Mathieu <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
41eee5f
Parents:
5ac0a7a
Message:

Minor clean up to understand what's going on

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/documentation_window.py

    r78bcf3c3 r90662e6  
    22import logging 
    33import wx 
    4 from wx import Frame 
    54import webbrowser 
    6 wx_supports_html2 = float(wx.__version__[:3]) >= 2.9 
    7 if wx_supports_html2: 
     5 
     6wx_supports_html2 = True 
     7try: 
    88    import wx.html2 as html 
    9 else: 
    10     import wx.html as html 
     9except: 
     10    wx_supports_html2 = False 
     11 
    1112from gui_manager import get_app_dir 
    1213 
    13 PATH_APP = get_app_dir()  
    1414 
    15 class DocumentationWindow(Frame): 
     15class DocumentationWindow(wx.Frame): 
    1616    def __init__(self, parent, id, path, title, size=(850, 540)): 
    17         Frame.__init__(self, parent, id, title, size=size) 
     17        wx.Frame.__init__(self, parent, id, title, size=size) 
    1818 
    1919        SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     
    2424            # bothering to worry about docs when running using the old 
    2525            # (non - run.py) way. 
    26             docs_path = os.path.join(PATH_APP, "doc") 
     26            docs_path = os.path.join(get_app_dir(), "doc") 
    2727 
    2828        file_path = "file:///" + docs_path + "/" + path 
    2929 
    30         if not os.path.exists(docs_path): 
     30        if not os.path.exists(file_path): 
    3131            logging.error("Could not find Sphinx documentation at %s \ 
    32             -- has it been built?", docs_path) 
     32            -- has it been built?", file_path) 
    3333        elif wx_supports_html2: 
    3434            # Complete HTML/CSS support! 
     
    3737            self.Show() 
    3838        else:  
     39            logging.error("No html2 support, popping up a web browser") 
    3940            #For cases that do not build against current version dependency 
    4041            # Wx 3.0 we provide a webbrowser call - this is particularly for  
     
    4344            webbrowser.open_new_tab(file_path) 
    4445 
    45   
     46def main(): 
     47    app = wx.App() 
     48    DocumentationWindow(None, -1, "index.html", "Documentation",) 
     49    app.MainLoop() 
     50 
     51if __name__ == '__main__': 
     52    main() 
Note: See TracChangeset for help on using the changeset viewer.