nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
Other
2.08k stars 625 forks source link

GUI: A base dialog for general-purpose dialogs with multiple settings #4620

Open nvaccessAuto opened 9 years ago

nvaccessAuto commented 9 years ago

Reported by nvdakor on 2014-11-12 17:50 Hi, Recent NVDA code added several general-purpose dialogs such as the new exit dialog and update check dialog. As opposed to specialized dialogs such as find dialog in browse mode, these dialogs have a common weakness: multiple instance possibility, mitigated with use the weakrefs and an instance variable. Another weakness is the problem of window placement: manual intervention is needed to center them and to provide needed sizers. To provide a common base case where NvDA core or add-ons may display general-purpose dialogs that are not settings dialogs, I propose a new base dialog class in GUI subsystem as follows:

class ExitDialog(gui.Dialog):
""" code """

All that'll be added will be the new options for exiting. The dialogs to be modified include exit dialog, donations, update check and alerts, cursor manager's find dialog, welcome dialog, installer and possibly others. I excluded app module and object specific dialogs such as comments dialog in Excel, as they need to be placed near the cell where the comments will appear. In the end, Settings Dialogs will also be rewritten to inherit from the new base dialog if the devs elect to do so.

nvaccessAuto commented 9 years ago

Comment 1 by jteh on 2014-11-12 22:13 The problem with this is that aside from centering and multiple instance prevention, most code isn't common to all dialogs that aren't settings dialogs. For example, the update check dialogs don't have OK and Cancel buttons. Some dialogs need to show themselves in their constructors and others don't, which is a problem for centering in a base class. Some dialogs don't even need multiple instance prevention because they will never be launched twice; e.g. the update installation dialog. The point is that if we give it a generic name like Dialog, it will seem as if authors have to use it for all non-settings dialogs, but this isn't true in reality.

In short, I agree we need a common base class for preventing multiple instances, but I don't think we can abstract the rest.

feerrenrut commented 6 years ago

A common base class could perhaps override the Show and ShowModal methods in order to ensure that prePopup / postPopup happen, see comment on "Introduce the ability to postpone a downloaded update" #6355

As discussed in the linked comment, it's not certain that newer operating systems or versions of wx require this. Linking / suggesting for completeness sake.

josephsl commented 2 months ago

Hi,

2024 update: I think there is an issue in 2025.1 milestone to do something about dialogs. We could combine this issue with that one or leave the issues separate.

Thanks.