-###
-# 'SOLVER' dialog box
-###
-##class MyDialog( QDialog ):
-## # constructor
-## def __init__( self, parent = None, modal = 0):
-## QDialog.__init__( self, parent )
-## self.setObjectName( "MyDialog" )
-## self.setModal( modal )
-## self.setWindowTitle( "SOLVER!" )
-## vb = QVBoxLayout( self )
-## vb.setMargin( 8 )
-
-## hb0 = QHBoxLayout( self )
-## label = QLabel( "Prenom: ", self )
-## hb0.addWidget( label )
-## self.entry = QLineEdit( self )
-## self.entry.setMinimumWidth( 200 )
-## hb0.addWidget( self.entry )
-## vb.addLayout( hb0 )
-
-## hb1 = QHBoxLayout( self )
-## bOk = QPushButton( "&OK", self )
-## self.connect( bOk, SIGNAL( 'clicked()' ), self, SLOT( 'accept()' ) )
-## hb1.addWidget( bOk )
-
-## hb1.addStretch( 10 )
-
-## bCancel = QPushButton( "&Cancel", self )
-## self.connect( bCancel, SIGNAL( 'clicked()' ), self, SLOT( 'close()' ) )
-## hb1.addWidget( bCancel )
-
-## vb.addLayout( hb1 )
-## pass
-
-## # OK button slot
-## def accept( self ):
-## name = str( self.entry.text() )
-## if name != "":
-## inPoint = [1, 2, 3]
-## outPoint = [0, 0]
-## print "GENERICSOLVERGUI.accept (1): inPoint = ", inPoint
-## print "GENERICSOLVERGUI.accept (1): outPoint = ", outPoint
-## (ok,outPoint) = getEngine().Exec( inPoint, outPoint )
-## QMessageBox.information( self, 'Info', "Exec() method returned %d" % ok )
-## print "GENERICSOLVERGUI.accept (2): inPoint = ", inPoint
-## print "GENERICSOLVERGUI.accept (2): outPoint = ", outPoint
-## self.close()
-## else:
-## QMessageBox.warning( self, 'Error!', 'Please, enter the name!' )
-## pass
-
-###
-# Plays with study
-###
-def addObjectInStudy( builder, father, objname, objid ):
- obj = getSubSObjectByName( father, objname )
- if obj is None:
- obj = builder.NewObject( father )
- attr = builder.FindOrCreateAttribute( obj, "AttributeName" )
- attr.SetValue( objname )
- attr = builder.FindOrCreateAttribute( obj, "AttributeLocalID" )
- attr.SetValue( objid )
- return obj
-
-def setValueToVariable( builder, varobj, value ):
- attr = builder.FindOrCreateAttribute( varobj, "AttributeLocalID" )
- objid = attr.Value()
- if (objid == GUIcontext.VARIABLE_ID):
- attr = builder.FindOrCreateAttribute( varobj, "AttributeReal" )
- attr.SetValue( value )
- else:
- attr = builder.FindOrCreateAttribute( varobj, "AttributeName" )
- QMessageBox.information( sgPyQt.getDesktop(), 'Info', "Object '%s' isn't a variable. Can't set value." % attr.Value() )
- pass
-
-def getValueOfVariable( builder, varobj ):
- attr = builder.FindOrCreateAttribute( varobj, "AttributeLocalID" )
- objid = attr.Value()
- if (objid == GUIcontext.VARIABLE_ID):
- attr = builder.FindOrCreateAttribute( varobj, "AttributeReal" )
- return attr.Value()
- else:
- attr = builder.FindOrCreateAttribute( varobj, "AttributeName" )
- QMessageBox.information( sgPyQt.getDesktop(), 'Info', "Object '%s' isn't a variable. Can't set value." % attr.Value() )
- return 0.
-
-def getSubSObjectByName( sobjFather, childName ):
- study = getStudy()
- iter = study.NewChildIterator( sobjFather )
- #builder = study.NewBuilder()
- while iter.More():
- sobj = iter.Value()
- if sobj.GetName() == childName:
- return sobj
- iter.Next()
- pass
- return None