Re: [orca-list] code review



On Mon, Dec 23, 2013 at 1:52 PM, Alex Midence <alex midence gmail com> wrote:
Symon
Link?

I just got off the phone with Johnathan,
the first step I think for orca is to strip out all complex formatting
code and push it out.
We need to make it into something that can be edited by blind people.

take a look at this :
https://github.com/h4ck3rm1k3/orca/blob/f79656250c6946e3bfd2e9184467ac97a84f5b40/src/orca/formatting_braille_eval.py

it represents a closed world representation of the braille formatting,
each function represents one of the nested ifs:

def action_3_unfocused ():
        return [Component(obj,asString(label + displayedText +
roleName + (description and space(": ") + description)))]

It should look more like :

class SomeAction(SomeBraileAction) :
    def unfocused():
        return [
             Component(obj,asString(label + displayedText + roleName +
(description and space(": ") + description)))
       ]


What if we moved the format strings into a jinja2 template system?
http://jinja.pocoo.org/docs/
Even better it could be a template like :

{{label}} {{displayedText}} {{roleName}} {{description}}  {{space(":
")}} {{description}}

but i am not exactly sure how that would work yet, but the idea would
be move all the formatting out into a domain specific language that
can be edited in small specific files by disabled people and not some
bloated huge nested dict.

mike




-- 
James Michael DuPont
Member of Free Libre Open Source Software Kosova http://www.flossk.org
Saving Wikipedia(tm) articles from deletion http://SpeedyDeletion.wikia.com
Mozilla Rep https://reps.mozilla.org/u/h4ck3rm1k3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]