prepare for PyCXX 7.0

This commit is contained in:
wmayer
2018-04-18 19:20:50 +02:00
parent 08286c407e
commit 99ec96acd5
36 changed files with 226 additions and 239 deletions

View File

@@ -168,7 +168,7 @@ void CommandPy::setParameters(Py::Dict arg)
#endif
}
else {
throw Py::Exception("The dictionary can only contain string keys");
throw Py::TypeError("The dictionary can only contain string keys");
}
boost::to_upper(ckey);
@@ -185,7 +185,7 @@ void CommandPy::setParameters(Py::Dict arg)
cvalue = PyFloat_AsDouble(value);
}
else {
throw Py::Exception("The dictionary can only contain number values");
throw Py::TypeError("The dictionary can only contain number values");
}
getCommandPtr()->Parameters[ckey]=cvalue;
}
@@ -202,7 +202,7 @@ PyObject* CommandPy::toGCode(PyObject *args)
return PyString_FromString(getCommandPtr()->toGCode().c_str());
#endif
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* CommandPy::setFromGCode(PyObject *args)
@@ -214,7 +214,7 @@ PyObject* CommandPy::setFromGCode(PyObject *args)
Py_INCREF(Py_None);
return Py_None;
}
throw Py::Exception("Argument must be a string");
throw Py::TypeError("Argument must be a string");
}
// Placement attribute get/set
@@ -231,7 +231,7 @@ void CommandPy::setPlacement(Py::Object arg)
if(arg.isType(PlacementType)) {
getCommandPtr()->setFromPlacement( *static_cast<Base::PlacementPy*>((*arg))->getPlacementPtr() );
} else
throw Py::Exception("Argument must be a placement");
throw Py::TypeError("Argument must be a placement");
}
PyObject* CommandPy::transform(PyObject *args)
@@ -242,7 +242,7 @@ PyObject* CommandPy::transform(PyObject *args)
Path::Command trCmd = getCommandPtr()->transform( *p->getPlacementPtr() );
return new CommandPy(new Path::Command(trCmd));
} else
throw Py::Exception("Argument must be a placement");
throw Py::TypeError("Argument must be a placement");
}
// custom attributes get/set

View File

@@ -100,7 +100,7 @@ void PathPy::setCommands(Py::List list)
Path::Command &cmd = *static_cast<Path::CommandPy*>((*it).ptr())->getCommandPtr();
getToolpathPtr()->addCommand(cmd);
} else {
throw Py::Exception("The list can only contain Path Commands");
throw Py::TypeError("The list can only contain Path Commands");
}
}
}
@@ -124,7 +124,7 @@ PyObject* PathPy::copy(PyObject * args)
if (PyArg_ParseTuple(args, "")) {
return new PathPy(new Path::Toolpath(*getToolpathPtr()));
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* PathPy::addCommands(PyObject * args)
@@ -184,7 +184,7 @@ PyObject* PathPy::toGCode(PyObject * args)
return PyString_FromString(result.c_str());
#endif
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* PathPy::setFromGCode(PyObject * args)
@@ -196,7 +196,7 @@ PyObject* PathPy::setFromGCode(PyObject * args)
Py_INCREF(Py_None);
return Py_None;
}
throw Py::Exception("Argument must be a string");
throw Py::TypeError("Argument must be a string");
}
// custom attributes get/set

View File

@@ -223,7 +223,7 @@ PyObject* ToolPy::copy(PyObject * args)
if (PyArg_ParseTuple(args, "")) {
return new ToolPy(new Path::Tool(*getToolPtr()));
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* ToolPy::setFromTemplate(PyObject * args)
@@ -276,7 +276,7 @@ PyObject* ToolPy::templateAttrs(PyObject * args)
PyDict_SetItemString(dict, "cuttingEdgeHeight", PyFloat_FromDouble(getToolPtr()->CuttingEdgeHeight));
return dict;
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* ToolPy::getToolTypes(PyObject * args)
@@ -290,7 +290,7 @@ PyObject* ToolPy::getToolTypes(PyObject * args)
}
return list;
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* ToolPy::getToolMaterials(PyObject * args)
@@ -304,7 +304,7 @@ PyObject* ToolPy::getToolMaterials(PyObject * args)
}
return list;
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
@@ -405,7 +405,7 @@ void TooltablePy::setTools(Py::Dict arg)
Py_DECREF(success);
}
} else {
throw Py::Exception("The dictionary can only contain int:tool pairs");
throw Py::TypeError("The dictionary can only contain int:tool pairs");
}
}
}
@@ -417,7 +417,7 @@ PyObject* TooltablePy::copy(PyObject * args)
if (PyArg_ParseTuple(args, "")) {
return new TooltablePy(new Path::Tooltable(*getTooltablePtr()));
}
throw Py::Exception("This method accepts no argument");
throw Py::TypeError("This method accepts no argument");
}
PyObject* TooltablePy::addTools(PyObject * args)