From a5a04e359cba047674b4fbe7da5d7365b1e072a4 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 19 Jun 2017 13:32:27 +0200 Subject: [PATCH] fix bug in pr774, improve whitespaces --- src/Mod/Sketcher/App/SketchObjectPyImp.cpp | 7 +++--- src/Mod/Sketcher/Gui/CommandCreateGeo.cpp | 25 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 94f6f78a07..3e497a2a6b 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -827,7 +827,6 @@ PyObject* SketchObjectPy::extend(PyObject *args) { double increment; int endPoint; - int GeoId; if (PyArg_ParseTuple(args, "idi", &GeoId, &increment, &endPoint)) { @@ -837,10 +836,12 @@ PyObject* SketchObjectPy::extend(PyObject *args) PyErr_SetString(PyExc_ValueError, str.str().c_str()); return 0; } + Py_Return; } - Py_Return; + PyErr_SetString(PyExc_TypeError, "extend() method accepts:\n" - "-- int,float,int\n"); + "-- int,float,int\n"); + return 0; } PyObject* SketchObjectPy::addSymmetric(PyObject *args) diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 7670e6bc64..b190e6a507 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -6090,8 +6090,8 @@ namespace SketcherGui { public: ExtendSelection(App::DocumentObject* obj) : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) - , object(obj) - , disabled(false) + , object(obj) + , disabled(false) {} bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName) @@ -6100,28 +6100,27 @@ namespace SketcherGui { return false; if (!sSubName || sSubName[0] == '\0') return false; - if (disabled) - return true; + if (disabled) + return true; std::string element(sSubName); if (element.substr(0, 4) == "Edge") { int GeoId = std::atoi(element.substr(4, 4000).c_str()) - 1; Sketcher::SketchObject *Sketch = static_cast(object); const Part::Geometry *geom = Sketch->getGeometry(GeoId); if (geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() || - geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId() - ) + geom->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) return true; } return false; } void setDisabled(bool isDisabled) { - disabled = isDisabled; + disabled = isDisabled; } protected: bool disabled; }; -}; +} /* XPM */ static const char *cursor_extension[]={ @@ -6186,7 +6185,7 @@ public: Q_UNUSED(sketchgui) Gui::Selection().clearSelection(); Gui::Selection().rmvSelectionGate(); - filterGate = new ExtendSelection(sketchgui->getObject()); + filterGate = new ExtendSelection(sketchgui->getObject()); Gui::Selection().addSelectionGate(filterGate); setCursor(QPixmap(cursor_extension),7,7); } @@ -6339,7 +6338,7 @@ public: EditCurve.resize(31); Mode = STATUS_SEEK_Second; } - filterGate->setDisabled(true); + filterGate->setDisabled(true); } } else if (Mode == STATUS_SEEK_Second) { try { @@ -6365,7 +6364,7 @@ public: if(continuousMode){ // This code enables the continuous creation mode. Mode=STATUS_SEEK_First; - filterGate->setDisabled(false); + filterGate->setDisabled(false); EditCurve.clear(); sketchgui->drawEdit(EditCurve); EditCurve.resize(2); @@ -6394,7 +6393,7 @@ protected: SelectMode Mode; std::vector EditCurve; int BaseGeoId; - ExtendSelection* filterGate = nullptr; + ExtendSelection* filterGate = nullptr; bool ExtendFromStart; // if true, extend from start, else extend from end (circle only) bool SavedExtendFromStart; double Increment; @@ -6494,7 +6493,7 @@ namespace SketcherGui { return false; } }; -}; +} /* XPM */