In new splitted addPoint methods, getObjectsInfo and the consequent checks have been removed and moved to main DraftEdit module in a new get_specific_object_info method.
This method returns the info for the selected object at a given position and the 3d Vector of the point clicked on the object.
The wrapper allows to call resetTrackers in the main module after the callback to the GuiTools is executed.
This is the last commit, many thanks to @matthijskooijman for having menthored me :)
I think it's helpful to have @matthijskooijman explanation on this use of the wrapper:
This defines a new wrapper function, that calls the original callback and then calls resetTrackers. Note that this creates a new function for every loop iteration, so each of these wrapper functions captures potentially different callback, self and obj values so things work as expected. Note I did something weird with the callback value there: Since functions like these capture a variable, not its value at the time of function definition, and loop variables like label and callback are a single variable shared between all loop iterations, capturing callback directly ends up with all wrappers calling the last callback (i.e. they all capture the same variable and by the time the wrappers are called, that variable will contain the last of the callbacks). This is commonly solved by using a default value in the function definition, since such a default value uses the value of the (in this case) callback variable, not capturing the variable.
get_edit_point_context_menu(self, edit_command, obj, node_idx)
get_edit_obj_context_menu(self, edit_command, obj, position)
that are called depending if the user is over an editpoint or over another part of the object.
This enable to start editing also without an user click event, by just calling the method and specifying the object and the edit point index.
It is used for alternative edit mode (alt_edit_mode) by arc context menu
The code that was intended to handle this preference looked inside
Mod/BIM instad of Mod/Draft for the preference. This seems to have been
broken since the preference was first introduced in commit 507c40669d
(Draft: Turned autogroup button into layers selector (added pref option
to restore old groups-based system)).
This also removes a stray "-" that was probably a leftover from a merge
conflict, introduced in commit 68119de02f (Draft: move Draft_AutoGroup to
gui_groups module). Since -True is still true and -False is still false,
this did not actually break the code, though.
See https://forum.freecadweb.org/viewtopic.php?t=42018 for related
discussion.
This uses the default value that can be passed to getattr to simplify
code that uses it. By choosing an appropriate default value, a separate
call to hasattr can be avoided and in some cases duplicate code can be
avoided.
This applies this trick where possible in wire.py and circle.py.
This commit does not change behavior.
This caused the original object to be moved when using the Draft move
tool to move a link object, when the original object has MoveWithHost
set (e.g. a Window). There was already a similar exception for clones,
so it makes sense to extend this for links too.
Note that there seem to be more problems with the "MoveWithHost"
mechanism and fixing them might completely refactor this code, but until
then, this is a simple and targeted fix that at least makes moving
links to windows work as expected.
See https://forum.freecadweb.org/viewtopic.php?f=23&t=57223 for
discussion of this bug, its fix and the additional problems mentioned.