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

Refactor COM Registration Fixing Tool part 2: remove bugs, return Windows errors, improve UX #12355

Merged
merged 71 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
45345c7
Refactored the COM Registration Fixing Tool to fix bugs and impro…
Sep 2, 2024
239810d
changes
Sep 2, 2024
5467ff6
Pre-commit auto-fix
pre-commit-ci[bot] Sep 2, 2024
a293607
String reformatting
Sep 3, 2024
5dfea2a
Remove old imports
Sep 3, 2024
e15dedc
Emitintro message using a method.
Sep 3, 2024
e948d0f
Fix quoting
Sep 3, 2024
9dec84d
Pre-commit auto-fix
pre-commit-ci[bot] Sep 3, 2024
9c25ec8
Line length fixes.
Sep 3, 2024
07e172f
Fix bad perms.
Sep 3, 2024
842ca05
Trying new continue/cancel dialog
Sep 3, 2024
2282ece
Fix various things the AI did wrong.
Sep 3, 2024
1895c6d
Remove warning icon and ding.
Sep 3, 2024
c37844e
Pre-commit auto-fix
pre-commit-ci[bot] Sep 3, 2024
16cc4e2
Fix title and message ordering in ContinueCancelDialog.__init__
Sep 3, 2024
60d6a4f
Remove unnecessary UTF-8 header line
Sep 3, 2024
2edf3c7
Fix instruction from "Press OK" to "Press Continue".
Sep 3, 2024
d180df6
Add docstring.
Sep 3, 2024
661af13
Fix-up some indenting.
Sep 3, 2024
c655cc5
Pre-commit auto-fix
pre-commit-ci[bot] Sep 3, 2024
2cf4977
Merge branch 'master' into CRFTRefactor
Sep 3, 2024
f38b55f
Added a note to changes for devs.
Sep 3, 2024
a8d871c
Merge branch 'master' into CRFTRefactor
Sep 5, 2024
b497007
Implemented an alternate way of having the Cancel button be selected …
Sep 5, 2024
0bc63ce
Pre-commit auto-fix
pre-commit-ci[bot] Sep 5, 2024
7465eb2
Apply Sean's proposed language to replace the "...power user..." refe…
XLTechie Sep 6, 2024
1f2f510
Merge branch 'master' into CRFTRefactor
Sep 6, 2024
020bfbf
One more try at NVDA style method definition indenting.
Sep 6, 2024
8cb3c21
Pre-commit auto-fix
pre-commit-ci[bot] Sep 6, 2024
4ccae98
Apply suggestions from code review
XLTechie Sep 9, 2024
28b202d
Merge branch 'master' into CRFTRefactor
Sep 9, 2024
255106d
Move new class to nvdaControls.py
Sep 9, 2024
d46fe7d
Transformed the intro message from a method to a constant.
Sep 9, 2024
5597e09
Fix bad import.
Sep 10, 2024
82b6cc5
Merge branch 'master' into CRFTRefactor
Sep 10, 2024
4fda926
Apply suggestions from code review
XLTechie Sep 10, 2024
70e2f61
Make ContinueCancelDialog private. Type hint ButtonHelper instances m…
Sep 10, 2024
a7712bc
Make message and class private in init.
Sep 10, 2024
e6bb3bf
Fix missed change
Sep 10, 2024
9c81960
Merge branch 'master' into CRFTRefactor
Sep 10, 2024
7f1ee11
Rebuild
Sep 10, 2024
c81163c
Edit user guide
Sep 10, 2024
72baafe
Merge branch 'master' into CRFTRefactor
Sep 16, 2024
2a4b537
String update.
Sep 16, 2024
479bf4f
Review suggestions for user guide
Sep 16, 2024
e225029
Attempt context help
Sep 16, 2024
fe7577f
Pre-commit auto-fix
pre-commit-ci[bot] Sep 16, 2024
037bc61
Fix import
Sep 16, 2024
d9ce718
Pre-commit auto-fix
pre-commit-ci[bot] Sep 16, 2024
107f27e
Merge branch 'master' into CRFTRefactor
Sep 17, 2024
66cf13a
Docstring update for context help
Sep 17, 2024
3e399f5
One more update of the message.
Sep 17, 2024
fa1e81f
Update the message again, per review request.
Sep 17, 2024
f76faf8
Syntax fixes
SaschaCowley Sep 17, 2024
97a472d
Apply newline suggestions from code review
XLTechie Sep 18, 2024
4eb0fd0
Very minor grammar enhancement.
Sep 18, 2024
c9c59f3
Merge branch 'master' into CRFTRefactor
Sep 18, 2024
ef7f345
Correction to an unrelated changes listing
Sep 18, 2024
7be360a
Slight grammar clarification in user guide.
XLTechie Sep 18, 2024
70b596c
Correction to grammar clarification in user guide.
XLTechie Sep 18, 2024
5fd2344
Remove attribution from changes entries
Sep 19, 2024
4e88743
Merge branch 'master' into CRFTRefactor
Sep 19, 2024
10ea475
Apply suggestions from code review
XLTechie Sep 19, 2024
78a1398
Update user guide per review suggestion.
Sep 19, 2024
1a158f1
Add a clarifying comment
Sep 19, 2024
aba1ce7
Change a word in the intro message for more clarity.
XLTechie Sep 19, 2024
bad035a
Merge branch 'master' into CRFTRefactor
Sep 19, 2024
5bcf510
Revert "Update user guide per review suggestion.": a newer version ma…
Sep 19, 2024
894e820
Merge branch 'master' into CRFTRefactor
Sep 19, 2024
1e58fae
Potential new user guide entry.
Sep 19, 2024
f8befd5
Fix a tiny bit of structure in the UG
Sep 19, 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
98 changes: 70 additions & 28 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
VoiceDictionaryDialog,
TemporaryDictionaryDialog,
)
from .utilityDialogs import ContinueCancelDialog

# ExitDialog is accessed through `import gui.ExitDialog` as opposed to `gui.exit.ExitDialog`.
# Be careful when removing, and only do in a compatibility breaking release.
Expand Down Expand Up @@ -483,49 +484,90 @@ def onInstallCommand(self, evt):
blockAction.Context.SECURE_MODE,
blockAction.Context.MODAL_DIALOG_OPEN,
)
def onRunCOMRegistrationFixesCommand(self, evt):
if (
messageBox(
_(
# Translators: A message to warn the user when starting the COM Registration Fixing tool
"You are about to run the COM Registration Fixing tool. "
"This tool will try to fix common system problems that stop NVDA from being able to access content "
"in many programs including Firefox and Internet Explorer. "
"This tool must make changes to the System registry and therefore requires administrative access. "
"Are you sure you wish to proceed?",
),
# Translators: The title of the warning dialog displayed when launching the COM Registration Fixing tool
_("Warning"),
wx.YES | wx.NO | wx.ICON_WARNING,
self,
)
== wx.NO
):
def onRunCOMRegistrationFixesCommand(self, evt) -> None:
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
"""Manages the interactive running of the COM Registration Fixing Tool.
Shows a dialog to the user, giving an overview of what is going to happen.
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.
"""
# Translators: The title of various dialogs displayed when using the COM Registration Fixing tool
genericTitle: str = _("Fix COM Registrations")
introDialog = ContinueCancelDialog(
self,
genericTitle,
self._CRFTIntroMessage(),
)
response: int = introDialog.ShowModal()
if response == wx.CANCEL:
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 tries to fix your system's COM registrations."),
_("Please wait while NVDA attempts to fix your system's COM registrations..."),
)
error: str | None = None
try:
systemUtils.execElevated(config.SLAVE_FILENAME, ["fixCOMRegistrations"])
except: # noqa: E722
except WindowsError as e:
# 1223 is "The operation was canceled by the user."
if e.winerror == 1223:
# Same as if the user selected "no" in the initial dialog.
log.debug("Run of COM Registration Fixing Tool canceled during UAC.")
return
else:
log.error("Could not execute fixCOMRegistrations command", exc_info=True)
error = e # Hold for later display to the user
return # Safe because of finally block
except Exception:
log.error("Could not execute fixCOMRegistrations command", exc_info=True)
progressDialog.done()
del progressDialog
return
finally: # Clean up the progress dialog, and display any important error to the user before returning
progressDialog.done()
del progressDialog
self.postPopup()
# If there was a Windows error, inform the user because it may have support value
if error is not None:
messageBox(
_(
# Translators: message shown to the user on COM Registration Fix fail
"The COM Registration Fixing Tool was unsuccessful. This Windows "
"error may provide more information. {}",
).format(error),
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
# Translators: Added to the title of the dialog showing the COM Registration Fix failure
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
genericTitle + " " + _("Failed"),
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
wx.OK,
)
# Display success dialog if there were no errors
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
messageBox(
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
_(
# Translators: The message displayed when the COM Registration Fixing tool completes.
"The COM Registration Fixing tool has finished. "
# Translators: Message shown when the COM Registration Fixing tool completes.
"The COM Registration Fixing Tool has completed successfully.\n"
"It is highly recommended that you restart your computer now, to make sure the changes take full effect.",
),
# Translators: The title of a dialog presented when the COM Registration Fixing tool is complete.
_("COM Registration Fixing Tool"),
genericTitle,
wx.OK,
)

def _CRFTIntroMessage(self) -> str:
"""Helper that returns the COM Registration Fixing Tool's introductory statement."""
return _(
# Translators: Explain the COM Registration Fixing tool to users before running
"Welcome to the COM Registration Fixing tool.\n"
"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 are sometimes 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"
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
"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"
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
"Press Continue to try to repair the registry now.\n",
)
coderabbitai[bot] marked this conversation as resolved.
Show resolved Hide resolved

@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
def onConfigProfilesCommand(self, evt):
self.prePopup()
Expand Down
Empty file modified source/gui/logViewer.py
100755 → 100644
Empty file.
47 changes: 47 additions & 0 deletions source/gui/utilityDialogs.py
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2024 NV Access Limited, Luke Davis
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html

import wx

from .nvdaControls import MessageDialog


class ContinueCancelDialog(MessageDialog):
"""
This implementation of a `gui.nvdaControls.MessageDialog`, provides `Continue` and `Cancel` buttons as its controls.
These serve the same functions as `OK` and `Cancel` in other dialogs, but may be more desirable in some situations.
"""

def __init__(
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
self,
parent,
title: str,
message: str,
dialogType: int = MessageDialog.DIALOG_TYPE_STANDARD,
continueByDefault: bool = True,
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
) -> None:
"""Creates a ContinueCancelDialog MessageDialog.

:param parent: The parent window for the dialog, usually `gui.mainFrame`.
:param title: The title or caption of the dialog.
:param message: The message to be shown in the dialog.
:param dialogType: One of the dialog type constants from MessageDialog, defaults to standard.
:param continueByDefault: Whether the Continue button should be the one wx sets as default, defaults to True.
"""
self.continueByDefault: bool = continueByDefault
super().__init__(parent, title, message, dialogType)

def _addButtons(self, buttonHelper) -> None:
"""Override to add Continue and Cancel buttons."""
# Translators: The label for the Continue button in an NVDA dialog.
continueButton = buttonHelper.addButton(self, id=wx.ID_OK, label=_("&Continue"))
continueButton.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.OK))
# Translators: The label for the Cancel button in an NVDA dialog.
cancelButton = buttonHelper.addButton(self, id=wx.ID_CANCEL, label=_("Cancel"))
cancelButton.Bind(wx.EVT_BUTTON, lambda evt: self.EndModal(wx.CANCEL))
if self.continueByDefault:
continueButton.SetDefault()
else:
cancelButton.SetDefault()
6 changes: 6 additions & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ In order to use this feature, the application volume adjuster needs to be enable

* The Report link destination, Character formatting information, and Speak selection dialogs, now include "Close" and "Copy" buttons for user convenience. (#17018, @XLTechie)
* The exit dialog now allows you to restart NVDA with add-ons disabled and debug logging enabled simultaneously. (#11538, @CyrilleB79)r
* Changes to the COM Registration Fixing Tool: (#12355, @XLTechie)
* It will now show a message to the user, including the error, in the rare event of a Windows error while attempting COM re-registrations.
* It now starts with a more user friendly explanation of its purpose, instead of a warning. (#12351, @XLTechie, @britechguy)
* The initial window can now be exited with `escape` or `alt+f4`. (#10799, @XLTechie)
XLTechie marked this conversation as resolved.
Show resolved Hide resolved
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved

### Bug Fixes

* Native support for the Dot Pad tactile graphics device from Dot Inc as a multiline braille display. (#17007)
* Improvements when editing in Microsoft PowerPoint:
* Caret reporting no longer breaks when text contains wide characters, such as emoji. (#17006 , @LeonarddeR)
* Character location reporting is now accurate (e.g. when pressing `NVDA+Delete`. (#9941, @LeonarddeR)
* The COM Registration Fixing Tool no longer reports success on failure. (#12355, @XLTechie)

### Changes for Developers

Expand All @@ -34,6 +39,7 @@ Add-ons will need to be re-tested and have their manifest updated.
* Updated Ruff to 0.6.3. (#17102)
* Updated Comtypes to 1.4.6. (#17061, @LeonarddeR)
* `ui.browseableMessage` may now be called with options to present a button for copying to clipboard, and/or a button for closing the window. (#17018, @XLTechie)
* There is a new `gui.utilityDialogs.ContinueCancelDialog`, for producing simple dialogs with Continue and Cancel buttons. (#12355, @XLTechie)
SaschaCowley marked this conversation as resolved.
Show resolved Hide resolved
XLTechie marked this conversation as resolved.
Show resolved Hide resolved

#### API Breaking Changes

Expand Down