Core: do not override sys.stdin when using FreeCAD as Python module
This commit is contained in:
@@ -296,6 +296,7 @@ void PythonStdin::init_type()
|
||||
behaviors().doc("Redirection of stdin to FreeCAD to open an input dialog");
|
||||
// you must have overwritten the virtual functions
|
||||
behaviors().supportRepr();
|
||||
behaviors().supportGetattr();
|
||||
add_varargs_method("readline",&PythonStdin::readline,"readline()");
|
||||
}
|
||||
|
||||
@@ -316,6 +317,14 @@ Py::Object PythonStdin::repr()
|
||||
return Py::String(s_out.str());
|
||||
}
|
||||
|
||||
Py::Object PythonStdin::getattr(const char *name)
|
||||
{
|
||||
if (strcmp(name, "closed") == 0) {
|
||||
return Py::Boolean(false);
|
||||
}
|
||||
return getattr_methods(name);
|
||||
}
|
||||
|
||||
Py::Object PythonStdin::readline(const Py::Tuple& /*args*/)
|
||||
{
|
||||
return Py::String( (const char *)pyConsole->readline().toLatin1() );
|
||||
|
||||
Reference in New Issue
Block a user