Back to index

salome-gui  6.5.0
Classes | Defines | Typedefs | Functions | Variables
SALOME_PYQT_ModuleLight.cxx File Reference
#include "SALOME_PYQT_PyInterp.h"
#include <SUITApp_init_python.hxx>
#include <PyInterp_Interp.h>
#include <PyConsole_Interp.h>
#include <PyConsole_Console.h>
#include <PyInterp_Dispatcher.h>
#include "SALOME_PYQT_ModuleLight.h"
#include "SALOME_PYQT_DataModelLight.h"
#include <Container_init_python.hxx>
#include <SUIT_ResourceMgr.h>
#include <SUIT_DataObjectIterator.h>
#include <SUIT_Desktop.h>
#include <SUIT_ViewModel.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <STD_MDIDesktop.h>
#include <STD_TabDesktop.h>
#include <LightApp_Preferences.h>
#include <LightApp_Application.h>
#include <LightApp_Study.h>
#include <QtxWorkstack.h>
#include <QtxWorkspace.h>
#include <QtxActionGroup.h>
#include <QtxActionMenuMgr.h>
#include <QtxActionToolMgr.h>
#include <QFile>
#include <QDomDocument>
#include <QDomNode>
#include <QDomElement>
#include <QMenuBar>
#include <QMenu>
#include <QAction>
#include "sipAPISalomePyQtGUILight.h"
#include <sip.h>
#include "sipQtGuiQWidget.h"
#include "sipQtGuiQMenu.h"
#include <utilities.h>

Go to the source code of this file.

Classes

class  SALOME_PYQT_ModuleLight::XmlHandler
class  FuncMsg
 Function call in/out tracer. More...

Defines

#define PY_SSIZE_T_MAX   INT_MAX
#define PY_SSIZE_T_MIN   INT_MIN
#define INIT_FUNCTION   initSalomePyQtGUILight

Typedefs

typedef int Py_ssize_t

Functions

PyMODINIT_FUNC INIT_FUNCTION ()
SALOME_PYQT_LIGHT_EXPORT
CAM_Module
createModule ()
static QString tagName (const QDomElement &element)
 Get tag name for the DOM element.
static QString attribute (const QDomElement &element, const QString &attName)
 Get DOM element's attribute by its name.
static bool checkBool (const QString &value, const int check=-1)
 Inspect specified string for the boolean value.
static int checkInt (const QString &value, const int def=-1, const int shift=-1)
 Inspect specified string for the integer value.

Variables

const char * DEFAULT_NAME = "SALOME_PYQT_ModuleLight"
 Default name of the module, replaced at the moment of module creation.
const int DEFAULT_GROUP = 40
 Default menu group number.
const bool IsCallOldMethods = false
 Allow calling obsolete callback methods.

Define Documentation

#define INIT_FUNCTION   initSalomePyQtGUILight

Definition at line 164 of file SALOME_PYQT_ModuleLight.cxx.

#define PY_SSIZE_T_MAX   INT_MAX

Definition at line 109 of file SALOME_PYQT_ModuleLight.cxx.

#define PY_SSIZE_T_MIN   INT_MIN

Definition at line 110 of file SALOME_PYQT_ModuleLight.cxx.


Typedef Documentation

typedef int Py_ssize_t

Definition at line 108 of file SALOME_PYQT_ModuleLight.cxx.


Function Documentation

static QString attribute ( const QDomElement &  element,
const QString &  attName 
) [static]

Get DOM element's attribute by its name.

Parameters:
elementDOM element
attNameattribute name
Returns:
empty string if the element does not have such attribute

Definition at line 2052 of file SALOME_PYQT_ModuleLight.cxx.

{
  return element.attribute( attName ).trimmed();
}

Here is the caller graph for this function:

static bool checkBool ( const QString &  value,
const int  check = -1 
) [static]

Inspect specified string for the boolean value.

This function returns true if string represents boolean value:

  • "true", "yes" or "1" for true
  • "false", "no" or "0" for false Second parameter allows to specify what boolean value is expected:
  • 1: true
  • 0: false
  • other value is not taken into account (return represented value)
Parameters:
valueinspected string
checkexpected boolean value
Returns:
boolean value represented by the string (check is not 1 or 0) or true if value correspond to the specified check

Definition at line 2073 of file SALOME_PYQT_ModuleLight.cxx.

{
  QString v = value.toLower();
  if ( ( v == "true"  || v == "yes" || v == "1" ) && ( check != 0 ) )
    return true;
  if ( ( v == "false" || v == "no"  || v == "0" ) && ( check == 0 ) )
    return true;
  return false;
}

Here is the caller graph for this function:

static int checkInt ( const QString &  value,
const int  def = -1,
const int  shift = -1 
) [static]

Inspect specified string for the integer value.

This function returns returns -1 if item is empty or represents an invalid number.

Parameters:
valueinspected string
defdefault value
shiftshift value (it is added to the integer value to produce shifted result)

Definition at line 2092 of file SALOME_PYQT_ModuleLight.cxx.

{
  bool bOk;
  int val = value.toInt( &bOk );
  if ( !bOk ) val = def;
  if ( shift > 0 && bOk && val < 0 )
    val += shift;
  return val;
}

Here is the caller graph for this function:

Definition at line 183 of file SALOME_PYQT_ModuleLight.cxx.

                                                      {

    static bool alreadyInitialized = false;
    if ( !alreadyInitialized ) {
      // call only once (see comment above) !
      static PyThreadState *gtstate = 0;
#ifndef GUI_DISABLE_CORBA
      if(SUIT_PYTHON::initialized)
        gtstate = SUIT_PYTHON::_gtstate;
      else
        gtstate = KERNEL_PYTHON::_gtstate;
#else
      gtstate = SUIT_PYTHON::_gtstate;
#endif
      PyEval_RestoreThread( gtstate );
      INIT_FUNCTION();
      PyEval_ReleaseThread( gtstate );
      alreadyInitialized = !alreadyInitialized;
    }
    return new SALOME_PYQT_ModuleLight();
  }
PyMODINIT_FUNC INIT_FUNCTION ( )
static QString tagName ( const QDomElement &  element) [static]

Get tag name for the DOM element.

Parameters:
elementDOM element
Returns:
empty string if the element does not have tag name

Definition at line 2040 of file SALOME_PYQT_ModuleLight.cxx.

{
  return element.tagName().trimmed();
}

Here is the caller graph for this function:


Variable Documentation

const int DEFAULT_GROUP = 40

Default menu group number.

Definition at line 84 of file SALOME_PYQT_ModuleLight.cxx.

const char* DEFAULT_NAME = "SALOME_PYQT_ModuleLight"

Default name of the module, replaced at the moment of module creation.

Definition at line 78 of file SALOME_PYQT_ModuleLight.cxx.

Allow calling obsolete callback methods.

If the macro CALL_OLD_METHODS is not defined, the invoking of obsolete Python module's methods like setSetting(), definePopup(), etc. is blocked.

CALL_OLD_METHODS macro can be defined for example by adding -DCALL_OLD_METHODS compilation option to the Makefile.

Definition at line 101 of file SALOME_PYQT_ModuleLight.cxx.