From 3d38234ce4c634113ae8953f5b35e1401a77c90d Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 12 Sep 2012 10:34:14 +0200 Subject: [PATCH 1/3] 0000831: python print causes File descriptor error on windows --- src/Base/Interpreter.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index a1ddd5a7af..427e439dc3 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -38,6 +38,7 @@ #include "PyTools.h" #include "Exception.h" #include "PyObjectBase.h" +#include char format2[1024]; //Warning! Can't go over 512 characters!!! @@ -89,6 +90,36 @@ SystemExitException::SystemExitException(const SystemExitException &inst) // --------------------------------------------------------- +// Fixes #0000831: python print causes File descriptor error on windows +class PythonStdOutput : public Py::PythonExtension +{ +public: + static void init_type(void) + { + behaviors().name("PythonStdOutput"); + behaviors().doc("Python standard output"); + add_varargs_method("write",&PythonStdOutput::write,"write()"); + add_varargs_method("flush",&PythonStdOutput::flush,"flush()"); + } + + PythonStdOutput() + { + } + ~PythonStdOutput() + { + } + + Py::Object write(const Py::Tuple&) + { + return Py::None(); + } + Py::Object flush(const Py::Tuple&) + { + return Py::None(); + } +}; + +// --------------------------------------------------------- InterpreterSingleton::InterpreterSingleton() { @@ -311,6 +342,10 @@ const char* InterpreterSingleton::init(int argc,char *argv[]) PyEval_InitThreads(); Py_Initialize(); PySys_SetArgv(argc, argv); + PythonStdOutput::init_type(); + PythonStdOutput* out = new PythonStdOutput(); + PySys_SetObject("stdout", out); + PySys_SetObject("stderr", out); this->_global = PyEval_SaveThread(); } From 498e7c1b6849abdf57d1302063308e21cfb5acf6 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 12 Sep 2012 10:39:05 +0200 Subject: [PATCH 2/3] 0000830: Part Design Fillet and Chamfer icons should be different from the Part icons --- .../Resources/icons/PartDesign_Chamfer.svg | 24 +++++++------- .../Gui/Resources/icons/PartDesign_Fillet.svg | 31 +++++++++---------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Chamfer.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Chamfer.svg index e0ac0430e0..1019cd0fe5 100644 --- a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Chamfer.svg +++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Chamfer.svg @@ -15,7 +15,7 @@ id="svg3364" sodipodi:version="0.32" inkscape:version="0.48.3.1 r9886" - sodipodi:docname="PartDesign_Chamfer_v3.svg" + sodipodi:docname="PartDesign_Chamfer.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.1"> + style="stop-color:#ff2b1e;stop-opacity:1;" /> @@ -129,9 +129,9 @@ inkscape:collect="always" xlink:href="#linearGradient3864" id="linearGradient5146" - x1="55.545452" - y1="25.818182" - x2="20.636362" + x1="48.272724" + y1="25.636364" + x2="16.090908" y2="24.181818" gradientUnits="userSpaceOnUse" spreadMethod="pad" /> @@ -143,9 +143,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="5.4999999" - inkscape:cx="36.157676" - inkscape:cy="24.078612" + inkscape:zoom="11" + inkscape:cx="33.74495" + inkscape:cy="31.251397" inkscape:current-layer="g3780" showgrid="true" inkscape:document-units="px" @@ -175,8 +175,8 @@ id="g3780" transform="matrix(0.82780005,0,0,0.83717425,-0.2499405,9.0601524)"> @@ -186,8 +186,8 @@ id="path3801" inkscape:connector-curvature="0" /> @@ -129,12 +129,11 @@ inkscape:collect="always" xlink:href="#linearGradient3776" id="linearGradient3784" - x1="26.214075" - y1="12.623135" - x2="15.684641" - y2="38.033287" - gradientUnits="userSpaceOnUse" - spreadMethod="reflect" /> + x1="24.566774" + y1="12.948906" + x2="17.990864" + y2="28.911695" + gradientUnits="userSpaceOnUse" /> @@ -175,8 +174,8 @@ id="g3780" transform="matrix(0.82780005,0,0,0.83717425,-0.2499405,9.0601524)"> @@ -187,8 +186,8 @@ inkscape:connector-curvature="0" /> From 6c722111f8bc8b40eb806b717bc070b3a621c437 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 12 Sep 2012 15:01:41 +0200 Subject: [PATCH 3/3] 0000826: reading from the python console for using pdb --- src/Gui/PythonConsole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 8c5d2cea92..3f8eb7d480 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -1236,8 +1236,8 @@ QString PythonConsole::readline( void ) // ... and wait until we get notified about pendingSource QObject::connect( this, SIGNAL(pendingSource()), &loop, SLOT(quit()) ); // application is about to quit - if (loop.exec() < 0) - inputBuffer = QLatin1String("quit()"); + if (loop.exec() != 0) + { PyErr_SetInterrupt(); } //< send SIGINT to python this->_sourceDrain = NULL; //< disable source drain return inputBuffer.append(QChar::fromAscii('\n')); //< pass a newline here, since the readline-caller may need it! }