Skip to content

Commit

Permalink
Set stop button color based on running tag. (#492)
Browse files Browse the repository at this point in the history
Signed-off-by: Vyacheslav Chigrin <vyacheslav.chigrin@izba.dev>
  • Loading branch information
vchigrin committed Jul 18, 2024
1 parent 04167bd commit 332a51d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions timetagger/app/front.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,11 +1255,17 @@ def _draw_tracking_buttons(self, ctx, x, y, h):
running_summary = ""
records = window.store.records.get_running_records()
has_running = False
running_tag_color = None
if len(records) > 0:
has_running = True
running_summary = "Timers running"
if len(records) == 1:
tagz = window.store.records.tags_from_record(records[0]).join(" ")
running_tags = window.store.records.tags_from_record(records[0])
if len(running_tags) == 1:
running_tag_color = window.store.settings.get_color_for_tag(
running_tags[0]
)
tagz = running_tags.join(" ")
stop_tt += " " + tagz
if window.simplesettings.get("show_stopwatch"):
running_summary = dt.duration_string(now - records[0].t1, True)
Expand All @@ -1284,7 +1290,11 @@ def _draw_tracking_buttons(self, ctx, x, y, h):
"fas-\uf04d",
"record_stopall",
stop_tt,
{"ref": "topright", "font": FONT.condensed, "color": COLORS.acc_clr},
{
"ref": "topright",
"font": FONT.condensed,
"color": running_tag_color if running_tag_color else COLORS.acc_clr,
},
)
x -= dx + 3
dx = self._draw_button(
Expand Down

0 comments on commit 332a51d

Please sign in to comment.