Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App: Fix missing python addProperty and removeProperty of Document object #8920

Merged
merged 1 commit into from Mar 17, 2023

Conversation

FlachyJoe
Copy link
Contributor

The python Document class didn't have addProperty nor removeProperty but such behavior was available throw GUI.

Forum discussion (french): https://forum.freecad.org/viewtopic.php?t=76855

@github-actions github-actions bot added the Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD label Mar 16, 2023
@wwmayer wwmayer merged commit a290fe8 into FreeCAD:master Mar 17, 2023
6 checks passed
getDocumentPtr()->addDynamicProperty(sType,sName,sGroup,sDocStr.c_str(),attr,
Base::asBoolean(ro), Base::asBoolean(hd));

return Py::new_reference_to(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwmayer Is it sensible to return a reference to the object (Document in this case) rather than to the created property ?
I saw it's same in DocumentObjectPy implementation, so it's a general question. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have Python wrappers for Property classes. When trying to access a property of a document(object) you get directly its value. So, yes, it's sensible to return a reference of itself.

@FlachyJoe FlachyJoe deleted the document-addproperty branch March 19, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants