#! /usr/local/bin/wish -f set sysadmin_myname sysadmin set sysadmin_help(help) \ "A sysadmin application is selected using the \"Applications\" menu. If you want to tear-off this menu, click-middle-hold over the \ \"Applications\" button, drag the menu to wherever you want, \ and then release-middle. \ To release the menu, click-left-hold on the \"Applications\" button, \ move the mouse off of the button, and then release-left." wm title . "Brian's sysadmin tool" frame .title \ -borderwidth 2 \ -relief raised pack append .title \ [menubutton .title.apps \ -menu .title.apps.menu \ -relief raised \ -state disabled \ -text Applications] \ {left} \ [button .title.quit \ -command exit \ -text Quit] \ {right} \ [button .title.help \ -command "sysadmin_callback_help {Help with sysadmin tool} help" \ -text Help] \ {right} \ [button .title.options \ -command sysadmin_callback_options \ -text Options] \ {right} #--------------------------------------- menu .title.apps.menu #--------------------------------------- frame .subtitle \ -borderwidth 2 pack append .subtitle \ [label .subtitle.msg \ -text ""] \ {top expand} pack append . \ .title {top pady 5 fill} \ .subtitle {top fill} source sysadmin-utility.tcl ############################################################################## # # Callback: Help with sysadmin # proc sysadmin_callback_help { title msg } { global sysadmin_myname global sysadmin_help # global my_font sysadmin_proc_mkmsg "showing help now..." set w .help if {$msg != "help"} { append w $msg } catch { destroy $w } toplevel $w wm title $w $title if {$msg != "help"} { wm iconname $w "$msg help" } else { wm iconname $w $msg } # wm iconbitmap $w @$snmptcl_icon frame $w.frame \ -borderwidth 10 pack append $w.frame \ [message $w.frame.msg \ -font -*-courier-medium-r-normal-*-120-* \ -text $sysadmin_help($msg)] \ {expand} frame $w.bot \ -borderwidth 1 pack append $w.bot \ [button $w.bot.button \ -command "sysadmin_proc_mkmsg {}; destroy $w" \ -text Dismiss] \ {top padx 5 pady 5 expand} pack append $w \ $w.frame {top expand filly} \ $w.bot {bottom fill} } ############################################################################## # # displays a one-line message in the title-bar # # msg - message to display # set sysadmin_armed 0 set sysadmin_busy 0 set sysadmin_ignore 0 proc sysadmin_proc_mkmsg { msg } { global sysadmin_armed global sysadmin_ignore if {$sysadmin_ignore == 1} { set sysadmin_ignore 0 return } incr sysadmin_armed if {$msg == ""} { catch { .subtitle.msg configure \ -background bisque1 } .subtitle.msg configure -text "" } else { catch { .subtitle.msg configure \ -background bisque3 } .subtitle.msg configure \ -text $msg after 30000 "sysadmin_proc_mkmsg_aux $sysadmin_armed" } } ############################################################################## proc sysadmin_proc_mkmsg_aux { serial } { global sysadmin_armed global sysadmin_busy if {$serial == $sysadmin_armed} { if {$sysadmin_busy} { after 30000 "sysadmin_mkmsg_aux $sysadmin_armed" } else { sysadmin_proc_mkmsg "" } } } ############################################################################## ### END