File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -1148,7 +1148,7 @@ def _setCursor(self, info: textInfos.TextInfo):
1148
1148
1149
1149
def _getTypeformFromFormatField (self , field , formatConfig ):
1150
1150
typeform = louis .plain_text
1151
- if not (formatConfig ["fontAttributeReporting" ] & OutputMode . BRAILLE ) :
1151
+ if not OutputMode (formatConfig ["fontAttributeReporting" ]). inBraille :
1152
1152
return typeform
1153
1153
if field .get ("bold" , False ):
1154
1154
typeform |= louis .bold
Original file line number Diff line number Diff line change 11
11
the default value.
12
12
"""
13
13
14
- from enum import unique
14
+ from enum import unique , property as enum_property
15
15
from utils .displayString import (
16
16
DisplayStringIntEnum ,
17
17
DisplayStringStrEnum ,
@@ -246,3 +246,21 @@ def _displayStringLabels(self):
246
246
# Translators: A label for an option to choose a method of reporting information, e.g. font attributes.
247
247
self .SPEECH_AND_BRAILLE : _ ("Speech and braille" ),
248
248
}
249
+
250
+ @enum_property
251
+ def inSpeech (self ) -> bool :
252
+ """Check if the output mode includes speech.
253
+
254
+ Returns:
255
+ bool: True if the output mode includes speech, False otherwise.
256
+ """
257
+ return self & self .SPEECH != 0
258
+
259
+ @enum_property
260
+ def inBraille (self ) -> bool :
261
+ """Check if the output mode includes braille.
262
+
263
+ Returns:
264
+ bool: True if the output mode includes braille, False otherwise.
265
+ """
266
+ return self & self .BRAILLE != 0
Original file line number Diff line number Diff line change @@ -2718,7 +2718,7 @@ def getFormatFieldSpeech( # noqa: C901
2718
2718
# Translators: Reported when text is no longer marked as emphasised
2719
2719
else _ ("not emphasised" ))
2720
2720
textList .append (text )
2721
- if formatConfig ["fontAttributeReporting" ] & OutputMode . SPEECH :
2721
+ if OutputMode ( formatConfig ["fontAttributeReporting" ]). inSpeech :
2722
2722
bold = attrs .get ("bold" )
2723
2723
oldBold = attrsCache .get ("bold" ) if attrsCache is not None else None
2724
2724
if (bold or oldBold is not None ) and bold != oldBold :
You can’t perform that action at this time.
0 commit comments