AC_ENABLE_MPI_SEQ_CONTAINER(no)
# _GBO_SALOME_PYTHON_PACKAGING_
-PYLOGLEVEL=DEBUG
+if test "X$enable_debug" = "Xyes"; then
+ PYLOGLEVEL=DEBUG
+else
+ PYLOGLEVEL=WARNING
+fi
AC_SUBST(PYLOGLEVEL)
echo
Documentation of the programming interface (API)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-This section describes the python packages and modules of the
+This section describes the python modules of the
``salome.kernel`` python package. The main part is generated from the
code documentation included in source python files.
The KERNEL python package essentially contains:
* Helper functions to manipulate KERNEL objects from python. For
- example, the ``studyedit.py`` module makes you ease with the
- manipulation of the SALOME study, its ``SComponent`` and
- ``SObject``.
-* General purpose functions for logging, threading, and other recurent
- stuff in python programming. These function has no dependancy with
- SALOME and could be used from any python interpreter
+ example, the ``studyedit.py`` module facilitates the
+ manipulation of components and items in SALOME study.
+* General purpose functions for logging and other recurrent
+ stuff in python programming.
Note that these functions either encapsulate the python programming
interface of KERNEL core (the CORBA or SWIG interfaces for example) or
.. code-block:: python
- import salome
- salome.salome_init()
- salomeStudyId = salome.myStudyId
+ from salome.kernel.studyedit import getStudyEditor
- from salome.kernel import studyedit
- studyEditor = studyedit.getStudyEditor(salomeStudyId)
+ studyEditor = getStudyEditor() # Get an editor for the current study
myStudyComponent = studyEditor.findOrCreateComponent(
+ moduleName,
componentName,
- componentLabel,
- componentIcon,
- engineName)
+ componentIcon)
myStudyItem = studyEditor.createItem(
myStudyComponent,
itemName,
- itemComment,
- itemType,
- itemIcon)
+ comment = itemComment,
+ icon = itemIcon)
The specification of the programming interface of this package is
-detailled in the part :doc:`Documentation of the programming interface
+detailed in the part :doc:`Documentation of the programming interface
(API)</docapi>` of this documentation.
.. note::
#
"""
This module provides several functions to indicate the deprecation of a
-module, a method or a function. This is a temporary module to be used only
-during PAL refactoring.
+module, a method or a function.
"""
import sys
from salome.kernel import termcolor
-msg_seedoc = "See PAL refactoring documentation for possible replacements."
+msg_seedoc = "See documentation for possible replacements."
def __deprecated_with_msg(func, msg):
import sys, os
import logging
+from salome.kernel.deprecation import deprecated
from salome.kernel import termcolor
import salome.kernel.logconfig
When creating a new Logger object, the parameter `keyword` defines the
name of the logger, `level` defines the logging level (default is
- :const:`logging.WARNING` if PAL module is configured with --disable-debug
- option or :const:`logging.DEBUG` otherwise), and `color` defines the color
+ :const:`logging.DEBUG` if KERNEL module is configured with --enable-debug
+ option or :const:`logging.WARNING` otherwise), and `color` defines the color
of the log messages for this logger (log messages will appear in color
only when displayed on color-capable ASCII terminals). See module
:mod:`salome.kernel.termcolor` for the color constants.
"""
self.setLevel(logging.INFO)
+ @deprecated("Deprecated since version 5.1.5. Please replace with "
+ "Logger.critical(message)")
def fatal(self, message):
"""
Log a message with CRITICAL level. This method only exists for
compatibility, as the same thing can be done by calling
``Logger.debug(message, exc_info = True)``.
"""
+
+ @deprecated("Class ExtLogger is deprecated since version 5.1.5. See "
+ "documentation for replacement.")
+ def __init__(self, keyword = "KEY",
+ level = salome.kernel.logconfig.loggingLevel,
+ color = None, sourceFileName=None):
+ Logger.__init__(self, keyword, level, color, sourceFileName)
def debug( self, message ):
"""
Find a component corresponding to the Salome module `moduleName` in
the study. If none is found, create a new component and associate it
with the corresponding engine (i.e. the engine named `moduleName`).
+ Note that in Salome 5, the module name and engine name must be
+ identical (every module must provide an engine with the same name).
+ In Salome 6 it will be possible to define a different name for the
+ engine.
:type moduleName: string
:param moduleName: name of the module corresponding to the component
componentName = moduleName
self.builder.SetName(sComponent, componentName)
if icon is not None:
- # _MEM_ : This will be effective if and only if the componentName
- # corresponds to the module name (as specified in the SalomeApp.xml)
+ # _MEM_ : This will be effective if and only if "moduleName"
+ # really corresponds to the module name (as specified in the
+ # SalomeApp.xml)
self.setIcon(sComponent, icon)
# This part will stay inactive until Salome 6. In Salome 6, the
self.setTypeId(item, typeId)
def removeItem(self, item, withChildren = False ):
- # TODO: Update doc (this doc is not clear. Is the item removed or not?)
"""
- Remove the given item from the study (the item still is in
- the study after the removal)
- @param item: the browser object to be removed
- @param withChildren: remove children if True
+ Remove the given item from the study. Note that the items are never
+ really deleted. They just don't appear in the study anymore.
+
+ :type item: SObject
+ :param item: the item to be removed
+
+ :type withChildren: boolean
+ :param withChildren: if :const:`True`, also remove the children of
+ `item`
+
+ :return: :const:`True` if the item was removed successfully, or
+ :const:`False` if an error happened.
"""
ok = False
try:
ok = True
except:
ok = False
-
return ok
def setItemAtTag(self, fatherItem, tag, name = None, fileType = None,