On Mon, 20 May 2013 14:11:02 -0500
"Edward K. Ream" <[email protected]> wrote:

> On Mon, May 20, 2013 at 8:47 AM, Terry Brown <[email protected]>wrote:
> 
> > On Mon, 20 May 2013 04:00:59 -0700 (PDT)
> > Fidel Pérez <[email protected]> wrote:
> >
> 
> > Although I still have a mess on which functions can be called how, and
> > where to find the list of classes that can be called such as
> "editCommands"
> > and the rest that they might exist.
> 
> I'm not aware of a general solution to the problem of finding the
> > various pieces of Leo's class structure.  Basically there are all these
> > classes defined in the source, and instances of these are attached to
> > each other in a hierarchical network (with loops).
> >
> 
> I suppose you could say that there is no general solution, but the
> situation isn't really all that difficult.

But how does that help with the example of wanting to find
insertIconFromFile?  You need to know it's a member of editFileCommandsClass, 
which isn't an unreasonable requirement.  But where's editFileCommandsClass 
attached?  c.editFileCommands, which also seems reasonable, but c.<class name 
without Class> is not a general recipe for finding things, it only works in a 
handful of cases.  c.frame.body.getSelectedText() is a good example.  It's easy 
to find if you already know where it is, but it's not 
c.frame.body.bodyCtrl.getSelectedText().  I know it's something I spend of lot 
of time searching through, although I don't think it's a fault with Leo, just a 
complexity problem.

The search function is proving a lot harder than the Leo outline based
introspector, which only descends into nodes when you explicitly ask it
to.

Cheers -Terry

> Start with c.  We know what that is:  it is a commander object representing
> an open outline.
> 
> There are **official ivars** of c, all referring to wrapper classes defined
> in leoFrame.py:
> 
> c.frame: an instance of leoFrame.
> c.frame.tree: an instance of  leoTree.
> c.frame.body: an instance of leoBody.
> c.frame.log: an instance of leoLog.
> 
> The tree, body and log objects have a *ctrl* objects, which are *wrapper*
> classes:
> 
> c.frame.tree.treeCtrl
> c.frame.body.bodyCtrl
> c.frame.log.logCtrl
> 
> In particular, see
> http://leoeditor.com/scripting.html#c-frame-body-bodyctrlfor a
> description of the high-level text interface supported by all
> high-level text widgets, including the log and body classes.
> 
> These wrapper classes have a widget ivar, which is a reference to the
> corresponding Qt widget object.  For example::
> 
>     import PyQt4.QtGui as QtGui
>     w = c.frame.body.bodyCtrl.widget
>     g.es(w)
>     g.es(isinstance(w,QtGui.QTextBrowser)
> 
> yields::
> 
>     (LeoQTextBrowser) 62418136
>     True
> 
> As shown, the LeoQTextBrowser class is a real (subclass of) QTextBrowser.
> 
> HTH.  I've made a note to discuss official ivars in more detail in the
> scripting chapter.
> 
> Edward
> 

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


Reply via email to