Files
sics/site_ansto/instrument/util/script_context_util.tcl
Ferdi Franceschini 2ec6505ef8 Merged 2.4 branch
r2828 | ffr | 2009-11-25 09:56:49 +1100 (Wed, 25 Nov 2009) | 2 lines
2012-11-15 16:57:26 +11:00

53 lines
1.4 KiB
Tcl

namespace eval ::scobj { }
proc ::scobj::set_required_props {hpath} {
foreach child [hlist $hpath] {
hsetprop $hpath/$child data false
::scobj::set_required_props $hpath/$child
}
}
proc ::scobj::hinit_nodeprops {node hpath} {
hsetprop $hpath nxalias $node
foreach {prop propval} [subst {
control true
data true
nxsave true
mutable true
klass parameter
sdsinfo ::nexus::scobj::sdsinfo
long_name $node
}] {
if {[hpropexists $hpath $prop] == false} {
hsetprop $hpath $prop $propval
}
}
}
proc ::scobj::hinit_scobjprops {scobj hpath} {
foreach {prop propval} [subst {
klass parameter
long_name $scobj
}] {
if {[hpropexists $hpath $prop] == false} {
sicslist setatt $scobj $prop $propval
} else {
sicslist setatt $scobj $prop [hgetpropval $hpath $prop]
}
}
hsetprop $hpath sicsdev $scobj
::scobj::hinit_nodeprops $scobj $hpath
}
##
# @brief Initialise the hdb properties required for generating the GumTree interface and
# saving data for script context objects
# @param scobj, name of script context object
# @param par, optional parameter
proc ::scobj::hinitprops {scobj {par "@none"}} {
if {$par == "@none"} {
set hpath /sics/$scobj
::scobj::hinit_scobjprops $scobj $hpath
} else {
set hpath /sics/$scobj/$par
::scobj::hinit_nodeprops ${scobj}_$par $hpath
}
}