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

  • From: James Scholes <james@xxxxxxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Fri, 15 Apr 2016 14:41:05 +0100

Damien Sykes-Pendleton wrote:

This is seeming to be a much more complicated job than I originally
thought - I've still no idea how to access various objects in code, let
alone try and apply logic about object positioning, ordering and/or
hierarchies.

Then you need to write some code and use the NVDA Python console to
figure out how it all fits together.  If there is something specific
that you don't understand, tell us so we can give you some pointers.
For instance:

- When you say "accessing various objects in code," which objects do you
mean?
- Do you understand how event handlers work, and the fact that they
receive the object on which the event was fired as an argument?  In
other words, do you understand that, from within an event handler
function, you can find other objects using the object delivered to your
function as a starting point?
- Do you understand what methods and attributes objects have to help you
find other objects around them, e.g. simpleNext, simplePrevious,
children, etc?
- Have you tried using the NVDA Python console to navigate around an
application you're familiar with to get a feel for how all of this works?
- Have you ran the Python built-in function dir on an object to see what
properties and methods it exposes?  Object introspection at runtime is
one of Python's biggest bonuses, and you're probably going to need it.
- Have you downloaded the code of some other app modules contributed by
the community to see if you can figure out how they work?  Some of the
app modules that ship with NVDA itself, if you check out the source
code, are not overly complicated.  Earlier, you were completely stumped
by the snippet of code that I posted.  You need to understand how that
works.

That gives you a number of things to investigate.  If you don't have a
clue what I'm talking about, take them step by step, and ask us about
any particular issues you're having.  Then try to write a simple,
useless app module.  A good exercise would be to implement an event
handler for the list box in your family tree application which simply
makes NVDA play a tone whenever you move to a new item.  Once you have
that working, perhaps add some logging which will write to the NVDA log
the newly-selected value in the list box, which will help you get a feel
for how it all fits together.  After that, you can start to implement
code to make NVDA find and speak the information you're looking for.

What you're not going to be able to do at this point is sit down and
write this app module from scratch, and have it finished in one sitting.
 You need to build your understanding, and only then can you start to
make your code do what you want.
-- 
James Scholes
http://twitter.com/JamesScholes
----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting 
bugs. 

Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: