Changeset 9 for trunk/gui/apps
- Timestamp:
- Apr 19, 2005, 8:06:13 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/apps/driver
r8 r9 27 27 package require Rappture 28 28 29 option add *MainWin.mode webstartupFile29 option add *MainWin.mode desktop startupFile 30 30 option add *MainWin.borderWidth 0 startupFile 31 31 option add *MainWin.anchor center startupFile … … 41 41 option add *MainWin.bgScript "" startupFile 42 42 option add *MainWin.bgColor white startupFile 43 option add *Tooltip.background white 43 44 44 45 image create photo in2out \ … … 124 125 Rappture::MainWin .main -borderwidth 0 125 126 126 #.main configure -title [$config get title]127 .main configure -title [$config get title] 127 128 128 129 # build everything inside this main window … … 203 204 # HOOK UP ANY CONTROLS CALLED OUT IN CONFIG.XML 204 205 # ---------------------------------------------------------------------- 205 foreach access [$config children -type access controls] { 206 set name [$config get controls.$access] 207 switch -glob -- $name { 208 parameters.ambient* - structure* { 209 ## $win.input.device controls add $name 210 } 211 } 212 } 206 proc controls_add {container libObj path} { 207 set presets "" 208 foreach pre [$libObj children -type preset $path] { 209 lappend presets \ 210 [$libObj get $path.$pre.value] \ 211 [$libObj get $path.$pre.label] 212 } 213 214 set type Rappture::Gauge 215 set units [$libObj get $path.units] 216 if {$units != ""} { 217 set desc [Rappture::Units::description $units] 218 if {[string match temperature* $desc]} { 219 set type Rappture::TemperatureGauge 220 } 221 } 222 223 set counter 0 224 set w "$container.gauge[incr counter]" 225 while {[winfo exists $w]} { 226 set w "$container.gauge[incr counter]" 227 } 228 229 # create the widget 230 $type $w -units $units -presets $presets 231 pack $w -side top -anchor w 232 # bind $w <<Value>> [itcl::code $this _controlSet $w $libObj $path] 233 234 set min [$libObj get $path.min] 235 if {"" != $min} { $w configure -minvalue $min } 236 237 set max [$libObj get $path.max] 238 if {"" != $max} { $w configure -maxvalue $max } 239 240 set str [$libObj get $path.default] 241 if {$str != ""} { $w value $str } 242 243 if {$type == "Rappture::Gauge" && "" != $min && "" != $max} { 244 set color [$libObj get $path.color] 245 if {$color == ""} { 246 set color blue 247 } 248 if {$units != ""} { 249 set min [Rappture::Units::convert $min -to $units -units off] 250 set max [Rappture::Units::convert $max -to $units -units off] 251 } 252 $w configure -spectrum [Rappture::Spectrum ::#auto [list \ 253 $min white $max $color] -units $units] 254 } 255 256 set str [$libObj get $path.label] 257 if {$str != ""} { 258 set help [$libObj get $path.help] 259 if {"" != $help} { 260 append str "\n$help" 261 } 262 if {$units != ""} { 263 set desc [Rappture::Units::description $units] 264 append str "\n(units of $desc)" 265 } 266 Rappture::Tooltip::for $w $str 267 } 268 269 set str [$libObj get $path.icon] 270 if {$str != ""} { 271 $w configure -image [image create photo -data $str] 272 } 273 } 274 275 if {[winfo exists $win.input.device]} { 276 foreach access [$config children -type access controls] { 277 set name [$config get controls.$access] 278 switch -glob -- $name { 279 input.(ambient)* - structure* { 280 $win.input.device controls add $name 281 } 282 } 283 } 284 } else { 285 foreach access [$config children -type access controls] { 286 set name [$config get controls.$access] 287 controls_add $win.input $tool $name 288 } 289 $w.analyze simulate 290 }
Note: See TracChangeset
for help on using the changeset viewer.