X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPYHELLO%2FPYHELLO.py;fp=src%2FPYHELLO%2FPYHELLO.py;h=3303c8fdd1dd94e99e2d6241b119163faec4977f;hb=07c0897d109f195fb52301a591e59dad594bc93c;hp=72897c38ff96517cfa1473ced78ed8cb0fe19e7b;hpb=5a9ad1e6bc011c829a03168dfc70900835e887b5;p=samples%2Fpyhello.git diff --git a/src/PYHELLO/PYHELLO.py b/src/PYHELLO/PYHELLO.py old mode 100644 new mode 100755 index 72897c3..3303c8f --- a/src/PYHELLO/PYHELLO.py +++ b/src/PYHELLO/PYHELLO.py @@ -76,22 +76,24 @@ class PYHELLO(PYHELLO_ORB__POA.PYHELLO_Gen, """ Create object. """ - def createObject( self, study, name ): + def createObject( self, name ): + study = getStudy() builder = study.NewBuilder() - father = findOrCreateComponent( study ) - object = builder.NewObject( father ) - attr = builder.FindOrCreateAttribute( object, "AttributeName" ) + father = findOrCreateComponent() + obj = builder.NewObject( father ) + attr = builder.FindOrCreateAttribute( obj, "AttributeName" ) attr.SetValue( name ) - attr = builder.FindOrCreateAttribute( object, "AttributeLocalID" ) + attr = builder.FindOrCreateAttribute( obj, "AttributeLocalID" ) attr.SetValue( objectID() ) pass """ Dump module data to the Python script. """ - def DumpPython( self, study, isPublished, isMultiFile ): + def DumpPython( self, isPublished, isMultiFile ): abuffer = [] names = [] + study = getStudy() father = study.FindComponent( moduleName() ) if father: iterator = study.NewChildIterator(father) @@ -102,17 +104,17 @@ class PYHELLO(PYHELLO_ORB__POA.PYHELLO_Gen, pass pass if names: - abuffer += [ "from salome import lcc" ] + abuffer += [ "import salome" ] abuffer += [ "import PYHELLO_ORB" ] abuffer += [ "" ] - abuffer += [ "pyhello = lcc.FindOrLoadComponent('FactoryServerPy', '%s')" % moduleName() ] + abuffer += [ "pyhello = salome.lcc.FindOrLoadComponent( 'FactoryServerPy', '%s' )" % moduleName() ] abuffer += [ "" ] - abuffer += [ "pyhello.createObject(theStudy, '%s')" % name for name in names ] + abuffer += [ "pyhello.createObject( '%s')" % name for name in names ] abuffer += [ "" ] pass if isMultiFile: abuffer = [ " " + s for s in abuffer ] - abuffer[0:0] = [ "def RebuildData( theStudy ):" ] + abuffer[0:0] = [ "def RebuildData():" ] abuffer += [ " pass" ] abuffer += [ "\0" ] return ("\n".join( abuffer ), 1)