[nvda-translations] Re: wxpython localization

  • From: Mesar Hameed <mesar.hameed@xxxxxxxxx>
  • To: nvda-translations@xxxxxxxxxxxxx
  • Date: Tue, 20 Sep 2011 11:17:43 +0100

wxpython 2.8 files added.

Please be extra careful, there are many messages with c or python 
formatting instructions.

If you use poedit, you might find the attached nvda app module helpful, 
paste it in explore my nvda settings -> appmodules 
I have submitted it to nvda for review as ticket 
http://nvda-project.org/ticket/1811

two new shortcuts, control+shift+a, control+shift+c

Thank you all!

Mesar

On Tue 20/09/11,11:24, killer-of-god wrote:
> Ok, if polish and some others translations are incomplete and fixing
> it may also be a good work for NVDA, and other projects, I thing we
> have a strong reason to do it.

#appModules/poedit.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2011 Mesar Hameed <mhameed@xxxxxxxxxxxxx>, NVDA contributers
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

import api
import appModuleHandler
import controlTypes
import ui


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<steps and p.next: 
                        p = p.next
                        i += 1
                # the path requests us to look for further siblings, but none 
found.
                if i<steps: return None
        # the path requests us to look for further children, but none found.
        if len(path): return None
        return p


class AppModule(appModuleHandler.AppModule):

        def script_reportAutoCommentsWindow(self,gesture):
                obj = fetchObject(api.getForegroundObject(), [2, 0, 1, 0, 1, 0, 
0, 0])

                # check the controlid, because in certain situations 
                # autoComments and comment windows change places.
                if obj and obj.windowControlID == 102:
                        try:
                                ui.message(obj.name + " " + obj.value)
                        except:
                                ui.message("No automatic comment.")
                else:
                        ui.message("Could not find automatic comments window.")
        script_reportAutoCommentsWindow.__doc__ = "Reports the content of the 
automatic comments window."

        def script_reportCommentsWindow(self,gesture):
                obj = fetchObject(api.getForegroundObject(), [2, 0, 1, 0, 1, 0, 
1, 0])

                # if it isnt in the normal location, try to find it in the
                # location of the automatic window.
                if not obj: 
                        obj = fetchObject(api.getForegroundObject(), [2, 0, 1, 
0, 1, 0, 0, 0])

                if obj and obj.windowControlID == 105:
                        try:
                                ui.message(obj.name + " " + obj.value)
                        except:
                                ui.message("No comment.")
                else:
                        ui.message("Could not find comment window.")
        script_reportCommentsWindow.__doc__ = "Reports the content of the 
comments window."

        __gestures = {
                "kb:control+shift+c": "reportCommentsWindow",
                "kb:control+shift+a": "reportAutoCommentsWindow",
        }

        def chooseNVDAObjectOverlayClasses(self, obj, clsList):
                if obj.role == controlTypes.ROLE_EDITABLETEXT:
                        if obj.windowControlID == 102:
                                obj.name =  "automatic comments:"
                        if obj.windowControlID == 104:
                                obj.name = "translation:"
                        if obj.windowControlID == 105:
                                obj.name = "comments:"

Other related posts: