On Sep 3, 6:47 pm, "Edward K. Ream" <[email protected]> wrote:

> The overall situation is clear:

Indeed it is.  I can now understand the docstring :-)

Indeed, the template provides the "raw materials" for the callouts.
The user supplies the desired combination and location of callouts,
and the original screenshot, and the result is a new screenshots with
callouts applied.

At the code level, the fundamental operation is the xpath call.  For
example::

    object = template.xpath("//*...@id='co_text_1]")

This searches the xml file for an xml element whose id is 'co_text_1.
The //*[ syntax is a bit boggling at first, but once one sees the
pattern everything becomes clear.  As I said in an earlier post, the
start of the InkCall class defines the objects that should be defined
in the template.  Here is the list the actual list.

ids = [
        "co_bc_1",        # 1 digit black circle
        "co_bc_2",        # 2 digit black circle
        "co_bc_text_1",   # text holder for 1 digit black circle
        "co_bc_text_2",   # text holder for 2 digit black circle
        "co_frame",       # frame for speech balloon callout
        "co_g_bc_1",      # group for 1 digit black circle
        "co_g_bc_2",      # group for 2 digit black circle
        "co_g_co",        # group for speech balloon callout
        "co_shot",        # image for screen shot
        "co_text_holder", # text holder for speech balloon callout
    ]

We are going to be seeing xpath statements involving these, so it's
good to notice the patterns in the names:  co_<type>_id.

Naturally, these names can be "computed" using Python string
operations.  For example:

     part = dict([(g, template.xpath("//*...@id='%s']"%g)[0])
                  for g in 'co_g_co', 'co_g_bc_1', 'co_g_bc_2'])

This is much less horrifying now that we know the patterns for a)
xpath and b) object names.

So that's about it for the code ;-)  It's not too difficult once one
sees the patterns.  Of course, only Terry knows where the bodies are
hidden....

Now that I understand the code in detail, it's time to put it to
work...

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to