Skip to content

Commit

Permalink
Address review actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofdusk committed Jun 3, 2019
1 parent 0cf311e commit 79c2458
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
16 changes: 6 additions & 10 deletions source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import os
import re
import itertools
import importlib
from comInterfaces.tom import ITextDocument
import tones
import languageHandler
Expand Down Expand Up @@ -439,8 +438,7 @@ def findOverlayClasses(self,clsList):
if classString and classString.find('.')>0:
modString,classString=os.path.splitext(classString)
classString=classString[1:]
# #8712: Python 3 wants a dot (.) when loading a module from the same folder via relative imports, and this is done via package argument.
mod=importlib.import_module("NVDAObjects.IAccessible.%s"%modString, package="NVDAObjects.IAccessible")
mod=__import__(modString,globals(),locals(),[])
newCls=getattr(mod,classString)
elif classString:
newCls=globals()[classString]
Expand All @@ -451,21 +449,21 @@ def findOverlayClasses(self,clsList):
if windowClassName=="Frame Notification Bar" and role==oleacc.ROLE_SYSTEM_CLIENT:
clsList.append(IEFrameNotificationBar)
elif self.event_objectID==winUser.OBJID_CLIENT and self.event_childID==0 and windowClassName=="_WwG":
from .winword import WordDocument
from winword import WordDocument
clsList.append(WordDocument)
elif self.event_objectID==winUser.OBJID_CLIENT and self.event_childID==0 and windowClassName in ("_WwN","_WwO"):
if self.windowControlID==18:
from .winword import SpellCheckErrorField
from winword import SpellCheckErrorField
clsList.append(SpellCheckErrorField)
else:
from .winword import WordDocument_WwN
from winword import WordDocument_WwN
clsList.append(WordDocument_WwN)
elif windowClassName=="DirectUIHWND" and role==oleacc.ROLE_SYSTEM_TOOLBAR:
parentWindow=winUser.getAncestor(self.windowHandle,winUser.GA_PARENT)
if parentWindow and winUser.getClassName(parentWindow)=="Frame Notification Bar":
clsList.append(IENotificationBar)
if windowClassName.lower().startswith('mscandui'):
from . import mscandui
import mscandui
mscandui.findExtraOverlayClasses(self,clsList)
elif windowClassName=="GeckoPluginWindow" and self.event_objectID==0 and self.IAccessibleChildID==0:
from mozilla import GeckoPluginWindowRoot
Expand Down Expand Up @@ -528,9 +526,6 @@ def findOverlayClasses(self,clsList):
elif windowClassName.startswith("Chrome_"):
from . import chromium
chromium.findExtraOverlayClasses(self, clsList)
elif windowClassName == "ConsoleWindowClass":
from .winConsoleLegacy import winConsoleLegacy
clsList.append(winConsoleLegacy)


#Support for Windowless richEdit
Expand Down Expand Up @@ -2012,4 +2007,5 @@ def event_alert(self):
("NUIDialog",oleacc.ROLE_SYSTEM_CLIENT):"NUIDialogClient",
("_WwB",oleacc.ROLE_SYSTEM_CLIENT):"winword.ProtectedDocumentPane",
("MsoCommandBar",oleacc.ROLE_SYSTEM_LISTITEM):"msOffice.CommandBarListItem",
("ConsoleWindowClass",oleacc.ROLE_SYSTEM_CLIENT):"winConsoleLegacy.WinConsoleLegacy",
}
14 changes: 7 additions & 7 deletions source/NVDAObjects/IAccessible/winConsoleLegacy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#NVDAObjects/IAccessible/winConsoleLegacy.py
#NVDAObjects/IAccessible/WinConsoleLegacy.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
Expand All @@ -10,14 +10,14 @@
import api
import core

class winConsoleLegacy(Terminal, EditableTextWithoutAutoSelectDetection, IAccessible):
class WinConsoleLegacy(Terminal, EditableTextWithoutAutoSelectDetection, IAccessible):
STABILIZE_DELAY = 0.03

def _get_TextInfo(self):
consoleObject=winConsoleHandler.consoleObject
if consoleObject and self.windowHandle == consoleObject.windowHandle:
return winConsoleHandler.legacyConsoleTextInfo
return super(winConsoleLegacy,self).TextInfo
return super(WinConsoleLegacy,self).TextInfo

def event_becomeNavigatorObject(self, isFocus=False):
if winConsoleHandler.consoleObject is not self:
Expand All @@ -28,17 +28,17 @@ def event_becomeNavigatorObject(self, isFocus=False):
# The user is returning to the focus object with object navigation.
# The focused console should always be monitored if possible.
self.startMonitoring()
super(winConsoleLegacy,self).event_becomeNavigatorObject(isFocus=isFocus)
super(WinConsoleLegacy,self).event_becomeNavigatorObject(isFocus=isFocus)

def event_gainFocus(self):
if winConsoleHandler.consoleObject is not self:
if winConsoleHandler.consoleObject:
winConsoleHandler.disconnectConsole()
winConsoleHandler.connectConsole(self)
super(winConsoleLegacy, self).event_gainFocus()
super(WinConsoleLegacy, self).event_gainFocus()

def event_loseFocus(self):
super(winConsoleLegacy, self).event_loseFocus()
super(WinConsoleLegacy, self).event_loseFocus()
if winConsoleHandler.consoleObject is self:
winConsoleHandler.disconnectConsole()

Expand All @@ -49,7 +49,7 @@ def _getTextLines(self):
return winConsoleHandler.getConsoleVisibleLines()

def script_caret_backspaceCharacter(self, gesture):
super(winConsoleLegacy, self).script_caret_backspaceCharacter(gesture)
super(WinConsoleLegacy, self).script_caret_backspaceCharacter(gesture)
# #2586: We use console update events for typed characters,
# so the typedCharacter event is never fired for the backspace key.
# Call it here so that speak typed words works as expected.
Expand Down
6 changes: 3 additions & 3 deletions source/NVDAObjects/window/winConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright (C) 2019 Bill Dengler

import warnings
from ..IAccessible.winConsoleLegacy import winConsoleLegacy as WinConsole
from ..IAccessible.winConsoleLegacy import WinConsoleLegacy as WinConsole

warnings.warn("NVDAObjects.window.winConsole is deprecated. Use NVDAObjects.IAccessible.winConsoleLegacy or NVDAObjects.UIA.winConsoleUIA instead",
DeprecationWarning, stacklevel=3)
warnings.warn("NVDAObjects.window.winConsole is deprecated. Use NVDAObjects.IAccessible.WinConsoleLegacy or NVDAObjects.UIA.winConsoleUIA instead",
DeprecationWarning, stacklevel=3)

0 comments on commit 79c2458

Please sign in to comment.