Skip to content

Commit

Permalink
Revert "Make gui.MainFrame.popupSettingsDialog part of the public API (
Browse files Browse the repository at this point in the history
…nvaccess#15121)"

This reverts commit a8b79c7.

The commit text referenced the solution to an unrelated issue.
The lint changes necessary for nvaccess#15121, appear to have broken NVDA's vision settings, OCR, and possibly more.
  • Loading branch information
Luke Davis authored and Luke Davis committed Jul 15, 2023
1 parent a8b79c7 commit 0f2415f
Showing 1 changed file with 34 additions and 46 deletions.
80 changes: 34 additions & 46 deletions source/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import core
from typing import (
Optional,
Type,
)
import systemUtils
from .message import (
Expand All @@ -42,25 +41,9 @@
# Be careful when removing, and only do in a compatibility breaking release.
from .exit import ExitDialog
from .settingsDialogs import (
BrailleDisplaySelectionDialog,
BrailleSettingsPanel,
BrowseModePanel,
DocumentFormattingPanel,
GeneralSettingsPanel,
InputCompositionPanel,
KeyboardSettingsPanel,
MouseSettingsPanel,
MultiCategorySettingsDialog,
NVDASettingsDialog,
ObjectPresentationPanel,
SettingsDialog,
SpeechSettingsPanel,
SpeechSymbolsDialog,
SynthesizerSelectionDialog,
TouchInteractionPanel,
ReviewCursorPanel,
UwpOcrPanel,
)
from .settingsDialogs import *
from .startupDialogs import WelcomeDialog
from .inputGestures import InputGesturesDialog
from . import logViewer
Expand Down Expand Up @@ -186,7 +169,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: Type[SettingsDialog], *args, **kwargs):
def _popupSettingsDialog(self, dialog, *args, **kwargs):
self.prePopup()
try:
dialog(self, *args, **kwargs).Show()
Expand All @@ -201,15 +184,15 @@ def popupSettingsDialog(self, dialog: Type[SettingsDialog], *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 All @@ -218,13 +201,13 @@ def onExecuteUpdateCommand(self, evt):
from addonHandler import getIncompatibleAddons
if any(getIncompatibleAddons(apiVersion, backCompatToAPIVersion)):
confirmUpdateDialog = updateCheck.UpdateAskInstallDialog(
parent=mainFrame,
parent=gui.mainFrame,
destPath=destPath,
version=version,
apiVersion=apiVersion,
backCompatTo=backCompatToAPIVersion
)
runScriptModalDialog(confirmUpdateDialog)
gui.runScriptModalDialog(confirmUpdateDialog)
else:
updateCheck.executePendingUpdate()

Expand All @@ -249,57 +232,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 @@ -355,11 +338,16 @@ 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()
self.popupSettingsDialog(AddonStoreDialog, _storeVM)
try:
AddonStoreDialog(mainFrame, _storeVM).Show()
except SettingsDialog.MultiInstanceErrorWithDialog as errorWithDialog:
errorWithDialog.dialog.SetFocus()
self.postPopup()

def onReloadPluginsCommand(self, evt):
import appModuleHandler, globalPluginHandler
Expand All @@ -374,8 +362,8 @@ def onReloadPluginsCommand(self, evt):
)
def onCreatePortableCopyCommand(self,evt):
self.prePopup()
from . import installerGui
d = installerGui.PortableCreaterDialog(mainFrame)
import gui.installerGui
d=gui.installerGui.PortableCreaterDialog(gui.mainFrame)
d.Show()
self.postPopup()

Expand All @@ -384,7 +372,7 @@ def onCreatePortableCopyCommand(self,evt):
blockAction.Context.MODAL_DIALOG_OPEN,
)
def onInstallCommand(self, evt):
from . import installerGui
from gui import installerGui
installerGui.showInstallGui()

@blockAction.when(
Expand Down Expand Up @@ -426,7 +414,7 @@ def onRunCOMRegistrationFixesCommand(self, evt):
def onConfigProfilesCommand(self, evt):
self.prePopup()
from .configProfiles import ProfilesDialog
ProfilesDialog(mainFrame).Show()
ProfilesDialog(gui.mainFrame).Show()
self.postPopup()


Expand Down

0 comments on commit 0f2415f

Please sign in to comment.