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.
This commit is contained in:
vocx-fc
2020-03-16 22:45:21 -06:00
committed by Yorik van Havre
parent 4d90327a97
commit f518cfee8f

View File

@@ -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`,