1 # vim: ft=tcl ts=4 shiftwidth=4 foldmarker=<<<,>>>
3 class tlc::Signal_monitor {
10 variable signal_source
15 variable oldsignals {}
18 method update_sig {signal newstatus}
19 method force_update {}
24 configbody tlc::Signal_monitor::signal_source { #<<<1
29 body tlc::Signal_monitor::constructor {args} { #<<<1
30 array set sigstatus {}
32 eval itk_initialize $args
36 body tlc::Signal_monitor::destructor {} { #<<<1
37 foreach signal $oldsignals {
38 catch {$signal detach_output [code $this update_sig $signal]}
44 body tlc::Signal_monitor::rerender {} { #<<<1
45 catch {eval destroy [winfo children $w]} ;# Kodomokiri
47 foreach signal $oldsignals {
48 catch {$signal detach_output [code $this update_sig $signal]}
54 if {$signal_source == ""} return
56 #label $w.sourcename -text "Source: $signal_source" -font $::cfg(boldfont)
57 label $w.sourcename -text "Source: $signal_source"
59 blt::table $w -padx 5 -pady 5 \
60 $w.sourcename 1,1 -anchor w
63 foreach {signame signal} [$signal_source signals_available] {
64 checkbutton $w.signal_$r -text $signame \
65 -variable [scope sigstatus($signal)] -state disabled
67 $signal attach_output [code $this update_sig $signal]
68 lappend oldsignals $signal
71 $w.signal_$r $r,1 -anchor w
76 button $w.force_update -text "Update" -command [code $this force_update]
79 $w.force_update $r,1 -anchor c
83 body tlc::Signal_monitor::update_sig {signal newstatus} { #<<<1
84 set sigstatus($signal) $newstatus
88 body tlc::Signal_monitor::force_update {} { #<<<1
90 foreach signal [array names sigstatus] {
91 set sigstatus($signal) [$signal state]