Changeset d20eb45 in sasview
- Timestamp:
- Jun 20, 2015 11:00:18 PM (10 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/documentation_window.py
re8af9b1 rd20eb45 1 1 """ 2 documentation module provides a simple means to add help throughout the 2 documentation module provides a simple means to add help throughout the 3 3 application. It checks for the existence of html2 package needed to support 4 4 fully html panel which supports css. The class defined here takes a title for … … 12 12 class brings up the default browser and passes the file:/// string to it. In 13 13 this case however the instruction portion is usually not passed for security 14 reasons. 14 reasons. 15 15 """ 16 import sys17 16 import os 18 17 import logging … … 27 26 except: 28 27 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 35 29 36 30 from gui_manager import get_app_dir … … 38 32 39 33 class 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 """ 40 49 def __init__(self, parent, dummy_id, path, url_instruction, title, size=(850, 540)): 41 50 wx.Frame.__init__(self, parent, dummy_id, title, size=size) … … 49 58 docs_path = os.path.join(get_app_dir(), "doc") 50 59 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 51 68 file_path = os.path.join(docs_path, path) 52 url = "file:///" + urllib.quote(file_path, '/\:')+ url_instruction69 url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 53 70 54 71 if not os.path.exists(file_path): … … 69 86 70 87 def main(): 88 """ 89 main loop function if running alone for testing. 90 """ 71 91 app = wx.App() 72 92 DocumentationWindow(None, -1, "index.html", "", "Documentation",)
Note: See TracChangeset
for help on using the changeset viewer.