commit - 19cab05cdf5a86d4f9a15acc9d527523c642f093
commit + 9b739c87b03bd1deeb6644dedaa89e7356b294a1
blob - 8885c20a7c13de9d7239f400bdfd32f0f7608bd5
blob + b0438237396d6f1dbc79b55808599bd3962856ee
--- contrib/amusing
+++ contrib/amusing
set cur_song ""
set cur_time 0
set max_time 0
-set status "stopped"
set mode {"off" "off" "off"}
set toggle_btn "pause"
}
proc getstatus {} {
- global status
global cur_time
global max_time
global toggle_btn
while {[gets $fd line] != -1} {
switch -glob $line {
"playing *" {
- set status "playing"
set toggle_btn "pause"
}
"paused *" {
- set status "paused"
set toggle_btn "play"
}
"stopped *" {
- set status "stopped"
set toggle_btn "play"
}
"position *" {settime cur_time $line}
}
proc handle_event {fd} {
- global status
global toggle_btn
if {[eof $fd]} {
"mode *" {puts "TODO: refresh mode"}
"next" {getsongs} # may be optimized
"pause" {
- set status "paused"
set toggle_btn "play"
}
"play" {
- set status "playing"
set toggle_btn "pause"
}
"prev" {getsongs} # may be optimized
"seek *" {setpos $ev}
"stop" {
- set status "stopped"
set toggle_btn "play"
}
default {puts "un-catched event $ev"}
}
}
-grid [ttk::frame .c.cntl -padding "0 5 0 0"] -column 0 -row 2
+grid [ttk::frame .c.cntl -padding "0 5 0 5"] -column 0 -row 2
ttk::button .c.cntl.prev -text "prev" -command "amused prev"
ttk::button .c.cntl.togg -textvariable toggle_btn -command "amused toggle"
ttk::button .c.cntl.stop -text stop -command "amused stop"
grid .c.cntl.stop -column 2 -row 0
grid .c.cntl.next -column 3 -row 0
-grid [ttk::frame .c.status -padding "5 5 5 5"] -column 0 -row 3
-ttk::label .c.status.text -textvariable status
-grid .c.status.text
-
-grid [ttk::frame .c.bottom -borderwidth 2] -column 0 -row 4
+grid [ttk::frame .c.bottom -borderwidth 2] -column 0 -row 3
ttk::label .c.bottom.cur_time -textvariable cur_time -padding "0 0 5 0"
ttk::scale .c.bottom.bar -orient horizontal -length 400 -command amused_seek
ttk::label .c.bottom.max_time -textvariable max_time -padding "5 0 0 0"
-grid [ttk::frame .c.current -padding "0 5 0 0"] -column 0 -row 5
+grid [ttk::frame .c.current -padding "0 5 0 0"] -column 0 -row 4
grid [ttk::label .c.current.title -textvariable cur_song]
grid .c.bottom.cur_time -column 0 -row 0