diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2021-11-16 17:36:55 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2021-11-16 17:36:55 +0100 |
commit | c96d94f498dbc8d4fe9722861ef5687b8bc5595c (patch) | |
tree | 5cdde065316a43fbdc44fcf079a3dcf3789e5513 | |
parent | f6a53e66c73e69bff27ce6abdbb4ca01cf5e2516 (diff) | |
download | poezio-c96d94f498dbc8d4fe9722861ef5687b8bc5595c.tar.gz poezio-c96d94f498dbc8d4fe9722861ef5687b8bc5595c.tar.bz2 poezio-c96d94f498dbc8d4fe9722861ef5687b8bc5595c.tar.xz poezio-c96d94f498dbc8d4fe9722861ef5687b8bc5595c.zip |
Avoid calling get_theme() more than once
And avoid calling it altogether when no time is passed.
-rw-r--r-- | poezio/ui/render.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/poezio/ui/render.py b/poezio/ui/render.py index 2256dc14..aad482b5 100644 --- a/poezio/ui/render.py +++ b/poezio/ui/render.py @@ -265,14 +265,14 @@ class PreMessageHelpers: """ Write the date on the yth line of the window """ - theme = get_theme() if time: + theme = get_theme() if history and time.date() != date.today(): format = theme.LONG_TIME_FORMAT else: format = theme.SHORT_TIME_FORMAT time_str = time.strftime(format) - color = get_theme().COLOR_TIME_STRING + color = theme.COLOR_TIME_STRING with buffer.colored_text(color=color): buffer.addstr(time_str) buffer.addstr(' ') |