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

Make gui.MainFrame.popupSettingsDialog part of the public API #15121

Merged
merged 3 commits into from
Jul 14, 2023
Merged
Changes from 2 commits
Commits
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
50 changes: 23 additions & 27 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import core
from typing import (
Optional,
Type,
)
import systemUtils
from .message import (
Expand Down Expand Up @@ -169,7 +170,7 @@ def onSaveConfigurationCommand(self,evt):
messageBox(_("Could not save configuration - probably read only file system"),_("Error"),wx.OK | wx.ICON_ERROR)

@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
def _popupSettingsDialog(self, dialog, *args, **kwargs):
def popupSettingsDialog(self, dialog: Type[SettingsDialog], *args, **kwargs):
self.prePopup()
try:
dialog(self, *args, **kwargs).Show()
Expand All @@ -184,15 +185,15 @@ def _popupSettingsDialog(self, dialog, *args, **kwargs):

@blockAction.when(blockAction.Context.SECURE_MODE)
def onDefaultDictionaryCommand(self, evt):
self._popupSettingsDialog(DefaultDictionaryDialog)
self.popupSettingsDialog(DefaultDictionaryDialog)

@blockAction.when(blockAction.Context.SECURE_MODE)
def onVoiceDictionaryCommand(self, evt):
self._popupSettingsDialog(VoiceDictionaryDialog)
self.popupSettingsDialog(VoiceDictionaryDialog)

@blockAction.when(blockAction.Context.SECURE_MODE)
def onTemporaryDictionaryCommand(self, evt):
self._popupSettingsDialog(TemporaryDictionaryDialog)
self.popupSettingsDialog(TemporaryDictionaryDialog)

@blockAction.when(blockAction.Context.SECURE_MODE)
def onExecuteUpdateCommand(self, evt):
Expand Down Expand Up @@ -232,57 +233,57 @@ def onExitCommand(self, evt):
log.error("NVDA already in process of exiting, this indicates a logic error.")

def onNVDASettingsCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog)
self.popupSettingsDialog(NVDASettingsDialog)

def onGeneralSettingsCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, GeneralSettingsPanel)
self.popupSettingsDialog(NVDASettingsDialog, GeneralSettingsPanel)

def onSelectSynthesizerCommand(self,evt):
self._popupSettingsDialog(SynthesizerSelectionDialog)
self.popupSettingsDialog(SynthesizerSelectionDialog)

def onSpeechSettingsCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, SpeechSettingsPanel)
self.popupSettingsDialog(NVDASettingsDialog, SpeechSettingsPanel)

def onSelectBrailleDisplayCommand(self,evt):
self._popupSettingsDialog(BrailleDisplaySelectionDialog)
self.popupSettingsDialog(BrailleDisplaySelectionDialog)

def onBrailleSettingsCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, BrailleSettingsPanel)
self.popupSettingsDialog(NVDASettingsDialog, BrailleSettingsPanel)

def onKeyboardSettingsCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, KeyboardSettingsPanel)
self.popupSettingsDialog(NVDASettingsDialog, KeyboardSettingsPanel)

def onMouseSettingsCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, MouseSettingsPanel)
self.popupSettingsDialog(NVDASettingsDialog, MouseSettingsPanel)

def onTouchInteractionCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, TouchInteractionPanel)
self.popupSettingsDialog(NVDASettingsDialog, TouchInteractionPanel)

def onReviewCursorCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, ReviewCursorPanel)
self.popupSettingsDialog(NVDASettingsDialog, ReviewCursorPanel)

def onInputCompositionCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, InputCompositionPanel)
self.popupSettingsDialog(NVDASettingsDialog, InputCompositionPanel)

def onObjectPresentationCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, ObjectPresentationPanel)
self.popupSettingsDialog(NVDASettingsDialog, ObjectPresentationPanel)

def onBrowseModeCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, BrowseModePanel)
self.popupSettingsDialog(NVDASettingsDialog, BrowseModePanel)

def onDocumentFormattingCommand(self,evt):
self._popupSettingsDialog(NVDASettingsDialog, DocumentFormattingPanel)
self.popupSettingsDialog(NVDASettingsDialog, DocumentFormattingPanel)

def onUwpOcrCommand(self, evt):
self._popupSettingsDialog(NVDASettingsDialog, UwpOcrPanel)
self.popupSettingsDialog(NVDASettingsDialog, UwpOcrPanel)

@blockAction.when(blockAction.Context.SECURE_MODE)
def onSpeechSymbolsCommand(self, evt):
self._popupSettingsDialog(SpeechSymbolsDialog)
self.popupSettingsDialog(SpeechSymbolsDialog)

@blockAction.when(blockAction.Context.SECURE_MODE)
def onInputGesturesCommand(self, evt):
self._popupSettingsDialog(InputGesturesDialog)
self.popupSettingsDialog(InputGesturesDialog)

def onAboutCommand(self,evt):
# Translators: The title of the dialog to show about info for NVDA.
Expand Down Expand Up @@ -338,16 +339,11 @@ def onAddonsManagerCommand(self, evt: wx.MenuEvent):
blockAction.Context.RUNNING_LAUNCHER,
)
def onAddonStoreCommand(self, evt: wx.MenuEvent):
self.prePopup()
from ._addonStoreGui import AddonStoreDialog
from ._addonStoreGui.viewModels.store import AddonStoreVM
_storeVM = AddonStoreVM()
_storeVM.refresh()
try:
AddonStoreDialog(mainFrame, _storeVM).Show()
except SettingsDialog.MultiInstanceErrorWithDialog as errorWithDialog:
errorWithDialog.dialog.SetFocus()
self.postPopup()
self.popupSettingsDialog(AddonStoreDialog, _storeVM)

def onReloadPluginsCommand(self, evt):
import appModuleHandler, globalPluginHandler
Expand Down