Avoid calling get_theme() more than once
And avoid calling it altogether when no time is passed.
This commit is contained in:
parent
f6a53e66c7
commit
c96d94f498
1 changed files with 2 additions and 2 deletions
|
@ -265,14 +265,14 @@ class PreMessageHelpers:
|
||||||
"""
|
"""
|
||||||
Write the date on the yth line of the window
|
Write the date on the yth line of the window
|
||||||
"""
|
"""
|
||||||
theme = get_theme()
|
|
||||||
if time:
|
if time:
|
||||||
|
theme = get_theme()
|
||||||
if history and time.date() != date.today():
|
if history and time.date() != date.today():
|
||||||
format = theme.LONG_TIME_FORMAT
|
format = theme.LONG_TIME_FORMAT
|
||||||
else:
|
else:
|
||||||
format = theme.SHORT_TIME_FORMAT
|
format = theme.SHORT_TIME_FORMAT
|
||||||
time_str = time.strftime(format)
|
time_str = time.strftime(format)
|
||||||
color = get_theme().COLOR_TIME_STRING
|
color = theme.COLOR_TIME_STRING
|
||||||
with buffer.colored_text(color=color):
|
with buffer.colored_text(color=color):
|
||||||
buffer.addstr(time_str)
|
buffer.addstr(time_str)
|
||||||
buffer.addstr(' ')
|
buffer.addstr(' ')
|
||||||
|
|
Loading…
Reference in a new issue