Re: [orca-list] code review



For what it's worth, the formatting strings are a mess that are
difficult for sighted users. :) Object presentation will be redone as
part of the performance work I am doing and the formatting code will be
going away by side effect.

--joanie (Orca maintainer)

On 12/23/2013 04:49 PM, Mike Dupont wrote:
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







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