The example of usage:
\code
# update Object browser contents
-salome.sg.updateObjBrowser(True)
-
-# get the active study ID
-studyId = salome.sg.getActiveStudyId()
+salome.sg.updateObjBrowser()
# get the active study name
studyName = salome.sg.getActiveStudyName()
study. The active study is a GUI concept: it's the study currently
active on the desktop.
"""
- studyId = sgPyQt.getStudyId()
- study = services.getStudyManager().GetStudyByID( studyId )
+ study = services.getStudy()
return study
#
study = getActiveStudy()
builder = study.NewBuilder()
builder.RemoveObject( sobj )
- SalomeGUI.updateObjBrowser(True)
+ SalomeGUI.updateObjBrowser()
pass
#
/*!
\brief Update an Object Browser of the study.
-
- The \a updateSelection parameter is obsolete and currently is not used.
- This parameter will be removed in future, so try to avoid its usage in
- your code.
-
- \brief updateSelection update selection flag (not used)
- \sa getActiveStudy()
*/
-void SalomePyQt::updateObjBrowser( bool updateSelection )
+void SalomePyQt::updateObjBrowser()
{
class TEvent: public SALOME_Event
{
- bool myUpdateSelection;
public:
- TEvent( bool updateSelection )
- : myUpdateSelection( updateSelection ) {}
+ TEvent() {}
virtual void Execute()
{
if ( SUIT_Session::session() ) {
}
}
};
- ProcessVoidEvent( new TEvent( updateSelection ) );
+ ProcessVoidEvent( new TEvent() );
}
static const QString getActiveComponent();
static PyObject* getActivePythonModule();
static bool activateModule( const QString& );
- static void updateObjBrowser( bool = true );
+ static void updateObjBrowser();
static bool isModified();
static void setModified( bool );
static const QString getActiveComponent() /ReleaseGIL/ ;
static SIP_PYOBJECT getActivePythonModule() /ReleaseGIL/ ;
static bool activateModule( const QString& ) /ReleaseGIL/ ;
- static void updateObjBrowser( bool = true ) /ReleaseGIL/ ;
+ static void updateObjBrowser() /ReleaseGIL/ ;
static bool isModified() /ReleaseGIL/ ;
static void setModified( bool ) /ReleaseGIL/ ;
/*!
\brief Update active study's Object Browser.
- \param updateSelection this parameter is obsolete
*/
-void SALOMEGUI_Swig::updateObjBrowser( bool /*updateSelection*/ )
+void SALOMEGUI_Swig::updateObjBrowser()
{
class TEvent: public SALOME_Event
{
bool hasDesktop();
- void updateObjBrowser( bool );
+ void updateObjBrowser();
const char* getActiveStudyName();
bool hasDesktop();
/* update object browser*/
- void updateObjBrowser(bool);
+ void updateObjBrowser();
/* get active study */
const char *getActiveStudyName();
ARealTable.SetTitle("Very useful data")
# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
# ============================================================================
myBuilder.Addreference(myRefObject,myObject3);
# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
# ============================================================================
ACmt.SetValue("Just a comment")
# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(True)
+salome.sg.updateObjBrowser()
# ============================================================================
from qtsalome import *
def minmax(context):
- # get context study, studyId, salomeGui
+ # get context study, salomeGui
study = context.study
- studyId = context.studyId
sg = context.sg
from minmax_ui import Ui_Dialog
given parameters.
'''
print "TUBE: creating the geometry ..."
- studyId = study._get_StudyId()
- geompy = geomtools.getGeompy(studyId)
+ geompy = geomtools.getGeompy()
radius_ext = radius
radius_int = radius_ext - width
# We have to create a partition so that we can use an hexaedric
# meshing algorithm.
- studyId = study._get_StudyId()
- geompy = geomtools.getGeompy(studyId)
+ geompy = geomtools.getGeompy()
print "TUBE: creating a partition ..."
toolPlane = geompy.MakeFaceHW(2.1*length,2.1*radius,3)
smesh.SetName(Nb_Segments, 'Nb. Segments_1')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
- salome.sg.updateObjBrowser(False)
+ salome.sg.updateObjBrowser()
return mesh
created in the Geometry part of the study, and the shape study
object is stored in this folder of the study.
"""
- studyId = study._get_StudyId()
- geompy = geomtools.getGeompy(studyId)
+ geompy = geomtools.getGeompy()
if folderName is None:
# Insert the shape in the study by the standard way
# A folder name has been specified to embed this shape. Find
# or create a folder with this name in the Geometry study, and
# then store the shape in this folder.
- studyEditor = getStudyEditor(studyId)
+ studyEditor = getStudyEditor()
geomStudyFolder = studyEditor.findOrCreateComponent("GEOM")
shapeStudyFolder = studyEditor.findOrCreateItem(geomStudyFolder,folderName)
erase the drawing in the viewer.
The underlying GEOM object is returned (so that it can be destroyed)
"""
- studyId = study._get_StudyId()
shape = IDToObject(shapeStudyEntry)
studyObject = IDToSObject(shapeStudyEntry)
- studyEditor = getStudyEditor(studyId)
+ studyEditor = getStudyEditor()
studyEditor.removeItem(studyObject,True)
return shape
import salome
salome.salome_init()
study = salome.myStudy
- studyId = salome.myStudyId
from salome.geom import geomtools
- geompy = geomtools.getGeompy(studyId)
+ geompy = geomtools.getGeompy()
# --------------------------------------------------
# Create a first shape (GEOM object)
context attributes:
- sg : the SALOME Swig interface
- - studyId : the SALOME studyId that must be used to execute the plugin
- study : the SALOME study object that must be used to execute the plugin
"""
class Context:
def __init__(self,sgpyqt):
self.sg=sgpyqt
- self.studyId=salome.sg.getActiveStudyId()
- self.study= salome.myStudyManager.GetStudyByID(self.studyId)
+ self.study=salome.myStudy
def find_menu(smenu):
lmenus=smenu.split("|")
def importPlugins(self):
"""Execute the salome_plugins file that contains plugins definition """
- studyId=sg.getActiveStudyId()
- if studyId == 0:
- self.menu.clear()
- self.menu.menuAction().setVisible(False)
- return
- elif self.lasttime ==0 or salome.myStudy == None:
+ if self.lasttime ==0 or salome.myStudy == None:
salome.salome_init(embedded=1)
lasttime=0