3 # Copyright (C) 2010-2012 CEA/DEN
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # Define all possible option for log command : sat doc <options>
23 parser = src.options.Options()
24 parser.add_option('h', 'html', 'boolean', 'html', "Open sat html documentation in browser", None)
25 parser.add_option('p', 'pdf', 'boolean', 'pdf', "Open sat pdf documentation in viewer", False)
26 parser.add_option('e', 'edit', 'boolean', 'edit', "edit/modify source dodumentation rst files", False)
27 parser.add_option('c', 'compile', 'boolean', 'compile', "how to compile html/pdf doc", False)
30 """method that is called when salomeTools is called with --help option.
32 :return: The text to display for the log command description.
36 The doc command gives access to the sat documentation.
39 >> sat doc # --html as default
44 def run(args, runner, logger):
45 '''method that is called when salomeTools is called with log parameter.
48 (options, args) = parser.parse_args(args)
50 # get the log directory.
51 satDir = runner.cfg.VARS.salometoolsway
52 docDir = os.path.join(satDir, "doc")
53 htmlFile = os.path.join(docDir, "build", "html", "index.html")
54 pdfFile = os.path.join(satDir, "doc", "build", "latex", "salomeTools.pdf")
55 rstFiles = os.path.join(satDir, "doc", "src", "*.rst")
56 rstFilesCommands = os.path.join(satDir, "doc", "src", "commands", "*.rst")
57 readmeFile = os.path.join(satDir, "doc", "README")
59 logger.write("docdir %s\n" % docDir, 6)
60 logger.write("options %s\n" % options, 6)
63 src.system.show_in_editor(runner.cfg.USER.browser, htmlFile, logger)
65 src.system.show_in_editor(runner.cfg.USER.pdf_viewer, pdfFile, logger)
67 src.system.show_in_editor(runner.cfg.USER.editor, rstFiles, logger)
68 src.system.show_in_editor(runner.cfg.USER.editor, rstFilesCommands, logger)
70 logger.write("How to comile documentation:\n%s" % open(readmeFile,"r").read(), 3)