From f518cfee8f5602425efed90d96b4c0dfac86626c Mon Sep 17 00:00:00 2001 From: vocx-fc Date: Mon, 16 Mar 2020 22:45:21 -0600 Subject: [PATCH] Draft: GuiCommandSimplest to serve as base of simple Gui Commands 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. --- src/Mod/Draft/draftguitools/gui_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_base.py b/src/Mod/Draft/draftguitools/gui_base.py index 86cc109d88..fd02f8c563 100644 --- a/src/Mod/Draft/draftguitools/gui_base.py +++ b/src/Mod/Draft/draftguitools/gui_base.py @@ -33,7 +33,7 @@ import draftutils.todo as todo from draftutils.messages import _msg, _log -class GuiCommandSimplest(object): +class GuiCommandSimplest: """Simplest base class for GuiCommands. This class only sets up the command name and the document object @@ -126,7 +126,7 @@ class GuiCommandNeedsSelection(GuiCommandSimplest): return False -class GuiCommandBase(object): +class GuiCommandBase: """Generic class that is the basis of all Gui commands. This class should eventually replace `DraftTools.DraftTool`,