Way better active alarm display. Snooze and dismiss are still wierd.
This commit is contained in:
parent
8690532c19
commit
c8bb1517c5
@ -28,12 +28,40 @@ def _draw_error(stdscr, error_message):
|
|||||||
stdscr.attroff(curses.color_pair(3) | curses.A_BOLD)
|
stdscr.attroff(curses.color_pair(3) | curses.A_BOLD)
|
||||||
|
|
||||||
def _draw_active_alarms(stdscr, context):
|
def _draw_active_alarms(stdscr, context):
|
||||||
"""Draw the active alarms screen"""
|
"""Draw the active alarms"""
|
||||||
_init_colors()
|
_init_colors()
|
||||||
height, width = stdscr.getmaxyx()
|
height, width = stdscr.getmaxyx()
|
||||||
|
current_time = datetime.now()
|
||||||
|
|
||||||
|
# Draw the main clock (original position)
|
||||||
|
time_str = current_time.strftime("%H:%M:%S")
|
||||||
|
digit_width = 14
|
||||||
|
total_width = digit_width * len(time_str)
|
||||||
|
start_x = (width - total_width) // 2
|
||||||
|
start_y = (height - 7) // 2 - 4 # Original position from _draw_main_clock
|
||||||
|
|
||||||
|
# Draw blinking dot
|
||||||
|
if int(current_time.timestamp()) % 2 == 0:
|
||||||
|
stdscr.attron(curses.color_pair(1))
|
||||||
|
stdscr.addstr(start_y - 1, start_x + total_width - 2, "•")
|
||||||
|
stdscr.attroff(curses.color_pair(1))
|
||||||
|
|
||||||
|
# Green color for big time
|
||||||
|
stdscr.attron(curses.color_pair(1))
|
||||||
|
for i, digit in enumerate(time_str):
|
||||||
|
_draw_big_digit(stdscr, start_y, start_x + i * digit_width, digit)
|
||||||
|
stdscr.attroff(curses.color_pair(1))
|
||||||
|
|
||||||
|
# Draw date (as in main clock)
|
||||||
|
date_str = current_time.strftime("%Y-%m-%d")
|
||||||
|
date_x = width // 2 - len(date_str) // 2
|
||||||
|
date_y = height // 2 + 4
|
||||||
|
stdscr.attron(curses.color_pair(2))
|
||||||
|
stdscr.addstr(date_y, date_x, date_str)
|
||||||
|
stdscr.attroff(curses.color_pair(2))
|
||||||
|
|
||||||
|
# Get active alarm info
|
||||||
active_alarms = context.get('active_alarms', {})
|
active_alarms = context.get('active_alarms', {})
|
||||||
|
|
||||||
if not active_alarms:
|
if not active_alarms:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -42,14 +70,25 @@ def _draw_active_alarms(stdscr, context):
|
|||||||
alarm_info = active_alarms[alarm_id]
|
alarm_info = active_alarms[alarm_id]
|
||||||
alarm_config = alarm_info['config']
|
alarm_config = alarm_info['config']
|
||||||
|
|
||||||
# Draw alarm details
|
# Format alarm info
|
||||||
stdscr.addstr(height // 2 - 2, width // 2 - 10, "ALARM TRIGGERED")
|
alarm_name = alarm_config.get('name', 'Unnamed Alarm')
|
||||||
stdscr.addstr(height // 2, width // 2 - len(alarm_config.get('name', 'Unnamed Alarm'))//2,
|
alarm_time = alarm_config.get('time', 'Unknown Time')
|
||||||
alarm_config.get('name', 'Unnamed Alarm'))
|
#snooze_count = alarm_info.get('snooze_count', 0)
|
||||||
|
|
||||||
# Time info
|
# Draw alarm info under the clock
|
||||||
time_str = alarm_config.get('time', 'Unknown Time')
|
info_y = start_y + 8 # Position below the clock
|
||||||
stdscr.addstr(height // 2 + 2, width // 2 - len(time_str)//2, time_str)
|
#alarm_str = f"[ {alarm_name} - {alarm_time} - Snoozed: {snooze_count}x ]"
|
||||||
|
alarm_str = f"[ {alarm_name} - {alarm_time} ]"
|
||||||
|
alarm_x = max(0, width // 2 - len(alarm_str) // 2)
|
||||||
|
alarm_y = date_y - 2 # Just above the date
|
||||||
|
|
||||||
|
# Center the alarm info
|
||||||
|
info_x = max(0, width // 2 - len(alarm_str) // 2)
|
||||||
|
|
||||||
|
# Draw with green color
|
||||||
|
stdscr.attron(curses.color_pair(1))
|
||||||
|
stdscr.addstr(alarm_y, alarm_x, alarm_str)
|
||||||
|
stdscr.attroff(curses.color_pair(1))
|
||||||
|
|
||||||
# Instructions
|
# Instructions
|
||||||
stdscr.addstr(height - 2, width // 2 - 15, "S: Snooze D: Dismiss")
|
stdscr.addstr(height - 2, width // 2 - 15, "S: Snooze D: Dismiss")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user