Skip to content

Commit 3aca986

Browse files
authored
Merge a45c2c8 into c6bdc66
2 parents c6bdc66 + a45c2c8 commit 3aca986

1 file changed

Lines changed: 23 additions & 27 deletions

File tree

source/gui/__init__.py

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import core
2525
from typing import (
2626
Optional,
27+
Type,
2728
)
2829
import systemUtils
2930
from .message import (
@@ -169,7 +170,7 @@ def onSaveConfigurationCommand(self,evt):
169170
messageBox(_("Could not save configuration - probably read only file system"),_("Error"),wx.OK | wx.ICON_ERROR)
170171

171172
@blockAction.when(blockAction.Context.MODAL_DIALOG_OPEN)
172-
def _popupSettingsDialog(self, dialog, *args, **kwargs):
173+
def popupSettingsDialog(self, dialog: Type[SettingsDialog], *args, **kwargs):
173174
self.prePopup()
174175
try:
175176
dialog(self, *args, **kwargs).Show()
@@ -184,15 +185,15 @@ def _popupSettingsDialog(self, dialog, *args, **kwargs):
184185

185186
@blockAction.when(blockAction.Context.SECURE_MODE)
186187
def onDefaultDictionaryCommand(self, evt):
187-
self._popupSettingsDialog(DefaultDictionaryDialog)
188+
self.popupSettingsDialog(DefaultDictionaryDialog)
188189

189190
@blockAction.when(blockAction.Context.SECURE_MODE)
190191
def onVoiceDictionaryCommand(self, evt):
191-
self._popupSettingsDialog(VoiceDictionaryDialog)
192+
self.popupSettingsDialog(VoiceDictionaryDialog)
192193

193194
@blockAction.when(blockAction.Context.SECURE_MODE)
194195
def onTemporaryDictionaryCommand(self, evt):
195-
self._popupSettingsDialog(TemporaryDictionaryDialog)
196+
self.popupSettingsDialog(TemporaryDictionaryDialog)
196197

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

234235
def onNVDASettingsCommand(self,evt):
235-
self._popupSettingsDialog(NVDASettingsDialog)
236+
self.popupSettingsDialog(NVDASettingsDialog)
236237

237238
def onGeneralSettingsCommand(self,evt):
238-
self._popupSettingsDialog(NVDASettingsDialog, GeneralSettingsPanel)
239+
self.popupSettingsDialog(NVDASettingsDialog, GeneralSettingsPanel)
239240

240241
def onSelectSynthesizerCommand(self,evt):
241-
self._popupSettingsDialog(SynthesizerSelectionDialog)
242+
self.popupSettingsDialog(SynthesizerSelectionDialog)
242243

243244
def onSpeechSettingsCommand(self,evt):
244-
self._popupSettingsDialog(NVDASettingsDialog, SpeechSettingsPanel)
245+
self.popupSettingsDialog(NVDASettingsDialog, SpeechSettingsPanel)
245246

246247
def onSelectBrailleDisplayCommand(self,evt):
247-
self._popupSettingsDialog(BrailleDisplaySelectionDialog)
248+
self.popupSettingsDialog(BrailleDisplaySelectionDialog)
248249

249250
def onBrailleSettingsCommand(self,evt):
250-
self._popupSettingsDialog(NVDASettingsDialog, BrailleSettingsPanel)
251+
self.popupSettingsDialog(NVDASettingsDialog, BrailleSettingsPanel)
251252

252253
def onKeyboardSettingsCommand(self,evt):
253-
self._popupSettingsDialog(NVDASettingsDialog, KeyboardSettingsPanel)
254+
self.popupSettingsDialog(NVDASettingsDialog, KeyboardSettingsPanel)
254255

255256
def onMouseSettingsCommand(self,evt):
256-
self._popupSettingsDialog(NVDASettingsDialog, MouseSettingsPanel)
257+
self.popupSettingsDialog(NVDASettingsDialog, MouseSettingsPanel)
257258

258259
def onTouchInteractionCommand(self,evt):
259-
self._popupSettingsDialog(NVDASettingsDialog, TouchInteractionPanel)
260+
self.popupSettingsDialog(NVDASettingsDialog, TouchInteractionPanel)
260261

261262
def onReviewCursorCommand(self,evt):
262-
self._popupSettingsDialog(NVDASettingsDialog, ReviewCursorPanel)
263+
self.popupSettingsDialog(NVDASettingsDialog, ReviewCursorPanel)
263264

264265
def onInputCompositionCommand(self,evt):
265-
self._popupSettingsDialog(NVDASettingsDialog, InputCompositionPanel)
266+
self.popupSettingsDialog(NVDASettingsDialog, InputCompositionPanel)
266267

267268
def onObjectPresentationCommand(self,evt):
268-
self._popupSettingsDialog(NVDASettingsDialog, ObjectPresentationPanel)
269+
self.popupSettingsDialog(NVDASettingsDialog, ObjectPresentationPanel)
269270

270271
def onBrowseModeCommand(self,evt):
271-
self._popupSettingsDialog(NVDASettingsDialog, BrowseModePanel)
272+
self.popupSettingsDialog(NVDASettingsDialog, BrowseModePanel)
272273

273274
def onDocumentFormattingCommand(self,evt):
274-
self._popupSettingsDialog(NVDASettingsDialog, DocumentFormattingPanel)
275+
self.popupSettingsDialog(NVDASettingsDialog, DocumentFormattingPanel)
275276

276277
def onUwpOcrCommand(self, evt):
277-
self._popupSettingsDialog(NVDASettingsDialog, UwpOcrPanel)
278+
self.popupSettingsDialog(NVDASettingsDialog, UwpOcrPanel)
278279

279280
@blockAction.when(blockAction.Context.SECURE_MODE)
280281
def onSpeechSymbolsCommand(self, evt):
281-
self._popupSettingsDialog(SpeechSymbolsDialog)
282+
self.popupSettingsDialog(SpeechSymbolsDialog)
282283

283284
@blockAction.when(blockAction.Context.SECURE_MODE)
284285
def onInputGesturesCommand(self, evt):
285-
self._popupSettingsDialog(InputGesturesDialog)
286+
self.popupSettingsDialog(InputGesturesDialog)
286287

287288
def onAboutCommand(self,evt):
288289
# Translators: The title of the dialog to show about info for NVDA.
@@ -338,16 +339,11 @@ def onAddonsManagerCommand(self, evt: wx.MenuEvent):
338339
blockAction.Context.RUNNING_LAUNCHER,
339340
)
340341
def onAddonStoreCommand(self, evt: wx.MenuEvent):
341-
self.prePopup()
342342
from ._addonStoreGui import AddonStoreDialog
343343
from ._addonStoreGui.viewModels.store import AddonStoreVM
344344
_storeVM = AddonStoreVM()
345345
_storeVM.refresh()
346-
try:
347-
AddonStoreDialog(mainFrame, _storeVM).Show()
348-
except SettingsDialog.MultiInstanceErrorWithDialog as errorWithDialog:
349-
errorWithDialog.dialog.SetFocus()
350-
self.postPopup()
346+
self.popupSettingsDialog(AddonStoreDialog, _storeVM)
351347

352348
def onReloadPluginsCommand(self, evt):
353349
import appModuleHandler, globalPluginHandler

0 commit comments

Comments
 (0)