Skip to content

Commit

Permalink
Show last refresh date-time on button when hovered (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
FaceCrap authored May 10, 2024
1 parent 56b2ba8 commit 52ea0ad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3829,6 +3829,15 @@ def draw_settings_color(setting: str):
# Normal button
if imgui.button("Refresh!", width=width, height=height):
utils.start_refresh_task(api.refresh())
elif imgui.is_item_hovered():
draw_list = imgui.get_window_draw_list()
screen_pos = imgui.get_cursor_screen_pos()
col = imgui.get_color_u32_rgba(1, 1, 1, 1)
text = str(f"Last refresh: {set.last_successful_refresh.display or 'Never'}")
text_size = imgui.calc_text_size(text)
text_x = screen_pos.x + (width - text_size.x) / 2
text_y = screen_pos.y - text_size.y - 3 * imgui.style.item_spacing.y
draw_list.add_text(text_x, text_y, col, text)
if imgui.begin_popup_context_item("###refresh_context"):
# Right click = more options context menu
if imgui.selectable(f"{icons.bell_badge_outline} Check notifs", False)[0]:
Expand Down

0 comments on commit 52ea0ad

Please sign in to comment.