* Draft: make move, rotate and scale commands link-aware Fixes #12836. Fixes #15681. These changes are presented as a single ('big') PR because the mentioned commands have several similarities. Working on them seperately would have made less sense. The commands have been made 'link-aware' meaning they can now handle Links and objects in linked containers. This required several changes in the following main files. For each command all options are handled by a single function now (the `move`, `rotate` and `scale` functions). This was the only reasonable solution to correctly handle nested placements. As a result there is no longer a need to build very complex 'cmd' strings in the gui_*.py files (which is a good thing IMO). Main files: * move.py * rotate.py * scale.py * gui_move.py * gui_rotate.py * gui_scale.py * gui_trackers.py The following files have also been updated: * Draft.py: Imports updated. * DraftGui.py: If `CopyMode` is changed the ghosts have to be updated. The move and rotate commands now also show previews of movable children. But since those are not copied they should be removed from the ghosts if `CopyMode` is changed to `True`. * utils.py: Some helper functions have been added. An existing helper function (only used internally) has been renamed. * gui_utils.py: The `select` function has been updated to accept a list of tuples to allow the reselection of nested objects. * clone.py: A new property `ForceCompound`, necessary for non-uniform scaling, has been added. * join.py: The `join_wires` function now returns the resultant wire objects. * task_scale.py: Updated to allow negative scale factors. Support for `SubelementMode` preference added. * dimension.py: `transform` methods added. * layer.py: `get_layer` function added. * svg.py: Updated to use `get_layer`. * view_text.py: Instead of two added `coin.SoTransform()` nodes the main transform node is used instead. This was done so that ghosts of Draft Texts can be handled properly without requiring dedicated code in gui_trackers.py. Notes: * Support for "App::Annotation" is limited. Only their `Position` is handled (by the move and rotate commands). * Support for "Image::ImagePlane" has been removed from the scale command. The object has its own calibrate feature (see https://wiki.freecad.org/Std_Import). * Copies and clones are always created in the global space. * Fix several unit test issues. * Reset value that was changed while testing * Rebase and update test_modification.py * Reintroduce scaling of image planes
General
2020 May
These files provide the logic behind the "task panels" of the "GuiCommands"
defined in draftguitools/.
These files should not have code to create the task panel widgets manually.
These interfaces should be properly defined in .ui files
made with Qt Designer and placed inside the Resources/ui/ directory.
There are many GUI commands which are "old style" and thus don't have
an individual task panel. These commands use the task panel defined
in the big DraftGui.py module. This module defines many widgets
for many tools, and selectively chooses the widgets to show and to hide
depending on the command that is activated.
A big file that controls many widgets at the same time is difficult
to handle and to maintain because changing the behavior of one widget
may affect the operation of various GUI commands.
This must be changed so that in the future each tool has its own
individual task panel file, and its own .ui file.
Individual files are more maintainable because changes can be done
to a single tool without affecting the rest.
For more information see the thread: [Discussion] Splitting Draft tools into their own modules
To do
In the future each tool should have its own individual task panel file,
and its own .ui file.
This should be done by breaking DraftGui.py, creating many .ui files,
creating many task panel modules, and making sure these modules
are used correctly by the GUI commands.