Skip to content

Commit

Permalink
Code restructuring.
Browse files Browse the repository at this point in the history
Restructure global plugin portion to follow a more logical order (imports, Core workarounds, UIA constants, UIA objects and the class itself).
Tweaks to app module texts. In particular, removed commented out code path in Calculator UWP.
  • Loading branch information
josephsl committed Oct 9, 2016
1 parent c3227d4 commit 9d74f30
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19 deletions.
5 changes: 1 addition & 4 deletions addon/appModules/calculator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WinTenApps/calculator.py
# Part of Windows 10 App Essentials collection
# Copyright 2015 Joseph Lee, released under GPL.
# Copyright 2015-2016 Joseph Lee, released under GPL.

# Provides enhanced support for modern Calculator, including announcing results.

Expand All @@ -19,9 +19,6 @@ def event_nameChange(self):
return
else:
self.appModule.enterPressed = False
# Handle Redstone weirdness where pressing ENTER does not set focus to equals button.
#if winVersion.winVersion[2] > 10586:
#queueHandler.queueFunction(queueHandler.eventQueue, self.reportFocus)


class AppModule(appModuleHandler.AppModule):
Expand Down
1 change: 0 additions & 1 deletion addon/appModules/microsoftedge.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ def event_nameChange(self, obj, nextHandler):
if obj.role == controlTypes.ROLE_STATICTEXT and obj.parent.UIAElement.cachedClassName == "NotificationBar":
ui.message(obj.name)
nextHandler()

2 changes: 1 addition & 1 deletion addon/appModules/searchui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def event_nameChange(self, obj, nextHandler):
element = obj.UIAElement
# There are two Cortana response lines. Usually line 2 is more reliable.
# However, Redstone seems to favor line 1 better.
# A specific automation ID is seen for reminders and others.
# A specific automation ID is used for reminders and others.
if element.cachedAutomationID in ("SpeechContentLabel", "WeSaidTextBlock", self.greetingLine):
ui.message(obj.name)
self.CortanaResponseCache = obj.name
Expand Down
1 change: 0 additions & 1 deletion addon/appModules/shellexperiencehost.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#Copyright (C) 2015 NV Access Limited
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

# Borrowed directly from NVDA Core (2016 Joseph Lee)

import appModuleHandler
Expand Down
2 changes: 1 addition & 1 deletion addon/appModules/teamviewertouch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# WinTenApps/teamviewertouch.py
# Part of Windows 10 Apps Essentials collection
# Part of Windows 10 App Essentials collection
# Copyright 2015 Joseph Lee, released under GPL.

# TeamViewer Touch allows tablets to connect to remote computers.
Expand Down
1 change: 1 addition & 0 deletions addon/appModules/winstore_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
class AppModule(appModuleHandler.AppModule):

def event_NVDAObject_init(self, obj):
# Extraneous information announced when going through apps to be updated/installed, so use a grandchild's name.
if isinstance(obj, UIA) and obj.role == controlTypes.ROLE_LISTITEM and obj.firstChild and obj.firstChild.UIAElement.cachedAutomationID == "InstallControl":
obj.name = obj.firstChild.firstChild.name
23 changes: 12 additions & 11 deletions addon/globalPlugins/wintenObjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ def getAppModuleFromProcessID(processID):
appModuleHandler.runningTable[processID]=mod
return mod

# Extra UIA constants
UIA_LiveRegionChangedEventId = 20024 # Coerce this to name change event for now.
UIA_ControllerForPropertyId = 30104 # Auto-suggestions.

# UIA COM constants
TreeScope_Subtree = 7

# We know the following elements are dialogs.
wintenDialogs=("Shell_Dialog", "Popup", "Shell_Flyout")

# Looping selectors are used in apps such as Alarms and Clock and Windows Update to select time values.
class LoopingSelectorItem(UIA):

Expand All @@ -44,16 +54,6 @@ def event_UIA_elementSelected(self):
api.setNavigatorObject(self)
self.reportFocus()

# We know the following elements are dialogs.
wintenDialogs=("Shell_Dialog", "Popup", "Shell_Flyout")

# Extra UIA constants
UIA_LiveRegionChangedEventId = 20024 # Coerce this to name change event for now.
UIA_ControllerForPropertyId = 30104 # Auto-suggestions.

# UIA COM constants
TreeScope_Subtree = 7

# Search fields.
# Some of them raise controller for event, an event fired if another UI element depends on this control.
class SearchField(UIA):
Expand Down Expand Up @@ -97,6 +97,7 @@ class MenuItemNoPosInfo(UIA):
def _get_positionInfo(self):
return {}


class GlobalPlugin(globalPluginHandler.GlobalPlugin):

def __init__(self):
Expand All @@ -107,7 +108,7 @@ def __init__(self):
import versionInfo
if not hasattr(versionInfo, "version_build"):
appModuleHandler.getAppModuleFromProcessID = getAppModuleFromProcessID
# Listen for additional events (to be removed once NVDA Core itself supports them.
# Listen for additional events (to be removed once NVDA Core supports them.
if UIA_ControllerForPropertyId not in UIAHandler.UIAPropertyIdsToNVDAEventNames:
UIAHandler.UIAPropertyIdsToNVDAEventNames[UIA_ControllerForPropertyId] = "UIA_controllerFor"
UIAHandler.handler.clientObject.AddPropertyChangedEventHandler(UIAHandler.handler.rootElement,TreeScope_Subtree,UIAHandler.handler.baseCacheRequest,UIAHandler.handler,[UIA_ControllerForPropertyId])
Expand Down

0 comments on commit 9d74f30

Please sign in to comment.