1
0
mirror of https://bitbucket.org/svk28/rac-gui synced 2024-09-21 00:38:02 +00:00
1c_rac-gui/lib/function.tcl

61 lines
1.6 KiB
Tcl
Raw Normal View History

2018-05-16 11:17:27 +00:00
######################################################
# Rac GUI
# Distributed under GNU Public License
# Author: Sergey Kalinin svk@nuk-svk.ru
# Copyright (c) "http://nuk-svk.ru", 2018
# https://bitbucket.org/svk28/rac-gui
######################################################
proc Quit {} {
exit
}
proc TreePress {tree} {
global host
set cluster [$tree item [$tree selection] -values]
set root [$tree selection]
RunCommand $root "infobase summary list --cluster=$cluster $host"
}
proc RunCommand {root par} {
global dir rac_cmd cluster
set pipe [open "|$rac_cmd $par" "r"]
while {[gets $pipe line]>=0} {
puts "$line"
set str [split $line ":"]
set param [string trim [lindex $str 0]]
set val [string trim [lindex $str 1]]
.frm_work.tree_work insert {} end -text "$param" -values "$val"
#.frm_work.tree_work insert {} end -text "$val" -values "$val"
if {$param eq "cluster"} {
set cluster $val
}
if {$param eq "name"} {
set cluster_name $val
.frm_tree.tree insert $root end -text "$val" -values "$cluster"
}
}
close $pipe
# fileevent $pipe readable [list DebugInfo .frm_work.tree_work $pipe]
# fconfigure $pipe -buffering none -blocking no
}
proc DebugInfo {widget f} {
if {[eof $f]} {
catch [close $f] msg
if {$msg != ""} {
puts $msg
} else {
puts $msg
}
}
while {[gets $f line]>=0} {
puts "$line"
$widget insert {} end -text "$line" -values "$line"
}
}