--- /dev/null
+# - Sphinx detection
+#
+# Output variables:
+# SPHINX_EXECUTABLE - path to the Sphinx executable
+# SPHINX_PYTHONPATH - path to the Sphinx Python modules
+#
+###########################################################################
+# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+FIND_PROGRAM(SPHINX_EXECUTABLE
+ NAMES sphinx-build sphinx-build-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
+ PATH_SUFFIXES Scripts)
+FIND_PROGRAM(SPHINX_APIDOC_EXECUTABLE
+ NAMES sphinx-apidoc sphinx-apidoc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
+ PATH_SUFFIXES Scripts)
+
+# Get root dir locally, going up two levels from the exec:
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${SPHINX_EXECUTABLE}" PATH)
+GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+IF(WIN32)
+ SET(SPHINX_PYTHONPATH "${_tmp_ROOT_DIR}/lib/site-packages")
+ELSE()
+ SET(SPHINX_PYTHONPATH "${_tmp_ROOT_DIR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages")
+ENDIF()
+
+# Handle the standard arguments of the find_package() command:
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE SPHINX_APIDOC_EXECUTABLE)
+
+IF(SPHINX_EXECUTABLE)
+ EXECUTE_PROCESS(COMMAND ${SPHINX_EXECUTABLE} "--version" OUTPUT_VARIABLE SPHINX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+ STRING(REGEX REPLACE ".* ([0-9.]+)$" "\\1" SPHINX_VERSION "${SPHINX_VERSION}" )
+ MESSAGE(STATUS "Sphinx version is ${SPHINX_VERSION}")
+ IF(SPHINX_VERSION VERSION_LESS "1.3")
+ SET(SPHINX_THEME "default")
+ ELSE()
+ SET(SPHINX_THEME "classic")
+ ENDIF()
+ENDIF(SPHINX_EXECUTABLE)
SET (SHAPER_Version 8.5.0)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
+OPTION(SHAPER_BUILD_DOC "Generate SHAPER documentation" ON)
INCLUDE(SalomeMacros)
ADD_CUSTOM_TARGET(run_unit_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "models_tests")
ENDIF(ADD_MODELS_TESTS)
+
+IF(SHAPER_BUILD_DOC)
+ INCLUDE(FindSphinx)
+ ADD_SUBDIRECTORY (doc)
+ENDIF(SHAPER_BUILD_DOC)
+
+
+
# Add the uninstall target for eclipse IDE
if (CMAKE_GENERATOR MATCHES "NMake Makefiles")
configure_file("${CMAKE_SOURCE_DIR}/CMakeCommon/cmake_uninstall.cmake.in"
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-SET(HTML_RESOURCES
- index.html
-)
+SET(input ${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in)
+
+SET(output ${CMAKE_CURRENT_BINARY_DIR}/conf.py)
+
+CONFIGURE_FILE(${input} ${output})
+
-ADD_CUSTOM_TARGET(usr_docs
- SOURCES ${HTML_RESOURCES}
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc/gui"
+#sphinx-build -b html -c doc -D latex_paper_size=a4 -d doc/doctree /dn23/PPGP/vsv/SALOME730/SOURCES/PPGP_SRC/doc doc/html
+
+INSTALL(CODE "
+EXECUTE_PROCESS(
+COMMAND ${SPHINX_EXECUTABLE} -Q -b html -c ${CMAKE_CURRENT_BINARY_DIR} -D latex_paper_size=a4 -d doctree ${CMAKE_CURRENT_SOURCE_DIR} html
+WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)"
)
-INSTALL(FILES ${HTML_RESOURCES} DESTINATION ${SHAPER_INSTALL_GUI_DOC} OPTIONAL)
-INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target usr_docs)")
+IF(${HAVE_SALOME})
+INSTALL(CODE "
+EXECUTE_PROCESS(
+COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil;shutil.rmtree('${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SHAPER', True);shutil.copytree('${CMAKE_CURRENT_BINARY_DIR}/html', '${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/SHAPER')\"
+)
+")
+ELSE(${HAVE_SALOME})
+INSTALL(CODE "
+EXECUTE_PROCESS(
+COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil;shutil.rmtree('${CMAKE_INSTALL_PREFIX}/doc', True);shutil.copytree('${CMAKE_CURRENT_BINARY_DIR}/html', '${CMAKE_INSTALL_PREFIX}/doc')\"
+)
+")
+ENDIF(${HAVE_SALOME})
--- /dev/null
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+SPHINXPROJ = SHAPER
+SOURCEDIR = .
+BUILDDIR = _build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# SHAPER documentation build configuration file, created by
+# sphinx-quickstart on Fri Aug 3 11:29:53 2018.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+# import os
+# import sys
+# sys.path.insert(0, os.path.abspath('.'))
+
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+#
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'SHAPER'
+copyright = u'2014-2017 CEA/DEN, EDF R&D'
+author = u'vsv'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = u'3.0.0'
+# The full version, including alpha/beta/rc tags.
+release = u'3.0.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This patterns also effect to html_static_path and html_extra_path
+exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = 'alabaster'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#
+# html_theme_options = {}
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+
+# -- Options for HTMLHelp output ------------------------------------------
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'SHAPERdoc'
+
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+ # The paper size ('letterpaper' or 'a4paper').
+ #
+ # 'papersize': 'letterpaper',
+
+ # The font size ('10pt', '11pt' or '12pt').
+ #
+ # 'pointsize': '10pt',
+
+ # Additional stuff for the LaTeX preamble.
+ #
+ # 'preamble': '',
+
+ # Latex figure (float) alignment
+ #
+ # 'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'SHAPER.tex', u'SHAPER Documentation',
+ u'vsv', 'manual'),
+]
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'shaper', u'SHAPER Documentation',
+ [author], 1)
+]
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'SHAPER', u'SHAPER Documentation',
+ author, 'SHAPER', 'One line description of project.',
+ 'Miscellaneous'),
+]
+++ /dev/null
-The documentation for the SHAPER module will come soon.
\ No newline at end of file
--- /dev/null
+.. SHAPER documentation master file, created by
+ sphinx-quickstart on Fri Aug 3 11:29:53 2018.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Welcome to SHAPER's documentation!
+==================================
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
--- /dev/null
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=.
+set BUILDDIR=_build
+set SPHINXPROJ=SHAPER
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+
+:end
+popd
myTooltip = "";
myIcon = "";
myKeysequence = "";
+ myHelpFile = "";
myGroupId = "";
myWorkbenchId = "";
void Config_FeatureMessage::setApplyContinue(bool isModal)
{
myIsApplyContinue = isModal;
+}
+
+const std::string& Config_FeatureMessage::helpFileName() const
+{
+ return myHelpFile;
+}
+
+void Config_FeatureMessage::setHelpFileName(const std::string& aName)
+{
+ myHelpFile = aName;
}
\ No newline at end of file
* \class Config_FeatureMessage
* \ingroup Config
* \brief Class to pass a feature entry extracted from xml file.
+
* Example of the feature entry:
* \code
* <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
std::string myTooltip; ///<Represents action's tooltip
std::string myIcon; ///<Represents action's icon
std::string myKeysequence; ///<Represents action's key sequence
+ std::string myHelpFile; ///<Contains name of help file
std::string myGroupId; ///<Id of feature's group
std::string myWorkbenchId; ///<Id of feature's workbench
CONFIG_EXPORT const std::string& groupId() const;
/// Id of Feature's Toolbar
CONFIG_EXPORT const std::string& toolBarId() const;
+ /// Returns help file name for the feature
+ CONFIG_EXPORT const std::string& helpFileName() const;
/// Id of Feature's Workbench
CONFIG_EXPORT const std::string& workbenchId() const;
/// Kind of a document which contains the feature
CONFIG_EXPORT void setGroupId(const std::string& groupId);
///Set id of Feature's Group
CONFIG_EXPORT void setToolBarId(const std::string& aId);
+ ///Set help file name
+ CONFIG_EXPORT void setHelpFileName(const std::string& aName);
///Set id of Feature's Workbench
CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);
///Set kind of a document which contains the feature
getProperty(theFeatureNode, FEATURE_TOOLTIP));
outFeatureMessage->setIcon(getProperty(theFeatureNode, FEATURE_ICON));
outFeatureMessage->setKeysequence(getProperty(theFeatureNode, FEATURE_KEYSEQUENCE));
+ outFeatureMessage->setHelpFileName(getProperty(theFeatureNode, HELP_FILE));
std::string aGroupName = restoreAttribute(NODE_GROUP, _ID);
std::string aWBNName = restoreAttribute(NODE_WORKBENCH, _ID);
const static char* GROUP_TOOLBAR = "toolbar";
const static char* FEATURE_ICON = "icon";
const static char* FEATURE_TEXT = "title";
+const static char* HELP_FILE = "helpfile";
const static char* FEATURE_KEYSEQUENCE = "keysequence";
const static char* FEATURE_NESTED = "nested";
const static char* FEATURE_WHEN_NESTED = "when_nested";
/// \return Currently installed property panel
ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; }
+ QString helpFileName() const { return myHelpFileName; }
+
+ void setHelpFileName(QString theName) {
+ myHelpFileName = theName;
+ }
+
signals:
/// The operation is started
void beforeStarted();
/// Access to property panel
ModuleBase_IPropertyPanel* myPropertyPanel;
+
+ QString myHelpFileName;
};
#endif
#include <QToolButton>
#include <QAction>
#include <QDesktopWidget>
+#include <QProcess>
#include <iterator>
Events_Loop::loop()->send(aMsg);
}
+
+//******************************************************
+void XGUI_Workshop::onHelpActionClicked()
+{
+ XGUI_OperationMgr* anOperationMgr = operationMgr();
+ if (anOperationMgr) {
+ ModuleBase_Operation* aOperation = anOperationMgr->currentOperation();
+ if (aOperation) {
+ QString aDocDir;
+ const QChar aSep = QDir::separator();
+#ifdef HAVE_SALOME
+ QString aBrowserName("HelpBrowser");
+ QString aDir(getenv("SHAPER_ROOT_DIR"));
+ if (!aDir.isEmpty()) {
+ aDocDir = aDir + aSep + "share" + aSep + "doc" + aSep +
+ "salome" + aSep + "gui" + aSep + "SHAPER";
+ }
+ SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr();
+ bool aUseExtBrowser = aResMgr->booleanValue("ExternalBrowser", "use_external_browser", false);
+ if (aUseExtBrowser) {
+ QString platform;
+#ifdef WIN32
+ platform = "winapplication";
+#else
+ platform = "application";
+#endif
+ aBrowserName = aResMgr->stringValue("ExternalBrowser", platform);
+ }
+#else
+ QString aBrowserName("C:\\Program Files\\Internet Explorer\\iexplore.exe");
+ QString aDir(getenv("OPENPARTS_ROOT_DIR"));
+ aDocDir = aDir + aSep + "doc";
+#endif
+ QStringList aParams;
+ aParams << aDocDir + aSep + aOperation->helpFileName();
+ QProcess::startDetached(aBrowserName, aParams);
+ }
+ }
+}
+
+
//******************************************************
void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const bool theUpdateViewer)
{
aFeatureInfo = aCommand->featureMessage();
#endif
bool anIsAutoPreview = true;
- if (aFeatureInfo.get())
+ if (aFeatureInfo.get()) {
anIsAutoPreview = aFeatureInfo->isAutoPreview();
- else {
+ theOperation->setHelpFileName(aFeatureInfo->helpFileName().c_str());
+ } else {
std::string aXmlCfg, aDescription;
module()->getXMLRepresentation(aFeatureKind, aXmlCfg, aDescription);
ModuleBase_WidgetFactory aFactory(aXmlCfg, moduleConnector());
QAction* aPreviewAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Preview);
connect(aPreviewAct, SIGNAL(triggered()), this, SLOT(onPreviewActionClicked()));
+ QAction* aHelpAct = myActionsMgr->operationStateAction(XGUI_ActionsMgr::Help);
+ connect(aHelpAct, SIGNAL(triggered()), this, SLOT(onHelpActionClicked()));
+
connect(myPropertyPanel, SIGNAL(keyReleased(QObject*, QKeyEvent*)),
myOperationMgr, SLOT(onKeyReleased(QObject*, QKeyEvent*)));
connect(myPropertyPanel, SIGNAL(enterClicked(QObject*)),
/// compute preview.
void onPreviewActionClicked();
+ /// Called on help button clicked in the property panel.
+ void onHelpActionClicked();
+
private:
/// Init menu
void initMenu();