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

Custom Order & Dynamic Data commands in Property View of DD objects #82

Open
Media-Evil opened this issue Sep 26, 2024 · 1 comment
Open

Comments

@Media-Evil
Copy link

  1. Custom order. If it isn't exactly easy/possible to reorder properties in DD object, would it be possible to allow the user to create a custom mapping for order of properties by dradding properties in the property view or similar menu?

  2. It is intuitively expected that one could edit ptoperty values in the property view. When it comes to DD, property name is intuitively considered a property value, IDK what are the implications of allowing editing property names in the property view, but what about the context menu. It already contains add/remove property commands, why not adding "Rename" and "Set/Update Tooltip" command, which would merely link to the current implementation used in the tree view context menus?

@mwganson
Copy link
Owner

The only way I know of to sort properties is to name/rename them so they sort alphabetically in the desired manner, example using property names like aLength, bWidth, cHeight would be a way to control how the properties appear in the panel. Related to this, but slightly different, is assigning the properties to different groups, which DynamicData can also do by the move to new group command, which internally simply modifies the group name attribute of the property.

The widgets that hold the properties are not exposed to python, but rather are managed by c++ code in the FreeCAD core application. Changing the sorting method would amount to hacking the widgets by finding them as children of the main window and manipulating their attributes through Qt. Even this might not work or might not persist if the widgets are getting created anew each time the object is selected or if sorting gets reapplied each time a property is added/removed.

The context menu options you get in the core are all in c++, inaccessible from python, as far as I know. If these were standard commands, example: Std_Delete, then they could be called from python with Gui.runCommand("Std_Delete", 0) as an example, but they're not implemented as standard commands. Standard commands will always show up in the python console when you execute one in the Gui, so that's one way to tell if it's a standard command.

One thing that could perhaps be improved upon in DynamicData is to find these widgets when opening certain dialogs and determining which property is selected. This is not exposed to python in FreeCAD, but could potentially be done through Qt. Then this information could be used to configure the dialog before presenting it to the user. As an example, if the rename property command is selected, the current implementation is to open the dialog and allow the user to select which property to rename from the dialog (unless there is only one property, then it is used). But if it is known which property is selected, then that could be preselected for the user in the dialog. I don't know of a way to add DynamicData commands to the property view context menu, only for the tree view with object selection is it possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants