Changes in / [dce368f:f2ea95a] in sasview


Ignore:
Files:
3 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    re9df8a5 recdd132  
    4949/docs/sphinx-docs/source/user/perspectives 
    5050/docs/sphinx-docs/source/user/sasgui 
    51 /docs/sphinx-docs/katex*.zip 
    5251 
    5352 
  • docs/sphinx-docs/Makefile

    r3194371 r1d5f5c2  
    1616PAPEROPT_a4     = -D latex_paper_size=a4 
    1717PAPEROPT_letter = -D latex_paper_size=letter 
    18 ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source-temp 
     18ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 
    1919# the i18n builder cannot share the environment and doctrees with the others 
    2020I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 
     
    5353        rm -rf source/dev/api 
    5454        sphinx-apidoc -o source/dev/api -d 8 ../../src 
    55  
     55         
    5656html: stubs 
    5757        $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 
  • docs/sphinx-docs/build_sphinx.py

    r3194371 r01f1e17  
    324324        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 
    325325 
    326 def fetch_katex(version, destination="_static"): 
    327     from zipfile import ZipFile 
    328     import urllib2 
    329     url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version 
    330     cache_path = "katex_%s.zip" % version 
    331     if not os.path.exists(cache_path): 
    332         try: 
    333             fd_in = urllib2.urlopen(url) 
    334             with open(cache_path, "wb") as fd_out: 
    335                 fd_out.write(fd_in.read()) 
    336         finally: 
    337             fd_in.close() 
    338     with ZipFile(cache_path) as zip: 
    339         zip.extractall(destination) 
    340326 
    341327def retrieve_bumps_docs(): 
     
    374360                     SASVIEW_BUILD]) 
    375361 
    376 def build_pdf(): 
    377     """ 
    378     Runs sphinx-build for pdf.  Reads in all .rst files and spits out the final html. 
    379     """ 
    380     print("=== Build PDF Docs from ReST Files ===") 
    381     subprocess.call(["sphinx-build", 
    382                      "-b", "latex", # Builder name. TODO: accept as arg to setup.py. 
    383                      "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
    384                      SPHINX_SOURCE, 
    385                      os.path.join(SPHINX_BUILD, "latex")]) 
    386  
    387     LATEXDIR = os.path.join(SPHINX_BUILD, "latex") 
    388     def pdflatex(): 
    389         subprocess.call(["pdflatex", "Sasview.tex"], cwd=LATEXDIR) 
    390     pdflatex() 
    391     pdflatex() 
    392     pdflatex() 
    393     subprocess.call(["makeindex", "-s", "python.ist", "Sasview.idx"], cwd=LATEXDIR) 
    394     pdflatex() 
    395     pdflatex() 
    396  
    397     print("=== Copy PDF to HTML Directory ===") 
    398     source = os.path.join(LATEXDIR, "Sasview.pdf") 
    399     target = os.path.join(SASVIEW_DOCS, "Sasview.pdf") 
    400     shutil.copyfile(source, target) 
    401  
    402362def build(): 
    403363    """ 
    404364    Runs sphinx-build.  Reads in all .rst files and spits out the final html. 
    405365    """ 
    406     print("=== Build HTML Docs from ReST Files ===") 
     366    print("=== Build HTML Docs from Rest Files ===") 
    407367    subprocess.call(["sphinx-build", 
    408368                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
     
    415375    copy_tree(html, SASVIEW_DOCS) 
    416376 
    417 def convert_katex(): 
    418     print("=== Preprocess HTML, converting latex to html ===") 
    419     subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS]) 
     377    #We are building latex doc on linux only 
     378    if "linux" in platform: 
     379        print "=== Build Latex Docs from Rest Files ===" 
     380        subprocess.call(["sphinx-build", 
     381                     "-b", "latex", # Builder name. TODO: accept as arg to setup.py. 
     382                     "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
     383                     SPHINX_SOURCE, 
     384                     os.path.join(SPHINX_BUILD, "latex")]) 
     385 
     386        print "=== Copy Latex Docs to Build Directory ===" 
     387        latex = os.path.join(SPHINX_BUILD, "latex") 
     388        copy_tree(latex, SASVIEW_DOCS) 
    420389 
    421390def rebuild(): 
     
    424393    retrieve_user_docs() 
    425394    retrieve_bumps_docs() 
    426     fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT) 
    427395    apidoc() 
    428396    build() 
    429     #build_pdf() 
    430     #convert_katex() 
    431397 
    432398    print("=== Done ===") 
  • docs/sphinx-docs/source/conf.py

    r28c4a3d r959eb01  
    3535              'sphinx.ext.todo', 
    3636              'sphinx.ext.coverage', 
    37               'mathjax', 
     37              'sphinx.ext.mathjax', 
    3838              'dollarmath', 
    3939              'sphinx.ext.viewcode'] 
    40  
    41 #STATIC_PATH = '../../_static/' 
    42 STATIC_PATH = '' 
    43 mathjax_path = [ 
    44     STATIC_PATH + 'katex/katex.min.js', 
    45     STATIC_PATH + 'katex/contrib/auto-render.min.js', 
    46     STATIC_PATH + 'rendermath.js' 
    47 ] 
    48 mathjax_css = STATIC_PATH + 'katex/katex.min.css' 
    49  
    5040 
    5141# Add any paths that contain templates here, relative to this directory. 
  • src/sas/sasgui/guiframe/documentation_window.py

    r9d566b2 r959eb01  
    1616import os 
    1717import logging 
     18import wx 
    1819import webbrowser 
    1920import urllib 
    2021import sys 
    2122 
    22 import wx 
    23 try: 
    24     import wx.html2 as html 
    25     WX_SUPPORTS_HTML2 = True 
    26 except ImportError: 
    27     WX_SUPPORTS_HTML2 = False 
    28  
    29 from .gui_manager import get_app_dir 
    30  
    3123logger = logging.getLogger(__name__) 
    3224 
    3325SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     26WX_SUPPORTS_HTML2 = True 
     27try: 
     28    import wx.html2 as html 
     29except: 
     30    WX_SUPPORTS_HTML2 = False 
    3431 
    35 THREAD_STARTED = False 
    36 def start_documentation_server(doc_root, port): 
    37     import thread 
    38     global THREAD_STARTED 
    39     if not THREAD_STARTED: 
    40         thread.start_new_thread(_documentation_server, (doc_root, port)) 
    41         THREAD_STARTED = True 
    4232 
    43 def _documentation_server(doc_root, port): 
    44     from SimpleHTTPServer import SimpleHTTPRequestHandler 
    45     from SocketServer import TCPServer 
     33from gui_manager import get_app_dir 
    4634 
    47     os.chdir(doc_root) 
    48     httpd = TCPServer(("127.0.0.1", port), SimpleHTTPRequestHandler, bind_and_activate=False) 
    49     httpd.allow_reuse_address = True 
    50     try: 
    51         httpd.server_bind() 
    52         httpd.server_activate() 
    53         httpd.serve_forever() 
    54     finally: 
    55         httpd.server_close() 
    5635 
    5736class DocumentationWindow(wx.Frame): 
     
    9170        #Note added June 21, 2015     PDB 
    9271        file_path = os.path.join(docs_path, path) 
    93         if path.startswith('http'): 
    94             url = path 
    95         elif not os.path.exists(file_path): 
    96             url = "index.html" 
     72        url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 
     73 
     74        if not os.path.exists(file_path): 
    9775            logger.error("Could not find Sphinx documentation at %s \ 
    9876            -- has it been built?", file_path) 
    99         elif True: 
    100             start_documentation_server(docs_path, port=7999) 
    101             url = "http://localhost:7999/" + path.replace('\\', '/') + url_instruction 
    102         else: 
    103             url = "file:///" + urllib.quote(file_path, r'/\:')+ url_instruction 
    104  
    105         logger.info("showing url " + url) 
    106         if WX_SUPPORTS_HTML2: 
     77        elif WX_SUPPORTS_HTML2: 
    10778            # Complete HTML/CSS support! 
    10879            self.view = html.WebView.New(self) 
    10980            self.view.LoadURL(url) 
    110             self.Bind(html.EVT_WEBVIEW_ERROR, self.OnError, self.view) 
    11181            self.Show() 
    11282        else: 
     
    11888            webbrowser.open_new_tab(url) 
    11989 
    120     def OnError(self, evt): 
    121         logger.error("%d: %s", evt.GetInt(), evt.GetString()) 
    122  
    12390def main(): 
    12491    """ 
    12592    main loop function if running alone for testing. 
    12693    """ 
    127     url = "index.html" if len(sys.argv) <= 1 else sys.argv[1] 
    12894    app = wx.App() 
    129     DocumentationWindow(None, -1, url, "", "Documentation",) 
     95    DocumentationWindow(None, -1, "index.html", "", "Documentation",) 
    13096    app.MainLoop() 
    13197 
Note: See TracChangeset for help on using the changeset viewer.