if isinstance(parameter,str):
if notebook.isVariable(parameter):
Result.append(notebook.get(parameter))
- pass
- pass
+ else:
+ raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!"
else:
Result.append(parameter)
pass
void SetEditCurrentArgument();
void ReverseAngle();
void ValueChangedInSpinBox( double );
+ void TextValueChangedInSpinBox( const QString& );
void ConstructorsClicked( int );
void SetDoubleSpinBoxStep( double );
};
connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )),
+ this, SLOT(TextValueChangedInSpinBox(const QString& )));
+ connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )),
+ this, SLOT(TextValueChangedInSpinBox(const QString& )));
+ connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )),
+ this, SLOT(TextValueChangedInSpinBox(const QString& )));
+
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
ActivateThisDialog();
}
+//=================================================================================
+// function : TextValueChangedInSpinBox
+// purpose :
+//=================================================================================
+void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QString& s)
+{
+ QObject* send = (QObject*)sender();
+ bool isDigit = true;
+
+ switch (getConstructorId()) {
+ case 0:
+ GroupPoints->SpinBox_DX->text().toDouble(&isDigit);
+ if(!isDigit){
+ GroupPoints->CheckButton1->setChecked(false);
+ }
+ GroupPoints->CheckButton1->setEnabled(isDigit);
+ break;
+ case 1:
+ if (send == GroupDimensions->SpinBox_DX1) {
+ GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit);
+ if(!isDigit)
+ GroupDimensions->CheckButton1->setChecked(false);
+ GroupDimensions->CheckButton1->setEnabled(isDigit);
+ }
+ else if(send == GroupDimensions->SpinBox_DX2){
+ GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit);
+ if(!isDigit)
+ GroupDimensions->CheckButton2->setChecked(false);
+ GroupDimensions->CheckButton2->setEnabled(isDigit);
+ }
+ break;
+ }
+}
+
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue)
{
QObject* send = (QObject*)sender();
-
switch (getConstructorId()) {
case 0:
if (send == GroupPoints->SpinBox_DX)
// function : isValid
// purpose :
//=================================================================================
-bool TransformationGUI_MultiTranslationDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
{
int aConstructorId = getConstructorId();
-
- if (aConstructorId == 0)
- return !(myBase->_is_nil() || myVectorU->_is_nil());
- else if (aConstructorId == 1)
- return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil());
+
+ if (aConstructorId == 0) {
+ bool ok = true;
+ ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+ return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok;
+ }
+ else if (aConstructorId == 1) {
+ bool ok = true;
+ ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok;
+ return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok;
+ }
return 0;
}
GEOM::GEOM_Object_var anObj;
+ QStringList aParameters;
+
switch (getConstructorId()) {
case 0:
if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU);
+ if(!IsPreview()) {
+ aParameters<<GroupPoints->SpinBox_DX->text();
+ aParameters<<GroupPoints->SpinBox_DY->text();
+ }
res = true;
}
break;
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU,
myVectorV, myStepV, myNbTimesV);
+ if(!IsPreview()) {
+ aParameters<<GroupDimensions->SpinBox_DX1->text();
+ aParameters<<GroupDimensions->SpinBox_DY1->text();
+ aParameters<<GroupDimensions->SpinBox_DX2->text();
+ aParameters<<GroupDimensions->SpinBox_DY2->text();
+ }
res = true;
}
break;
}
- if (!anObj->_is_nil())
+ if (!anObj->_is_nil()) {
+ if(!IsPreview())
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
+ }
return res;
}
void ReverseStepU();
void ReverseStepV();
void ValueChangedInSpinBox( double );
+ void TextValueChangedInSpinBox( const QString& );
void ConstructorsClicked( int );
void SetDoubleSpinBoxStep( double );
};
return false;
}
}
- return true;
+ return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
}
//=================================================================================
for ( int i = 0; i < myObjects.length(); i++ ) {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() );
- if ( !anObj->_is_nil() )
+ if ( !anObj->_is_nil() ) {
+ if(!IsPreview()) {
+ anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
+ }
objects.push_back( anObj._retn() );
+ }
}
}
else {
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )),
+ this, SLOT(TextValueChangedInSpinBox( const QString&)));
+
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
ActivateThisDialog();
}
+void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s)
+{
+ bool isDigit = true;
+ s.toDouble(&isDigit);
+ if(!isDigit) {
+ GroupPoints->CheckButton2->setChecked(false);
+ }
+ GroupPoints->CheckButton2->setEnabled(isDigit);
+}
+
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
// function : isValid
// purpose :
//=================================================================================
-bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_RotationDlg::isValid (QString& msg)
{
if (myObjects.length() < 1) return false;
switch (getConstructorId()) {
case 0:
- return !(myAxis->_is_nil());
+ return !(myAxis->_is_nil()) && GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
break;
case 1:
return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil());
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
RotateCopy(myObjects[i], myAxis, GetAngle() * PI180);
- if (!anObj->_is_nil())
+ if (!anObj->_is_nil()) {
+ if(!IsPreview()) {
+ anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
+ }
objects.push_back(anObj._retn());
+ }
}
}
else {
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox();
+ void TextValueChangedInSpinBox( const QString& );
void CreateCopyModeChanged( bool );
void ConstructorsClicked( int );
void onReverse();
#include <GeometryGUI.h>
#include <GEOMBase.h>
-#include <QtxDoubleSpinBox.h>
+#include <SalomeApp_DoubleSpinBox.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
LineEdit2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
TextLabel3 = new QLabel(tr("GEOM_SCALE_FACTOR"), GroupBox1);
- SpinBox_FX = new QtxDoubleSpinBox(GroupBox1);
+ SpinBox_FX = new SalomeApp_DoubleSpinBox(GroupBox1);
TextLabel4 = new QLabel(tr("GEOM_SCALE_FACTOR_Y"), GroupBox1);
- SpinBox_FY = new QtxDoubleSpinBox(GroupBox1);
+ SpinBox_FY = new SalomeApp_DoubleSpinBox(GroupBox1);
TextLabel5 = new QLabel(tr("GEOM_SCALE_FACTOR_Z"), GroupBox1);
- SpinBox_FZ = new QtxDoubleSpinBox(GroupBox1);
+ SpinBox_FZ = new SalomeApp_DoubleSpinBox(GroupBox1);
CheckBoxCopy = new QCheckBox(tr("GEOM_CREATE_COPY"), GroupBox1);
CheckBoxCopy->setChecked(true);
// function : isValid
// purpose :
//=================================================================================
-bool TransformationGUI_ScaleDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_ScaleDlg::isValid (QString& msg)
{
if (myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001)
{
// && !myPoint->_is_nil()
- if (getConstructorId() == 0)
- return true;
+ if (getConstructorId() == 0) {
+ return SpinBox_FX->isValid( msg, !IsPreview() );
+ }
if (fabs(SpinBox_FY->value()) > 0.00001 &&
- fabs(SpinBox_FZ->value()) > 0.00001)
+ fabs(SpinBox_FZ->value()) > 0.00001 &&
+ SpinBox_FX->isValid( msg, !IsPreview()) &&
+ SpinBox_FY->isValid( msg, !IsPreview()) &&
+ SpinBox_FZ->isValid( msg, !IsPreview()))
return true;
}
return false;
{
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value());
- if (!anObj->_is_nil())
+ if (!anObj->_is_nil()) {
+ if(!IsPreview())
+ anObj->SetParameters(SpinBox_FX->text().toLatin1().constData());
objects.push_back(anObj._retn());
+ }
}
}
else
ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(),
SpinBox_FY->value(), SpinBox_FZ->value());
if (!anObj->_is_nil())
+ if(!IsPreview()) {
+ QStringList aParameters;
+ aParameters<<SpinBox_FX->text();
+ aParameters<<SpinBox_FY->text();
+ aParameters<<SpinBox_FZ->text();
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+ }
objects.push_back(anObj._retn());
}
}
class QLabel;
class QLineEdit;
class QPushButton;
-class QtxDoubleSpinBox;
+class SalomeApp_DoubleSpinBox;
//=================================================================================
// class : TransformationGUI_ScaleDlg
QLabel* TextLabel3;
QLabel* TextLabel4;
QLabel* TextLabel5;
- QtxDoubleSpinBox* SpinBox_FX;
- QtxDoubleSpinBox* SpinBox_FY;
- QtxDoubleSpinBox* SpinBox_FZ;
+ SalomeApp_DoubleSpinBox* SpinBox_FX;
+ SalomeApp_DoubleSpinBox* SpinBox_FY;
+ SalomeApp_DoubleSpinBox* SpinBox_FZ;
QCheckBox* CheckBoxCopy;
private slots:
// function : isValid
// purpose :
//=================================================================================
-bool TransformationGUI_TranslationDlg::isValid (QString& /*msg*/)
+bool TransformationGUI_TranslationDlg::isValid (QString& msg)
{
int aConstructorId = getConstructorId();
if (myObjects.length() < 1) return false;
switch (aConstructorId) {
- case 0:
- return true;
+ case 0:
+ {
+ bool ok = true;
+ ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
+ ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
+ return ok;
+ }
case 1:
return !(myPoint1->_is_nil() || myPoint2->_is_nil());
case 2:
- return !(myVector->_is_nil());
+ return !(myVector->_is_nil()) && GroupPoints->SpinBox3->isValid( msg, !IsPreview() );
default:
break;
}
double dy = GroupPoints->SpinBox2->value();
double dz = GroupPoints->SpinBox3->value();
+ QStringList aParameters;
+ aParameters<<GroupPoints->SpinBox1->text();
+ aParameters<<GroupPoints->SpinBox2->text();
+ aParameters<<GroupPoints->SpinBox3->text();
+
if (toCreateCopy) {
for (int i = 0; i < myObjects.length(); i++) {
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateDXDYDZCopy(myObjects[i], dx, dy, dz);
- if (!anObj->_is_nil())
+ if (!anObj->_is_nil()) {
+ if(!IsPreview())
+ anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
objects.push_back(anObj._retn());
+ }
}
}
else {
}
case 2:
{
+ QStringList aParameters;
bool byDistance = GroupPoints->CheckBox1->isChecked();
if (byDistance) {
double aDistance = GroupPoints->SpinBox3->value();
myCurrObject = myObjects[i];
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy);
- if (!anObj->_is_nil())
+ if (!anObj->_is_nil()) {
+ if(toCreateCopy)
+ if(!IsPreview())
+ anObj->SetParameters(GroupPoints->SpinBox3->text().toLatin1().constData());
objects.push_back(anObj._retn());
+ }
}
}
else {