[nvda-addons] Re: Developing Addons - The best way to get started?

  • From: "Damien Sykes-Pendleton" <damien@xxxxxxxxxxxxxxxxxxxx>
  • To: <nvda-addons@xxxxxxxxxxxxx>
  • Date: Thu, 14 Apr 2016 22:02:46 +0100

Hi,
Well, NVDA sees the text spanning over what it seems to think are six separate 
objects. If you look at the dialog though, it seems that the information spans 
several lines (I.E. uses \n).
Cheers.
Kind regards,
Damien.


From: driemer.riemer@xxxxxxxxx 
Sent: Thursday, April 14, 2016 9:06 PM
To: nvda-addons@xxxxxxxxxxxxx 
Subject: [nvda-addons] Re: Developing Addons - The best way to get started?

Can you please explain more by what you mean by span multiple lines? I am 
trying to figure out whether simple name changing code or text info code would 
be better. Once I can get a better feel for the way this app is working I might 
be able to explain thought processes I would go through to write an app module 
for this.

Sent from my heavily encrypted iPhone. 
Please disregard errors as this is a smaller device.

On Apr 14, 2016, at 14:00, Damien Sykes-Pendleton <damien@xxxxxxxxxxxxxxxxxxxx> 
wrote:


  Hi,
  They are all at the same level, but they also have the information that is 
read out as well as that that isn’t. All the objects seem to be located in the 
dialog level, including buttons, lists and these six labels that span multiple 
lines, which is why I think NVDA saw it as six separate controls.
  Here’s what I found about the parent object:

  INFO - globalCommands.GlobalCommands.script_navigatorObject_devInfo 
(20:52:00):
  Developer info for navigator object:
  name: u''
  role: ROLE_DIALOG
  states: STATE_FOCUSABLE
  isFocusable: True
  hasFocus: False
  Python object: <NVDAObjects.Dynamic_DialogIAccessibleWindowNVDAObject object 
at 0x04E2F230>
  Python class mro: (<class 
'NVDAObjects.Dynamic_DialogIAccessibleWindowNVDAObject'>, <class 
'NVDAObjects.behaviors.Dialog'>, <class 'NVDAObjects.IAccessible.IAccessible'>, 
<class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 
'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 
'object'>)
  description: u'Spouse\n7th Great-Grandmother\nMarriage 
Date\nChildren\nBirth/*BR Date\nB:\nM:\nD:\n1727 - Childwall, Lancashire, 
England\n5 Jun 1748 - Childwall, Prescot, Lancashire, England (Age 21)\n1796 - 
Prescot, Lancashire, England (Age 69)\nJohn Pendleton'
  location: (2, 77, 796, 459)
  value: None
  appModule: <'appModuleHandler' (appName u'ancquest', process ID 8572) at 
address 4d8a7f0>
  appModule.productName: u'Ancestral Quest 14.0'
  appModule.productVersion: u'14.00.0028.0'
  TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>
  windowHandle: 67886
  windowClassName: u'#32770'
  windowControlID: 59648
  windowStyle: 1342177348
  windowThreadID: 11096
  windowText: u''
  displayText: u'     Family     Pedigree      Name List      Individual      
Timeline  English (Default)John PendletonFatherB:1727 - Childwall, Lancashire, 
EnglandM:5 Jun 1748 - Childwall, Prescot, Lancashire, England (Age 21)D:1796 - 
Prescot, Lancash (Age 69)Root P' (truncated)
  IAccessibleObject: <POINTER(IAccessible) ptr=0xba43fa0 at 4e42ad0>
  IAccessibleChildID: 0
  IAccessible event parameters: windowHandle=67886, objectID=-4, childID=0
  IAccessible accName: u''
  IAccessible accRole: ROLE_SYSTEM_DIALOG
  IAccessible accState: STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048576)
  IAccessible accDescription: None
  IAccessible accValue: None

  Kind regards,
  Damien.


  From: derek riemer 
  Sent: Thursday, April 14, 2016 8:22 PM
  To: nvda-addons@xxxxxxxxxxxxx 
  Subject: [nvda-addons] Re: Developing Addons - The best way to get started?

  Hi,
  Can you pull some add-ons down from the repo (bitbucket.org/nvdaaddonteam)? 
It helps to look at other peoples code. Also, I see there that the window class 
name has no useful info. look at the window control id's,, window handles, and 
other attributes. You might be able to use a nameChange event to find that 
window.
  You should mess around with the name change event.
  When I say looping through the objects, do you see a parent object with 
children and each child has several objects?
  "other kind of separation? For some reason according to object navigation the 
control seems to be separated into six objects."
  how are the objects related to eachother? 



  On 4/14/2016 12:45 PM, Damien Sykes-Pendleton wrote:

    Hi,
    How do I know what is unique about them? There is a lot of info there that 
I wouldn’t even know where to start with.
    Even if I could find what I was looking for, I don’t even know how I would 
access it programatically.
    Kind regards,
    Damien.


    From: driemer.riemer@xxxxxxxxx 
    Sent: Thursday, April 14, 2016 6:56 PM
    To: nvda-addons@xxxxxxxxxxxxx 
    Subject: [nvda-addons] Re: Developing Addons - The best way to get started?

    Is there anything unique about where those objects are? You could probably 
figure out a way to loop through all of those objects in there to announce each 
of the info for all of them. It looks like the info is readily available in the 
name so I name change might do it but I'm not certain 

    Sent from my heavily encrypted iPhone. 
    Please disregard errors as this is a smaller device.

    On Apr 14, 2016, at 06:11, Damien Sykes-Pendleton 
<damien@xxxxxxxxxxxxxxxxxxxx> wrote:


      Hi Derek,
      The log reads as follows:
      INFO - globalCommands.GlobalCommands.script_navigatorObject_devInfo 
(13:00:34):
      Developer info for navigator object:
      name: u'1727 - Childwall, Lancashire, England'
      role: ROLE_WINDOW
      states: STATE_FOCUSABLE
      isFocusable: True
      hasFocus: False
      Python object: <NVDAObjects.IAccessible.WindowRoot object at 0x04C93DD0>
      Python class mro: (<class 'NVDAObjects.IAccessible.WindowRoot'>, <class 
'NVDAObjects.IAccessible.GenericWindow'>, <class 
'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.Window'>, 
<class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 
'baseObject.AutoPropertyObject'>, <type 'object'>)
      description: None
      location: (35, 124, 344, 16)
      value: None
      appModule: <'appModuleHandler' (appName u'ancquest', process ID 6864) at 
address 4adba30>
      appModule.productName: u'Ancestral Quest 14.0'
      appModule.productVersion: u'14.00.0028.0'
      TextInfo: <class 'displayModel.DisplayModelTextInfo'>
      windowHandle: 1574452
      windowClassName: u'Static'
      windowControlID: 289
      windowStyle: 1342177292
      windowThreadID: 9772
      windowText: u'1727 - Childwall, Lancashire, England'
      displayText: u'1727 - Childwall, Lancashire, England'
      IAccessibleObject: <POINTER(IAccessible) ptr=0x8f6ad70 at 4e42b70>
      IAccessibleChildID: 0
      IAccessible event parameters: windowHandle=1574452L, objectID=0, 
childID=0L
      IAccessible accName: u'1727 - Childwall, Lancashire, England'
      IAccessible accRole: ROLE_SYSTEM_WINDOW
      IAccessible accState: STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048576)
      IAccessible accDescription: None
      IAccessible accValue: None

      I notice it is only giving us the birth year. I’m wondering if this is 
because of multiline or some other kind of separation? For some reason 
according to object navigation the control seems to be separated into six 
objects.
      Kind regards,
      Damien.


      From: derek riemer 
      Sent: Thursday, April 14, 2016 12:39 AM
      To: nvda-addons@xxxxxxxxxxxxx 
      Subject: [nvda-addons] Re: Developing Addons - The best way to get 
started?

      My first advice is to try and turn off simple navigation in review 
settings. (I created a configuration profile for this). Now, use object 
navigation to see if you can spot that text. If you can, can you press nvda+f1, 
copy the rest of the log from there to the bottom and paste it here (assuming 
it's not private info in any way)? That is called the developer info. we should 
probably see where that information is, and if it actually changes at all. 
Then, we would either create event_BLABLABLA or something. We might either 
design the add-on with an overlay class, or with an simple events on the global 
plugin, and then speak it.  The idea is to figure out where that text is, and 
then a way in which to figure out if the object the event is fired on is that 
object or if it's another object. also, we need to figure out if the event ever 
gains keyboard focus, as that we can fix by telling NVDA to set focus to it.
      Does any of this not make sense (should I explain any particular concept 
in more detail)?


      On 4/13/2016 4:45 PM, Damien Sykes-Pendleton wrote:

        Hi,
        The program is a family tree builder – so far the only accessible one I 
have found.
        When you select a person in the primary navigation area it shows up 
summary information for them, (date and place of birth, date, place, and age at 
marriage, and date, place and age at death). This read automatically when I 
used to use JAWS, so I’m guessing it’s a simple case of trying to tell NVDA 
where that information is, and/or how to access it so that it too can speak the 
information automatically.
        Kind regards,
        Damien.


        From: derek riemer 
        Sent: Wednesday, April 13, 2016 11:30 PM
        To: nvda-addons@xxxxxxxxxxxxx 
        Subject: [nvda-addons] Re: Developing Addons - The best way to get 
started?

        Can you give an example of what the text you want spoken is and when it 
isn't spoken?


        On 4/13/2016 1:36 PM, Damien Sykes-Pendleton wrote:

          Hi there,
          Not sure if my messages came through yesterday, so sending it again.
          When I began the process of trying to learn addon development, I 
attempted to write an application-based addon that would read textual 
information that was otherwise being overlooked. I may have used another addon 
as a starting point but I had no idea as to what the actual issue was or what 
my particular circumstances were, other than the text was not being read when 
it should be.
          What I vaguely know is that the system creates controls as physical 
graphics with different identifying factors such as locations and what should 
happen if it is activated that make it what it is. I know nothing about how it 
works in depth – I’m not even sure if it is a control object that is at fault, 
since the information is text only.
          I can’t even refer back to my script, my computer crashed since then, 
and as it didn’t work I don’t think that would necessarily help anyway.
          One thing I did manage is to apply the first example app module to 
the application I want to change as opposed to Notepad, I.E. making it beep on 
the gain focus event. Even if I so much as moved the cursor, pressed Tab, went 
into menus etc, it beeped all the time, so not sure if that’s to do with 
keyboard input or whatever. If so then that’s not the issue. Key commands are 
being recognised fine, it’s just what is, or in this case isn’t, being spoken 
by NVDA itself.
          I really would like to tackle this and nip it in the bud. I doubt at 
this moment in time I could work on NVDA itself given my limited knowledge of 
how both the codebase and the project management works, so I guess the least I 
can do is to write addons.
          Thanks.
          Kind regards,
          Damien.


          From: derek riemer 
          Sent: Tuesday, April 12, 2016 5:59 PM
          To: nvda-addons@xxxxxxxxxxxxx 
          Subject: [nvda-addons] Re: Developing Addons - The best way to get 
started?

          Hi,
          It really depends what you intend your add-on to do. Do you think 
some code should execute? Test it by either importing logHandler, and logging 
with one of the methods there, or use tones.beep to beep as the first thing 
that happens in that function. Also, it shouldn't play the error sound unless 
you are running master or next. Look for errors in your log, test your add-on 
with master or next, or go to the NVDA python console and run >>> import 
versionInfo
          >>> versionInfo.isTestVersion = True
          Then the sound should happen. You could write an add-on to set this 
to true at NVDA Startup (Hint) just putting that in a python file in the 
globalPlugins folder should do it. Do not be afraid to ask us questions if you 
have a hypothesis about some control, and a way in which you are trying to make 
it work. I promise you, there are no dumb questions here. If it is a script, be 
sure to bind it to a gesture. If it is one of the meriad of events, then you 
may very well just have to play with trying multiple events until you find the 
right one. That's where making NVDA play different tones for different events 
is super helpful.
          HTH


          On 4/12/2016 10:32 AM, Damien Sykes-Pendleton wrote:

            Hi there,
            OK. So I now have a fair grasp of the Python language. Luckily 
because I’ve tried so many times before and failed it was just a case of 
refreshing my memory as to what different things meant, and reading more 
in-depth those things that I didn’t understand. I think it kind of helped that 
the easy stuff was, well, easy, and the harder stuff I have covered before in 
other languages, but they are termed or written differently. I think one thing 
that confused me a lot when I started out is how all classes inherit from 
object, when an instance of a class is also called an object. Wow...Deep stuff.
            Also, this time, I have seen Python code in action, having 
installed Python itself. It’s odd, but I think that helped me more than I 
realised it would. Reading code and then seeing it work seems to impress things 
more firmly into memory (Human, that is).
            Now that I’ve done that, it seems when I tried this before that the 
thing I was struggling with most were NVDA concepts. There were no errors 
triggered (At least I don’t think), but the addon itself that I created didn’t 
work.
            Is there anything else I need to look at? The development guide has 
become a little easier in some respects but I’m still in the dark about others, 
for instance application controls, accessing them, reading them, event 
triggers, etc.
            Thanks.
            Kind regards,
            Damien.


            From: derek riemer 
            Sent: Friday, April 08, 2016 6:17 PM
            To: nvda-addons@xxxxxxxxxxxxx 
            Subject: [nvda-addons] Re: Developing Addons - The best way to get 
started?

            Hi,
            Please feel free to ask us (especially me) anyy development 
questions you have. I can try to help. Please believe me when I say I know 
where you are coming from, I had to learn all this myself, and it is damn hard. 
Even if you ask "This button is not speaking, How should I try to make it 
speak?" I will try to walk you in the right direction.


            On 4/8/2016 5:56 AM, Damien Sykes-Pendleton wrote:

              Hi James, 
              Again. This proves just how much, or little, knowledge I have on 
this subject. I always assumed that the information that NVDA uses to evaluate 
the functionality or purpose of a control was through the Windows API. When I 
wrote my first addon that didn't involve copying and pasting from an example, 
it was to read content that NVDA didn't recognise on its own for whatever 
reason, that other screen readers did. This didn't work. My theory for this is 
that I was pretty much guessing what I had to do to get it to work, and of 
course that is not the way to understand your own code. It helps to understand 
what your code needs to do, something of which I understood very little, if not 
nothing at all. If you can't understand that, you need to be able to understand 
what you want to do. Although I know what I want to do in terms of 
functionality, translating that into code is very difficult, given that I don't 
know about all the underlying structures such as in-depth control information 
(ID, handle, class etc), NVDA objects, accessibility platforms, the list goes 
on and on. 
              As for learning Python itself, this is not so much the problem as 
remembering every single thing I'm reading. When I look at a Python tutorial, 
I'm thinking, yes this makes sense. Sounds good to me. Oh wow, I've finished 
the tutorial. Let's go back to addons. Oh wait, what did the tutorial say about 
this? I don't remember that part...Look back at the tutorial. Oh, it's not in 
here. This must be an NVDA specific reference. Either that, or, Ah yes, I 
remember this now. Now how was the addon guide referencing this? 
              I'm trying to explain it the best way I can, because there isn't 
one specific example or situation that I can pinpoint without referencing 
something else, it's all linked, hence the massive confusion which, if we're 
talking code, is making my brain go into an infinite loop. 
              Kind regards, 
              Damien. 
              -----Original Message----- From: James Scholes 
              Sent: Friday, April 08, 2016 12:25 PM 
              To: nvda-addons@xxxxxxxxxxxxx 
              Subject: [nvda-addons] Re: Developing Addons - The best way to 
get started? 

              Replies inline. 

              Damien Sykes-Pendleton wrote: 

                Well if we're constraining ourselves to the facts, I can only 
really 
                say what I have said before, in that the developer guide 
assumes a 
                good working knowledge of Python and NVDA's internal workings, 
                neither of which I feel I have enough of to really get going. 


              First, tackle Python.  You need a good, working knowledge of the 
              language to write NVDA add-ons.  This will never change, no 
matter how 
              much documentation is written.  Create some small Python projects 
which 
              make use of object-oriented programming, inheritance, wxPython. 

              It is incredibly important to understand that creating NVDA 
add-ons is 
              not at all like writing JAWS scripts.  With JAWS scripting, the 
language 
              is proprietary and the creators of that language decide in 
advance what 
              functionality you have access to.  NVDA not only gives you the 
full 
              power of the Python language, but also lets you write code which 
runs in 
              the same environment as NVDA's core, meaning that you can 
literally do 
              whatever you like, only constrained by your imagination and 
knowledge. 
              Naturally, this provides a lot of room for error, so NVDA add-on 
writing 
              often comes with a  lot of responsibility.  That is why there is 

              higher barrier to entry.  It's up to you to decide whether that 
barrier 
              is worth scaling or not.  But nobody, on this list or otherwise, 
              will ever be able to create documentation that explains every 
possible 
              aspect of creating NVDA add-ons.  Having said that, the community 
has 
              created some extra documentation, which I will leave it up to 
them to share. 


                I have looked into Python, both on the official language 
tutorial 
                and from Learn Python the Hard Way. Although these are both 
good 
                resources, they are also very extensive to the point that by 
the 
                time I have read them and gone back to the developer guide, I'm 
                trying to conceptualise everything else into Python terms 
rather than 
                NVDA terms 


              I'm not entirely sure what you mean here.  NVDA is Python.  
Granted, to 
              write a good add-on, you have to be aware of some of NVDA's 
internals, 
              but really, you need to give us examples of what you're trying to 
do and 
              why it's posing a problem.  If you have a good understanding of 
Python 
              as I said above, writing NVDA add-on boilerplate will be easy. 


                some of which can be done but easily forgotten, or others which 
can't 
                be done at all. 


              Again, I have no idea what you mean.  What Python features, 
              functionality or concepts are you having difficulty translating 
into 
              valid concepts to be used in an NVDA add-on? 


                Then, as I have also said before, there 
                is the vagueness of references, such as "Refer to the NVDA code 
                documentation". I cannot find this documentation anywhere, even 
in 
                the NVDA source code. 


              If you check out the NVDA source code and read the accompanying 
readme 
              files, you will see instructions on generating the NVDA code 
              documentation.  You can also browse an online copy, although I 
don't 
              think it's updated on a regular basis, at: 
              https://files.derekriemer.com/nvda/module-tree.html ;

              Honestly though, I think most NVDA developers will tell you that 
reading 
              the code itself is usually better than the documentation.  If 
you're 
              hoping that the code documentation will shine a light on 
everything that 
              has hitherto seemed confusing, you'll be seriously disappointed.  
The 
              code documentation is constructed from Python docstrings.  It's a 
terse 
              reference, not a guide. 


                Even so, I doubt I'd be able to glean much 
                from it, since NVDA has a lot of in-depth interaction with the 
                operating system which, when it comes to development, I know 
hardly 
                anything about the workings of. This then also adds the Windows 
API 
                to my reference list, and now I feel like I am on a road of 
                information overload. 


              Any portions of the Windows API that are used by NVDA have 
already been 
              wrapped as simple Python functions for use in higher level 
abstractions. 
              Unless you need to use a part of it that hasn't already been 
defined as 
              such, you don't need to understand the ins and outs of that. 
              Additionally, it's highly unlikely that, for your first add-ons, 
you'll 
              even need to use such functionality.  Rather, you'll interact 
with the 
              abstractions that NVDA provides. 

              To sum up: 
              1. Learn Python.  If you don't know the language, if you can't 
write 
              scripts or small programs in it, you will have a hard time 
writing code 
              for NVDA. 
              2. Get familiar with reading other people's Python code.  You'll 
be 
              doing a lot of that if you want to create high quality add-ons. 
              3. Give us examples of things you're finding hard.  We don't need 
an 
              article, we just need you to explain what you don't understand so 
we can 
              point you in the right direction. 
              4. Don't run before you can walk.  If you're struggling with how 
to 
              create the most basic of add-ons, the Windows API isn't even a 
distant 
              concern. 



            -- 

--------------------------------------------------------------------

            Derek Riemer 
              a.. Department of computer science, third year undergraduate 
student. 
              b.. Proud user of the NVDA screen reader. 
              c.. Open source enthusiast. 
              d.. Member of Bridge Cu 
              e.. Avid skiier. 
            Websites: 
            Honors portfolio 
            Awesome little hand built weather app! 


            mailto:derek.riemer@xxxxxxxxxxxx ;
            Phone: (303) 906-2194 



          -- 

----------------------------------------------------------------------

          Derek Riemer 
            a.. Department of computer science, third year undergraduate 
student. 
            b.. Proud user of the NVDA screen reader. 
            c.. Open source enthusiast. 
            d.. Member of Bridge Cu 
            e.. Avid skiier. 
          Websites: 
          Honors portfolio 
          Awesome little hand built weather app! 


          mailto:derek.riemer@xxxxxxxxxxxx ;
          Phone: (303) 906-2194 



        -- 

------------------------------------------------------------------------

        Derek Riemer 
          a.. Department of computer science, third year undergraduate student. 
          b.. Proud user of the NVDA screen reader. 
          c.. Open source enthusiast. 
          d.. Member of Bridge Cu 
          e.. Avid skiier. 
        Websites: 
        Honors portfolio 
        Awesome little hand built weather app! 


        mailto:derek.riemer@xxxxxxxxxxxx ;
        Phone: (303) 906-2194 



      -- 

--------------------------------------------------------------------------

      Derek Riemer 
        a.. Department of computer science, third year undergraduate student. 
        b.. Proud user of the NVDA screen reader. 
        c.. Open source enthusiast. 
        d.. Member of Bridge Cu 
        e.. Avid skiier. 
      Websites: 
      Honors portfolio 
      Awesome little hand built weather app! 


      mailto:derek.riemer@xxxxxxxxxxxx ;
      Phone: (303) 906-2194 



  -- 

------------------------------------------------------------------------------

  Derek Riemer 
    a.. Department of computer science, third year undergraduate student. 
    b.. Proud user of the NVDA screen reader. 
    c.. Open source enthusiast. 
    d.. Member of Bridge Cu 
    e.. Avid skiier. 
  Websites: 
  Honors portfolio 
  Awesome little hand built weather app! 


  mailto:derek.riemer@xxxxxxxxxxxx ;
  Phone: (303) 906-2194 

Other related posts: