(if there is one) and referenced object ID (for references). I.e.
this is the same data the user can see in the Object Browser columns.
\code
-salome.DumpStudy(salome.myStudy)
+salome.DumpStudy()
\endcode
\li \b IDToSObject() Get SALOMEDS object by its entry ID.
pos = tmp_str.rfind( _extension_ );
if( !with_extension && pos >= 0 )
- tmp_str = pos < (int)file_path.size()-1 ? file_path.substr( 0, pos ) : "";
+ tmp_str = pos < (int)tmp_str.size()-1 ? tmp_str.substr( 0, pos ) : "";
return tmp_str;
}
methods : defined in SALOMEDS.idl
methods:
- salome.DumpStudy(study) : Dump a study, given the ior
+ salome.DumpStudy() : Dump a study, given the ior
---
'''
print doc_salome
#--------------------------------------------------------------------------
-def DumpComponent(Study, SO, offset):
- it = Study.NewChildIterator(SO)
- Builder = Study.NewBuilder()
+def DumpComponent(SO, offset):
+ global myStudy
+ it = myStudy.NewChildIterator(SO)
+ Builder = myStudy.NewBuilder()
while it.More():
CSO = it.Value()
it.Next()
a = a + " "
ofs = ofs +1
print a + ">" + RefSO.GetID()
- DumpComponent(Study, CSO, offset+2)
+ DumpComponent(CSO, offset+2)
#--------------------------------------------------------------------------
-def DumpStudy(Study):
- itcomp = Study.NewComponentIterator()
+def DumpStudy():
+ global myStudy
+ itcomp = myStudy.NewComponentIterator()
while itcomp.More():
SC = itcomp.Value()
itcomp.Next()
name = SC.ComponentDataType()
print "-> ComponentDataType is " + name
- DumpComponent(Study, SC, 1)
+ DumpComponent(SC, 1)
#--------------------------------------------------------------------------
salome_initial=1
def salome_init(embedded=0):
"""
- Performs only once SALOME general purpose intialisation for scripts.
+ Performs only once SALOME general purpose initialization for scripts.
Provides:
orb reference to CORBA
lcc a LifeCycleCorba instance
try:
# study can be clear either from GUI or directly with salome.myStudy.Clear()
myStudy.Clear()
+ myStudy.Init()
except:
pass
salome_initial=1
salome_iapp_close()
- salome_study_close()
- myStudy, myStudyName=None,None
pass
#--------------------------------------------------------------------------
-def DumpComponent(Study, SO, Builder,offset):
- it = Study.NewChildIterator(SO)
+def DumpComponent(SO, Builder,offset):
+ global myStudy
+ it = myStudy.NewChildIterator(SO)
while it.More():
CSO = it.Value()
a=offset*"--" + ">" + CSO.GetID()
#--------------------------------------------------------------------------
-def DumpStudy(Study):
+def DumpStudy():
"""
Dump a study, given the ior
"""
- itcomp = Study.NewComponentIterator()
- Builder = Study.NewBuilder()
+ global myStudy
+ itcomp = myStudy.NewComponentIterator()
+ Builder = myStudy.NewBuilder()
while itcomp.More():
SC = itcomp.Value()
name = SC.ComponentDataType()
print "-> ComponentDataType is " + name
- DumpComponent(Study, SC,Builder, 1)
+ DumpComponent(SC,Builder, 1)
itcomp.Next()
#--------------------------------------------------------------------------
return myObj
def ObjectToSObject(obj):
+ global myStudy
mySO = None
if obj is not None:
ior = orb.object_to_string(obj)
#--------------------------------------------------------------------------
def PersistentPresentation(theSO, theWithID):
+ global myStudy
# put the sobject's content (with subchildren) to the string
aResult = ""
attrs = theSO.GetAllAttributes()
def openStudy(theStudyPath):
print "openStudy"
- salome.myStudy.Open(theStudyPath)
- theStudyName = salome.myStudy._get_Name()
- print theStudyPath, theStudyName
- return theStudyName
-
- #--------------------------------------------------------------------------
-def clearStudy():
global myStudy
- print "clearStudy"
- myStudy.Clear()
- myStudy = None
- pass
+ myStudy.Open(theStudyPath)
+ print theStudyPath, myStudy._get_Name()
#--------------------------------------------------------------------------
if verbose(): print "Study found"
pass
- # get study name
+ import types
+ if theStudyPath and type(theStudyPath) == types.StringType:
+ openStudy(theStudyPath)
+
myStudyName = myStudy._get_Name()
return myStudy, myStudyName
-
-def salome_study_close():
- global myStudy, myStudyName
- myStudy, myStudyName = None, None
- pass
SALOME_NamingService * salomens = new SALOME_NamingService(orb);
- MESSAGE("Create New Study ");
+ MESSAGE("Find Study ");
CORBA::Object_ptr obj2 = salomens->Resolve("Study");
SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj2);
_impl->setNotifier(_notifier);
_impl->setGenObjRegister( _genObjRegister );
+ // update desktop title with new study name
+ NameChanged();
+
// Notify GUI that study was created
SALOME_NamingService *aNamingService = KERNEL::getNamingService();
CORBA::Object_var obj = aNamingService->Resolve("/Kernel/Session");
bool res = _impl->Open(std::string(aUrl));
+ // update desktop title with new study name
+ NameChanged();
+
if ( !res )
THROW_SALOME_CORBA_EXCEPTION("Impossible to Open study from file", SALOME::BAD_PARAM)
return res;
SALOMEDS::Locker lock;
// URL is specified as IDL attribute: user exception cannot be raised
_impl->URL(std::string((char*)url));
+
+ // update desktop title with new study name
+ NameChanged();
}
void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR, const char* anEntry)
isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
+
+void SALOMEDS_Study_i::NameChanged()
+{
+ // Notify GUI that the name of study was changed
+ SALOME_NamingService *aNamingService = KERNEL::getNamingService();
+ CORBA::Object_var obj = aNamingService->Resolve("/Kernel/Session");
+ SALOME::Session_var aSession = SALOME::Session::_narrow(obj);
+ if ( !CORBA::is_nil(aSession) ) {
+ std::stringstream ss;
+ ss << "studyNameChanged";
+ std::string str = ss.str();
+ SALOMEDS::unlock();
+ aSession->emitMessageOneWay(str.c_str());
+ SALOMEDS::lock();
+ }
+}
class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
{
private:
+
+ void NameChanged();
CORBA::ORB_var _orb;
SALOMEDSImpl_Study* _impl;
SALOMEDS_StudyBuilder_i* _builder;