Show queue in sorted order

This commit is contained in:
Dianne Skoll
2021-12-02 11:17:48 -05:00
parent 21cce0e104
commit 4fa956aa27

View File

@@ -2505,6 +2505,7 @@ proc ShowQueue { file } {
if {[catch {set obj [::json::json2dict $line]}]} {
continue;
}
set obj [lsort -command sort_q $obj]
foreach q $obj {
$w.t insert end "$q\n"
}
@@ -2512,6 +2513,18 @@ proc ShowQueue { file } {
$w.t configure -state disabled
}
proc sort_q { a b } {
set a_ttime [dict get $a nextttime]
set b_ttime [dict get $b nextttime]
if {$a_ttime < $b_ttime} {
return -1
}
if {$a_ttime > $b_ttime} {
return 1
}
return 0
}
#---------------------------------------------------------------------------
# DaemonReadable
# Arguments: