ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 6f10243 was
a4340d1,
checked in by butler, 10 years ago
|
Restructure the way the new help documentation gets displayed
1) Make the _onSphinxDocumentation a single line instatiation of
documentation_window passing only the location within the documentation
tree instead of the whol documentation path.
2) Put all the logic in documentation_window to check for 2.9 or higher
3) If lower than 2.9 go to same documentation but open with broswer (no
longer requires a connection)
4) Fix logging string so if the path is not found it fails but sends a
logging string to the log
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import os |
---|
2 | import logging |
---|
3 | import wx |
---|
4 | from wx import Frame |
---|
5 | import webbrowser |
---|
6 | wx_supports_html2 = float(wx.__version__[:3]) >= 2.9 |
---|
7 | if wx_supports_html2: |
---|
8 | import wx.html2 as html |
---|
9 | else: |
---|
10 | import wx.html as html |
---|
11 | |
---|
12 | |
---|
13 | class DocumentationWindow(Frame): |
---|
14 | def __init__(self, parent, id, path, title='Help', size=(850, 540)): |
---|
15 | Frame.__init__(self, parent, id, title, size=size) |
---|
16 | |
---|
17 | SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" |
---|
18 | if SPHINX_DOC_ENV in os.environ: |
---|
19 | docs_path = os.path.join(os.environ[SPHINX_DOC_ENV]) |
---|
20 | else: |
---|
21 | docs_path = os.path.join(PATH_APP, "..", "..", "doc") |
---|
22 | |
---|
23 | if (not os.path.exists(docs_path)): |
---|
24 | print "logging" |
---|
25 | logging.error("Could not find Sphinx documentation at %s \ |
---|
26 | -- has it been built?", docs_path) |
---|
27 | |
---|
28 | elif wx_supports_html2: |
---|
29 | # Complete HTML/CSS support! |
---|
30 | self.view = html.WebView.New(self) |
---|
31 | self.view.LoadURL("file://" + docs_path + '\\' + path) |
---|
32 | self.Show() |
---|
33 | else: |
---|
34 | #For cases that do not build against current version dependency |
---|
35 | # Wx 3.0 we provide a webbrowser call - this is particularly for |
---|
36 | #Red hat used at SNS for which Wx 3.0 is not available. This |
---|
37 | #does not deal with issue of math in docs of course. |
---|
38 | |
---|
39 | webbrowser.open_new_tab("file:///" + docs_path + "/" + path) |
---|
40 | |
---|
41 | |
---|
Note: See
TracBrowser
for help on using the repository browser.