Changeset d20eb45 in sasview


Ignore:
Timestamp:
Jun 21, 2015 1:00:18 AM (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:
c8d22ec
Parents:
e8af9b1
Message:

Final fix to documentationwindow (I hope) mac docs should work and
removed a couple more pylint warnings.

File:
1 edited

Legend:

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

    re8af9b1 rd20eb45  
    11""" 
    2 documentation module provides a simple means to add help throughout the  
     2documentation module provides a simple means to add help throughout the 
    33application. It checks for the existence of html2 package needed to support 
    44fully html panel which supports css.  The class defined here takes a title for 
     
    1212class brings up the default browser and passes the file:/// string to it.  In 
    1313this case however the instruction portion is usually not passed for security 
    14 reasons.  
     14reasons. 
    1515""" 
    16 import sys 
    1716import os 
    1817import logging 
     
    2726except: 
    2827    WX_SUPPORTS_HTML2 = False 
    29 if sys.platform.count("win32") > 0: 
    30     #this is a PC 
    31     WX_SUPPORTS_HTML2 = True 
    32 else: 
    33     #this is a MAC 
    34     WX_SUPPORTS_HTML2 = False 
     28 
    3529 
    3630from gui_manager import get_app_dir 
     
    3832 
    3933class DocumentationWindow(wx.Frame): 
     34    """ 
     35    DocumentationWindow inherits from wx.Frame and provides a centralized 
     36    coherent framework for all help documentation.  Help files must be html 
     37    files stored in an properly organized tree below the top 'doc' folder.  In 
     38    order to display the appropriate help file from anywhere in the gui, the 
     39    code simply needs to know the location below the top level where the 
     40    help file resides along with the name of the help file. 
     41    called 
     42    (self, parent, dummy_id, path, url_instruction, title, size=(850, 540)) 
     43     
     44    :param path: path to html file beginning AFTER /doc/ and ending in the  
     45    file.html 
     46    :param url_instructions: anchor string or other query e.g. '#MyAnchor 
     47    :param title - text to place in the title bar of the help panel 
     48    """ 
    4049    def __init__(self, parent, dummy_id, path, url_instruction, title, size=(850, 540)): 
    4150        wx.Frame.__init__(self, parent, dummy_id, title, size=size) 
     
    4958            docs_path = os.path.join(get_app_dir(), "doc") 
    5059 
     60        #note that filepath for mac OS, at least in bundle starts with a 
     61        #forward slash as /Application, while the PC string begins C:\ 
     62        #It seems that mac OS is happy with four slashes as in file:////App... 
     63        #Two slashes is not sufficient to indicate path from root.  Thus for now 
     64        #we use "file:///" +... If the mac behavior changes may need to make the 
     65        #file:/// be another constant at the beginning that yields // for Mac 
     66        #and /// for PC. 
     67        #Note added June 21, 2015     PDB  
    5168        file_path = os.path.join(docs_path, path) 
    52         url = "file:///" + urllib.quote(file_path, '/\:')+ url_instruction 
     69        url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 
    5370 
    5471        if not os.path.exists(file_path): 
     
    6986 
    7087def main(): 
     88    """ 
     89    main loop function if running alone for testing. 
     90    """ 
    7191    app = wx.App() 
    7292    DocumentationWindow(None, -1, "index.html", "", "Documentation",) 
Note: See TracChangeset for help on using the changeset viewer.