#appModules/poedit.py #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2012-2013 Mesar Hameed, NV Access Limited #This file is covered by the GNU General Public License. #See the file COPYING for more details. """App module for Poedit. """ import api import appModuleHandler import controlTypes import displayModel import textInfos import tones import ui from NVDAObjects.IAccessible import sysListView32 import windowUtils import NVDAObjects.IAccessible import winUser def getPath(obj, ancestor): """Gets the path of the object with respect to its ancestor. the ancestor is typically the forground object. @returns: A list of coordinates relative to the ansestor. @rtype: L{list} """ path = [] cancel = 0 if obj == stopObj: return [] p = obj while p != stopObj: counter = 0 while p.previous: p = p.previous counter += 1 cancel += 1 # Looks like we have an infinite ancestry, so get out if cancel == 50: return [-1] path.append(counter) p = p.parent path.reverse() return path def fetchObject(obj, path): """Fetch the child object described by path. @returns: requested object if found, or None @rtype: L{NVDAObjects.NVDAObject} """ path.reverse() p = obj while len(path) and p.firstChild: p = p.firstChild steps = path.pop() i=0 while i