Also import `DraftGeomUtils` where necessary.
These modules were previously imported globaly when the base
`DraftTool` class was first called by the individual tools
through the `Creator` and `Modifier` classes.
However, since `DraftTool` was moved to a separate module,
these `Part` and `DraftGeomUtils` modules are no longer
in the `DraftTools` namespace, and therefore they
cannot be imported globally anymore.
Now the `Part` and `DraftGeomUtils` modules are imported
in the specific functions where they are actually needed.
This is the base class of most Draft Gui Commands,
particularly those which were developed a long time ago.
It is inherited by `Creator` and `Modifier`
to set some specific options for some tools.
Newer Gui Commands do not use these classes and thus
are independent of `DraftTool`.
Nevertheless, in the future we expect to organize further
the commands so that they all derive from a few classes,
so that they all share some common properties and behaviors.
These small functions and utilities are placed in another
module, so they can be imported and called
by the individual Gui Command classes as necessary.
When these Gui Command classes are moved to their respective
modules, they will be able to import this auxiliary module as well.
This class defines the `command_name` of the command,
so that it is output to the report view, and is also recorded
in the log file.
It also stores the current document so it can be used inside the
command.
The class implements with `IsActive` method so that the command
is only active when an active document exists.
Also `GuiCommandNeedsSelection`, which subclasses the former
class. It reimplements `IsActive` in order to be available
only when there is a selection.
Changed snap toolbar behaviour:
- create a list of available snaps (Gui.Snapper.snaps)
- make it consistent with Snap Gui Commands (in gui_snaps module)
- create a list of active snaps (Gui.Snapper.active_snaps)
- refactor the isEnabled() method to allow it to check if the given snap is in Gui.Snapper.active_snaps and not if the snap toolbar button isChecked()
- updated and reordered the new list of gui snap commands in draftutils.init_tools and used it as a base to refactor the creation of draft toolbar
- updated all the draft snap gui tools to make them control the toolbar buttons directly
.
.
.
Previously they were imported directly in `InitGui.py`,
now they are collected in `DraftTools.py`, so that they
are imported at the same time as other modules.
Also provide an icon so this icon appears in the menu.
These two Gui Commands were inside `DraftTools.py`
but they were considered obsolete as they just call `Draft_Edit`.
They were completely removed in f5f43913e0 and 8fd55eb6ff.
They are restored in this commit and placed in their own module
just for historical reasons; however this module is not imported
in `DraftTools.py`.