From 10f7889ef21023c3a96366d89c4662a075d9e5f9 Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Tue, 12 Aug 2025 15:49:04 -0400 Subject: [PATCH] Add balloon help and URL support to daily reminders view. --- scripts/tkremind.in | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/scripts/tkremind.in b/scripts/tkremind.in index e094b70d..c4fcac96 100644 --- a/scripts/tkremind.in +++ b/scripts/tkremind.in @@ -4249,6 +4249,12 @@ proc DisplayTimeContinuously {} { } +proc daily_rem_enter { lines } { + global Balloon + balloon_cancel_timer + set Balloon(HelpId) [after $Balloon(HelpTime) [list details_popup $lines]] +} + #*********************************************************************** # %PROCEDURE: ShowTodaysReminders # %ARGUMENTS: @@ -4348,7 +4354,9 @@ proc ShowTodaysReminders { force date } { set arr [lsort -command compare_reminders $arr] set old_date {} set did_a_date 0 + set t_index 0 foreach thing $arr { + incr t_index set mydate [dict get $thing date] if {"$mydate" != "$old_date"} { if {"$old_date" != ""} { @@ -4360,7 +4368,7 @@ proc ShowTodaysReminders { force date } { } } set old_date $mydate - set tags {} + set tags [list "l_$t_index"] if {[dict exists $thing r] && [dict exists $thing g] && [dict exists $thing g]} { set r [dict get $thing r] set g [dict get $thing g] @@ -4385,6 +4393,24 @@ proc ShowTodaysReminders { force date } { $w.text tag configure "clr$color" -foreground "#$color" } + set help_lines {} + if {[dict exists $thing info]} { + set info [dict get $thing info] + if {[dict exists $info location]} { + lappend help_lines [list "Location:" [dict get $info location]] + } + if {[dict exists $info description]} { + lappend help_lines [list "Description:" [dict get $info description]] + } + if {[dict exists $info url]} { + lappend help_lines [list "URL:" "Middle-click to open [dict get $info url]"] + $w.text tag bind "l_$t_index" [list exec xdg-open [dict get $info url]] + } + } + if {[llength $help_lines] >= 1} { + $w.text tag bind "l_$t_index" +[list daily_rem_enter $help_lines] + $w.text tag bind "l_$t_index" +[list details_leave $w] + } if {[dict exists $thing filename]} { set fname [dict get $thing filename] # Don't make INCLUDECMD output editable @@ -4395,11 +4421,10 @@ proc ShowTodaysReminders { force date } { set l [dict get $thing lineno] } set fntag [string cat "FILE_" $l "_" $fname] - $w.text tag bind $fntag [list $w.text tag configure $fntag -underline 1] - $w.text tag bind $fntag [list $w.text tag configure $fntag -underline 0] - $w.text tag bind $fntag [list FireEditor $w.text $fntag] - $w.text tag bind $fntag [list FireEditor $w.text $fntag] - lappend tags $fntag + $w.text tag bind "l_$t_index" +[list $w.text tag configure "l_$t_index" -underline 1] + $w.text tag bind "l_$t_index" +[list $w.text tag configure "l_$t_index" -underline 0] + $w.text tag bind "l_$t_index" [list FireEditor $w.text $fntag] + $w.text tag bind "l_$t_index" [list FireEditor $w.text $fntag] } } $w.text insert end [dict get $thing body] $tags @@ -4437,6 +4462,14 @@ proc compare_reminders { a b } { if {$a_time > $b_time} { return 1 } + set a_prio [dict get $a priority] + set b_prio [dict get $b priority] + if {$a_prio < $b_prio} { + return -1; + } + if {$a_prio > $b_prio} { + return 1; + } return 0 }