Skip to content

Commit

Permalink
Speech Viewer: allow to close with alt+F4 & add a close button on the…
Browse files Browse the repository at this point in the history
… title bar for use with pointing devices (#10791) (#12330)

The Speech Viewer currently has no close button nor can be closed with alt+F4.

As described by @Qchristensen in #10791 (comment), most dialogs in NVDA can be closed with alt+F4.
As argued by @bhavyashah in #10791 (comment), the Speech Viewer is especially useful for sighted testers who might be more familiar in using pointing devices than keyboard shortcuts.

Description of how this pull request fixes the issue:
Handle closing with alt+F4 & add a standard close button in the title bar of the dialog.

Co-authored-by: Sean Budd <[email protected]>
  • Loading branch information
JulienCochuyt and seanbudd authored Apr 29, 2021
1 parent badd390 commit f84a7d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 4 additions & 3 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2020 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Thomas Stivers, Babbage B.V.
# Copyright (C) 2006-2021 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Mesar Hameed, Joseph Lee,
# Thomas Stivers, Babbage B.V., Accessolutions, Julien Cochuyt
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

Expand Down Expand Up @@ -439,7 +439,8 @@ def __init__(self, frame):
item = menu_tools.Append(wx.ID_ANY, _("View log"))
self.Bind(wx.EVT_MENU, frame.onViewLogCommand, item)
# Translators: The label for the menu item to toggle Speech Viewer.
item=self.menu_tools_toggleSpeechViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Speech viewer"))
item = self.menu_tools_toggleSpeechViewer = menu_tools.AppendCheckItem(wx.ID_ANY, _("Speech viewer"))
item.Check(speechViewer.isActive)
self.Bind(wx.EVT_MENU, frame.onToggleSpeechViewerCommand, item)

self.menu_tools_toggleBrailleViewer: wx.MenuItem = menu_tools.AppendCheckItem(
Expand Down
11 changes: 4 additions & 7 deletions source/speechViewer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2020 NV Access Limited, Thomas Stivers
# Copyright (C) 2006-2021 NV Access Limited, Thomas Stivers, Accessolutions, Julien Cochuyt
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

Expand Down Expand Up @@ -38,7 +38,7 @@ def __init__(self, onDestroyCallBack):
title=_("NVDA Speech Viewer"),
size=dialogSize,
pos=dialogPos,
style=wx.CAPTION | wx.RESIZE_BORDER | wx.STAY_ON_TOP
style=wx.CAPTION | wx.CLOSE_BOX | wx.RESIZE_BORDER | wx.STAY_ON_TOP
)
self._isDestroyed = False
self.onDestroyCallBack = onDestroyCallBack
Expand Down Expand Up @@ -97,10 +97,8 @@ def _onDialogActivated(self, evt):
self.shouldShowOnStartupCheckBox.SetFocus()

def onClose(self, evt):
if not evt.CanVeto():
deactivate()
return
evt.Veto()
assert isActive, "Cannot close Speech Viewer as it is already inactive"
deactivate()

def onShouldShowOnStartupChanged(self, evt):
config.conf["speechViewer"]["showSpeechViewerAtStartup"] = self.shouldShowOnStartupCheckBox.IsChecked()
Expand Down Expand Up @@ -185,4 +183,3 @@ def deactivate():
# #7077: If the window is destroyed, text control will be gone, so save speech viewer position before destroying the window.
_guiFrame.savePositionInformation()
_guiFrame.Destroy()
isActive = False
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ What's New in NVDA
- New braille tables: Belarusian literary braille, Belarusian computer braille, Urdu grade 1, Urdu grade 2.
- Support for Adobe Flash content has been removed from NVDA due to the use of Flash being actively discouraged by Adobe. (#11131)
- NVDA will exit even with windows still open, the exit process now closes all NVDA windows and dialogs (#1740)
- The Speech Viewer can now be closed with `alt+F4` and has a standard close button for easier interaction with users of pointing devices. (#12330)


== Bug Fixes ==
Expand Down

0 comments on commit f84a7d9

Please sign in to comment.