Changeset c3437260 in sasview


Ignore:
Timestamp:
Nov 30, 2014 11:06:12 AM (10 years ago)
Author:
Peter Parker
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:
70a9d1c
Parents:
9729a6d
Message:

Refs #221 - Add extra help menu item if wxPython 2.9 or higher is present. This button just opens up a viewer on the index.html page of the Sphinx documentation. Note the slight implementation detail of using os.environ to track whether or not run.py has been used to run SasView? 'in-place'. In this case the documentation is in a different place relative to the main sansview.py entry point of the program.

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • run.py

    rf8940db rc3437260  
    6767    #import numpy; numpy.seterr(all='raise') 
    6868 
     69    # Notify the help menu that the Sphinx documentation is in a different  
     70    # place than it otherwise would be. 
     71 
     72     
     73 
    6974    # find the directories for the source and build 
    7075    from distutils.util import get_platform 
     
    7277    platform = '%s-%s'%(get_platform(),sys.version[:3]) 
    7378    build_path = joinpath(root, 'build','lib.'+platform) 
     79 
     80    os.environ['SASVIEW_DOC_PATH'] = joinpath(build_path, "doc") 
    7481 
    7582    # Make sure that we have a private version of mplconfig 
  • src/sans/guiframe/gui_manager.py

    rafb5080 rc3437260  
    13301330        self._help_menu = wx.Menu() 
    13311331        style = self.__gui_style & GUIFRAME.WELCOME_PANEL_ON 
     1332 
    13321333        if style == GUIFRAME.WELCOME_PANEL_ON or custom_config != None: 
    13331334            # add the welcome panel menu item 
     
    13371338                self._help_menu.AppendSeparator() 
    13381339                wx.EVT_MENU(self, id, self.show_welcome_panel) 
     1340 
    13391341        # Look for help item in plug-ins  
    13401342        for item in self.plugins: 
     
    13431345                self._help_menu.Append(id,'&%s Help' % item.sub_menu, '') 
    13441346                wx.EVT_MENU(self, id, item.help) 
     1347 
     1348        # Only show new Sphinx docs link if version of wx supports displaying 
     1349        # it correctly. 
     1350        show_sphinx_docs = float(wx.__version__[:3]) >= 2.9 
     1351        if show_sphinx_docs: 
     1352            self._help_menu.AppendSeparator() 
     1353            id = wx.NewId() 
     1354            self._help_menu.Append(id, '&Sphinx Documentation', '') 
     1355            wx.EVT_MENU(self, id, self._onSphinxDocs) 
     1356 
    13451357        if config._do_tutorial and (IS_WIN or sys.platform =='darwin'): 
    13461358            self._help_menu.AppendSeparator() 
     
    21482160                        wx.MessageBox(msg, 'Error') 
    21492161 
    2150                        
     2162    def _onSphinxDocs(self, evt): 
     2163        """ 
     2164        Pop up a Sphinx Documentation dialog. 
     2165         
     2166        :param evt: menu event 
     2167        """ 
     2168        # Running SasView "in-place" using run.py means the docs will be in a 
     2169        # different place than they would otherwise. 
     2170        SPHINX_DOC_ENV = "SASVIEW_DOC_PATH" 
     2171        if SPHINX_DOC_ENV in os.environ: 
     2172            docs_path = os.path.join(os.environ[SPHINX_DOC_ENV], "index.html") 
     2173        else: 
     2174            docs_path = os.path.join(PATH_APP, "..", "..", "doc", "index.html") 
     2175 
     2176        if os.path.exists(docs_path): 
     2177            from documentation_window import DocumentationWindow 
     2178 
     2179            sphinx_doc_viewer = DocumentationWindow(None, -1, docs_path) 
     2180            sphinx_doc_viewer.Show() 
     2181        else: 
     2182            logging.error("Could not find Sphinx documentation at '%' -- has it been built?" % docs_path) 
     2183 
    21512184    def set_manager(self, manager): 
    21522185        """ 
Note: See TracChangeset for help on using the changeset viewer.