[nvda-addons] Re: Getting somewhere!

  • From: "Damien Sykes-Pendleton" <damien@xxxxxxxxxxxxxxxxxxxx>
  • To: <nvda-addons@xxxxxxxxxxxxx>
  • Date: Sun, 17 Apr 2016 21:00:59 +0100

Hi Joseph,
I was able to increase the line limitation, though it doesn't show them in my text editor so not sure whether it's worked or not.
I have, however, changed the list access, and changed the indentation method. Again this was another setting I had to change, I have a parser that parses c-style blocks into Python indentations, that is set to use tab but my editor decided to use spaces instead.
Also on Noelia's recommendation I have put invalid combinations into a list to shorten the comparison statement.
Let me know if this is any better.
Cheers.
Kind regards,
Damien.
-----Original Message----- From: Joseph Lee
Sent: Sunday, April 17, 2016 8:02 PM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Getting somewhere!

Hi Damien,

As people always say, the first ones are hard, but despite that, you're
showing potential.

Nevertheless: As a code reviewer, I specialize in overall picture and user
experience, including headers, consistency, translatable strings and such.
Thus:

1. Please try using tabs instead of spaces for indentation for consistency
with the rest of NVDA Core source code and add-ons.
2. A short header at the top of the file would be nice. This allows others
to see the status of copyrights, who wrote the add-on and what the add-on
does.
3. It appears you are using a text editor that somehow enforces line length,
which causes certain parts of source code to break. Please try using editors
such as Notepad++ and others where this doesn't occur or has a setting to
control this.
4. You don't have to use list[len(something)-1], as list[-1] is used to
retrieve the last item of a list.

Reviews from others are appreciated.
Cheers,
Joseph

-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx] On Behalf Of Damien
Sykes-Pendleton
Sent: Sunday, April 17, 2016 4:31 AM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Getting somewhere!

Hi,
OK then, here goes.
Thanks.
Kind regards,
Damien.
-----Original Message-----
From: James Scholes
Sent: Sunday, April 17, 2016 12:22 PM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Getting somewhere!

Damien Sykes-Pendleton wrote:

I wasn't sure whether you could or not, that's why, given the fact
that I'm guessing I'm the only person on here who uses the application
for which it's intended.
I'm also not sure whether I should send it as part of the email, or as
a download link etc.

We don't really need to use the application in question to give you a code
review.  Send it through as an attachment and we'll take a look.
--
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

----------------------------------------------------------------
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 import appModuleHandler
import ui

class AppModule(appModuleHandler.AppModule):
        def parse_relevant_info(self, text):
                info=text.split("\n")
                text=""
                full_name=info[-1]
                pos=info.index("B:")
                info=info[pos+3:len(info)]
                while len(info)<3:
                        info.append("Unknown")
                birth=info[0]
                marriage=info[1]
                death=info[2]
                invalid=["","B:","M:","D:",full_name]
                if birth in invalid:
                        birth="Unknown"
                if marriage in invalid or marriage==birth:
                        marriage="Unknown"
                if death in invalid or death==birth or death==marriage:
                        death="Unknown"
                text="Born: "+birth+". Married: "+marriage+". Died: "+death+"."
                return text

        def event_gainFocus(self, obj, nextHandler):
                if obj.windowControlID==271:
                        
obj.description=self.parse_relevant_info(obj.parent.parent.parent.descrip
tion)
                        ui.message(obj.name+": "+obj.description)
                else:
                        nextHandler()

Other related posts: