From c96d94f498dbc8d4fe9722861ef5687b8bc5595c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 16 Nov 2021 17:36:55 +0100 Subject: Avoid calling get_theme() more than once And avoid calling it altogether when no time is passed. --- poezio/ui/render.py | 4 ++-- 1 file 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(' ') -- cgit v1.2.3