App: remove Py2 code from several src/App .cpp files
This commit is contained in:
@@ -78,25 +78,10 @@ Base::Quantity PropertyQuantity::createQuantityFromPy(PyObject *value)
|
||||
Base::Quantity quant;
|
||||
|
||||
if (PyUnicode_Check(value)){
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
quant = Quantity::parse(QString::fromUtf8(PyUnicode_AsUTF8(value)));
|
||||
}
|
||||
#else
|
||||
PyObject* unicode = PyUnicode_AsUTF8String(value);
|
||||
std::string Str;
|
||||
Str = PyString_AsString(unicode);
|
||||
quant = Quantity::parse(QString::fromUtf8(Str.c_str()));
|
||||
Py_DECREF(unicode);
|
||||
}
|
||||
else if (PyString_Check(value))
|
||||
quant = Quantity::parse(QString::fromLatin1(PyString_AsString(value)));
|
||||
#endif
|
||||
else if (PyFloat_Check(value))
|
||||
quant = Quantity(PyFloat_AsDouble(value),_Unit);
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
else if (PyInt_Check(value))
|
||||
quant = Quantity((double)PyInt_AsLong(value),_Unit);
|
||||
#endif
|
||||
else if (PyLong_Check(value))
|
||||
quant = Quantity((double)PyLong_AsLong(value),_Unit);
|
||||
else if (PyObject_TypeCheck(value, &(QuantityPy::Type))) {
|
||||
|
||||
Reference in New Issue
Block a user