Commit Graph

66 Commits

Author SHA1 Message Date
wmayer
1f12dca2b4 Py: replace BaseExceptionFreeCADError with more suitable exception types 2022-03-17 13:54:23 +01:00
wmayer
b13284a221 Base: let interpreter keep track of created modules 2022-03-13 22:34:01 +01:00
wmayer
91e4e468dd Base: move ILogger sub-classes to their own source files in order to reduce including stream classes in client code 2022-03-06 10:13:47 +01:00
Uwe
38ea286f28 [Base] Geometry etc.: remove unused includes 2022-03-01 13:56:02 +01:00
Uwe
288ccdb004 [Base] fix typo to silence spellchecker CI 2022-02-22 02:31:51 +01:00
wmayer
e92325c9c9 App: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:55:56 +02:00
wmayer
c563198b35 Base: remove some more deprecated Py2 code
and remove deprecated void from function signature and replace 0 or NULL with nullptr
2021-04-26 10:29:48 +02:00
luz paz
59b7e9fdd0 Base: remove Py2 code 2021-04-26 09:23:58 +02:00
wmayer
dd4dd204d0 App/Gui: fix memory leaks:
+ add function to cleanup units and quantities in debug build
+ fix reference leak in PropertyVector::getPyPathValue()
+ fix reference leak in PropertyPlacement::getPyPathValue()
+ in InterpreterSingleton::init() use a static std::vector<wchar_t*> instead of a C array
  to free memory at program end
+ in MainWindow::closeEvent() explicitly delete all task watchers
+ in ReportOutputObserver constructor pass parent to QObject
+ in PropertyEditor destructor explicitly delete QItemEditorFactory
2021-02-27 10:56:19 +01:00
wmayer
64fdf4c799 Py: [skip ci] replace PyList_Append with Py::List::append 2020-12-13 16:44:14 +01:00
luz paz
01b21e0d06 Base: Fix header uniformity, whitespace, and doxygen
[skip ci]
2020-11-22 18:12:16 +01:00
wmayer
27070858f0 Base: [skip ci] fix several -Wunused-parameter warnings 2020-11-06 08:15:44 +01:00
wmayer
42a723d172 Base: [skip ci] fix several -Wunused-parameter warnings 2020-11-06 08:14:00 +01:00
wmayer
a51d2bab99 Base: Py2 related fix 2020-09-04 19:02:29 +02:00
wmayer
6f7118850b Base: [skip ci] Various fixes in InterpreterSingleton::runStringWithKey:
+ fix memory leak (localDictionary) by replacing C API with PyCXX
+ don't write the whole code as error message if an error occurs. Python raises an exception with all relevant information for debugging
2020-09-04 09:58:21 +02:00
mwganson
69f43d7bf3 [CheckGeometry] fix segfault, reformat output with lower case, use try/except to check for runtime python errors and fall back on OCCT method if script failed. 2020-09-03 12:09:38 +02:00
mwganson
720668a7a5 [check geometry] decrement some pyobject references 2020-09-03 12:09:38 +02:00
mwganson
cf9118d249 [CheckGeometry] fix python2 build 2020-09-03 12:09:38 +02:00
mwganson
179d687f0e [CheckGeometry] fix py2 build failure 2020-09-03 12:09:38 +02:00
mwganson
3c19765c37 [CheckGeometry] update a source code comment 2020-09-03 12:09:38 +02:00
mwganson
ed3ff7db5e [CheckGeometry] add new shapecontent builder instead of OCCT's to correct some errors in OCCT's values and to add for some more advanced information, e.g. volume or area, add new method to Base::Interpreter runStringWithKey() -- allows to run a python script and get a string return value 2020-09-03 12:09:38 +02:00
wmayer
9367e73e92 LGTM: [skip ci] fix: Inconsistent definition of copy constructor and assignment ('Rule of Two')
Remove user-defined copy constructor of Exception classes without assignment operator
2020-07-27 13:47:41 +02:00
wmayer
88fd77b31d Porting Py3.8/Py3.9:
Since Py3.3: 'Py_ssize_t PyUnicode_GetSize(PyObject*)' is deprecated [-Wdeprecated-declarations]
Since Py3.9: 'PyObject* PyEval_CallObjectWithKeywords(PyObject*, PyObject*, PyObject*)' is deprecated [-Wdeprecated-declarations]
Since Py3.9: 'void PyEval_InitThreads()' is deprecated [-Wdeprecated-declarations]
2020-06-12 17:51:33 +02:00
luz.paz
ae72e2c762 Trivial code formatting for some {.cpp,.h} files 2020-04-06 12:55:27 +02:00
wmayer
5bfef75696 Base: [skip ci] add method to more easily set the Python error indicator from a Base::Exception 2020-03-18 17:53:13 +01:00
luz.paz
011e5aedfa src/Base: [skip ci] fix header uniformity
This PR fixes header uniformity across all `src/Base` files
2019-12-25 11:38:58 +01:00
asapelkin
875a463923 Used single quotes for single character in string::find algorithm, more efficient 2019-11-21 18:59:43 +01:00
luz.paz
e9caeef557 Fix typos in src/Base 2019-08-17 15:32:49 +02:00
Zheng, Lei
8f16147a40 Base: improve exception
For better FC and Python exception mapping.
2019-08-17 14:52:08 +02:00
wmayer
c7cf339ac6 replace raw string with normal C string to fix build failure 2019-05-23 23:28:33 +02:00
ezzieyguywuf
327d509bc9 Added python virtual environment initialization, if present. 2019-05-22 13:53:47 +02:00
wmayer
9b351e8551 fix crash when checking an empty error message of an exception 2019-04-01 11:22:55 +02:00
luz.paz
69b3b0b7f2 Misc. typos 2018-05-19 12:06:34 -04:00
wmayer
1b5995d787 workaround for bug in VS 2013 that occurs at Python init time 2018-04-15 19:05:06 +02:00
Unknown
e3eca59173 Misc. typo fixes
Various workbenches
2017-12-23 14:30:30 +01:00
wmayer
fde42545ba fix various coverity issues 2017-09-15 11:48:38 +02:00
wmayer
4cda387e61 py3: support of Python 3.4 2017-06-06 23:49:42 +02:00
wmayer
729cfd8155 py3: fox compiler warnings
issue 0000995
2017-06-04 00:17:57 +02:00
Yorik van Havre
ccebc7d16b py3: Base: files A-I ported to python3
issue 0000995
2017-05-17 16:39:28 +02:00
wmayer
1d8206acbf Fix various issues:
+ fix dangling pointers when fetching Python error text
+ initialize members in overloaded constructors of Exception class
+ implement assignment operator in sub-class
+ move to PyCXX API to simplify handling with reference counting and reading values from the dict
2017-05-15 18:49:09 +02:00
Abdullah Tahiri
3a27e2d8ff Enable exceptions to save/restore information in a python dictionary and enable throwing exception from dictionary information 2017-05-13 15:27:57 +02:00
Abdullah Tahiri
053300cfa1 Enable PyException to reconstruct the original exception 2017-05-13 15:27:57 +02:00
wmayer
fb7094bf31 use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
cb9be09512 Coverity issues:
129643
129654
129689
129714
2016-08-16 14:05:52 +02:00
wmayer
3feaef3d2e + unify method names 2016-05-18 23:43:58 +02:00
DeepSOIC
7d7cf5c723 Attacher: add general purpose editor UI (python)
Added as PartGui.AttachmentEditor, and Part_EditAttachment gui command
2016-05-18 23:05:51 +02:00
Ian Rees
7f42b2b8fb More fixes around Python exit codes 2016-03-27 13:01:04 +13:00
wmayer
8675778a68 + fix crash when raising SystemExitException if not called inside Python function 2016-03-21 18:50:57 +01:00
Bruce Lacey
05076993d6 Propagate sys.exit(code) up the call stack to the shell
SystemExitException is instantiated and thrown by Base::Interpreter
whenever the python interpreter executes a sys.exit(<exitCode>) call.
However, in the current implementation, the SystemExitException
effectively swallows the <exitCode> hence under this change,
SystemExitException has been extended to save the <exitCode> passed to
the sys.exit() call when it is instantiated and provides a new
getExitCode() accessor method to retrieve the <exitCode> in a
try/catch block.  MainGui.cpp was change to pass the corresponding
<exitCode> to the system exit() call so it is accessible in the shell.
2016-03-21 18:28:29 +01:00
wmayer
991394dc76 + improve exception handling in initialization scripts 2015-12-29 23:42:29 +01:00