summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2021-11-16 17:36:55 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2021-11-16 17:36:55 +0100
commitc96d94f498dbc8d4fe9722861ef5687b8bc5595c (patch)
tree5cdde065316a43fbdc44fcf079a3dcf3789e5513
parentf6a53e66c73e69bff27ce6abdbb4ca01cf5e2516 (diff)
downloadpoezio-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.py4
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(' ')