On Mon, 21 Dec 2015 12:47:54 -0500
Jacob Peck <[email protected]> wrote:
> The convention tends to be using @settings trees and the appropriate
> c.config.getX() methods, but obviously that only works for scripts
> run within Leo. If you're writing a script for use both within and
> outside of Leo, you might want to go the other way.
>
> My personal Leo scripts tend to hold their own configuration data in
> a << declarations >> node, as a part of the script tree itself -- I
> rarely use the same script across multiple workbooks.
>
> But really, it's completely up to you -- Leo is flexible enough to
> accommodate nearly everyone's individual coding patterns and
> workflows. There's generally no shortage of ways to do things in
> Leo :)
I think all of Jake's points are good answers. If you're using
@settings nodes, I don't think you'd need to make a configparser
yourself, just have a @settings tree in the outline with nodes like
@int mything-min-size = 12
@string mything-encoding-name = utf-8
then read with
min_size = c.config.getInt('mything-min-size')
etc. - using the first part of the settings names to group your
settings - but as Jake says, everything is flexible, you don't have to
do it that way.
Jake's declarations approach might work better if you want to tweak the
params a lot, seeing full reload is the only reliable way to update
after changing @settings.
Cheers -Terry
> -->Jake
>
> On 12/21/2015 12:32 PM, Rafi Bin-Nun wrote:
> > Thanks Terry, Let me re-phrase the question in those terms...
> >
> > When running Python scripts from Leo, should Leo build a
> > configparser config file and have the python script read it in with
> > configparser.read(), or should the Python script pull the
> > configuration information directly from Leo nodes?
> >
> > Thanks,
> > Rafi
> > --
> > 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]
> > <mailto:[email protected]>.
> > To post to this group, send email to [email protected]
> > <mailto:[email protected]>.
> > Visit this group at https://groups.google.com/group/leo-editor.
> > For more options, visit https://groups.google.com/d/optout.
>
--
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.