Skip to content

Commit

Permalink
Made generic title, fixed buttons, add stay on top flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Davis authored and Luke Davis committed Apr 12, 2024
1 parent ecfbfad commit 0400dd2
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,18 @@ def onRunCOMRegistrationFixesCommand(self, evt) -> None:
If the user chooses to continue: runs the tool, and displays a completion dialog.
Cancels the run attempt if the user fails or declines the UAC prompt.
"""
INTRO_MESSAGE = _(
# Translators: Explain the COM Registration Fixing tool to users before running
# Translators: Explain the COM Registration Fixing tool to users before running
introMessage: str = _(
"""Welcome to the COM Registration Fixing tool.
This tool is used by NVDA to fix problems it may have as it tries to interact with various applications, or with Windows itself.\n
It examines the system registry for corrupted or missing accessibility entries and will correct them.\n
Those entries can sometimes be damaged by installing or uninstalling programs, or other system events. This can result in "unknown" or "pane" being spoken instead of the content you were expecting, or previously accessible elements suddenly no longer reading correctly.\n\n
You have most likely been asked to run this tool by NVDA support or a power user trying to assist you.\n
Because it needs to modify the Windows registry, if you have User Account Control (UAC) active, you will be prompted by UAC before this tool can do its job. This is normal and you should answer using the Continue button.\n\n
Because it needs to modify the Windows registry, if you have User Account Control (UAC) active, you will be prompted by UAC before this tool can do its job. This is normal and you should answer by pressing the yes button.\n\n
Do you wish to try to repair the registry now?\n""" # noqa: E501 Flake8 sees this block as one line
)
# Translators: The title of various dialogs displayed when using the COM Registration Fixing tool
genericTitle: str = _("Fix COM Registrations")
'''class CRFTInfoPromptDialog(MessageDialog):
def _addButtons(self, buttonHelper):
"""Adds continue / cancel buttons.
Expand All @@ -477,26 +479,24 @@ def _addButtons(self, buttonHelper):
)
cancel.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.CANCEL))
#response = displayDialogAsModal(CRFTInfoPromptDialog(
'''
response = messageBox(
INTRO_MESSAGE,
# Translators: The title of the notice dialog displayed when launching the COM Registration Fixing tool
caption=_("Fix COM Registrations"),
style=wx.ID_OK | wx.ID_CANCEL | wx.CENTER
'''
response: int = messageBox(
introMessage,
caption=genericTitle,
style=wx.YES_NO | wx.CANCEL | wx.STAY_ON_TOP,
parent=self
)#)
if response == wx.CANCEL:
)
if response == wx.CANCEL or response == wx.NO:
log.debug("Run of COM Registration Fixing Tool canceled before UAC.")
return
progressDialog = IndeterminateProgressDialog(
mainFrame,
# Translators: The title of the dialog presented while NVDA is running the COM Registration fixing tool
_("COM Registration Fixing Tool"),
genericTitle,
# Translators: The message displayed while NVDA is running the COM Registration fixing tool
_("Please wait while NVDA attempts to fix your system's COM registrations...")
)
error: Optional[str] = None
try:
error = None
systemUtils.execElevated(config.SLAVE_FILENAME, ["fixCOMRegistrations"])
except WindowsError as e:
# 1223 is "The operation was canceled by the user."
Expand All @@ -507,7 +507,7 @@ def _addButtons(self, buttonHelper):
else:
log.error("Could not execute fixCOMRegistrations command", exc_info=True)
error = e # Hold for later display to the user
return
return # Safe because of finally block
except Exception as e:
log.error("Could not execute fixCOMRegistrations command", exc_info=True)
return
Expand All @@ -523,16 +523,14 @@ def _addButtons(self, buttonHelper):
"The COM Registration Fixing Tool was unsuccessful. This Windows "
"error may provide more information. {}"
).format(error),
# Translators: title of the dialog showing the COM Registration Fix failure
_("COM Registration Fix Tool Failed"), wx.OK
# Translators: Added to the title of the dialog showing the COM Registration Fix failure
genericTitle + " " + _("Failed"), wx.OK
)
# Display success dialog if there were no errors
messageBox(
# Translators: Message shown when the COM Registration Fixing tool completes.
_("The COM Registration Fixing Tool has completed successfully."),
# Translators: The title of a dialog presented when the COM Registration
# Fixing Tool completes successfully.
_("COM Registration Fixing Tool"), wx.OK
genericTitle, wx.OK
)

@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
Expand Down

0 comments on commit 0400dd2

Please sign in to comment.