Changes re comments on PR279

This commit is contained in:
WandererFan 2016-09-12 07:41:24 -04:00
parent 254b28ea77
commit 4e729f0840
4 changed files with 10 additions and 17 deletions

View File

@ -237,9 +237,9 @@ int DrawPage::addView(App::DocumentObject *docObj)
{
if(!docObj->isDerivedFrom(TechDraw::DrawView::getClassTypeId()))
return -1;
DrawView* view = static_cast<DrawView*>(docObj);
//position all new views in center of Page (exceptDVDimension)
DrawView* view = static_cast<DrawView*>(docObj);
if (!docObj->isDerivedFrom(TechDraw::DrawViewDimension::getClassTypeId())) {
view->X.setValue(getPageWidth()/2.0);
view->Y.setValue(getPageHeight()/2.0);

View File

@ -27,11 +27,8 @@ PyObject* DrawPagePy::addView(PyObject* args)
PyObject *pcDocObj;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
Base::Console().Error("Error: DrawPagePy::addView - Bad Arg - not DocumentObject\n");
return NULL;
//TODO: sb PyErr??
//PyErr_SetString(PyExc_TypeError,"addView expects a DrawView");
//return -1;
PyErr_SetString(PyExc_TypeError, "DrawPagePy::AddView - Bad Arg - not DocumentObject");
return nullptr;
}
DrawPage* page = getDrawPagePtr(); //get DrawPage for pyPage
@ -52,11 +49,8 @@ PyObject* DrawPagePy::removeView(PyObject* args)
PyObject *pcDocObj;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
Base::Console().Error("Error: DrawPagePy::removeView - Bad Arg - not DocumentObject\n");
return NULL;
//TODO: sb PyErr??
//PyErr_SetString(PyExc_TypeError,"removeView expects a DrawView");
//return -1;
PyErr_SetString(PyExc_TypeError, "DrawPagePy::removeView - Bad Arg - not DocumentObject");
return nullptr;
}
DrawPage* page = getDrawPagePtr(); //get DrawPage for pyPage

View File

@ -135,8 +135,7 @@ int DrawViewCollection::countChildren()
const std::vector<App::DocumentObject *> &views = Views.getValues();
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
App::DocumentObject *docObj = static_cast<App::DocumentObject *>(*it);
if(docObj->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) {
if((*it)->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) {
TechDraw::DrawViewCollection *viewCollection = static_cast<TechDraw::DrawViewCollection *>(*it);
numChildren += viewCollection->countChildren() + 1;
} else {

View File

@ -19,8 +19,8 @@ PyObject* DrawViewCollectionPy::addView(PyObject* args)
PyObject *pcDocObj;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
Base::Console().Error("Error: DrawViewClipPy::addView - Bad Arg - not DocumentObject\n");
return NULL;
PyErr_SetString(PyExc_TypeError, "DrawViewCollectionPy::addView - Bad Arg - not DocumentObject");
return nullptr;
}
DrawViewCollection* collect = getDrawViewCollectionPtr();
@ -37,8 +37,8 @@ PyObject* DrawViewCollectionPy::removeView(PyObject* args)
PyObject *pcDocObj;
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
Base::Console().Error("Error: DrawViewClipPy::addView - Bad Arg - not DocumentObject\n");
return NULL;
PyErr_SetString(PyExc_TypeError, "DrawViewCollectionPy::removeView - Bad Arg - not DocumentObject");
return nullptr;
}
DrawViewCollection* collect = getDrawViewCollectionPtr();