On Wed, Mar 7, 2018 at 6:30 PM, Terry Brown <[email protected]> wrote:
> I really don't understand the disconnect here. I want to log a warning to
the log pane.
At present, Leo has the following definitions in leoGlobals:
def error(*args, **keys):
g.es_print(color=g.actualColor('red'), *args, **keys)
def note(*args, **keys):
g.es_print(color=g.actualColor('black'), *args, **keys)
def warning(*args, **keys):
g.es_print(color=g.actualColor('blue'), *args, **keys)
They can be changed to:
def error(*args, **keys):
g.es_print(color=g.actualColor('error'), *args, **keys)
def note(*args, **keys):
g.es_print(color=g.actualColor('note'), *args, **keys)
def warning(*args, **keys):
g.es_print(color=g.actualColor('warning'), *args, **keys)
And this is probably *all *that needs to happen.
So please calm down and read the following carefully.
> Ideally, it would be
> g.log("Warning, keep away from children", type="warning")
> or
> g.warning("Warning, keep away from children")
> (I prefer the former)
g.log is a completely separate function. It should not be changed.
> Instead, for historical reasons, we have
> g.es <http://g.es/>("Warning, keep away from children", color="warning")
There is no such code in Leo's core. There is color="red" or color="blue".
In Leo's core all calls to g.es are exactly as they were before. Now,
however, you could write color="warning" or color="error".
> at least until recently, but now apparently we're supposed to use
> g.es <http://g.es/>("Warning, keep away from children", color="blue")
You have the situation completely backwards. color="blue" is the *legacy*.
You are no longer "supposed to" use it. You can use anything you like.
> So we (a) need to know that 'blue' is the arbitrary color code for
warnings, and (b) that this will print a message in the log in a theme
defined color that may not be any kind of blue.
This was what you were "supposed to know" previously. Nothing in Leo's core
has changed.
> So we're going backwards.
No. You have it backwards.
*Summary*
Changing calls to g.es in Leo's core is conceivable, but not necessary.
Changing the definitions of g.error, g.note and g.warning as described
above would probably suffice, provided that themes define @color
log_error/node/warning_color settings.
The new scheme increases our choices while allowing all legacy code to work
as before.
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 https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.