From: mpa Date: Thu, 3 Nov 2016 12:29:52 +0000 (+0300) Subject: Delete boolean parameter of UpdateObjBrowser method X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f3a9ff2737b9e64e09e63350891d95e3b2da4bbe;p=modules%2Fgui.git Delete boolean parameter of UpdateObjBrowser method --- diff --git a/doc/salome/gui/input/text_user_interface.doc b/doc/salome/gui/input/text_user_interface.doc index 5501c21ce..0e9984bfa 100644 --- a/doc/salome/gui/input/text_user_interface.doc +++ b/doc/salome/gui/input/text_user_interface.doc @@ -12,10 +12,7 @@ console (since SWIG library is linked directly to the GUI library). 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() diff --git a/src/GUI_PY/helper.py b/src/GUI_PY/helper.py index 3b11a48d0..0155ded09 100644 --- a/src/GUI_PY/helper.py +++ b/src/GUI_PY/helper.py @@ -66,8 +66,7 @@ def getActiveStudy(): 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 # @@ -115,7 +114,7 @@ def deleteSObjectSelected(): study = getActiveStudy() builder = study.NewBuilder() builder.RemoveObject( sobj ) - SalomeGUI.updateObjBrowser(True) + SalomeGUI.updateObjBrowser() pass # diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index 8dadb719f..3fa500408 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -644,22 +644,13 @@ bool SalomePyQt::activateModule( const QString& modName ) /*! \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() ) { @@ -677,7 +668,7 @@ void SalomePyQt::updateObjBrowser( bool updateSelection ) } } }; - ProcessVoidEvent( new TEvent( updateSelection ) ); + ProcessVoidEvent( new TEvent() ); } diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h index 70fe3a665..d67a38216 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h @@ -173,7 +173,7 @@ public: 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 ); diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip index d76e181b6..0ad047463 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip @@ -275,7 +275,7 @@ public: 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/ ; diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx index 7d85191c0..e1da1f907 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx @@ -172,9 +172,8 @@ bool SALOMEGUI_Swig::hasDesktop() /*! \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 { diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.hxx b/src/SALOME_SWIG/SALOMEGUI_Swig.hxx index fb735652b..f5d2227ee 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.hxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.hxx @@ -35,7 +35,7 @@ public: bool hasDesktop(); - void updateObjBrowser( bool ); + void updateObjBrowser(); const char* getActiveStudyName(); diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.i b/src/SALOME_SWIG/SALOMEGUI_Swig.i index 3b846dfe9..c77f14a6a 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.i +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.i @@ -57,7 +57,7 @@ public: bool hasDesktop(); /* update object browser*/ - void updateObjBrowser(bool); + void updateObjBrowser(); /* get active study */ const char *getActiveStudyName(); diff --git a/src/SALOME_SWIG/test_big_table.py b/src/SALOME_SWIG/test_big_table.py index f2aa597b6..109b56ffc 100755 --- a/src/SALOME_SWIG/test_big_table.py +++ b/src/SALOME_SWIG/test_big_table.py @@ -66,6 +66,6 @@ for i in range(1,myVerNb+1): ARealTable.SetTitle("Very useful data") # >>> Updating Object Browser ================================================ -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() # ============================================================================ diff --git a/src/SALOME_SWIG/test_many_objects.py b/src/SALOME_SWIG/test_many_objects.py index 94df01f83..42897dace 100755 --- a/src/SALOME_SWIG/test_many_objects.py +++ b/src/SALOME_SWIG/test_many_objects.py @@ -84,7 +84,7 @@ for i in range(0,myNb1): myBuilder.Addreference(myRefObject,myObject3); # >>> Updating Object Browser ================================================ -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() # ============================================================================ diff --git a/src/SALOME_SWIG/test_table.py b/src/SALOME_SWIG/test_table.py index e480f6ad8..780c3c7ae 100755 --- a/src/SALOME_SWIG/test_table.py +++ b/src/SALOME_SWIG/test_table.py @@ -109,7 +109,7 @@ ACmt = myBuilder.FindOrCreateAttribute(myCmtObject, "AttributeComment") ACmt.SetValue("Just a comment") # >>> Updating Object Browser ================================================ -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() # ============================================================================ diff --git a/src/SalomeApp/pluginsdemo/minmax_plugin.py b/src/SalomeApp/pluginsdemo/minmax_plugin.py index 59d143b41..2ab35522c 100644 --- a/src/SalomeApp/pluginsdemo/minmax_plugin.py +++ b/src/SalomeApp/pluginsdemo/minmax_plugin.py @@ -22,9 +22,8 @@ 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 diff --git a/src/SalomeApp/pluginsdemo/tubebuilder.py b/src/SalomeApp/pluginsdemo/tubebuilder.py index 3fcb8c639..1e6ef794d 100644 --- a/src/SalomeApp/pluginsdemo/tubebuilder.py +++ b/src/SalomeApp/pluginsdemo/tubebuilder.py @@ -33,8 +33,7 @@ def createGeometry(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH, width=DE 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 @@ -53,8 +52,7 @@ def createGeometryWithPartition(study, radius=DEFAULT_RADIUS, length=DEFAULT_LEN # 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) @@ -84,7 +82,7 @@ def createMesh(study, shape): 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 diff --git a/src/SalomeApp/pluginsdemo/xalome.py b/src/SalomeApp/pluginsdemo/xalome.py index a2f5343d7..c0f61a789 100644 --- a/src/SalomeApp/pluginsdemo/xalome.py +++ b/src/SalomeApp/pluginsdemo/xalome.py @@ -45,8 +45,7 @@ def addToStudy(study,shape,shapeName,folderName=None): 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 @@ -55,7 +54,7 @@ def addToStudy(study,shape,shapeName,folderName=None): # 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) @@ -78,10 +77,9 @@ def removeFromStudy(study,shapeStudyEntry): 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 @@ -163,10 +161,9 @@ def TEST_createAndDeleteShape(): 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) diff --git a/src/SalomeApp/salome_pluginsmanager.py b/src/SalomeApp/salome_pluginsmanager.py index 2eb1ef319..e4ffb88f4 100644 --- a/src/SalomeApp/salome_pluginsmanager.py +++ b/src/SalomeApp/salome_pluginsmanager.py @@ -77,7 +77,6 @@ In short to add a plugin: 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 """ @@ -118,8 +117,7 @@ def initialize(module,name,basemenuname,menuname): 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("|") @@ -239,12 +237,7 @@ class PluginsManager: 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