From: spo Date: Tue, 3 Nov 2015 10:33:23 +0000 (+0300) Subject: Remove redirection to execute(). Replace it with Interface.execute() with validation. X-Git-Tag: V_2.1.0~206^2~21^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb120247b5683e0a64ef34d109f6db0188eb5f98;p=modules%2Fshaper.git Remove redirection to execute(). Replace it with Interface.execute() with validation. --- diff --git a/src/PythonAPI/extension/box.py b/src/PythonAPI/extension/box.py index c4ef0018a..c3ef9dcbc 100644 --- a/src/PythonAPI/extension/box.py +++ b/src/PythonAPI/extension/box.py @@ -47,7 +47,7 @@ class Box(Interface): self.setLength(dy) self.setHeight(dz) - self._execute() + self.execute() pass def setWidth(self, width): diff --git a/src/PythonAPI/model/construction/axis.py b/src/PythonAPI/model/construction/axis.py index 2ec9ab00f..2c510be5a 100644 --- a/src/PythonAPI/model/construction/axis.py +++ b/src/PythonAPI/model/construction/axis.py @@ -53,7 +53,7 @@ class Axis(Interface): elif len(args) == 1: self.setCylindricalFace(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/construction/plane.py b/src/PythonAPI/model/construction/plane.py index 6035493e8..e92a1e603 100644 --- a/src/PythonAPI/model/construction/plane.py +++ b/src/PythonAPI/model/construction/plane.py @@ -59,7 +59,7 @@ class Plane(Interface): elif len(args) == 4: self.setGeneralEquation(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/construction/point.py b/src/PythonAPI/model/construction/point.py index 3892a1abd..b7ef7d78d 100644 --- a/src/PythonAPI/model/construction/point.py +++ b/src/PythonAPI/model/construction/point.py @@ -44,7 +44,7 @@ class Point(Interface): assert(len(args) == 3) self.setPoint(*args) - self._execute() + self.execute() pass def setPoint(self, x, y, z): diff --git a/src/PythonAPI/model/exchange/exchange.py b/src/PythonAPI/model/exchange/exchange.py index 7acbc28ca..67d1de38a 100644 --- a/src/PythonAPI/model/exchange/exchange.py +++ b/src/PythonAPI/model/exchange/exchange.py @@ -40,7 +40,7 @@ class Import(Interface): assert(len(args) == 1) self.setFilePath(args[0]) - self._execute() + self.execute() pass def setFilePath(self, file_path): @@ -94,7 +94,7 @@ class Export(Interface): self.setFileFormat(args[1]) self.setObjects(args[2]) - self._execute() + self.execute() pass def setFilePath(self, file_path): diff --git a/src/PythonAPI/model/features/boolean.py b/src/PythonAPI/model/features/boolean.py index 0beb4674c..89ce1fd6b 100644 --- a/src/PythonAPI/model/features/boolean.py +++ b/src/PythonAPI/model/features/boolean.py @@ -71,7 +71,7 @@ class Boolean(Interface): self.setToolObjects(tool_objects) self.setBoolType(bool_type) - self._execute() + self.execute() pass def setMainObjects(self, main_objects): diff --git a/src/PythonAPI/model/features/extrusion.py b/src/PythonAPI/model/features/extrusion.py index 27c2ec243..1ecccf996 100644 --- a/src/PythonAPI/model/features/extrusion.py +++ b/src/PythonAPI/model/features/extrusion.py @@ -78,7 +78,7 @@ class Extrusion(Interface): elif len(args) == 1: self.setSize(args[0]) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/features/extrusion_boolean.py b/src/PythonAPI/model/features/extrusion_boolean.py index 9399e860a..810a8a7c2 100644 --- a/src/PythonAPI/model/features/extrusion_boolean.py +++ b/src/PythonAPI/model/features/extrusion_boolean.py @@ -85,7 +85,7 @@ class ExtrusionBoolean(CompositeBoolean): elif len(args) == 2: self.setSizes(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/features/extrusion_sketch.py b/src/PythonAPI/model/features/extrusion_sketch.py index 4bdb13ce7..627a1c573 100644 --- a/src/PythonAPI/model/features/extrusion_sketch.py +++ b/src/PythonAPI/model/features/extrusion_sketch.py @@ -69,7 +69,7 @@ class ExtrusionSketch(CompositeSketch): elif len(args) == 2: self.setSizes(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/features/group.py b/src/PythonAPI/model/features/group.py index bfe661307..7e098d5d0 100644 --- a/src/PythonAPI/model/features/group.py +++ b/src/PythonAPI/model/features/group.py @@ -40,7 +40,7 @@ class Group(Interface): assert(len(args) == 1) self.setGroupList(args[0]) - self._execute() + self.execute() pass def setGroupList(self, main_objects): diff --git a/src/PythonAPI/model/features/partition.py b/src/PythonAPI/model/features/partition.py index d2242347f..fb9056e7c 100644 --- a/src/PythonAPI/model/features/partition.py +++ b/src/PythonAPI/model/features/partition.py @@ -50,7 +50,7 @@ class Partition(Interface): self.setToolObjects(tool_objects) self.setPartitionCombine(partition_combine) - self._execute() + self.execute() pass def setMainObjects(self, main_objects): diff --git a/src/PythonAPI/model/features/placement.py b/src/PythonAPI/model/features/placement.py index 4153d39e6..cd9e05874 100644 --- a/src/PythonAPI/model/features/placement.py +++ b/src/PythonAPI/model/features/placement.py @@ -57,7 +57,7 @@ class Placement(Interface): self.setReverseDirection(args[3]) self.setCentering(args[4]) - self._execute() + self.execute() pass def setObjectList(self, objects_list): diff --git a/src/PythonAPI/model/features/revolution.py b/src/PythonAPI/model/features/revolution.py index e816d6204..d5985b393 100644 --- a/src/PythonAPI/model/features/revolution.py +++ b/src/PythonAPI/model/features/revolution.py @@ -78,7 +78,7 @@ class Revolution(Interface): elif len(args) == 2: self.setAngles(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/features/revolution_boolean.py b/src/PythonAPI/model/features/revolution_boolean.py index 34f3fbc08..61361de65 100644 --- a/src/PythonAPI/model/features/revolution_boolean.py +++ b/src/PythonAPI/model/features/revolution_boolean.py @@ -92,7 +92,7 @@ class RevolutionBoolean(CompositeBoolean): elif len(args) == 2: self.setAngles(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/features/revolution_sketch.py b/src/PythonAPI/model/features/revolution_sketch.py index feafe5f1e..c75d0c051 100644 --- a/src/PythonAPI/model/features/revolution_sketch.py +++ b/src/PythonAPI/model/features/revolution_sketch.py @@ -77,7 +77,7 @@ class RevolutionSketch(CompositeSketch): elif len(args) == 2: self.setAngles(*args) - self._execute() + self.execute() pass def __clear(self): diff --git a/src/PythonAPI/model/features/rotation.py b/src/PythonAPI/model/features/rotation.py index 9165b89fa..0a1cf9a2c 100644 --- a/src/PythonAPI/model/features/rotation.py +++ b/src/PythonAPI/model/features/rotation.py @@ -48,7 +48,7 @@ class Rotation(Interface): self.setAxisObject(args[1]) self.setAngle(args[2]) - self._execute() + self.execute() pass def setMainObjects(self, main_objects): diff --git a/src/PythonAPI/model/features/translation.py b/src/PythonAPI/model/features/translation.py index 12aa6ab94..1a386892b 100644 --- a/src/PythonAPI/model/features/translation.py +++ b/src/PythonAPI/model/features/translation.py @@ -48,7 +48,7 @@ class Translation(Interface): self.setAxisObject(args[1]) self.setDistance(args[2]) - self._execute() + self.execute() pass def setMainObjects(self, main_objects): diff --git a/src/PythonAPI/model/parameter/parameter.py b/src/PythonAPI/model/parameter/parameter.py index 0dd32f485..a39810c7a 100644 --- a/src/PythonAPI/model/parameter/parameter.py +++ b/src/PythonAPI/model/parameter/parameter.py @@ -44,7 +44,7 @@ class Parameter(Interface): self.setName(args[0]) self.setExpression(args[1]) - self._execute() + self.execute() pass def setName(self, name): diff --git a/src/PythonAPI/model/partset/part.py b/src/PythonAPI/model/partset/part.py index a9bce9b3b..de956eaba 100644 --- a/src/PythonAPI/model/partset/part.py +++ b/src/PythonAPI/model/partset/part.py @@ -39,7 +39,7 @@ class Part(Interface): Interface.__init__(self, feature) assert(self._feature.getKind() == "Part") - self._execute() + self.execute() pass def document(self): diff --git a/src/PythonAPI/model/roots.py b/src/PythonAPI/model/roots.py index 7f463a95b..29080e218 100644 --- a/src/PythonAPI/model/roots.py +++ b/src/PythonAPI/model/roots.py @@ -57,14 +57,14 @@ class Interface(): raise AttributeError() + def _fillAttribute(self, attribute, value): + """Fill ModelAPI_Attribute* with value.""" + tools.fill_attribute(attribute, value) + def feature(self): """Return ModelAPI_Feature.""" return self._feature - def execute(self): - """Computes or recomputes the results""" - return self._feature.execute() - def getKind(self): """Return the unique kind of the feature""" return self._feature.getKind() @@ -81,10 +81,6 @@ class Interface(): """Return the result in the list of results""" return self._feature.lastResult() - def _fillAttribute(self, attribute, value): - """Fill ModelAPI_Attribute* with value.""" - tools.fill_attribute(attribute, value) - def setRealInput(self, inputid, value): """I.setRealInput(str, float) -- set real value to the attribute""" self._feature.data().real(inputid).setValue(value) @@ -94,8 +90,8 @@ class Interface(): validators = ModelAPI.ModelAPI_Session.get().validators() return validators.validate(self._feature) - def _execute(self): - """I._execute() -- validate and execute the feature. + def execute(self): + """I.execute() -- validate and execute the feature. Raises RuntimeError if validation fails. """ diff --git a/src/PythonAPI/model/sketcher/arc.py b/src/PythonAPI/model/sketcher/arc.py index 9bac67762..0a7ae432d 100644 --- a/src/PythonAPI/model/sketcher/arc.py +++ b/src/PythonAPI/model/sketcher/arc.py @@ -27,7 +27,7 @@ class Arc(Interface): raise WrongNumberOfArguments( "Arc takes 3 or 6 arguments (%s given)" % len(args) ) - self._execute() + self.execute() ######## # diff --git a/src/PythonAPI/model/sketcher/line.py b/src/PythonAPI/model/sketcher/line.py index eb8d735e0..08f870dbc 100644 --- a/src/PythonAPI/model/sketcher/line.py +++ b/src/PythonAPI/model/sketcher/line.py @@ -33,7 +33,7 @@ class Line(Interface): raise WrongNumberOfArguments( "Arc takes 1, 2 or 4 arguments (%s given)" % len(args) ) - self._execute() + self.execute() def __createByCoordinates(self, x1, y1, x2, y2): self.setStartPoint(x1, y1) diff --git a/src/PythonAPI/model/sketcher/point.py b/src/PythonAPI/model/sketcher/point.py index 3a65acea5..603a6234a 100644 --- a/src/PythonAPI/model/sketcher/point.py +++ b/src/PythonAPI/model/sketcher/point.py @@ -15,7 +15,7 @@ class Point(Interface): self._feature.data().attribute("PointCoordinates") ) self.setValue(x, y) - self._execute() + self.execute() def setValue(self, x, y): """Set point coordinates.""" diff --git a/src/PythonAPI/model/sketcher/sketch.py b/src/PythonAPI/model/sketcher/sketch.py index 254d515ad..d0dfcf659 100644 --- a/src/PythonAPI/model/sketcher/sketch.py +++ b/src/PythonAPI/model/sketcher/sketch.py @@ -127,7 +127,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintCoincidence") constraint.data().refattr("ConstraintEntityA").setAttr(p1) constraint.data().refattr("ConstraintEntityB").setAttr(p2) - self._execute() + self.execute() return constraint def setParallel(self, l1, l2): @@ -137,7 +137,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintParallel") constraint.data().refattr("ConstraintEntityA").setObject(l1) constraint.data().refattr("ConstraintEntityB").setObject(l2) - self._execute() + self.execute() return constraint def setPerpendicular(self, l1, l2): @@ -147,7 +147,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintPerpendicular") constraint.data().refattr("ConstraintEntityA").setObject(l1) constraint.data().refattr("ConstraintEntityB").setObject(l2) - self._execute() + self.execute() return constraint def setHorizontal(self, line): @@ -155,7 +155,7 @@ class Sketch(Interface): constraint to this Sketch.""" constraint = self._feature.addFeature("SketchConstraintHorizontal") constraint.data().refattr("ConstraintEntityA").setObject(line) - self._execute() + self.execute() return constraint def setVertical(self, line): @@ -163,7 +163,7 @@ class Sketch(Interface): constraint to this Sketch.""" constraint = self._feature.addFeature("SketchConstraintVertical") constraint.data().refattr("ConstraintEntityA").setObject(line) - self._execute() + self.execute() return constraint def setDistance(self, point, line, length): @@ -179,7 +179,7 @@ class Sketch(Interface): constraint.data().refattr("ConstraintEntityA").setAttr(point) constraint.data().refattr("ConstraintEntityB").setObject(line) constraint.data().real("ConstraintValue").setValue(length) - self._execute() + self.execute() return constraint def setLength(self, line, length): @@ -189,7 +189,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintLength") constraint.data().refattr("ConstraintEntityA").setObject(line) constraint.data().real("ConstraintValue").setValue(length) - self._execute() + self.execute() return constraint def setRadius(self, circle, radius): @@ -198,7 +198,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintRadius") constraint.data().refattr("ConstraintEntityA").setObject(circle) constraint.data().real("ConstraintValue").setValue(radius) - self._execute() + self.execute() return constraint def setEqual(self, object_1, object_2): @@ -208,7 +208,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintEqual") constraint.data().refattr("ConstraintEntityA").setObject(object_1) constraint.data().refattr("ConstraintEntityB").setObject(object_2) - self._execute() + self.execute() return constraint def setAngle(self, line_1, line_2, angle): @@ -218,7 +218,7 @@ class Sketch(Interface): constraint.data().refattr("ConstraintEntityA").setObject(line_1) constraint.data().refattr("ConstraintEntityB").setObject(line_2) constraint.data().real("ConstraintValue").setValue(angle) - self._execute() + self.execute() return constraint def setTangent(self, object_1, object_2): @@ -227,7 +227,7 @@ class Sketch(Interface): constraint = self._feature.addFeature("SketchConstraintTangent") constraint.data().refattr("ConstraintEntityA").setObject(object_1) constraint.data().refattr("ConstraintEntityB").setObject(object_2) - self._execute() + self.execute() return constraint def setFillet(self, line_1, line_2, radius): @@ -237,7 +237,7 @@ class Sketch(Interface): constraint.data().refattr("ConstraintEntityA").setObject(line_1) constraint.data().refattr("ConstraintEntityB").setObject(line_2) constraint.data().real("ConstraintValue").setValue(radius) - self._execute() + self.execute() return constraint #-------------------------------------------------------------