App: remove Py2 code from several src/App .cpp files

This commit is contained in:
luz paz
2021-04-14 10:18:27 -04:00
committed by wwmayer
parent ee98ed5baf
commit fc6d1292d1
12 changed files with 0 additions and 268 deletions

View File

@@ -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))) {