From: Mesar Hameed Date: Fri, 20 Jan 2012 08:42:18 +0000 (+0000) Subject: Added app module for Poedit. X-Git-Tag: jpdev130418~1129 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d944f97934fcb4f1d46df1c5eeafcedf7150a21f;p=nvdajp%2Fnvdajp.git Added app module for Poedit. Fixes #1811. --- diff --git a/source/appModules/poedit.py b/source/appModules/poedit.py new file mode 100644 index 000000000..f217a56a4 --- /dev/null +++ b/source/appModules/poedit.py @@ -0,0 +1,146 @@ +#appModules/poedit.py +#A part of NonVisual Desktop Access (NVDA) +#Copyright (C) 2012 Mesar Hameed +#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 + + +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