Rev 5461 is a mass update to most of Leo's files, including all
plugins in leoPlugins.leo, that begins this process. Here is the
checkin log:
"A mass update, replacing
g.es/_print(color='red') with g.error or
g.red and replacing
g.es/_print(color='blue') with g.warning or
g.blue. All unit tests pass and pylint is happy."
A few notes:
- These changes were long overdue anyway. It's bad style to put hard
constants in code, and "red" and "blue" are the worst kinds of hard
constants: they make it difficult or impossible to adapt to different
color schemes, and are not friendly to assistive technologies.
- g.red is a synonym for g.error; and g.blue is a synonym for
g.warning. For instance, you would say g.blue('done') rather than
g.warning('done').
- At present, g.red and g.error always print in red, and g.blue and
g.warning always print in blue, but the point of the mass update is
that these methods can now honor the following settings::
@color log_error_color = red
@color log_warning_color = blue
These is a small problem that must be worked around: these functions
in leoGlobals do not take a 'c' argument, so have no direct way of
doing, say,
color = c.config.getColor('log_error_color') or 'red'
So a kludge will be needed. When the log changes, Leo will set some
global, say g.app.log_c. This is also something that should have been
done a long time ago. I'll be working on this asap.
To summarize, when the work is complete users will be able to set
colors for the log_error_color and log_warning_color settings that
will be compatible with the color scheme used in the log pane. Calls
to g.error and g.red will use the former setting; calls to g.warning
and g.blue will use the latter.
Edward