Skip to content

Uniformize all "Copied to clipboard" messages (#6757)#9843

Merged
feerrenrut merged 6 commits into
nvaccess:masterfrom
accessolutions:i6757
Nov 17, 2020
Merged

Uniformize all "Copied to clipboard" messages (#6757)#9843
feerrenrut merged 6 commits into
nvaccess:masterfrom
accessolutions:i6757

Conversation

@JulienCochuyt

@JulienCochuyt JulienCochuyt commented Jun 28, 2019

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #6757

Summary of the issue:

The 5 clipboard-related scripts do not uniformly emit acknowledgement messages.
They present success either with speech&braille or speech only.
They either report failure, or not.
Three of them are triple-press gestures. The possibly lengthy copied text being reported before the statement "copied to clipboard" does not help to make it clear something different occurred.

Description of how this pull request fixes the issue:

  • Centralize reporting of success or failure in one place (inspired by Move the message 'selected' after the text which is selected. #9028)
  • Always report failure, reusing the existing "Unable to copy"
  • Announce "Copied to clipboard: {text}"
  • Display in braille the shorter "Copied: {text}" to accommodate smaller displays
  • Client code can benefit from the new notify parameter to api.copyToClip to obtain the new standard behavior. This new parameter defaults to False not to interfere with existing calls from addons.

Testing performed:

Tested with both speech and braille:

  • Copy the current navigator object
  • Copy the application title bar
  • Copy the application status bar
  • Copy the review selection (NVDA+F10)
  • Copy the cursor manager selection (control+C)

Known issues with pull request:

This PR adds the first translated message to the api module.
If this is to be considered a problem, the message part could easily be moved out to something like ui.acknowledgeCopyToClipboard(text: str, success: bool)

Change log entry:

Section: Changes
NVDA will now report "Copied to clipboard" before the copied text.

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

72e9d14: Rebased onto latest master

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

Rebased onto latest master and linted.

@lukaszgo1

Copy link
Copy Markdown
Contributor

While it is certainly too late to include this into 2019.3 it would be great if it can be considered for the next release. cc @feerrenrut @michaelDCurran

@feerrenrut

Copy link
Copy Markdown
Contributor

Does this require updates to the user guide?

@lukaszgo1

Copy link
Copy Markdown
Contributor

@feerrenrut wrote:

Does this require updates to the user guide?

IMHO it does not @JulienCochuyt Do you agree? I'd be great to push this forward - the change is quite small and in my opinion PR's such as this one i.e cosmetic changes are contributing to the backlog greatly.

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

@feerrenrut wrote:
Does this require updates to the user guide?

I couldn't find in the user guide any mention of the exact announce performed when text is copied.
Thus, no, I don't think any impact is needed there.

@lukaszgo1 wrote:

IMHO it does not @JulienCochuyt Do you agree? I'd be great to push this forward - the change is quite small and in my opinion PR's such as this one i.e cosmetic changes are contributing to the backlog greatly.

Thanks for your support.

Comment thread source/api.py Outdated
Comment on lines +322 to +327
# Translators: Announced when a text has been copied to clipboard.
# %s is replaced by the copied text.
speech.speakMessage(_("Copied to clipboard: %s" % text))
# Translators: Displayed in braille when a text has been copied to clipboard.
# %s is replaced by the copied text.
braille.handler.message(_("Copied: %s" % text))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not import speech for this. Instead, I think we should add an optional "brailleMessage" argument to ui.message. That way, the detail for how messaging is done is abstracted away.
Actually, I think this is only place in api.py that uses the ui module. We have long had requests for greater customization of UI messages collecting this UI together will probably help (also with consistency of messages). Perhaps the messages should be moved into the ui module, EG: def reportTextCopiedToClipboard(text: Optional[str]) -> None. When text is None, "Unable to copy" is reported. This can be called from each place that wishes to notify, rather than doing it in api.

Thinking about why these are different, perhaps both speech and braille should simply use "Copied: %s"? It's shorter, and arguably "to clipboard" doesn't tell the user anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just rebased onto latest master.
Done adding a brailleText parameter to ui.message.
Done moving "Unable to copy" within ui.reportTextCopiedToClipboard.

Regarding the lengthier spoken message, I felt it was closer to what is currently announced eg. in browse mode.
Let me know if you wish I change this anyway.

@feerrenrut

Copy link
Copy Markdown
Contributor

I couldn't find in the user guide any mention of the exact announce performed when text is copied. Thus, no, I don't think any impact is needed there.

@JulienCochuyt Thanks for checking.

JulienCochuyt added a commit to accessolutions/nvda that referenced this pull request May 1, 2020
@feerrenrut feerrenrut self-requested a review May 5, 2020 16:08
@codeofdusk

Copy link
Copy Markdown
Contributor

@feerrenrut Any updates on this PR?

@lukaszgo1

Copy link
Copy Markdown
Contributor

It seems all requested changes are addressed on this one. @feerrenrut Could it be that this got of your radar?

feerrenrut
feerrenrut previously approved these changes Nov 17, 2020
@feerrenrut feerrenrut merged commit 318c215 into nvaccess:master Nov 17, 2020
@nvaccessAuto nvaccessAuto added this to the 2020.4 milestone Nov 17, 2020
@JulienCochuyt JulienCochuyt deleted the i6757 branch November 17, 2020 08:13
@Adriani90

Copy link
Copy Markdown
Collaborator

Not sure if it comes from this PR, but I get now following error in NVDA alpha Version: alpha-21386,53cecfd7

STR:

  1. Open MS Outlook
  2. Open an Email
  3. Enable browse mode and select some text
  4. Press ctrl+c

Actual: Following error is raised and the selected text is not copied to the clipboard:

IO - inputCore.InputManager.executeGesture (00:52:29.103) - winInputHook (1524):
Input: kb(laptop):control+c
ERROR - scriptHandler.executeScript (00:52:29.113) - MainThread (8596):
error executing script: <bound method CursorManager.script_copyToClipboard of <appModules.outlook.MailViewerTreeInterceptor object at 0x00FB6530>> with gesture 'Strg+c'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 208, in executeScript
  File "cursorManager.pyc", line 409, in script_copyToClipboard
  File "treeInterceptorHandler.pyc", line 193, in copyToClipboard
TypeError: copyToClipboard() takes 1 positional argument but 2 were given

Expected: No error and the selected text is copied to the clipboard.

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

@Adriani90 wrote:

Not sure if it comes from this PR, but I get now following error in NVDA alpha Version: alpha-21386,53cecfd7

It does. My bad. Thank you for the report and STR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify NVDA’s speech feedback for copying actions on triple-pressing of certain commands in English to place ‘copied’ at the beginning

6 participants