Changeset e8af9b1 in sasview for src/sas


Ignore:
Timestamp:
Jun 20, 2015 10:08:09 PM (9 years ago)
Author:
butler
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:
d20eb45
Parents:
d896039
Message:

pylint cleanup and fix of mac documentation

File:
1 edited

Legend:

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

    r5f93489 re8af9b1  
     1""" 
     2documentation module provides a simple means to add help throughout the  
     3application. It checks for the existence of html2 package needed to support 
     4fully html panel which supports css.  The class defined here takes a title for 
     5the particular help panel, a pointer to the html documentation file of interest 
     6within the documentation tree along with a 'command' string such as a page 
     7anchor or a query string etc.  The path to the doc directory is retrieved 
     8automatically by the class itself.  Thus with these three pieces of information 
     9the class generates a panel with the appropriate title bar and help file 
     10formatted according the style sheets called in the html file.  Finally, if an 
     11old version of Python is running and the html2 package is not available the 
     12class brings up the default browser and passes the file:/// string to it.  In 
     13this case however the instruction portion is usually not passed for security 
     14reasons.  
     15""" 
    116import sys 
    217import os 
     
    621import urllib 
    722 
    8 wx_supports_html2 = True 
     23SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     24WX_SUPPORTS_HTML2 = True 
    925try: 
    1026    import wx.html2 as html 
    1127except: 
    12     wx_supports_html2 = False 
     28    WX_SUPPORTS_HTML2 = False 
    1329if sys.platform.count("win32") > 0: 
    1430    #this is a PC 
    15     wx_supports_html2 = True 
     31    WX_SUPPORTS_HTML2 = True 
    1632else: 
    1733    #this is a MAC 
    18     wx_supports_html2 = False 
    19  
    20  
     34    WX_SUPPORTS_HTML2 = False 
    2135 
    2236from gui_manager import get_app_dir 
     
    2438 
    2539class DocumentationWindow(wx.Frame): 
    26     def __init__(self, parent, id, path, url_instruction, title, size=(850, 540)): 
    27         wx.Frame.__init__(self, parent, id, title, size=size) 
     40    def __init__(self, parent, dummy_id, path, url_instruction, title, size=(850, 540)): 
     41        wx.Frame.__init__(self, parent, dummy_id, title, size=size) 
    2842 
    29         SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
    3043        if SPHINX_DOC_ENV in os.environ: 
    3144            docs_path = os.path.join(os.environ[SPHINX_DOC_ENV]) 
     
    3750 
    3851        file_path = os.path.join(docs_path, path) 
    39         url = "file:///" + urllib.quote(file_path,'\:')+ url_instruction 
     52        url = "file:///" + urllib.quote(file_path, '/\:')+ url_instruction 
    4053 
    4154        if not os.path.exists(file_path): 
    4255            logging.error("Could not find Sphinx documentation at %s \ 
    4356            -- has it been built?", file_path) 
    44         elif wx_supports_html2: 
     57        elif WX_SUPPORTS_HTML2: 
    4558            # Complete HTML/CSS support! 
    4659            self.view = html.WebView.New(self) 
    4760            self.view.LoadURL(url) 
    4861            self.Show() 
    49         else:  
     62        else: 
    5063            logging.error("No html2 support, popping up a web browser") 
    5164            #For cases that do not build against current version dependency 
    52             # Wx 3.0 we provide a webbrowser call - this is particularly for  
     65            # Wx 3.0 we provide a webbrowser call - this is particularly for 
    5366            #Red hat used at SNS for which Wx 3.0 is not available.  This 
    54             #does not deal with issue of math in docs of course.  
     67            #does not deal with issue of math in docs of course. 
    5568            webbrowser.open_new_tab(url) 
    5669 
Note: See TracChangeset for help on using the changeset viewer.