Commit Graph

63 Commits

Author SHA1 Message Date
André Caldas
560898907b Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
wmayer
5a153e50ff Gui: modernize C++: use default member init 2023-08-23 19:51:44 +02:00
wmayer
54bb9c9c62 Gui: modernize C++: return braced init list 2023-08-18 00:36:24 +02:00
wmayer
68d22d864b modernize C++: move from boost::bind to std::bind 2023-08-08 17:36:13 +02:00
marioalexis
0382f276a2 Gui: Replace C cast 2022-09-18 11:06:51 -05:00
berniev
75acacd1b7 Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
2022-09-14 13:25:13 -05:00
berniev
656ef8961f Gui: redundant void 2 2022-08-08 10:21:44 +02:00
wmayer
b548d3b1ef Partially revert "Remove unused code into GUI" 2022-07-17 12:32:03 +02:00
andrea
3018985f80 Remove unused code into GUI 2022-07-17 03:53:11 +02:00
wmayer
e9890c0798 Gui/Mod: replace several reinterpret_cast with static_cast 2022-06-25 11:36:55 +02:00
Zheng, Lei
3ef438eaf0 Fix mixed line endings 2022-04-26 12:52:55 -05:00
Chris Hennes
bedf920702 Gui: PR6497 move return statement to new line 2022-03-29 12:33:50 -05:00
wmayer
96adb98f46 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
wmayer
2dc78804b6 Core: Fix several coverity issues:
* CID 350582: Big parameter passed by value
* CID 350639: Big parameter passed by value
* CID 305234: Uncaught exception
* CID 316529: Uncaught exception
* CID 350597: Uncaught exception
* CID 350623: Uncaught exception
* CID 332690: Uncaught exception
* CID 332700: Unchecked return value
* CID 350576: Uninitialized scalar field
* CID 350587: Uninitialized scalar variable
* CID 192606: Uninitialized scalar field
* CID 332699: Uninitialized pointer field
* CID 350561: Dereference null return value
* CID 350610: Dereference null return value
* CID 350567: Dereference after null check
2022-03-13 13:53:32 +01:00
Uwe
8dfe91204b [Gui] ViewProviderPython* etc.: remove unused includes 2022-03-06 02:24:52 +01:00
wmayer
9955c64752 Mod: add string header to dxf.h 2022-03-01 17:18:29 +01:00
Uwe
dd5a681fd8 [Gui] remove unused headers 2022-02-19 03:41:28 +01:00
wmayer
00759f9c96 Gui: move PythonWrapper class to its own source file 2021-09-22 23:30:03 +02:00
wmayer
81267fc284 App/Gui: fix possible crash when destroying Python feature or its view provider 2021-02-17 12:00:38 +01:00
luz paz
298c677873 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
Zheng, Lei
49a5f554fa Gui: fix ViewProviderPythonFeature::getLinkedViewProvider 2020-08-07 17:20:55 +02:00
wmayer
f3b460e42e boost: fix for boost < 1.60 2020-06-15 19:38:39 +02:00
wmayer
4ec45b545e boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
Zheng, Lei
0f29155502 App/Gui: unify NotImplementedError handling in python features
Recognize NotImplementedError as an indication to call the C++
implementation.
2019-09-27 18:01:54 +02:00
wmayer
b50b21576e core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
Zheng, Lei
f8e1d455e0 Gui: improve Gui.addIcon(), add Gui.isIconCached()
The motivation of this patch is to make it easy for Python workbench
cache its own icons (possibly generated at runtime), saving the trouble
of pre-compiling the icons as binary resources.

* Gui.addIcon() now support a third argument as format. Default format
  is 'XPM' as before. The intention is to allow user to cache other
  format of icon image, like 'PNG'.

* ViewProviderPythonFeature::getIcon() now checks if the given string
  argument is a key to a cached icon.
2019-09-07 16:01:19 +02:00
wmayer
28f74290b2 fix -Wreturn-std-move 2019-09-07 15:19:28 +02:00
Zheng, Lei
08f0511b1f Python feature/observer related changes
* Add new API and signal handler in document observer

* Pre initialize python handler function to improve performance. In
  case Python code use dynamic patching, i.e. add class method at
  runtime (which is rare and should be discouraged), the python feature
  can be re-initialized by simply assign proeprty Proxy again.

* Add property tracking in DocumentObjectT

* WidgetFactory adds support for accepting python QIcon, which is used
  by ViewProviderPythonFeature
2019-08-17 15:08:34 +02:00
wmayer
2631df09c0 correctly handle again NotImplementedError in Python view providers 2019-02-22 13:26:33 +01:00
wmayer
645b397dda fixes 0003804: FC becomes unusable after double-cicking on FEM elements while clip view is active 2019-02-15 23:30:18 +01:00
wmayer
f898eafd64 move from deprecated boost.signals to boost.signals2 library 2018-10-30 19:09:03 +01:00
wmayer
e2ddabf235 returning a boolean from setEdit/unsetEdit of a Python view provider indicates a handled edit mode, None indicates to forward it to the C++ view provider 2018-10-03 17:39:22 +02:00
markus
868baa6dd2 Return NotImplemented on PythonFeature::setEdit if the setEdit is implemented and returns True for one of the standard, not Default, edit modes 2018-10-03 16:49:10 +02:00
wmayer
5eaf2e6387 fixes #0003564: Python objects: updateData calls to proxy instance that should have been deleted 2018-08-25 16:33:22 +02:00
wmayer
aa0f6b54d4 fixes #0003424: 'basic_string::_M_construct null not valid' when opening a v0.16 project with v0.17 2018-04-10 10:51:34 +02:00
wmayer
38388cf650 remove undesired virtual keyword from ViewProviderPythonFeatureImp 2017-04-28 21:15:53 +02:00
Yorik van Havre
765e164b0b Gui: implemented isShow() for python viewproviders 2017-04-28 15:03:47 -03:00
wmayer
f55635900f fix setEdit, unsetEdit and doubleClicked methods of Python view provider 2017-02-20 22:16:56 +01:00
wmayer
0c3f52303d switch to PySide2 for Qt5 2016-12-24 15:33:15 +01:00
wmayer
07a2182674 remove obsolete class ViewProviderPythonFeaturePy 2016-11-09 12:15:15 +01:00
wmayer
f19d424d8b fix -Wextra in FreeCADGui 2016-09-21 20:54:52 +02:00
wmayer
919d47015a + support of drag'n'drop for custom view provider 2015-11-03 16:21:51 +01:00
wmayer
6b3d7b17a7 + implement onDelete for Python proxy of view provider 2015-07-16 16:13:39 +02:00
wmayer
27863408c9 + remove references to SoFCSelection where not needed 2015-05-20 19:24:12 +02:00
wmayer
862e65df6c + build failure 2015-03-31 13:00:42 +02:00
wmayer
1d4de73415 + support context-menu in Python view providers 2015-03-31 11:32:43 +02:00
Sebastian Hoogen
faac8c36ba add encoding parameter to .as_std_string()
to handle PyUnicode Objects. Usually ASCII for object names and Utf-8
for file names and console output.
issue #995
2015-02-08 15:37:00 +01:00
jriegel
c1f0f70b88 Merge remote-tracking branch 'refs/remotes/origin/jriegel/NewWinBuild' into jriegel/review-NewLibPack
Conflicts:
	src/3rdParty/salomesmesh/CMakeLists.txt
2014-08-27 15:39:00 +02:00
wmayer
cc775f9254 + fix -Wnull-conversion, -Woverloaded-virtual, -Wlogical-not-parentheses, -Wsometimes-uninitialized 2014-08-26 19:14:13 +02:00
jriegel
d65a4e4ed7 some type clearification 2014-08-21 17:59:33 +02:00