Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions source/NVDAObjects/IAccessible/ia2TextMozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from NVDAObjects import NVDAObject, NVDAObjectTextInfo
from . import IA2TextTextInfo, IAccessible
from compoundDocuments import CompoundTextInfo
from locationHelper import RectLTWH
import locationHelper

class FakeEmbeddingTextInfo(textInfos.offsets.OffsetsTextInfo):

Expand Down Expand Up @@ -111,7 +111,7 @@ def __init__(self, obj, position):
self._startObj = self._endObj = tempObj
else:
self._start, self._startObj, self._end, self._endObj = self._findUnitEndpoints(tempTi, position)
elif isinstance(position, textInfos.Point):
elif isinstance(position, locationHelper.Point):
startObj = api.getDesktopObject().objectFromPoint(position.x, position.y)
while startObj and startObj.role == controlTypes.ROLE_STATICTEXT:
# Skip text leaf nodes.
Expand Down
11 changes: 5 additions & 6 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from NVDAObjects import NVDAObjectTextInfo, InvalidNVDAObject
from NVDAObjects.behaviors import ProgressBar, EditableTextWithoutAutoSelectDetection, Dialog, Notification, EditableTextWithSuggestions
import braille
from locationHelper import RectLTWH
import locationHelper
import ui

class UIATextInfo(textInfos.TextInfo):
Expand Down Expand Up @@ -308,10 +308,9 @@ def __init__(self,obj,position,_rangeObj=None):
raise LookupError
# sometimes rangeFromChild can return a NULL range
if not self._rangeObj: raise LookupError
elif isinstance(position,textInfos.Point):
elif isinstance(position,locationHelper.Point):
#rangeFromPoint used to cause a freeze in UIA client library!
p=POINT(position.x,position.y)
self._rangeObj=self.obj.UIATextPattern.RangeFromPoint(p)
self._rangeObj=self.obj.UIATextPattern.RangeFromPoint(position.toPOINT())
elif isinstance(position,UIAHandler.IUIAutomationTextRange):
self._rangeObj=position.clone()
else:
Expand Down Expand Up @@ -658,7 +657,7 @@ def _getBoundingRectsFromUIARange(self,range):
if not rectArray:
return rects
rectIndexes = xrange(0, len(rectArray), 4)
rectGen = (RectLTWH.fromFloatCollection(*rectArray[i:i+4]) for i in rectIndexes)
rectGen = (locationHelper.RectLTWH.fromFloatCollection(*rectArray[i:i+4]) for i in rectIndexes)
rects.extend(rectGen)
return rects

Expand Down Expand Up @@ -1353,7 +1352,7 @@ def _get_location(self):
if r is None:
return
# r is a tuple of floats representing left, top, width and height.
return RectLTWH.fromFloatCollection(*r)
return locationHelper.RectLTWH.fromFloatCollection(*r)

def _get_value(self):
val=self._getUIACacheablePropertyValue(UIAHandler.UIA_RangeValueValuePropertyId,True)
Expand Down
3 changes: 2 additions & 1 deletion source/NVDAObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import braille
import globalPluginHandler
import brailleInput
import locationHelper

class NVDAObjectTextInfo(textInfos.offsets.OffsetsTextInfo):
"""A default TextInfo which is used to enable text review of information about widgets that don't support text content.
Expand Down Expand Up @@ -989,7 +990,7 @@ def event_mouseMove(self,x,y):
speechWasCanceled=False
self._mouseEntered=True
try:
info=self.makeTextInfo(textInfos.Point(x,y))
info=self.makeTextInfo(locationHelper.Point(x,y))
except NotImplementedError:
info=NVDAObjectTextInfo(self,textInfos.POSITION_FIRST)
except LookupError:
Expand Down
17 changes: 8 additions & 9 deletions source/NVDAObjects/window/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from ..behaviors import EditableTextWithAutoSelectDetection
import braille
import watchdog
import locationHelper

selOffsetsAtLastCaretEvent=None

Expand Down Expand Up @@ -170,19 +171,18 @@ def _getPointFromOffset(self,offset):
winKernel.readProcessMemory(processHandle,internalP,ctypes.byref(p),ctypes.sizeof(p),None)
finally:
winKernel.virtualFreeEx(processHandle,internalP,0,winKernel.MEM_RELEASE)
point=textInfos.Point(p.x,p.y)
point=locationHelper.Point(p.x,p.y)
else:
res=watchdog.cancellableSendMessage(self.obj.windowHandle,winUser.EM_POSFROMCHAR,offset,None)
point=textInfos.Point(winUser.GET_X_LPARAM(res),winUser.GET_Y_LPARAM(res))
point=locationHelper.Point(winUser.GET_X_LPARAM(res),winUser.GET_Y_LPARAM(res))
# A returned coordinate can be a negative value if
# the specified character is not displayed in the edit control's client area.
# If the specified index is greater than the index of the last character in the control,
# the control returns -1.
if point.x <0 or point.y <0:
raise LookupError("Point with client coordinates x=%d, y=%d not within client area of object" %
(point.x, point.y))
point.x, point.y = winUser.ClientToScreen(self.obj.windowHandle, point.x, point.y)
return point
return point.toScreen(self.obj.windowHandle)


def _getOffsetFromPoint(self,x,y):
Expand Down Expand Up @@ -447,8 +447,7 @@ def _getParagraphOffsets(self,offset):
class ITextDocumentTextInfo(textInfos.TextInfo):

def _get_pointAtStart(self):
p=textInfos.Point(0,0)
(p.x,p.y)=self._rangeObj.GetPoint(comInterfaces.tom.tomStart)
p=locationHelper.Point(*self._rangeObj.GetPoint(comInterfaces.tom.tomStart))
if p.x and p.y:
return p
else:
Expand Down Expand Up @@ -570,7 +569,7 @@ def _getEmbeddedObjectLabel(self,embedRangeObj):
r.collapse(1)
left,top=r.GetPoint(comInterfaces.tom.tomStart)
import displayModel
label=displayModel.DisplayModelTextInfo(self.obj, textInfos.Rect(left, top, right, bottom)).text
label=displayModel.DisplayModelTextInfo(self.obj, locationHelper.RectLTRB(left, top, right, bottom)).text
if label and not label.isspace():
return label
# Windows Live Mail exposes the label via the embedded object's data (IDataObject)
Expand Down Expand Up @@ -625,8 +624,8 @@ def __init__(self,obj,position,_rangeObj=None):
if _rangeObj:
self._rangeObj=_rangeObj.Duplicate
return
if isinstance(position,textInfos.Point):
self._rangeObj=self.obj.ITextDocumentObject.rangeFromPoint(position.x,position.y)
if isinstance(position,locationHelper.Point):
self._rangeObj=self.obj.ITextDocumentObject.rangeFromPoint(*position)
elif position==textInfos.POSITION_ALL:
self._rangeObj=self.obj.ITextDocumentObject.range(0,0)
self._rangeObj.expand(comInterfaces.tom.tomStory)
Expand Down
6 changes: 3 additions & 3 deletions source/NVDAObjects/window/scintilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import locale
import watchdog
import eventHandler
import locationHelper

# Window messages
SCI_POSITIONFROMPOINT=2022
Expand Down Expand Up @@ -72,11 +73,10 @@ def _getOffsetFromPoint(self,x,y):
return watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POSITIONFROMPOINT,x,y)

def _getPointFromOffset(self,offset):
x, y = winUser.ClientToScreen(self.obj.windowHandle,
point=locationHelper.Point(
watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POINTXFROMPOSITION,None,offset),
watchdog.cancellableSendMessage(self.obj.windowHandle,SCI_POINTYFROMPOSITION,None,offset)
)
point=textInfos.Point(x, y)
).toScreen(self.obj.windowHandle)
if point.x is not None and point.y is not None:
return point
else:
Expand Down
6 changes: 3 additions & 3 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from . import Window
from ..behaviors import EditableTextWithoutAutoSelectDetection
from . import _msOfficeChart
from textInfos import Point
import locationHelper

#Word constants

Expand Down Expand Up @@ -661,7 +661,7 @@ def __init__(self,obj,position,_rangeObj=None):
if _rangeObj:
self._rangeObj=_rangeObj.Duplicate
return
if isinstance(position,textInfos.Point):
if isinstance(position, locationHelper.Point):
try:
self._rangeObj=self.obj.WinwordDocumentObject.activeWindow.RangeFromPoint(position.x,position.y)
except COMError:
Expand Down Expand Up @@ -1018,7 +1018,7 @@ def _get_pointAtStart(self):
raise LookupError
if not any((left.value, top.value, width.value, height.value)):
raise LookupError
return Point(left.value, top.value)
return locationHelper.Point(left.value, top.value)

def updateCaret(self):
self.obj.WinwordWindowObject.ScrollIntoView(self._rangeObj)
Expand Down
23 changes: 2 additions & 21 deletions source/appModules/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ def _get_shouldAllowIAccessibleFocusEvent(self):
return True
return False


class ClassicStartMenu(Window):
# Override the name, as Windows names this the "Application" menu contrary to all documentation.
# Translators: The title of Start menu/screen in your language (only the word start).
name = _("Start")

def event_gainFocus(self):
# In Windows XP, the Start button will get focus first, so silence this.
speech.cancelSpeech()
super(ClassicStartMenu, self).event_gainFocus()


class NotificationArea(IAccessible):
"""The Windows notification area, a.k.a. system tray.
"""
Expand Down Expand Up @@ -199,14 +187,7 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
return # Optimization: return early to avoid comparing class names and roles that will never match.

if windowClass == "ToolbarWindow32":
if role == controlTypes.ROLE_POPUPMENU:
parent = obj.parent
if parent and parent.windowClassName == "SysPager" and obj.windowStyle & 0x80:
clsList.insert(0, ClassicStartMenu)
else:
# Check whether this is the notification area, a.k.a. system tray.
if isinstance(obj.parent, ClassicStartMenu):
return # This can't be a notification area
if role != controlTypes.ROLE_POPUPMENU:
try:
# The toolbar's immediate parent is its window object, so we need to go one further.
toolbarParent = obj.parent.parent
Expand Down Expand Up @@ -280,7 +261,7 @@ def event_NVDAObject_init(self, obj):
return

if windowClass == "DV2ControlHost" and role == controlTypes.ROLE_PANE:
# Windows Vista/7 start menu.
# Windows 7 start menu.
obj.presentationType=obj.presType_content
obj.isPresentableFocusAncestor = True
# In Windows 7, the description of this pane is extremely verbose help text, so nuke it.
Expand Down
7 changes: 0 additions & 7 deletions source/appModules/klangoplayer.py

This file was deleted.

70 changes: 6 additions & 64 deletions source/appModules/outlook.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
return
if (windowClassName=="SUPERGRID" and controlID==4704) or (windowClassName=="rctrl_renwnd32" and controlID==109):
outlookVersion=self.outlookVersion
if outlookVersion and outlookVersion<=9:
clsList.insert(0, MessageList_pre2003)
elif obj.event_objectID==winUser.OBJID_CLIENT and obj.event_childID==0:
if (
outlookVersion
and outlookVersion > 9
and obj.event_objectID==winUser.OBJID_CLIENT
and obj.event_childID==0
):
clsList.insert(0,SuperGridClient2010)
if (windowClassName == "AfxWndW" and controlID==109) or (windowClassName in ("WeekViewWnd","DayViewWnd")):
clsList.insert(0,CalendarView)
Expand Down Expand Up @@ -246,67 +249,6 @@ def event_gainFocus(self):
obj.parent=self.parent
eventHandler.executeEvent("gainFocus",obj)

class MessageList_pre2003(IAccessible):

def _get_name(self):
if hasattr(self,'curMessageItem'):
return self.curMessageItem.msg.parent.name

def _get_role(self):
return controlTypes.ROLE_LIST

def _get_firstChild(self):
return getattr(self,"curMessageItem",None)

def _get_children(self):
child=getattr(self,"curMessageItem",None)
if child:
return [child]
else:
return []

def event_gainFocus(self):
try:
msg=self.nativeOm.ActiveExplorer().selection[0]
except:
msg=None
pass
if msg:
self.curMessageItem=MessageItem(self,msg)
super(MessageList_pre2003,self).event_gainFocus()
if msg:
eventHandler.executeEvent("gainFocus",self.curMessageItem)

def script_moveByMessage(self,gesture):
if hasattr(self,'curMessageItem'):
oldEntryID=self.curMessageItem.msg.entryID
else:
oldEntryID=None
gesture.send()
try:
msg=self.nativeOm.ActiveExplorer().selection[0]
except:
msg=None
pass
if msg:
messageItem=MessageItem(self,msg)
newEntryID=messageItem.msg.entryID
if newEntryID!=oldEntryID:
self.curMessageItem=messageItem
eventHandler.executeEvent("gainFocus",messageItem)

__moveByMessageGestures = (
"kb:downArrow",
"kb:upArrow",
"kb:home",
"kb:end",
"kb:delete",
)

def initOverlayClass(self):
for gesture in self.__moveByMessageGestures:
self.bindGesture(gesture, "moveByMessage")

class MessageItem(Window):

def __init__(self,windowHandle=None,parent=None,msg=None):
Expand Down
Loading