Skip to content

Commit

Permalink
move outputReason to outputReason.py (#12510)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanbudd committed Jun 16, 2021
1 parent ea7775c commit df6663a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
29 changes: 2 additions & 27 deletions source/controlTypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,12 @@
# See the file COPYING for more details.
# Copyright (C) 2007-2021 NV Access Limited, Babbage B.V.

from enum import Enum, auto
from typing import Any, Dict, List, Optional, Set

from .isCurrent import IsCurrent
from .outputReason import OutputReason
from .role import ROLE, roleLabels, silentRolesOnFocus, silentValuesForRoles
from .state import STATE, STATES_SORTED, stateLabels, negativeStateLabels
from .isCurrent import IsCurrent


class OutputReason(Enum):
"""Specify the reason that a given piece of output was generated.
"""
#: An object to be reported due to a focus change or similar.
FOCUS = auto()
#: An ancestor of the focus object to be reported due to a focus change or similar.
FOCUSENTERED = auto()
#: An item under the mouse.
MOUSE = auto()
#: A response to a user query.
QUERY = auto()
#: Reporting a change to an object.
CHANGE = auto()
#: A generic, screen reader specific message.
MESSAGE = auto()
#: Text reported as part of a say all.
SAYALL = auto()
#: Content reported due to caret movement or similar.
CARET = auto()
#: No output, but any state should be cached as if output had occurred.
ONLYCACHE = auto()

QUICKNAV = auto()


def processPositiveStates(role, states, reason: OutputReason, positiveStates=None):
Expand Down
31 changes: 31 additions & 0 deletions source/controlTypes/outputReason.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2007-2021 NV Access Limited, Babbage B.V.

from enum import Enum, auto


class OutputReason(Enum):
"""Specify the reason that a given piece of output was generated.
"""
#: An object to be reported due to a focus change or similar.
FOCUS = auto()
#: An ancestor of the focus object to be reported due to a focus change or similar.
FOCUSENTERED = auto()
#: An item under the mouse.
MOUSE = auto()
#: A response to a user query.
QUERY = auto()
#: Reporting a change to an object.
CHANGE = auto()
#: A generic, screen reader specific message.
MESSAGE = auto()
#: Text reported as part of a say all.
SAYALL = auto()
#: Content reported due to caret movement or similar.
CARET = auto()
#: No output, but any state should be cached as if output had occurred.
ONLYCACHE = auto()

QUICKNAV = auto()

0 comments on commit df6663a

Please sign in to comment.