Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b0c873a
Add ability to report start of paragraphs in braille
nvdaes Jul 24, 2024
ea9d8ad
Reformat files
nvdaes Jul 25, 2024
b4becef
Improve translators comment
nvdaes Jul 25, 2024
6a3ee72
Fix help event for show paragrahph start in braille
nvdaes Jul 25, 2024
4586a5b
Reformat file
nvdaes Jul 25, 2024
646c35b
Improve documentation, suggested by coderabbitai
nvdaes Jul 25, 2024
3c5be80
Apply suggestions from code review
nvdaes Jul 25, 2024
a8cfc6e
Apply suggestion from code review
nvdaes Jul 25, 2024
a3f9061
Improve user guide, addressing review suggestions
nvdaes Jul 25, 2024
53c19b1
Apply suggestions from code review
nvdaes Jul 25, 2024
0d9400b
Use single space as indicator for paragraphs, to get a double space
nvdaes Jul 26, 2024
23c017a
Revert "Use single space as indicator for paragraphs, to get a double…
nvdaes Jul 27, 2024
990c306
Revert "Revert "Use single space as indicator for paragraphs, to get …
nvdaes Jul 27, 2024
37e2ded
Prevent that indicator of paragraphs is kipped if the word wrap optio…
nvdaes Jul 27, 2024
ccc751a
Reformat files
nvdaes Jul 27, 2024
c3ed9ef
Set window poswhen paragraph start indicator should start the raw tex…
nvdaes Jul 28, 2024
078d83c
Improve setting the start position of window when it should start wit…
nvdaes Jul 28, 2024
77383c6
Handle moving to previous window when word wrap is active
nvdaes Jul 28, 2024
fa0e88d
Improvement to prevent skipping paragraph start indicators when word …
nvdaes Jul 28, 2024
9650792
Address review: add type for event
nvdaes Jul 29, 2024
d2c220a
Merge remote-tracking branch 'origin/master' into brailleParagraphs
nvdaes Jul 29, 2024
da68eb8
Add ability to customize paragraph start indicator
nvdaes Jul 29, 2024
e6ade9c
Add ability to customize paragraph start and update user guide
nvdaes Jul 29, 2024
c09f806
Merge remote-tracking branch 'origin/master' into brailleParagraphs
nvdaes Jul 30, 2024
7a4b136
Expand explanation about a case where paragraph start indicator may n…
nvdaes Jul 30, 2024
c497e7b
Add explanatory comment
nvdaes Jul 30, 2024
7452253
Apply format
nvdaes Jul 30, 2024
44c0aac
Add combo box with double space and pillcrow for paragraph start markers
nvdaes Jul 30, 2024
367b849
Update documentation
nvdaes Jul 30, 2024
a57cda1
Apply suggestions from code review
nvdaes Jul 31, 2024
c473f76
Address review: apply standars to user guide
nvdaes Jul 31, 2024
ff00e8c
Merge remote-tracking branch 'origin/master' into brailleParagraphs
nvdaes Jul 31, 2024
7d17001
Merge branch 'master' into brailleParagraphs
seanbudd Aug 1, 2024
1310ffd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 1, 2024
b80005d
Remove accidentally committed file
nvdaes Aug 1, 2024
e1d6241
Reset source/speech/commands.py to master, since it's not related to …
nvdaes Aug 1, 2024
40b6ebf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 1, 2024
9c5d601
Apply suggestions from code review
nvdaes Aug 1, 2024
f7a5229
Apply suggestions from code review
nvdaes Aug 1, 2024
16de62c
Update source/config/configSpec.py
nvdaes Aug 1, 2024
955a6be
Use paragraph start marker with integer value in config
nvdaes Aug 1, 2024
cc84855
Pre-commit autofix
pre-commit-ci[bot] Aug 1, 2024
3c0ec10
Fix for paragraphStartMarker
nvdaes Aug 1, 2024
69ba267
Pre-commit autofix
pre-commit-ci[bot] Aug 1, 2024
5a7e57e
Merge branch 'master' into brailleParagraphs
nvdaes Aug 1, 2024
a6c1215
Fix paragraphStartMarker in function
nvdaes Aug 1, 2024
a5d351d
Make PILCROW translatable adding a getParagraphStartMarker function i…
nvdaes Aug 1, 2024
43f9ee4
Update source/braille.py
nvdaes Aug 2, 2024
36e2797
Apply review suggestions
nvdaes Aug 2, 2024
f3109bc
Merge remote-tracking branch 'origin/master' into brailleParagraphs
nvdaes Aug 2, 2024
701ba49
Pre-commit auto-fix
pre-commit-ci[bot] Aug 2, 2024
a46c3cd
Pre-commit auto-fix
pre-commit-ci[bot] Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,9 @@ def getFormatFieldBraille(field, fieldCache, isAtStart, formatConfig):
"""
textList = []
if isAtStart:
paragraphStartMarker = getParagraphStartMarker()
if paragraphStartMarker:
textList.append(paragraphStartMarker)
if formatConfig["reportLineNumber"]:
lineNumber = field.get("line-number")
if lineNumber:
Expand Down Expand Up @@ -1195,6 +1198,25 @@ def getFormatFieldBraille(field, fieldCache, isAtStart, formatConfig):
return TEXT_SEPARATOR.join([x for x in textList if x])


def getParagraphStartMarker() -> str | None:
brailleConfig = config.conf["braille"]
if brailleConfig["readByParagraph"]:
paragraphStartMarker = brailleConfig["paragraphStartMarker"]
if paragraphStartMarker == "¶":
# Translators: This is a paragraph start marker used in braille.
# The default symbol is the pilcrow,
# a symbol also known as "paragraph symbol" or "paragraph marker".
# This symbol should translate in braille via LibLouis automatically.
# If there is a more appropriate character for your locale,
# consider overwriting this (e.g. for Ge'ez ፨).
# You can also use Unicode Braille such as ⠘⠏.
# Ensure this is consistent with other strings with the context "paragraphMarker".
paragraphStartMarker = pgettext("paragraphMarker", "¶")
else:
paragraphStartMarker = None
return paragraphStartMarker


def _getFormattingTags(
field: dict[str, str],
fieldCache: dict[str, str],
Expand Down Expand Up @@ -1899,6 +1921,16 @@ def _set_windowEndPos(self, endPos):
break
except ValueError:
pass
# When word wrap is enabled, the first block of spaces may be removed from the current window.
# This may prevent displaying the start of paragraphs.
paragraphStartMarker = getParagraphStartMarker()
if paragraphStartMarker and self.regions[-1].rawText.startswith(
paragraphStartMarker + TEXT_SEPARATOR,
):
region, regionStart, regionEnd = list(self.regionsWithPositions)[-1]
# Show paragraph start indicator if it is now at the left of the current braille window
if startPos <= len(paragraphStartMarker) + 1:
startPos = self.regionPosToBufferPos(region, regionStart)
self.windowStartPos = startPos

def _nextWindow(self):
Expand Down
19 changes: 19 additions & 0 deletions source/config/configFlags.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,22 @@ def _displayStringLabels(self):
# Translators: A label for an option to choose a method of reporting information, e.g. font attributes.
self.SPEECH_AND_BRAILLE: _("Speech and braille"),
}


class ParagraphStartMarker(DisplayStringStrEnum):
NONE = ""
SPACE = " "
PILCROW = "¶"
Comment thread
nvdaes marked this conversation as resolved.

@property
def _displayStringLabels(self):
return {
# Translators: This is a label for a paragraph start marker.
self.NONE: pgettext("paragraphMarker", "No paragraph start marker (default)"),
# Translators: This is a label for a paragraph start marker.
self.SPACE: pgettext("paragraphMarker", "Double space ( )"),
# Translators: This is a label for a paragraph start marker.
Comment thread
nvdaes marked this conversation as resolved.
# Pilcrow is a symbol also known as "paragraph symbol" or "paragraph marker".
# Ensure this is consistent with other strings with the context "paragraphMarker".
self.PILCROW: pgettext("paragraphMarker", "Pilcrow (¶)"),
}
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
reviewRoutingMovesSystemCaret = featureFlag(\
optionsEnum="ReviewRoutingMovesSystemCaretFlag", behaviorOfDefault="NEVER")
readByParagraph = boolean(default=false)
paragraphStartMarker = option("", " ", "¶", default="")
Comment thread
nvdaes marked this conversation as resolved.
wordWrap = boolean(default=true)
unicodeNormalization = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="disabled")
focusContextPresentation = option("changedContext", "fill", "scroll", default="changedContext")
Expand Down
23 changes: 23 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
NVDAKey,
ShowMessages,
TetherTo,
ParagraphStartMarker,
ReportLineIndentation,
ReportTableHeaders,
ReportCellBorders,
Expand Down Expand Up @@ -4386,8 +4387,24 @@ def makeSettings(self, settingsSizer):
wx.CheckBox(self.followCursorGroupBox, label=readByParagraphText),
)
self.bindHelpEvent("BrailleSettingsReadByParagraph", self.readByParagraphCheckBox)
self.readByParagraphCheckBox.Bind(wx.EVT_CHECKBOX, self.onReadByParagraphChange)
self.readByParagraphCheckBox.Value = config.conf["braille"]["readByParagraph"]

# Translators: This is a label for a combo-box in the Braille settings panel to select paragraph start markers.
labelText = _("Paragraph start marker:")
self.paragraphStartMarkersComboBox = followCursorGroupHelper.addLabeledControl(
labelText,
wx.Choice,
choices=[marker.displayString for marker in ParagraphStartMarker],
)
self.bindHelpEvent("BrailleParagraphStartMarkers", self.paragraphStartMarkersComboBox)
paragraphStartMarker = config.conf["braille"]["paragraphStartMarker"]
self.paragraphStartMarkersComboBox.SetSelection(
[marker.value for marker in ParagraphStartMarker].index(paragraphStartMarker),
)
if not self.readByParagraphCheckBox.GetValue():
self.paragraphStartMarkersComboBox.Disable()

# Translators: The label for a setting in braille settings to select how the context for the focus object should be presented on a braille display.
focusContextPresentationLabelText = _("Focus context presentation:")
self.focusContextPresentationValues = [x[0] for x in braille.focusContextPresentations]
Expand Down Expand Up @@ -4494,6 +4511,9 @@ def onSave(self):
braille.handler.setTether(tetherChoice, auto=False)
self.brailleReviewRoutingMovesSystemCaretCombo.saveCurrentValueToConf()
config.conf["braille"]["readByParagraph"] = self.readByParagraphCheckBox.Value
config.conf["braille"]["paragraphStartMarker"] = [marker.value for marker in ParagraphStartMarker][
self.paragraphStartMarkersComboBox.GetSelection()
]
config.conf["braille"]["wordWrap"] = self.wordWrapCheckBox.Value
self.unicodeNormalizationCombo.saveCurrentValueToConf()
config.conf["braille"]["focusContextPresentation"] = self.focusContextPresentationValues[
Expand All @@ -4520,6 +4540,9 @@ def onTetherToChange(self, evt: wx.CommandEvent) -> None:
tetherChoice = [x.value for x in TetherTo][evt.GetSelection()]
self.brailleReviewRoutingMovesSystemCaretCombo.Enable(tetherChoice != TetherTo.FOCUS.value)

def onReadByParagraphChange(self, evt: wx.CommandEvent):
self.paragraphStartMarkersComboBox.Enable(evt.IsChecked())

def _onModeChange(self, evt: wx.CommandEvent):
self.followCursorGroupBox.Enable(not evt.GetSelection())

Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
The available options are:
* Liblouis (default): Uses formatting markers defined in the selected braille table.
* Tags: Uses start and end tags to denote where certain font attributes begin and end. (#16864)
* When the "Read by paragraph" option is enabled, NVDA can now be configured to indicate the start of paragraphs in braille. (#16895, @nvdaes)
* The timeout to perform a multiple keypress is now configurable; this may be especially useful for people with dexterity impairment. (#11929, @CyrilleB79)

### Changes
Expand Down
13 changes: 13 additions & 0 deletions user_docs/en/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2163,6 +2163,19 @@ This means that you do not have to scroll the display at the end of each line ev
This may allow for more fluent reading of large amounts of text.
It is disabled by default.

##### Paragraph start marker {#BrailleParagraphStartMarkers}

Comment thread
nvdaes marked this conversation as resolved.
If "Read by paragraph" is checked, the selected start marker will be displayed to indicate the start of a paragraph.
This can be especially helpful in applications used to read large pieces of text, like structured documents or books.
In such documents, knowing where paragraphs start may be useful to understand the structure of the content, or to set bookmarks or annotations based on paragraph position.
Comment thread
nvdaes marked this conversation as resolved.

The options include using double space for softer paragraph breaks, or alternatively the paragraph symbol, Pilcrow (¶), for more obvious paragraph breaks.

| . {.hideHeaderRow} |.|
|---|---|
|Options |No paragraph start marker, Double space ( ), Pilcrow (¶)|
|Default |No paragraph start marker|

##### Focus context presentation {#BrailleSettingsFocusContextPresentation}

This option allows you to choose what context information NVDA will show on the braille display when an object gets focus.
Expand Down