Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the reporting of superscripts and subscripts from the report font attributes setting #10919

Merged
merged 4 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#: provide an upgrade step (@see profileUpgradeSteps.py). An upgrade step does not need to be added when
#: just adding a new element to (or removing from) the schema, only when old versions of the config
#: (conforming to old schema versions) will not work correctly with the new schema.
latestSchemaVersion = 3
latestSchemaVersion = 4

#: The configuration specification string
#: @type: String
Expand Down Expand Up @@ -173,6 +173,7 @@
reportFontAttributes = boolean(default=false)
reportRevisions = boolean(default=true)
reportEmphasis = boolean(default=false)
reportSuperscriptsAndSubscripts = boolean(default=false)
reportColor = boolean(default=False)
reportAlignment = boolean(default=false)
reportLineSpacing = boolean(default=false)
Expand Down
11 changes: 11 additions & 0 deletions source/config/profileUpgradeSteps.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ def upgradeConfigFrom_2_to_3(profile):
if "terminals" not in profile:
profile["terminals"] = {}
profile["terminals"]["speakPasswords"] = speakPasswords


def upgradeConfigFrom_3_to_4(profile):
"Reporting of superscripts and subscripts can now be configured separately to font attributes."
try:
profile['documentFormatting']['reportSuperscriptsAndSubscripts'] = (
profile['documentFormatting']['reportFontAttributes']
)
except KeyError:
# Setting does not exist, no need for upgrade of this setting
log.debug("reportFontAttributes not present, no action taken.")
13 changes: 13 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,16 @@ def makeSettings(self, settingsSizer):
self.fontAttrsCheckBox=fontGroup.addItem(wx.CheckBox(self,label=fontAttributesText))
self.fontAttrsCheckBox.SetValue(config.conf["documentFormatting"]["reportFontAttributes"])

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
superscriptsAndSubscriptsText = _("Su&perscripts and subscripts")
self.superscriptsAndSubscriptsCheckBox = fontGroup.addItem(
wx.CheckBox(self, label=superscriptsAndSubscriptsText)
)
self.superscriptsAndSubscriptsCheckBox.SetValue(
config.conf["documentFormatting"]["reportSuperscriptsAndSubscripts"]
)

# Translators: This is the label for a checkbox in the
# document formatting settings panel.
emphasisText=_("E&mphasis")
Expand Down Expand Up @@ -2145,6 +2155,9 @@ def onSave(self):
config.conf["documentFormatting"]["reportFontName"]=self.fontNameCheckBox.IsChecked()
config.conf["documentFormatting"]["reportFontSize"]=self.fontSizeCheckBox.IsChecked()
config.conf["documentFormatting"]["reportFontAttributes"]=self.fontAttrsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportSuperscriptsAndSubscripts"] = (
self.superscriptsAndSubscriptsCheckBox.IsChecked()
)
config.conf["documentFormatting"]["reportColor"]=self.colorCheckBox.IsChecked()
config.conf["documentFormatting"]["reportComments"]=self.commentsCheckBox.IsChecked()
config.conf["documentFormatting"]["reportRevisions"]=self.revisionsCheckBox.IsChecked()
Expand Down
1 change: 1 addition & 0 deletions source/speech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2178,6 +2178,7 @@ def getFormatFieldSpeech( # noqa: C901
else _("not hidden")
)
textList.append(text)
if formatConfig["reportSuperscriptsAndSubscripts"]:
textPosition=attrs.get("text-position")
oldTextPosition=attrsCache.get("text-position") if attrsCache is not None else None
if (textPosition or oldTextPosition is not None) and textPosition!=oldTextPosition:
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,7 @@ You can configure reporting of:
- Font name
- Font size
- Font attributes
- Superscripts and subscripts
- Emphasis
- Style
- Colors
Expand Down