diff --git a/.gitignore b/.gitignore index 82e1234e882d..1f9a93accd00 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,6 @@ install_manifest.txt /src/Tools/offlinedoc/localwiki/ /src/Tools/offlinedoc/*.txt OpenSCAD_rc.py -.subuser-dev /\.idea/ .tags tags diff --git a/.subuser.json b/.subuser.json deleted file mode 100644 index a004b52acbd9..000000000000 --- a/.subuser.json +++ /dev/null @@ -1 +0,0 @@ -{"image-sources-dir": "./subuser"} \ No newline at end of file diff --git a/src/Base/GeometryPyCXX.h b/src/Base/GeometryPyCXX.h index 8226918845e4..8dfd6cf9f8bb 100644 --- a/src/Base/GeometryPyCXX.h +++ b/src/Base/GeometryPyCXX.h @@ -185,11 +185,12 @@ class GeometryT : public Object } operator T() const { - // cast the PyObject pointer to the matching sub-class - // and call then the defined member function + return getValue(); + } + PyT* getPy() const + { PyT* py = static_cast(ptr()); - T* v = (py->*valuePtr)(); - return *v; + return py; } private: diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index a5967c60aca2..6e6a8e44f616 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -103,11 +103,7 @@ PyTypeObject PyObjectBase::Type = { /* --- Functions to access object as input/output buffer ---------*/ 0, /* tp_as_buffer */ /* --- Flags to define presence of optional/expanded features */ -#if PY_MAJOR_VERSION >= 3 Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, /*tp_flags */ -#else - Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_CLASS, /*tp_flags */ -#endif "The most base class for Python binding", /*tp_doc */ 0, /*tp_traverse */ 0, /*tp_clear */ @@ -134,10 +130,8 @@ PyTypeObject PyObjectBase::Type = { 0, /*tp_subclasses */ 0, /*tp_weaklist */ 0, /*tp_del */ - 0 /*tp_version_tag */ -#if PY_MAJOR_VERSION >= 3 - ,0 /*tp_finalize */ -#endif + 0, /*tp_version_tag */ + 0 /*tp_finalize */ #if PY_VERSION_HEX >= 0x03090000 ,0 /*tp_vectorcall */ #elif PY_VERSION_HEX >= 0x03080000 @@ -161,11 +155,7 @@ PyMethodDef PyObjectBase::Methods[] = { PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro) { const char *attr; -#if PY_MAJOR_VERSION >= 3 attr = PyUnicode_AsUTF8(attro); -#else - attr = PyString_AsString(attro); -#endif // For the __class__ attribute get it directly as with // ExtensionContainerPy::getCustomAttributes we may get @@ -204,7 +194,9 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro) pyObj->trackAttribute(attr, value); } } - else if (value && PyCFunction_Check(value)) { + else +#endif + if (value && PyCFunction_Check(value)) { // ExtensionContainerPy::initialization() transfers the methods of an // extension object by creating PyCFunction objects. // At this point no 'self' object is passed but is handled and determined @@ -220,18 +212,14 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro) PyErr_Format(PyExc_AttributeError, "", attr); } } -#endif + return value; } int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value) { const char *attr; -#if PY_MAJOR_VERSION >= 3 attr = PyUnicode_AsUTF8(attro); -#else - attr = PyString_AsString(attro); -#endif //FIXME: In general we don't allow to delete attributes (i.e. value=0). However, if we want to allow //we must check then in _setattr() of all subclasses whether value is 0. @@ -294,11 +282,7 @@ PyObject *PyObjectBase::_getattr(const char *attr) else { // As fallback solution use Python's default method to get generic attributes PyObject *w, *res; -#if PY_MAJOR_VERSION >= 3 w = PyUnicode_InternFromString(attr); -#else - w = PyString_InternFromString(attr); -#endif if (w != NULL) { res = PyObject_GenericGetAttr(this, w); Py_XDECREF(w); @@ -318,11 +302,7 @@ int PyObjectBase::_setattr(const char *attr, PyObject *value) return -1; // filter out softspace PyObject *w; // As fallback solution use Python's default method to get generic attributes -#if PY_MAJOR_VERSION >= 3 w = PyUnicode_InternFromString(attr); // new reference -#else - w = PyString_InternFromString(attr); // new reference -#endif if (w != NULL) { // call methods from tp_getset if defined int res = PyObject_GenericSetAttr(this, w, value); @@ -354,13 +334,8 @@ void PyObjectBase::resetAttribute() if (attrDict) { // This is the attribute name to the parent structure // which we search for in the dict -#if PY_MAJOR_VERSION < 3 - PyObject* key1 = PyString_FromString("__attribute_of_parent__"); - PyObject* key2 = PyString_FromString("__instance_of_parent__"); -#else PyObject* key1 = PyBytes_FromString("__attribute_of_parent__"); PyObject* key2 = PyBytes_FromString("__instance_of_parent__"); -#endif PyObject* attr = PyDict_GetItem(attrDict, key1); PyObject* inst = PyDict_GetItem(attrDict, key2); if (attr) { @@ -379,15 +354,9 @@ void PyObjectBase::setAttributeOf(const char* attr, PyObject* par) if (!attrDict) { attrDict = PyDict_New(); } -#if PY_MAJOR_VERSION < 3 - PyObject* key1 = PyString_FromString("__attribute_of_parent__"); - PyObject* key2 = PyString_FromString("__instance_of_parent__"); - PyObject* attro = PyString_FromString(attr); -#else PyObject* key1 = PyBytes_FromString("__attribute_of_parent__"); PyObject* key2 = PyBytes_FromString("__instance_of_parent__"); PyObject* attro = PyUnicode_FromString(attr); -#endif PyDict_SetItem(attrDict, key1, attro); PyDict_SetItem(attrDict, key2, par); Py_DECREF(attro); @@ -403,13 +372,8 @@ void PyObjectBase::startNotify() if (attrDict) { // This is the attribute name to the parent structure // which we search for in the dict -#if PY_MAJOR_VERSION < 3 - PyObject* key1 = PyString_FromString("__attribute_of_parent__"); - PyObject* key2 = PyString_FromString("__instance_of_parent__"); -#else PyObject* key1 = PyBytes_FromString("__attribute_of_parent__"); PyObject* key2 = PyBytes_FromString("__instance_of_parent__"); -#endif PyObject* attr = PyDict_GetItem(attrDict, key1); PyObject* parent = PyDict_GetItem(attrDict, key2); if (attr && parent) { diff --git a/src/Base/PyObjectBase.h b/src/Base/PyObjectBase.h index d7d1c0b6e8a2..593253f89e0d 100644 --- a/src/Base/PyObjectBase.h +++ b/src/Base/PyObjectBase.h @@ -463,12 +463,10 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort; #define __PY_CATCH(R) \ catch(Base::AbortException &e) \ { \ - e.ReportException(); \ _Py_ErrorObj(R,Base::BaseExceptionFreeCADAbort,e.getPyObject());\ } \ catch(Base::Exception &e) \ { \ - e.ReportException(); \ auto pye = e.getPyExceptionType(); \ if(!pye) \ pye = Base::BaseExceptionFreeCADError; \ diff --git a/src/Base/QuantityPyImp.cpp b/src/Base/QuantityPyImp.cpp index 60266fd73783..90af3385bd33 100644 --- a/src/Base/QuantityPyImp.cpp +++ b/src/Base/QuantityPyImp.cpp @@ -672,25 +672,31 @@ void QuantityPy::setFormat(Py::Dict arg) PyObject *QuantityPy::getCustomAttributes(const char* attr) const { + QuantityPy* py = nullptr; if (strcmp(attr, "Torr") == 0) { - return new QuantityPy(new Quantity(Quantity::Torr)); + py = new QuantityPy(new Quantity(Quantity::Torr)); } else if (strcmp(attr, "mTorr") == 0) { - return new QuantityPy(new Quantity(Quantity::mTorr)); + py = new QuantityPy(new Quantity(Quantity::mTorr)); } else if (strcmp(attr, "yTorr") == 0) { - return new QuantityPy(new Quantity(Quantity::yTorr)); + py = new QuantityPy(new Quantity(Quantity::yTorr)); } else if (strcmp(attr, "PoundForce") == 0) { - return new QuantityPy(new Quantity(Quantity::PoundForce)); + py = new QuantityPy(new Quantity(Quantity::PoundForce)); } else if (strcmp(attr, "AngularMinute") == 0) { - return new QuantityPy(new Quantity(Quantity::AngMinute)); + py = new QuantityPy(new Quantity(Quantity::AngMinute)); } else if (strcmp(attr, "AngularSecond") == 0) { - return new QuantityPy(new Quantity(Quantity::AngSecond)); + py = new QuantityPy(new Quantity(Quantity::AngSecond)); } - return 0; + + if (py) { + py->setNotTracking(); + } + + return py; } int QuantityPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/) diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index 9124592a906f..746b383373b4 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -737,11 +737,7 @@ PyObject* Application::sGetLocale(PyObject * /*self*/, PyObject *args) return NULL; std::string locale = Translator::instance()->activeLanguage(); -#if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(locale.c_str()); -#else - return PyString_FromString(locale.c_str()); -#endif } PyObject* Application::sSetLocale(PyObject * /*self*/, PyObject *args) @@ -819,11 +815,7 @@ PyObject* Application::sAddPreferencePage(PyObject * /*self*/, PyObject *args) PyObject* dlg; // old style classes -#if PY_MAJOR_VERSION >= 3 if (PyArg_ParseTuple(args, "O!s", &PyType_Type, &dlg, &grp)) { -#else - if (PyArg_ParseTuple(args, "O!s", &PyClass_Type, &dlg, &grp)) { -#endif // add to the preferences dialog new PrefPagePyProducer(Py::Object(dlg), grp); diff --git a/src/Gui/CommandPyImp.cpp b/src/Gui/CommandPyImp.cpp index ac53da444185..b705ec814978 100644 --- a/src/Gui/CommandPyImp.cpp +++ b/src/Gui/CommandPyImp.cpp @@ -77,11 +77,7 @@ PyObject* CommandPy::listAll(PyObject *args) PyObject* pyList = PyList_New(cmds.size()); int i=0; for ( std::vector::iterator it = cmds.begin(); it != cmds.end(); ++it ) { -#if PY_MAJOR_VERSION >= 3 PyObject* str = PyUnicode_FromString((*it)->getName()); -#else - PyObject* str = PyString_FromString((*it)->getName()); -#endif PyList_SetItem(pyList, i++, str); } return pyList; @@ -123,11 +119,7 @@ PyObject* CommandPy::listByShortcut(PyObject *args) PyObject* pyList = PyList_New(matches.size()); int i=0; for (std::string match : matches) { -#if PY_MAJOR_VERSION >= 3 PyObject* str = PyUnicode_FromString(match.c_str()); -#else - PyObject* str = PyString_FromString(match.c_str()); -#endif PyList_SetItem(pyList, i++, str); } return pyList; @@ -178,11 +170,7 @@ PyObject* CommandPy::getShortcut(PyObject *args) Command* cmd = this->getCommandPtr(); if (cmd) { -#if PY_MAJOR_VERSION >= 3 PyObject* str = PyUnicode_FromString(cmd->getAction() ? cmd->getAction()->shortcut().toString().toStdString().c_str() : ""); -#else - PyObject* str = PyString_FromString(cmd->getAction() ? cmd->getAction()->shortcut().toString().toStdString().c_str() : ""); -#endif return str; } else { @@ -283,21 +271,12 @@ PyObject* CommandPy::getInfo(PyObject *args) if (action) shortcutTxt = action->shortcut().toString().toStdString(); -#if PY_MAJOR_VERSION >= 3 PyObject* strMenuTxt = PyUnicode_FromString(menuTxt ? menuTxt : ""); PyObject* strTooltipTxt = PyUnicode_FromString(tooltipTxt ? tooltipTxt : ""); PyObject* strWhatsThisTxt = PyUnicode_FromString(whatsThisTxt ? whatsThisTxt : ""); PyObject* strStatustipTxt = PyUnicode_FromString(statustipTxt ? statustipTxt : ""); PyObject* strPixMapTxt = PyUnicode_FromString(pixMapTxt ? pixMapTxt : ""); PyObject* strShortcutTxt = PyUnicode_FromString(!shortcutTxt.empty() ? shortcutTxt.c_str() : ""); -#else - PyObject* strMenuTxt = PyString_FromString(menuTxt ? menuTxt : ""); - PyObject* strTooltipTxt = PyString_FromString(tooltipTxt ? tooltipTxt : ""); - PyObject* strWhatsThisTxt = PyString_FromString(whatsThisTxt ? whatsThisTxt : ""); - PyObject* strStatustipTxt = PyString_FromString(statustipTxt ? statustipTxt : ""); - PyObject* strPixMapTxt = PyString_FromString(pixMapTxt ? pixMapTxt : ""); - PyObject* strShortcutTxt = PyString_FromString(!shortcutTxt.empty() ? shortcutTxt.c_str() : ""); -#endif PyList_SetItem(pyList, 0, strMenuTxt); PyList_SetItem(pyList, 1, strTooltipTxt); PyList_SetItem(pyList, 2, strWhatsThisTxt); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index f4312f55fd38..1047880a50db 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -194,7 +194,8 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, FileDialog dlg(parent); dlg.setWindowTitle(windowTitle); dlg.setSidebarUrls(urls); - dlg.setIconProvider(new FileIconProvider()); + auto iconprov = std::make_unique(); + dlg.setIconProvider(iconprov.get()); dlg.setFileMode(QFileDialog::AnyFile); dlg.setAcceptMode(QFileDialog::AcceptSave); dlg.setDirectory(dirName); diff --git a/src/Gui/Icons/Std_MarkToRecompute.svg b/src/Gui/Icons/Std_MarkToRecompute.svg new file mode 100644 index 000000000000..190fd5432f3c --- /dev/null +++ b/src/Gui/Icons/Std_MarkToRecompute.svg @@ -0,0 +1,550 @@ + + + Std_MarkToRecompute + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + [bitacovir] + + + + + Std_MarkToRecompute + + + + 11-04-2021 + + + FreeCAD LGPL2+ + + + + + FreeCAD + + + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Gui/Icons/resource.qrc b/src/Gui/Icons/resource.qrc index 9269f819ed4d..abff6b522b7e 100644 --- a/src/Gui/Icons/resource.qrc +++ b/src/Gui/Icons/resource.qrc @@ -162,6 +162,7 @@ Std_HideSelection.svg Std_Import.svg Std_MergeProjects.svg + Std_MarkToRecompute.svg Std_PrintPdf.svg Std_RandomColor.svg Std_RecentFiles.svg diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index 90b75c468349..9f7583effb08 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -169,11 +169,7 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const if (result) { Py_DECREF(result); result = PyDict_GetItemString(dict, "htmldocument"); -#if PY_MAJOR_VERSION >= 3 const char* contents = PyUnicode_AsUTF8(result); -#else - const char* contents = PyString_AsString(result); -#endif res.append("HTTP/1.0 200 OK\n"); res.append("Content-type: text/html\n"); res.append(contents); @@ -204,11 +200,7 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const if (result) { Py_DECREF(result); result = PyDict_GetItemString(dict, "page"); -#if PY_MAJOR_VERSION >= 3 const char* page = PyUnicode_AsUTF8(result); -#else - const char* page = PyString_AsString(result); -#endif res.append("HTTP/1.0 200 OK\n"); res.append("Content-type: text/html\n"); res.append(page); diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 16212fcc30da..3eacfdacfa9c 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -171,17 +171,9 @@ void InteractiveInterpreter::setPrompt() Base::PyGILStateLocker lock; d->sysmodule = PyImport_ImportModule("sys"); if (!PyObject_HasAttrString(d->sysmodule, "ps1")) -#if PY_MAJOR_VERSION >= 3 PyObject_SetAttrString(d->sysmodule, "ps1", PyUnicode_FromString(">>> ")); -#else - PyObject_SetAttrString(d->sysmodule, "ps1", PyString_FromString(">>> ")); -#endif if (!PyObject_HasAttrString(d->sysmodule, "ps2")) -#if PY_MAJOR_VERSION >= 3 PyObject_SetAttrString(d->sysmodule, "ps2", PyUnicode_FromString("... ")); -#else - PyObject_SetAttrString(d->sysmodule, "ps2", PyString_FromString("... ")); -#endif } /** @@ -323,11 +315,7 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const throw Base::PyException(); /* not incref'd */ // It seems that the return value is always 'None' or Null -#if PY_MAJOR_VERSION >= 3 presult = PyEval_EvalCode((PyObject*)code, dict, dict); /* run compiled bytecode */ -#else - presult = PyEval_EvalCode(code, dict, dict); /* run compiled bytecode */ -#endif Py_XDECREF(code); /* decref the code object */ if (!presult) { if (PyErr_ExceptionMatches(PyExc_SystemExit)) { @@ -359,11 +347,7 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const } std::string err = str.str(); -#if PY_MAJOR_VERSION >= 3 errdata = PyUnicode_FromString(err.c_str()); -#else - errdata = PyString_FromString(err.c_str()); -#endif } } PyErr_Restore(errobj, errdata, errtraceback); @@ -474,13 +458,8 @@ PythonConsole::PythonConsole(QWidget *parent) d->_stdin = PySys_GetObject("stdin"); PySys_SetObject("stdin", d->_stdinPy); -#if PY_MAJOR_VERSION >= 3 const char* version = PyUnicode_AsUTF8(PySys_GetObject("version")); const char* platform = PyUnicode_AsUTF8(PySys_GetObject("platform")); -#else - const char* version = PyString_AsString(PySys_GetObject("version")); - const char* platform = PyString_AsString(PySys_GetObject("platform")); -#endif d->info = QString::fromLatin1("Python %1 on %2\n" "Type 'help', 'copyright', 'credits' or 'license' for more information.") .arg(QString::fromLatin1(version), QString::fromLatin1(platform)); @@ -837,12 +816,11 @@ void PythonConsole::runSource(const QString& line) setFocus(); // if focus was lost } catch (const Base::SystemExitException&) { -#if PY_MAJOR_VERSION >= 3 // In Python the exception must be cleared because when the message box below appears // callable Python objects can be invoked and due to a failing assert the application // will be aborted. PyErr_Clear(); -#endif + ParameterGrp::handle hPrefGrp = getWindowParameter(); bool check = hPrefGrp->GetBool("CheckSystemExit",true); int ret = QMessageBox::Yes; diff --git a/src/Gui/PythonConsolePy.cpp b/src/Gui/PythonConsolePy.cpp index c92b65a750e6..5f8be304e019 100644 --- a/src/Gui/PythonConsolePy.cpp +++ b/src/Gui/PythonConsolePy.cpp @@ -80,15 +80,9 @@ Py::Object PythonStdout::write(const Py::Tuple& args) try { Py::Object output(args[0]); if (PyUnicode_Check(output.ptr())) { -#if PY_MAJOR_VERSION >= 3 PyObject* unicode = PyUnicode_AsEncodedString(output.ptr(), "utf-8", 0); if (unicode) { const char* string = PyBytes_AsString(unicode); -#else - PyObject* unicode = PyUnicode_AsEncodedObject(output.ptr(), "utf-8", "strict"); - if (unicode) { - const char* string = PyString_AsString(unicode); -#endif int maxlen = qstrlen(string) > 10000 ? 10000 : -1; pyConsole->insertPythonOutput(QString::fromUtf8(string, maxlen)); Py_DECREF(unicode); @@ -163,15 +157,9 @@ Py::Object PythonStderr::write(const Py::Tuple& args) try { Py::Object output(args[0]); if (PyUnicode_Check(output.ptr())) { -#if PY_MAJOR_VERSION >= 3 PyObject* unicode = PyUnicode_AsEncodedString(output.ptr(), "utf-8", 0); if (unicode) { const char* string = PyBytes_AsString(unicode); -#else - PyObject* unicode = PyUnicode_AsEncodedObject(output.ptr(), "utf-8", "strict"); - if (unicode) { - const char* string = PyString_AsString(unicode); -#endif int maxlen = qstrlen(string) > 10000 ? 10000 : -1; pyConsole->insertPythonError(QString::fromUtf8(string, maxlen)); Py_DECREF(unicode); @@ -245,15 +233,9 @@ Py::Object OutputStdout::write(const Py::Tuple& args) try { Py::Object output(args[0]); if (PyUnicode_Check(output.ptr())) { -#if PY_MAJOR_VERSION >= 3 PyObject* unicode = PyUnicode_AsEncodedString(output.ptr(), "utf-8", 0); if (unicode) { const char* string = PyBytes_AsString(unicode); -#else - PyObject* unicode = PyUnicode_AsEncodedObject(output.ptr(), "utf-8", "strict"); - if (unicode) { - const char* string = PyString_AsString(unicode); -#endif Base::Console().Message("%s",string); Py_DECREF(unicode); } @@ -326,15 +308,9 @@ Py::Object OutputStderr::write(const Py::Tuple& args) try { Py::Object output(args[0]); if (PyUnicode_Check(output.ptr())) { -#if PY_MAJOR_VERSION >= 3 PyObject* unicode = PyUnicode_AsEncodedString(output.ptr(), "utf-8", 0); if (unicode) { const char* string = PyBytes_AsString(unicode); -#else - PyObject* unicode = PyUnicode_AsEncodedObject(output.ptr(), "utf-8", "strict"); - if (unicode) { - const char* string = PyString_AsString(unicode); -#endif Base::Console().Error("%s",string); Py_DECREF(unicode); } diff --git a/src/Gui/PythonDebugger.cpp b/src/Gui/PythonDebugger.cpp index 10f51e8119fe..403fd0ae88c9 100644 --- a/src/Gui/PythonDebugger.cpp +++ b/src/Gui/PythonDebugger.cpp @@ -437,11 +437,7 @@ void PythonDebugger::runFile(const QString& fn) dict = PyModule_GetDict(module); dict = PyDict_Copy(dict); if (PyDict_GetItemString(dict, "__file__") == NULL) { -#if PY_MAJOR_VERSION >= 3 PyObject *f = PyUnicode_FromString((const char*)pxFileName); -#else - PyObject *f = PyString_FromString((const char*)pxFileName); -#endif if (f == NULL) { fclose(fp); return; @@ -580,11 +576,7 @@ int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int wha //no = frame->f_tstate->recursion_depth; //std::string funcname = PyString_AsString(frame->f_code->co_name); -#if PY_MAJOR_VERSION >= 3 QString file = QString::fromUtf8(PyUnicode_AsUTF8(frame->f_code->co_filename)); -#else - QString file = QString::fromUtf8(PyString_AsString(frame->f_code->co_filename)); -#endif switch (what) { case PyTrace_CALL: self->depth++; diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index 84fa8d1b2a2f..d2be885c9f47 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -2067,11 +2067,7 @@ PyObject *SelectionSingleton::sCountObjectsOfType(PyObject * /*self*/, PyObject return NULL; unsigned int count = Selection().countObjectsOfType(objecttype, document, resolve); -#if PY_MAJOR_VERSION < 3 - return PyInt_FromLong(count); -#else return PyLong_FromLong(count); -#endif } PyObject *SelectionSingleton::sGetSelection(PyObject * /*self*/, PyObject *args) @@ -2340,15 +2336,9 @@ PyObject *SelectionSingleton::sSetVisible(PyObject * /*self*/, PyObject *args) if(visible == Py_None) { vis = -1; } -#if PY_MAJOR_VERSION < 3 - else if(PyInt_Check(visible)) { - vis = PyInt_AsLong(visible); - } -#else else if(PyLong_Check(visible)) { vis = PyLong_AsLong(visible); } -#endif else { vis = PyObject_IsTrue(visible)?1:0; } diff --git a/src/Gui/Stylesheets/Behave-dark.qss b/src/Gui/Stylesheets/Behave-dark.qss index 8cac105dc086..da1db23fc590 100644 --- a/src/Gui/Stylesheets/Behave-dark.qss +++ b/src/Gui/Stylesheets/Behave-dark.qss @@ -1552,6 +1552,18 @@ QPushButton:checked { border-color: #65A2E5; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Dark-blue.qss b/src/Gui/Stylesheets/Dark-blue.qss index 22a21751af7a..32c2c0f3d1b7 100644 --- a/src/Gui/Stylesheets/Dark-blue.qss +++ b/src/Gui/Stylesheets/Dark-blue.qss @@ -1519,6 +1519,18 @@ QPushButton:checked { border-color: #3874f2; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Dark-contrast.qss b/src/Gui/Stylesheets/Dark-contrast.qss index e73ce94ad43c..a60202a6696f 100644 --- a/src/Gui/Stylesheets/Dark-contrast.qss +++ b/src/Gui/Stylesheets/Dark-contrast.qss @@ -1519,6 +1519,18 @@ QPushButton:checked { border-color: #2053c0; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Dark-green.qss b/src/Gui/Stylesheets/Dark-green.qss index 829e141ce1c9..7b49d5bcd068 100644 --- a/src/Gui/Stylesheets/Dark-green.qss +++ b/src/Gui/Stylesheets/Dark-green.qss @@ -1519,6 +1519,17 @@ QPushButton:checked { border-color: #819c0c; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Dark-orange.qss b/src/Gui/Stylesheets/Dark-orange.qss index f36840ef995f..4305187e0f35 100644 --- a/src/Gui/Stylesheets/Dark-orange.qss +++ b/src/Gui/Stylesheets/Dark-orange.qss @@ -1519,6 +1519,18 @@ QPushButton:checked { border-color: #d0970c; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Darker-blue.qss b/src/Gui/Stylesheets/Darker-blue.qss index 73cdd9a09a95..12cf7a1204bb 100644 --- a/src/Gui/Stylesheets/Darker-blue.qss +++ b/src/Gui/Stylesheets/Darker-blue.qss @@ -1519,6 +1519,18 @@ QPushButton:checked { border-color: #2053c0; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Darker-green.qss b/src/Gui/Stylesheets/Darker-green.qss index f18adf34cd1f..9a54cefc363f 100644 --- a/src/Gui/Stylesheets/Darker-green.qss +++ b/src/Gui/Stylesheets/Darker-green.qss @@ -1519,6 +1519,18 @@ QPushButton:checked { border-color: #74831d; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Darker-orange.qss b/src/Gui/Stylesheets/Darker-orange.qss index 316b9088146a..1f94c59206c5 100644 --- a/src/Gui/Stylesheets/Darker-orange.qss +++ b/src/Gui/Stylesheets/Darker-orange.qss @@ -1519,6 +1519,18 @@ QPushButton:checked { border-color: #b28416; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Light-blue.qss b/src/Gui/Stylesheets/Light-blue.qss index 18e4bef37fb0..0742fd3cf26b 100644 --- a/src/Gui/Stylesheets/Light-blue.qss +++ b/src/Gui/Stylesheets/Light-blue.qss @@ -1516,6 +1516,18 @@ QPushButton:checked { border-color: #3874f2; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Light-green.qss b/src/Gui/Stylesheets/Light-green.qss index ef63811bc95d..6bf2e1a46030 100644 --- a/src/Gui/Stylesheets/Light-green.qss +++ b/src/Gui/Stylesheets/Light-green.qss @@ -1516,6 +1516,18 @@ QPushButton:checked { border-color: #819c0c; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/Light-orange.qss b/src/Gui/Stylesheets/Light-orange.qss index 2503a85cd7ab..3df634467c1f 100644 --- a/src/Gui/Stylesheets/Light-orange.qss +++ b/src/Gui/Stylesheets/Light-orange.qss @@ -1516,6 +1516,18 @@ QPushButton:checked { border-color: #d0970c; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons diff --git a/src/Gui/Stylesheets/ProDark.qss b/src/Gui/Stylesheets/ProDark.qss index 3238ff988532..1fe4f811fee3 100644 --- a/src/Gui/Stylesheets/ProDark.qss +++ b/src/Gui/Stylesheets/ProDark.qss @@ -1709,6 +1709,25 @@ Gui--PropertyEditor--PropertyEditor > QWidget > QWidget > QWidget > QWidget > QF padding: 2px 6px; } +/*================================================================================================== +Tool button Icon fix in save dialogs +==================================================================================================*/ +/* found under Tools -> Save Picture */ /* Draft -> ShapeString -> Font file */ + +QFileDialog#QFileDialog QToolButton { + background-color: transparent; + padding: 1px; + border: 1px; + margin: 0px; +} + +QFileDialog#QFileDialog QToolButton:hover, +QFileDialog#QFileDialog QToolButton:focus { + color: #ffffff; + background-color: #557bb6; + border: 1px solid #f5f5f5; +} + /*================================================================================================== Tool button inside QDialogs that works as QPushButtons ==================================================================================================*/ @@ -1753,8 +1772,8 @@ Tool button inside Task Panel content that works as QPushButtons QSint--ActionGroup QFrame[class="content"] QToolButton { color: #e0e0e0; text-align: center; - background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #2a2a2a, stop:1 #1e1e1e); - border: 1px solid #1e1e1e; + background-color: #2a2a2a; + border: 1px solid #494949; border-bottom-color: black; /* simulates shadow under the button */ padding: 2px 6px; /* different than regular QPushButton */ margin: 2px; /* different than regular QPushButton */ @@ -1765,14 +1784,14 @@ QSint--ActionGroup QFrame[class="content"] QToolButton { QSint--ActionGroup QFrame[class="content"] QToolButton:hover, QSint--ActionGroup QFrame[class="content"] QToolButton:focus { color: white; - border-color: #557BB6; + border-color: solid #f5f5f5; background-color: #557BB6; } QSint--ActionGroup QFrame[class="content"] QToolButton:disabled, QSint--ActionGroup QFrame[class="content"] QToolButton:disabled:checked { color: #f5f5f5; - border-color: #424242; + border-color: #494949; background-color: #424242; } diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index bf503200eebd..196ea983f2cb 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -2681,6 +2681,7 @@ void TreeWidget::setupText() this->markRecomputeAction->setText(tr("Mark to recompute")); this->markRecomputeAction->setStatusTip(tr("Mark this object to be recomputed")); + this->markRecomputeAction->setIcon(BitmapFactory().iconFromTheme("Std_MarkToRecompute")); this->recomputeObjectAction->setText(tr("Recompute object")); this->recomputeObjectAction->setStatusTip(tr("Recompute the selected object")); diff --git a/src/Gui/WidgetFactory.cpp b/src/Gui/WidgetFactory.cpp index dcbdc43cb1bf..4ffeeff5dba8 100644 --- a/src/Gui/WidgetFactory.cpp +++ b/src/Gui/WidgetFactory.cpp @@ -324,25 +324,14 @@ bool PythonWrapper::toCString(const Py::Object& pyobject, std::string& str) { if (PyUnicode_Check(pyobject.ptr())) { PyObject* unicode = PyUnicode_AsUTF8String(pyobject.ptr()); -#if PY_MAJOR_VERSION >= 3 str = PyBytes_AsString(unicode); -#else - str = PyString_AsString(unicode); -#endif Py_DECREF(unicode); return true; } -#if PY_MAJOR_VERSION >= 3 else if (PyBytes_Check(pyobject.ptr())) { str = PyBytes_AsString(pyobject.ptr()); return true; } -#else - else if (PyString_Check(pyobject.ptr())) { - str = PyString_AsString(pyobject.ptr()); - return true; - } -#endif #if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE) if (Shiboken::String::check(pyobject.ptr())) { const char* s = Shiboken::String::toCString(pyobject.ptr()); @@ -1002,16 +991,7 @@ Py::Object UiLoaderPy::createWidget(const Py::Tuple& args) // 1st argument Py::String str(args[0]); std::string className; -#if PY_MAJOR_VERSION >= 3 className = str.as_std_string("utf-8"); -#else - if (str.isUnicode()) { - className = str.as_std_string("utf-8"); - } - else { - className = (std::string)str; - } -#endif // 2nd argument QWidget* parent = 0; if (wrap.loadCoreModule() && args.size() > 1) { @@ -1024,16 +1004,7 @@ Py::Object UiLoaderPy::createWidget(const Py::Tuple& args) std::string objectName; if (args.size() > 2) { Py::String str(args[2]); -#if PY_MAJOR_VERSION >= 3 objectName = str.as_std_string("utf-8"); -#else - if (str.isUnicode()) { - objectName = str.as_std_string("utf-8"); - } - else { - objectName = (std::string)str; - } -#endif } QWidget* widget = loader.createWidget(QString::fromLatin1(className.c_str()), parent, @@ -1484,24 +1455,9 @@ Py::Object PyResource::setValue(const Py::Tuple& args) QVariant v; if (PyUnicode_Check(psValue)) { -#if PY_MAJOR_VERSION >= 3 v = QString::fromUtf8(PyUnicode_AsUTF8(psValue)); -#else - PyObject* unicode = PyUnicode_AsUTF8String(psValue); - v = QString::fromUtf8(PyString_AsString(unicode)); - Py_DECREF(unicode); - } - else if (PyString_Check(psValue)) { - v = QString::fromLatin1(PyString_AsString(psValue)); -#endif } -#if PY_MAJOR_VERSION < 3 - else if (PyInt_Check(psValue)) { - int val = PyInt_AsLong(psValue); - v = val; - } -#endif else if (PyLong_Check(psValue)) { unsigned int val = PyLong_AsLong(psValue); v = val; @@ -1514,17 +1470,9 @@ Py::Object PyResource::setValue(const Py::Tuple& args) int nSize = PyList_Size(psValue); for (int i=0; i= 3 if (!PyUnicode_Check(item)) -#else - if (!PyString_Check(item)) -#endif continue; -#if PY_MAJOR_VERSION >= 3 const char* pItem = PyUnicode_AsUTF8(item); -#else - char* pItem = PyString_AsString(item); -#endif str.append(QString::fromUtf8(pItem)); } diff --git a/src/Main/FreeCADGuiPy.cpp b/src/Main/FreeCADGuiPy.cpp index 83ef7a2defc0..bbaf03b6e883 100644 --- a/src/Main/FreeCADGuiPy.cpp +++ b/src/Main/FreeCADGuiPy.cpp @@ -377,7 +377,6 @@ PyMOD_INIT_FUNC(FreeCADGui) // is started in command mode if (Base::Type::fromName("Gui::BaseView").isBad()) Gui::Application::initApplication(); -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef FreeCADGuiModuleDef = { PyModuleDef_HEAD_INIT, "FreeCADGui", "FreeCAD GUI module\n", -1, @@ -386,9 +385,6 @@ PyMOD_INIT_FUNC(FreeCADGui) }; PyObject* module = PyModule_Create(&FreeCADGuiModuleDef); return module; -#else - Py_InitModule3("FreeCADGui", FreeCADGui_methods, "FreeCAD GUI module\n"); -#endif } catch (const Base::Exception& e) { PyErr_Format(PyExc_ImportError, "%s\n", e.what()); @@ -396,8 +392,6 @@ PyMOD_INIT_FUNC(FreeCADGui) catch (...) { PyErr_SetString(PyExc_ImportError, "Unknown runtime error occurred"); } -#if PY_MAJOR_VERSION >= 3 return 0; -#endif } diff --git a/src/Main/MainPy.cpp b/src/Main/MainPy.cpp index 88f3b6e5e20d..10ed3a39c1dd 100644 --- a/src/Main/MainPy.cpp +++ b/src/Main/MainPy.cpp @@ -109,19 +109,11 @@ PyMOD_INIT_FUNC(FreeCAD) putenv("LC_ALL=C"); // get whole path of the library Dl_info info; -#if PY_MAJOR_VERSION >= 3 int ret = dladdr((void*)PyInit_FreeCAD, &info); -#else - int ret = dladdr((void*)initFreeCAD, &info); -#endif if ((ret == 0) || (!info.dli_fname)) { free(argv); PyErr_SetString(PyExc_ImportError, "Cannot get path of the FreeCAD module!"); -#if PY_MAJOR_VERSION >= 3 return 0; -#else - return; -#endif } argv[0] = (char*)malloc(PATH_MAX); @@ -145,31 +137,14 @@ PyMOD_INIT_FUNC(FreeCAD) // backwards since the FreeCAD path was likely appended just before // we were imported. for (i = PyList_Size(pySysPath) - 1; i >= 0 ; --i) { -#if PY_MAJOR_VERSION >= 3 const char *basePath; -#else - char *basePath; -#endif PyObject *pyPath = PyList_GetItem(pySysPath, i); long sz = 0; -#if PY_MAJOR_VERSION >= 3 if ( PyUnicode_Check(pyPath) ) { // Python 3 string basePath = PyUnicode_AsUTF8AndSize(pyPath, &sz); } -#else - if ( PyString_Check(pyPath) ) { - // Python 2 string type - PyString_AsStringAndSize(pyPath, &basePath, &sz); - } - else if ( PyUnicode_Check(pyPath) ) { - // Python 2 unicode type - explicitly use UTF-8 codec - PyObject *fromUnicode = PyUnicode_AsUTF8String(pyPath); - PyString_AsStringAndSize(fromUnicode, &basePath, &sz); - Py_XDECREF(fromUnicode); - } -#endif // #if/else PY_MAJOR_VERSION >= 3 else { continue; } @@ -201,11 +176,7 @@ PyMOD_INIT_FUNC(FreeCAD) if (buf == NULL) { PyErr_SetString(PyExc_ImportError, "Cannot get path of the FreeCAD module!"); -#if PY_MAJOR_VERSION >= 3 return 0; -#else - return; -#endif } argv[0] = buf; @@ -239,7 +210,6 @@ PyMOD_INIT_FUNC(FreeCAD) std::clog.rdbuf(&stdclog); std::cerr.rdbuf(&stdcerr); -#if PY_MAJOR_VERSION >= 3 //PyObject* module = _PyImport_FindBuiltin("FreeCAD"); PyObject* modules = PyImport_GetModuleDict(); PyObject* module = PyDict_GetItemString(modules, "FreeCAD"); @@ -247,6 +217,5 @@ PyMOD_INIT_FUNC(FreeCAD) PyErr_SetString(PyExc_ImportError, "Failed to load FreeCAD module!"); } return module; -#endif } diff --git a/src/Mod/Fem/femmesh/gmshtools.py b/src/Mod/Fem/femmesh/gmshtools.py index 801104de94fe..d77260b4cfa8 100644 --- a/src/Mod/Fem/femmesh/gmshtools.py +++ b/src/Mod/Fem/femmesh/gmshtools.py @@ -125,6 +125,19 @@ def __init__(self, gmsh_mesh_obj, analysis=None): else: self.algorithm3D = "1" + # RecombinationAlgorithm + algoRecombo = self.mesh_obj.RecombinationAlgorithm + if algoRecombo == "Simple": + self.RecombinationAlgorithm = "0" + elif algoRecombo == "Blossom": + self.RecombinationAlgorithm = "1" + elif algoRecombo == "Simple full-quad": + self.RecombinationAlgorithm = "2" + elif algoRecombo == "Blossom full-quad": + self.RecombinationAlgorithm = "3" + else: + self.algoRecombo = "0" + # HighOrderOptimize optimizers = self.mesh_obj.HighOrderOptimize if optimizers == "None": @@ -766,8 +779,15 @@ def write_geo(self): ) geo.write("\n") if hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True: - geo.write("// other mesh options\n") + geo.write("// recombination for surfaces\n") geo.write("Mesh.RecombineAll = 1;\n") + if hasattr(self.mesh_obj, "Recombine3DAll") and self.mesh_obj.Recombine3DAll is True: + geo.write("// recombination for volumes\n") + geo.write("Mesh.Recombine3DAll = 1;\n") + if ( (hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True) + or (hasattr(self.mesh_obj, "Recombine3DAll") and self.mesh_obj.Recombine3DAll is True)): + geo.write("// recombination algorithm\n") + geo.write("Mesh.RecombinationAlgorithm = " + self.RecombinationAlgorithm + ";\n") geo.write("\n") geo.write("// optimize the mesh\n") diff --git a/src/Mod/Fem/femobjects/mesh_gmsh.py b/src/Mod/Fem/femobjects/mesh_gmsh.py index cc1167a0b89d..9feeef7737a3 100644 --- a/src/Mod/Fem/femobjects/mesh_gmsh.py +++ b/src/Mod/Fem/femobjects/mesh_gmsh.py @@ -60,6 +60,12 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject): "R-tree", "HXT" ] + known_mesh_RecombinationAlgorithms = [ + "Simple", + "Blossom", + "Simple full-quad", + "Blossom full-quad" + ] known_mesh_HighOrderOptimizers = [ "None", "Optimization", @@ -169,7 +175,7 @@ def add_properties(self, obj): "App::PropertyBool", "OptimizeStd", "FEM Gmsh Mesh Params", - "Optimize tetra elements" + "Optimize tetrahedral elements" ) obj.OptimizeStd = True @@ -201,6 +207,25 @@ def add_properties(self, obj): ) obj.RecombineAll = False + if not hasattr(obj, "Recombine3DAll"): + obj.addProperty( + "App::PropertyBool", + "Recombine3DAll", + "FEM Gmsh Mesh Params", + "Apply recombination algorithm to all volumes" + ) + obj.Recombine3DAll = False + + if not hasattr(obj, "RecombinationAlgorithm"): + obj.addProperty( + "App::PropertyEnumeration", + "RecombinationAlgorithm", + "FEM Gmsh Mesh Params", + "Recombination algorithm" + ) + obj.RecombinationAlgorithm = MeshGmsh.known_mesh_RecombinationAlgorithms + obj.RecombinationAlgorithm = "Simple" + if not hasattr(obj, "CoherenceMesh"): obj.addProperty( "App::PropertyBool", diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp index e081764279e0..6601973cc23a 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -693,7 +693,8 @@ class Module : public Py::ExtensionModule TColStd_IndexedDataMapOfStringString aMetadata; RWGltf_CafWriter aWriter (name8bit.c_str(), file.hasExtension("glb")); aWriter.SetTransformationFormat (RWGltf_WriterTrsfFormat_Compact); - //aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (0.001); + // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#coordinate-system-and-units + aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit (0.001); aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem (RWMesh_CoordinateSystem_Zup); Standard_Boolean ret = aWriter.Perform (hDoc, aMetadata, Message_ProgressRange()); if (!ret) { diff --git a/src/Mod/Part/App/OCCError.h b/src/Mod/Part/App/OCCError.h index fbdd98d20246..411641858abe 100644 --- a/src/Mod/Part/App/OCCError.h +++ b/src/Mod/Part/App/OCCError.h @@ -80,7 +80,6 @@ PartExport extern PyObject* PartExceptionOCCDimensionError; str += " "; \ if (msg) {str += msg;} \ else {str += "No OCCT Exception Message";} \ - Base::Console().Error(str.c_str()); \ _Py_Error(R,Part::PartExceptionOCCError,str.c_str()); \ } \ _PY_CATCH(R) diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 76e46556ae31..a714012221b4 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -592,6 +592,7 @@ PyObject * TopoShape::getPyObject() } } + prop->setNotTracking(); return prop; } diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index 4f5abc70b8b2..f52d1dfca8c1 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -461,7 +461,7 @@ TopoDS_Shape Transformed::getRemainingSolids(const TopoDS_Shape& shape) builder.Add(compShape, xp.Current()); } - return compShape; + return TopoDS_Shape(std::move(compShape)); } } diff --git a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Sprocket.svg b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Sprocket.svg index 15bc199d19c7..5cf2dc0cae6e 100644 --- a/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Sprocket.svg +++ b/src/Mod/PartDesign/Gui/Resources/icons/PartDesign_Sprocket.svg @@ -1,492 +1,16 @@ - - - - - - + + + - + image/svg+xml - + - - - + + diff --git a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp index 3976423d2d6c..0096539feefb 100644 --- a/src/Mod/TechDraw/Gui/CommandAnnotate.cpp +++ b/src/Mod/TechDraw/Gui/CommandAnnotate.cpp @@ -1199,7 +1199,7 @@ void CmdTechDrawCosmeticEraser::activated(int iMsg) cl2Delete.push_back(tag); } else { Base::Console().Message( - "CMD::CosmeticEraserP - edge: %d is confused - source: %d\n",idx,source); + "CMD::CosmeticEraser - edge: %d is confused - source: %d\n",idx,source); } } } else if (geomType == "Vertex") { diff --git a/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp b/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp index 63e4ea828dff..bca90ecae908 100644 --- a/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp +++ b/src/Mod/TechDraw/Gui/ViewProviderRichAnno.cpp @@ -99,7 +99,7 @@ bool ViewProviderRichAnno::setEdit(int ModNum) { // Base::Console().Message("VPRA::setEdit(%d)\n",ModNum); if (ModNum == ViewProvider::Default ) { - if (Gui::Control().activeDialog()) { //TaskPanel already open! + if (Gui::Control().activeDialog()) { //TaskPanel already open! return false; } Gui::Selection().clearSelection(); diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index bc7f60749a77..4621d855b37c 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -615,13 +615,11 @@ class @self.export.Namespace.replace("::","_")@Export @self.export.Name@ : publi } // Please sync the following catch implementation with PY_CATCH catch(Base::AbortException &e) { - e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject()); return NULL; } catch(Base::Exception &e) { - e.ReportException(); auto pye = e.getPyExceptionType(); if(!pye) pye = Base::BaseExceptionFreeCADError; @@ -790,13 +788,11 @@ class @self.export.Namespace.replace("::","_")@Export @self.export.Name@ : publi } // Please sync the following catch implementation with PY_CATCH catch(Base::AbortException &e) { - e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject()); return NULL; } catch(Base::Exception &e) { - e.ReportException(); auto pye = e.getPyExceptionType(); if(!pye) pye = Base::BaseExceptionFreeCADError; @@ -852,13 +848,11 @@ class @self.export.Namespace.replace("::","_")@Export @self.export.Name@ : publi } // Please sync the following catch implementation with PY_CATCH catch(Base::AbortException &e) { - e.ReportException(); PyErr_SetObject(Base::BaseExceptionFreeCADAbort,e.getPyObject()); return -1; } catch(Base::Exception &e) { - e.ReportException(); auto pye = e.getPyExceptionType(); if(!pye) pye = Base::BaseExceptionFreeCADError; diff --git a/subuser/freecad-dev/image/Dockerfile b/subuser/freecad-dev/image/Dockerfile deleted file mode 100644 index e971bd04e1e5..000000000000 --- a/subuser/freecad-dev/image/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:14.04 -RUN apt-get update -RUN apt-get install -yqq software-properties-common -RUN add-apt-repository ppa:freecad-maintainers/freecad-daily -RUN apt-get update -RUN apt-get install -yqq build-essential python python2.7-dev subversion cmake libtool autotools-dev automake bison flex gfortran git -RUN apt-get install -yqq libCoin80-dev libCoin80-doc libsoqt4-dev libqt4-dev qt4-dev-tools libsoqt4-dev python-qt4 libqtwebkit-dev -RUN apt-get install -yqq liboce-foundation-dev liboce-modeling-dev liboce-ocaf-dev liboce-visualization-dev oce-draw -RUN apt-get install -yqq libode-dev libeigen2-dev libeigen3-dev libsimage-dev libxerces-c2-dev -RUN apt-get install -yqq libpyside-dev pyside-tools libshiboken-dev doxygen python-pivy -RUN apt-get install -yqq libboost1.55-all-dev -RUN apt-get install -yqq libmedc-dev libvtk6-dev libproj-dev -RUN apt-get install -yqq libxerces-c-dev -RUN ln -s /usr/lib/x86_64-linux-gnu/libxerces-c.so /usr/lib/libxerces-c.so diff --git a/subuser/freecad-dev/permissions.json b/subuser/freecad-dev/permissions.json deleted file mode 100644 index 509ee26c6cef..000000000000 --- a/subuser/freecad-dev/permissions.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "maintainer": "Timothy ", - "stateful-home": true, - "executable": "/bin/bash", - "allow-network-access": true, - "basic-common-permissions": true, - "description": "A development environment for building and running freecad.", - "access-working-directory": true, - "graphics-card": true, - "gui": {"clipboard":true} -} diff --git a/vagrant/Xenial/generate_yaml.sh b/vagrant/Xenial/generate_yaml.sh index 37107c40bbf1..3f20c4866c85 100755 --- a/vagrant/Xenial/generate_yaml.sh +++ b/vagrant/Xenial/generate_yaml.sh @@ -101,5 +101,5 @@ echo " apps: FreeCAD: command: bin/launcher - plugs: [ locale-control,x11,opengl,network-bind,home,unity7 ] + plugs: [ locale-control,x11,opengl,network-bind,home,unity7,removable-media ] " >> snapcraft.yaml diff --git a/vagrant/generate_yaml.sh b/vagrant/generate_yaml.sh index 0528dfab5448..ff6f2c9189dd 100755 --- a/vagrant/generate_yaml.sh +++ b/vagrant/generate_yaml.sh @@ -117,5 +117,5 @@ echo " apps: FreeCAD: command: bin/launcher - plugs: [ locale-control,x11,opengl,network-bind,home,unity7 ] + plugs: [ locale-control,x11,opengl,network-bind,home,unity7,removable-media ] " >> snapcraft.yaml