- Timestamp:
- Aug 13, 2008, 1:33:28 PM (16 years ago)
- Location:
- trunk/gui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/apps/Makefile.in
r1106 r1111 28 28 rappture.env \ 29 29 simsim \ 30 $(srcdir)/simsim.tcl \ 31 about \ 32 $(srcdir)/about.tcl \ 30 about 33 31 34 32 WINDOWS_SCRIPTS = \ -
trunk/gui/apps/about.in
r1106 r1111 1 1 #!/bin/sh 2 # ----------------------------------------------------------------------3 # ABOUT4 2 # 5 3 # This little script lets developers create an "about" page for … … 15 13 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 16 14 # ====================================================================== 15 #\ 16 RAPPTURE_INSTALL_DIR=@prefix@ ; \ 17 . $RAPPTURE_INSTALL_DIR/bin/rappture.env ; \ 18 exec wish $0 $* 19 # ---------------------------------------------------------------------- 20 # wish executes everything from here on... 17 21 18 RAPPTURE_INSTALL_DIR=@prefix@ 22 # ---------------------------------------------------------------------- 23 # ABOUT PANEL 24 # 25 # This little script lets developers create an "about" page for 26 # the first page of a nanoWhim application. It's sort of like a 27 # web browser, but it shows only one page and handles the links 28 # so they pop things up on the user's desktop 29 # 30 # RUN AS FOLLOWS: 31 # about <file.html> 32 # 33 # ====================================================================== 34 # AUTHOR: Michael McLennan, Purdue University 35 # Copyright (c) 2004-2008 Purdue Research Foundation 36 # 37 # See the file "license.terms" for information on usage and 38 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 39 # ====================================================================== 19 40 20 . $RAPPTURE_INSTALL_DIR/bin/rappture.env 21 exec $RAPPTURE_INSTALL_DIR/bin/about.tcl $* 41 package require http 42 package require Rappture 43 package require RapptureGUI 44 45 option add *BugReport*banner*foreground white 46 option add *BugReport*banner*background #a9a9a9 47 option add *BugReport*banner*highlightBackground #a9a9a9 48 option add *BugReport*banner*font -*-helvetica-bold-r-normal-*-18-* 49 50 # install a better bug handler 51 Rappture::bugreport::install 52 53 proc escapeChars {info} { 54 regsub -all & $info \001 info 55 regsub -all \" $info {\"} info 56 regsub -all < $info {\<} info 57 regsub -all > $info {\>} info 58 regsub -all \001 $info {\&} info 59 return $info 60 } 61 62 # 63 # Process command line args to get the name of the HTML file... 64 # 65 if {[llength $argv] != 1} { 66 puts stderr "usage: about.tcl <file.html>" 67 exit 1 68 } 69 set url [lindex $argv 0] 70 71 Rappture::Scroller .scroller -xscrollmode auto -yscrollmode auto 72 pack .scroller -expand yes -fill both 73 74 Rappture::HTMLviewer .scroller.html -width 640 -height 480 75 .scroller contents .scroller.html 76 77 switch -regexp -- $url { 78 ^https?:// { 79 if {[catch {http::geturl $url} token] == 0} { 80 set html [http::data $token] 81 http::cleanup $token 82 } else { 83 set html "<html><body><h1>Oops! Internal Error</h1><p>[escapeChars $token]</p></body></html>" 84 } 85 .scroller.html load $html 86 } 87 default { 88 if {[string range $url 0 6] == "file://"} { 89 set file [string range $url 7 end] 90 } else { 91 set file $url 92 } 93 set cmds { 94 set fid [open $file r] 95 set html [read $fid] 96 close $fid 97 } 98 if {[catch $cmds result]} { 99 set html "<html><body><h1>Oops! File Not Found</h1><p>[escapeChars $result]</p></body></html>" 100 } 101 102 # not HTML? then escape nasty characters and display it. 103 if {![regexp {<html>.*</html>} $html]} { 104 set html "<html><body><p>[escapeChars $html]</p></body></html>" 105 } 106 .scroller.html load $html -in $file 107 } 108 } -
trunk/gui/apps/rappture.env.in
r1101 r1111 36 36 export MATLABPATH OCTAVE_PATH PERL5LIB RUBYLIB TCL_LIBRARY TK_LIBRARY 37 37 38 # This is specifically for python right now. 39 for i in $RAPPTURE_INSTALL_DIR/bin/_*.env ; do 40 . $i 41 done 38 # This is done specifically for python right now. 39 python="$RAPPTURE_INSTALL_DIR/bin/python.env" 40 if test -x "$python" ; then 41 . $python 42 fi 42 43 -
trunk/gui/apps/simsim.in
r712 r1111 1 1 #!/bin/sh 2 # ----------------------------------------------------------------------3 # SIMSIM KICKOFF SCRIPT4 #5 2 # ====================================================================== 6 3 # AUTHOR: Derrick S. Kearney, Purdue University … … 10 7 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 8 # ====================================================================== 12 13 RAPPTURE_INSTALL_DIR=@prefix@ 14 15 . $RAPPTURE_INSTALL_DIR/bin/rappture.env 16 exec $RAPPTURE_INSTALL_DIR/bin/simsim.tcl $* 9 #\ 10 RAPPTURE_INSTALL_DIR=@prefix@ ; \ 11 . $RAPPTURE_INSTALL_DIR/bin/rappture.env ; \ 12 exec wish $0 $* 13 14 package require Rappture 15 package require RapptureGUI 16 17 proc defaultHandler {child} { 18 set childchildList {} 19 set units [$child get "units"] 20 # this is for nanowire 21 if {[string is integer -strict $units]} { 22 set units "" 23 } 24 set defaultVal [$child get "default"] 25 if {"" != $defaultVal} { 26 if {"" != $units} { 27 set defaultVal [Rappture::Units::convert $defaultVal \ 28 -context $units -to $units -units on] 29 } 30 $child put "current" $defaultVal 31 } else { 32 if {"components" != [$child element -as type]} { 33 set childchildList [$child children] 34 } elseif {"parameters" != [$child element -as type]} { 35 set childchildList [$child children] 36 } else { 37 set childchildList [$child children] 38 } 39 } 40 return $childchildList 41 } 42 43 proc numberHandler {child} { 44 set value "" 45 set units [$child get "units"] 46 set min [$child get "min"] 47 set max [$child get "max"] 48 49 if {"" != $min} { 50 if {"" != $units} { 51 # check to see if the user added units to their min value 52 # apps like mosfet need this check. 53 set min [Rappture::Units::convert $min \ 54 -context $units -to $units -units off] 55 if {[string is double -strict $min]} { 56 # pass 57 } 58 } 59 } 60 61 if {"" != $max} { 62 if {"" != $units} { 63 # check to see if the user added units to their min value 64 # apps like mosfet need this check. 65 set max [Rappture::Units::convert $max \ 66 -context $units -to $units -units off] 67 if {[string is double -strict $max]} { 68 # pass 69 } 70 } 71 } 72 73 if {"yes" == [$child get "simset"]} { 74 $child remove "simset" 75 } else { 76 if { ("" != $min) && ("" != $max) } { 77 set value [random $min $max] 78 $child put current $value$units 79 } else { 80 defaultHandler $child 81 } 82 } 83 } 84 85 proc integerHandler {child} { 86 set value "" 87 set units [$child get "units"] 88 set min [$child get "min"] 89 set max [$child get "max"] 90 91 # nanowire needs this because they set units == 0 and 1 ??? 92 if {[string is integer -strict $units]} { 93 set units "" 94 } 95 96 if {"" != $min} { 97 if {"" != $units} { 98 # check to see if the user added units to their min value 99 # apps like mosfet need this check. 100 set min [Rappture::Units::convert $min \ 101 -context $units -to $units -units off] 102 if {[string is integer -strict $min]} { 103 # pass 104 } 105 } 106 } 107 108 if {"" != $max} { 109 if {"" != $units} { 110 # check to see if the user added units to their min value 111 # apps like mosfet need this check. 112 set max [Rappture::Units::convert $max \ 113 -context $units -to $units -units off] 114 if {[string is integer -strict $max]} { 115 # pass 116 } 117 } 118 } 119 120 if {"yes" == [$child get "simset"]} { 121 $child remove "simset" 122 } else { 123 if { ("" != $min) && ("" != $max) } { 124 set value [randomInt $min $max] 125 $child put current $value$units 126 } else { 127 defaultHandler $child 128 } 129 } 130 131 } 132 133 proc booleanHandler {child} { 134 if {"yes" == [$child get "simset"]} { 135 $child remove "simset" 136 } else { 137 set value [expr {int(rand()*2)}] 138 if {$value == 1} { 139 set value "yes" 140 } else { 141 set value "no" 142 } 143 $child put "current" $value 144 } 145 } 146 147 proc loaderHandler {child toolDir} { 148 149 set exDir [file join $toolDir "examples"] 150 if {! [file isdirectory $exDir]} { 151 puts "could not find examples directory" 152 exit 0 153 } 154 155 set exPathExp [$child get example] 156 set fpath [file join $exDir $exPathExp] 157 set exFileList [glob -nocomplain $fpath] 158 159 if {0 == [llength $exFileList]} { 160 puts "while searching examples directory: $exDir" 161 puts "could not open find files matching regex: $exPathExp" 162 set defaultEx [$child get "default"] 163 if {[file exists [file join $exDir $defaultEx]]} { 164 lappend exFileList $defaultEx 165 puts "using default example file" 166 } else { 167 puts "default example file does not exists, exiting" 168 exit 0; 169 } 170 } 171 172 set importExFileIdx [expr {int(rand()*[llength $exFileList])}] 173 set importExFile [lindex $exFileList $importExFileIdx] 174 175 if {! [file exists $importExFile]} { 176 # importExFile does not exist 177 } 178 179 set exlib [Rappture::library $importExFile] 180 181 # get the about.label from the file 182 # if about.label does not exist, use the file name 183 set importExLabel [$exlib get about.label] 184 if {"" != $importExLabel} { 185 set currentVal $importExLabel 186 } else { 187 set currentVal [file tail $importExFile] 188 } 189 190 $child put "current" $currentVal 191 192 set exlibChildList [::Rappture::entities -as object $exlib "input"] 193 return $exlibChildList 194 } 195 196 proc groupHandler {child} { 197 return [$child children -as object] 198 } 199 200 proc choiceHandler {child} { 201 if {"yes" == [$child get "simset"]} { 202 $child remove "simset" 203 } else { 204 set optList [$child children -as object -type option] 205 set optIdx [expr {int(rand()*[llength $optList])}] 206 set optLib [lindex $optList $optIdx] 207 set value [$optLib get value] 208 if {"" == $value} { 209 set value [$optLib get about.label] 210 } 211 $child put "current" $value 212 } 213 } 214 215 proc defaultize {xmlobj} { 216 set childList [$xmlobj children -as object input] 217 218 while {[llength $childList]} { 219 set child [lrange $childList 0 0] 220 set childList [lreplace $childList 0 0] 221 222 switch -- [$child element -as type] { 223 number { defaultHandler $child } 224 integer { defaultHandler $child } 225 boolean { defaultHandler $child } 226 string { defaultHandler $child } 227 choice { defaultHandler $child } 228 loader { loaderHandler $child } 229 structure { defaultHandler $child } 230 group { set cclist [groupHandler $child] 231 set childList [concat $childList $cclist] } 232 default { defaultHandler $child } 233 } 234 } 235 } 236 237 proc randomize {presetArr xmlobj toolDir} { 238 upvar $presetArr presets 239 set childList [$xmlobj children -as object input] 240 241 while {[llength $childList]} { 242 #foreach c $childList { 243 # puts "c = [$c element -as path]" 244 #} 245 #puts "-------------------------------------------" 246 247 set child [lrange $childList 0 0] 248 set childList [lreplace $childList 0 0] 249 250 #puts [$child element -as path] 251 set cpath [cleanPath [$child element -as path]] 252 253 set ppath [$child parent -as path] 254 set cPresets [array get presets $cpath*] 255 256 foreach {cPresetsPath cPresetsVal} $cPresets { 257 set cutIdx [expr {[string length $cpath] + 1}] 258 set iPath [string range $cPresetsPath $cutIdx end] 259 260 # apply the preset value and remove from preset array 261 $child put $iPath $cPresetsVal 262 unset presets($cPresetsPath) 263 264 # if the value was set on a current node, then set a preset flag 265 set lastdot [string last "." $iPath] 266 if {$lastdot > 0} { 267 incr lastdot 1 268 set tailNode [string range $iPath $lastdot end] 269 if {"current" == $tailNode} { 270 incr lastdot -2 271 set headNode [string range $iPath 0 $lastdot] 272 $child put $headNode.simset "yes" 273 } 274 } 275 } 276 277 switch -- [$child element -as type] { 278 number { numberHandler $child } 279 integer { integerHandler $child } 280 boolean { booleanHandler $child } 281 string { defaultHandler $child } 282 choice { choiceHandler $child } 283 loader { 284 set cpath [$child element -as path] 285 set ccList [loaderHandler $child $toolDir] 286 foreach cc $ccList { 287 set ccpath [$cc element -as path] 288 # even though the loader might have been returned in ccList 289 # do not add the loader back to the childList or you might 290 # get an infinite loop 291 if {$cpath != $ccpath} { 292 set ccpath [cleanPath $ccpath] 293 $xmlobj copy $ccpath from $cc "" 294 lappend childList [$xmlobj element -as object $ccpath] 295 } 296 } 297 } 298 structure { defaultHandler $child } 299 group { 300 set ccList [groupHandler $child] 301 set childList [concat $childList $ccList] 302 } 303 default { defaultHandler $child } 304 } 305 } 306 } 307 308 proc random {m M} { 309 return [expr {$m+(rand()*($M-$m+1))}] 310 } 311 312 proc randomInt {m M} { 313 return [expr {$m+(int(rand()*($M-$m+1)))}] 314 } 315 316 proc cleanPath { path } { 317 if {"." == [string index $path 0]} { 318 # this is because tcl's library module (element -as path) 319 # returns a crazy dot in the 0th position 320 set path [string range $path 1 end] 321 } 322 return $path 323 } 324 325 proc parsePathVal {listVar returnVar} { 326 upvar $listVar params 327 upvar $returnVar presetArr 328 catch {unset presetArr} 329 330 # initialize variables 331 set pathValStr "" 332 set match "junk" 333 334 while {"" != $match} { 335 set match "" 336 set path "" 337 set val "" 338 set val2 "" 339 set val3 "" 340 set val4 "" 341 set pathValStr [string trimleft [join $params " "]] 342 343 # search the params for: 344 # 1) xml path 345 # 2) followed by = sign 346 # 3) followed by a starting " sign 347 # 4) followed by any text (including spaces) 348 # 5) followed by an ending " sign 349 # ex: input.number(temperature).current="400K" 350 # ex: input.number(temperature).current=400K 351 # ex: input.string(blahh).current="hi momma, i love you!" 352 # \"([^\"]+)\" 353 # ((\"([^\"]+)\")|(:([^:]+):)|(\'([^\']+)\')|([^\s]+)) 354 regexp -expanded { 355 ( 356 [a-zA-Z0-9]+(\([a-zA-Z0-9._]+\))? 357 (\.[a-zA-Z0-9]+(\([a-zA-Z0-9._]+\))?)* 358 ) 359 = 360 ((\"([^\"]+)\")|(\'([^\']+)\')|([^\s]+)) 361 } $pathValStr match path junk junk junk val junk val2 junk val3 val4 362 363 364 if {"" != $match} { 365 # remove the matching element from orphaned params list 366 foreach p [split $match] { 367 set paramsIdx [lsearch -exact $params $p] 368 set params [lreplace $params $paramsIdx $paramsIdx] 369 } 370 371 if {("" != $val2) && ("" == $val3) && ("" == $val4)} { 372 set val $val2 373 } elseif {("" == $val2) && ("" != $val3) && ("" == $val4)} { 374 set val $val3 375 } elseif {("" == $val2) && ("" == $val3) && ("" != $val4)} { 376 set val $val4 377 } 378 379 # add the name and value to our preset array 380 set presetArr($path) $val 381 } 382 } 383 } 384 385 proc printHelp {} { 386 puts "simsim ?--tool <path> | --driver <path>? ?--randomize? ?--compare <path>? ?--help?" 387 puts "" 388 puts " --tool <path> - use the tool.xml file specified at <path>" 389 puts " --randomize - use random values instead of default" 390 puts " values for inputs elements" 391 puts " --driver <path> - run the application with the provided" 392 puts " driver.xml file." 393 puts " --compare <path> - compare the results with the provided" 394 puts " run.xml file." 395 puts " --driver-only <fname> - only create the driver file, do not run" 396 puts " --help - print this help menu." 397 exit 0 398 } 399 400 proc diffs {xmlobj1 xmlobj2} { 401 set rlist "" 402 403 # query the values for all entities in both objects 404 set thisv [concat [Rappture::entities $xmlobj1 "input"] [Rappture::entities $xmlobj1 "output"]] 405 set otherv [concat [Rappture::entities $xmlobj2 "input"] [Rappture::entities $xmlobj2 "output"]] 406 407 # scan through values for this object and compare against other one 408 foreach path $thisv { 409 set i [lsearch -exact $otherv $path] 410 if {$i < 0} { 411 foreach {raw norm} [value $xmlobj1 $path] break 412 lappend rlist - $path $raw "" 413 } else { 414 foreach {traw tnorm} [value $xmlobj1 $path] break 415 foreach {oraw onorm} [value $xmlobj2 $path] break 416 if {![string equal $tnorm $onorm]} { 417 lappend rlist c $path $traw $oraw 418 } 419 set otherv [lreplace $otherv $i $i] 420 } 421 } 422 423 #add any values left over in the other object 424 foreach path $otherv { 425 foreach {oraw onorm} [Rappture::LibraryObj::value $xmlobj2 $path] break 426 lappend rlist + $path "" $oraw 427 } 428 return $rlist 429 } 430 431 proc value {libobj path} { 432 switch -- [$libobj element -as type $path] { 433 structure { 434 set raw $path 435 # try to find a label to represent the structure 436 set val [$libobj get $path.about.label] 437 if {"" == $val} { 438 set val [$libobj get $path.current.about.label] 439 } 440 if {"" == $val} { 441 if {[$libobj element $path.current] != ""} { 442 set comps [$libobj children $path.current.components] 443 set val "<structure> with [llength $comps] components" 444 } else { 445 set val "<structure>" 446 } 447 } 448 return [list $raw $val] 449 } 450 number { 451 # get the usual value... 452 set raw "" 453 if {"" != [$libobj element $path.current]} { 454 set raw [$libobj get $path.current] 455 } elseif {"" != [$libobj element $path.default]} { 456 set raw [$libobj get $path.default] 457 } 458 if {"" != $raw} { 459 set val $raw 460 # then normalize to default units 461 set units [$libobj get $path.units] 462 if {"" != $units} { 463 set val [Rappture::Units::convert $val \ 464 -context $units -to $units -units off] 465 } 466 } 467 return [list $raw $val] 468 } 469 curve { 470 set raw "" 471 if {"" != [$libobj element $path.component.xy]} { 472 set raw [$libobj get $path.component.xy] 473 } 474 return [list $raw $raw] 475 } 476 log { 477 set raw "" 478 if {"" != [$libobj element]} { 479 set raw [$libobj get] 480 } 481 return [list $raw $raw] 482 } 483 cloud { 484 set raw "" 485 if {"" != [$libobj element $path.points]} { 486 set raw [$libobj get $path.points] 487 } 488 return [list $raw $raw] 489 } 490 field { 491 set raw "" 492 if {"" != [$libobj element $path.component.values]} { 493 set raw [$libobj get $path.component.values] 494 } 495 return [list $raw $raw] 496 } 497 498 499 } 500 501 # for all other types, get the value (current, or maybe default) 502 set raw "" 503 if {"" != [$libobj element $path.current]} { 504 set raw [$libobj get $path.current] 505 } elseif {"" != [$libobj element $path.default]} { 506 set raw [$libobj get $path.default] 507 } 508 return [list $raw $raw] 509 } 510 511 512 513 514 # keep the wish window from popping up 515 wm withdraw . 516 517 # set default values 518 set intf "./tool.xml" 519 set cintf "" 520 set defaults true 521 array set presets [] 522 set i 0 523 set oParams {} 524 set runapp true 525 set outf "driver.xml" 526 527 # parse command line arguments 528 set argc [llength $argv] 529 for {set i 0} {$i < $argc} {incr i} { 530 set opt [lindex $argv $i] 531 if {("-t" == $opt) || ("--tool" == $opt)} { 532 if {[expr {$i + 1}] < $argc} { 533 incr i 534 set intf [lindex $argv $i] 535 # puts "using $intf" 536 # need to check to see if file exists, if not raise error 537 } else { 538 printHelp 539 } 540 } elseif {("-d" == $opt) || ("--driver" == $opt)} { 541 if {[expr {$i + 1}] < $argc} { 542 incr i 543 set intf [lindex $argv $i] 544 # puts "using $intf" 545 # need to check to see if file exists, if not raise error 546 } else { 547 printHelp 548 } 549 } elseif {("-r" == $opt) || ("--randomize" == $opt)} { 550 set defaults false 551 } elseif {("-c" == $opt) || ("--compare" == $opt)} { 552 if {[expr {$i + 1}] < $argc} { 553 incr i 554 set cintf [lindex $argv $i] 555 # puts "comparing results with $cintf" 556 # need to check to see if file exists, if not raise error 557 } else { 558 printHelp 559 } 560 } elseif {("-do" == $opt) || ("--driver-only" == $opt)} { 561 set runapp false 562 if {[expr {$i + 1}] < $argc} { 563 incr i 564 set outf [lindex $argv $i] 565 } else { 566 printHelp 567 } 568 } elseif {("-h" == $opt) || ("--help" == $opt)} { 569 printHelp 570 } else { 571 # puts "bad value: $argv" 572 # printHelp 573 # place all extra params in the params array 574 lappend oParams $opt 575 } 576 } 577 578 # parse out path=val combinations from the list of orphaned parameters 579 parsePathVal oParams presets 580 if {0 != [llength $oParams]} { 581 puts "Could not understand the following parameters" 582 puts "oParams = $oParams" 583 puts "length oParams = [llength $oParams]" 584 } 585 586 set err "" 587 if {! [file exists $intf]} { 588 append err "\ntool file \"" $intf "\" does not exist, use -t option\n" 589 puts $err 590 printHelp 591 } 592 593 set xmlobj [Rappture::library $intf] 594 set installdir [file dirname $intf] 595 596 if {true == $defaults} { 597 defaultize $xmlobj 598 } else { 599 randomize presets $xmlobj $installdir 600 } 601 # pick defaults $xmlobj $presets 602 # pick randoms $xmlobj $presets 603 604 # if driver only flag was given, write driver and exit. 605 if {$runapp == false} { 606 set fid [open $outf w] 607 puts $fid [$xmlobj xml] 608 close $fid 609 exit 0 610 } 611 612 set tool [Rappture::Tool ::#auto $xmlobj $installdir] 613 614 # read the run.xml file. 615 # from analyzer.tcl: 616 617 # execute the job 618 foreach {status result} [eval $tool run] break 619 620 # read back the result from run.xml 621 if {$status == 0 && $result != "ABORT"} { 622 if {[regexp {=RAPPTURE-RUN=>([^\n]+)} $result match file]} { 623 set resultxmlobj [Rappture::library $file] 624 625 # do comparison if user chose to compare with other results 626 if {"" != $cintf} { 627 if {"" != $resultxmlobj} { 628 set compobj [Rappture::library $cintf] 629 set difflist [diffs $resultxmlobj $compobj] 630 if {[llength $difflist] > 0} { 631 puts $difflist 632 } 633 } 634 } 635 } else { 636 set status 1 637 puts "Can't find result file in output.\nDid you call Rappture::result in your simulator?" 638 } 639 } else { 640 puts $result 641 } 642 643 exit 0 -
trunk/gui/scripts/heightmapviewer.tcl
r1013 r1111 68 68 protected method _send_dataobjs {} 69 69 protected method _receive_image {option size} 70 protected method _receive_legend {ivol vmin vmax size}70 protected method ReceiveLegend {ivol vmin vmax size} 71 71 protected method _receive_echo {channel {data ""}} 72 72 … … 125 125 # 126 126 $_parser alias image [itcl::code $this _receive_image] 127 $_parser alias legend [itcl::code $this _receive_legend]127 $_parser alias legend [itcl::code $this ReceiveLegend] 128 128 129 129 # Initialize the view to some default parameters. … … 580 580 # tell the engine to expect some data 581 581 set nbytes [string length $data] 582 582 if { ![SendBytes "heightmap data follows $nbytes"] } { 583 583 return 584 584 } … … 647 647 648 648 # ---------------------------------------------------------------------- 649 # USAGE: _receive_legend <volume> <vmin> <vmax> <size>649 # USAGE: ReceiveLegend <volume> <vmin> <vmax> <size> 650 650 # 651 651 # Invoked automatically whenever the "legend" command comes in from … … 653 653 # specified <size> will follow. 654 654 # ---------------------------------------------------------------------- 655 itcl::body Rappture::HeightmapViewer:: _receive_legend {ivol vmin vmax size} {655 itcl::body Rappture::HeightmapViewer::ReceiveLegend {ivol vmin vmax size} { 656 656 if { [isconnected] } { 657 657 set bytes [ReceiveBytes $size] … … 671 671 -fill $itk_option(-plotforeground) -tags vmax 672 672 } 673 $c itemconfigure vmin -text $ _limits(vmin)673 $c itemconfigure vmin -text $vmin 674 674 $c coords vmin 10 [expr {$h-8}] 675 $c itemconfigure vmax -text $ _limits(vmax)675 $c itemconfigure vmax -text $vmax 676 676 $c coords vmax [expr {$w-10}] [expr {$h-8}] 677 677 } … … 951 951 set color white 952 952 set cmap "0.0 [Color2RGB $color] " 953 append cmap "$_limits(vmin) [Color2RGB $color] "954 953 set range [expr $_limits(vmax) - $_limits(vmin)] 955 954 for {set i 0} {$i < [llength $clist]} {incr i} { 956 955 set xval [expr {double($i+1)/([llength $clist]+1)}] 957 set xval [expr ($xval * $range) + $_limits(vmin)]958 956 set color [lindex $clist $i] 959 957 append cmap "$xval [Color2RGB $color] " 960 958 } 961 append cmap "$_limits(vmax) [Color2RGB $color] " 962 append cmap "1.0 [Color2RGB $color]" 959 append cmap "1.0 [Color2RGB $color] " 963 960 964 961 set opacity $style(-opacity) … … 987 984 lappend wmap 1.0 0.0 988 985 } 989 990 986 return [list $sname $cmap $wmap] 991 987 } -
trunk/gui/scripts/unirect2d.tcl
r919 r1111 25 25 public method mesh {} 26 26 public method values {} 27 public method hints {{keyword ""}} 27 28 28 29 private variable _xmax 0 … … 33 34 private variable _ynum 0 34 35 private variable _zv ""; # BLT vector containing the z-values 36 private variable _hints 35 37 } 36 38 … … 167 169 } 168 170 171 172 # ---------------------------------------------------------------------- 173 # USAGE: hints ?<keyword>? 174 # 175 # Returns a list of key/value pairs for various hints about plotting 176 # this curve. If a particular <keyword> is specified, then it returns 177 # the hint for that <keyword>, if it exists. 178 # ---------------------------------------------------------------------- 179 itcl::body Rappture::UniRect2d::hints {{keyword ""}} { 180 if {![info exists _hints]} { 181 foreach {key path} { 182 group about.group 183 label about.label 184 color about.color 185 style about.style 186 type about.type 187 xlabel xaxis.label 188 xdesc xaxis.description 189 xunits xaxis.units 190 xscale xaxis.scale 191 xmin xaxis.min 192 xmax xaxis.max 193 ylabel yaxis.label 194 ydesc yaxis.description 195 yunits yaxis.units 196 yscale yaxis.scale 197 ymin yaxis.min 198 ymax yaxis.max 199 } { 200 set str [$_curve get $path] 201 if {"" != $str} { 202 set _hints($key) $str 203 } 204 } 205 206 if {[info exists _hints(xlabel)] && "" != $_hints(xlabel) 207 && [info exists _hints(xunits)] && "" != $_hints(xunits)} { 208 set _hints(xlabel) "$_hints(xlabel) ($_hints(xunits))" 209 } 210 if {[info exists _hints(ylabel)] && "" != $_hints(ylabel) 211 && [info exists _hints(yunits)] && "" != $_hints(yunits)} { 212 set _hints(ylabel) "$_hints(ylabel) ($_hints(yunits))" 213 } 214 215 if {[info exists _hints(group)] && [info exists _hints(label)]} { 216 # pop-up help for each curve 217 set _hints(tooltip) $_hints(label) 218 } 219 } 220 221 if {$keyword != ""} { 222 if {[info exists _hints($keyword)]} { 223 return $_hints($keyword) 224 } 225 return "" 226 } 227 return [array get _hints] 228 } -
trunk/gui/scripts/visviewer.tcl
r1081 r1111 21 21 22 22 private common _servers ;# array of visualization server lists 23 #set _servers(nanovis) "128.210.189.216:2000"24 23 set _servers(nanovis) "" 25 24 set _servers(pymol) "" 25 #set _servers(nanovis) "128.210.189.216:2000" 26 #set _servers(pymol) "128.210.189.216:2020" 26 27 27 28 protected variable _dispatcher "" ;# dispatcher for !events -
trunk/gui/scripts/xyresult.tcl
r1104 r1111 124 124 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 125 125 126 127 126 itk_component add plot { 128 127 blt::graph $itk_interior.plot \ … … 134 133 pack $itk_component(plot) -expand yes -fill both 135 134 $itk_component(plot) pen configure activeLine \ 136 -symbol square -pixels 3 -linewidth 2 -color black 135 -symbol square -pixels 3 -linewidth 2 \ 136 -outline black -fill red -color black 137 137 138 138 # … … 200 200 201 201 # 202 # Add supportfor editing hidden/elements:202 # Add legend for editing hidden/elements: 203 203 # 204 204 itk_component add legend { … … 206 206 -borderwidth 1 -padx 3 -pady 0 \ 207 207 -text "L" -font "-*-times new roman-bold-i-*-*-11-*-*-*-*-*-*-*" \ 208 208 -command [list $itk_component(hull).legend activate \ 209 209 $itk_component(controls).legend left] 210 210 } { … … 214 214 } 215 215 pack $itk_component(legend) -padx 4 -pady 4 216 Rappture::Tooltip::for $itk_component(legend) "Display legend to hide/show elements" 216 Rappture::Tooltip::for $itk_component(legend) \ 217 "Display legend to hide/show elements" 217 218 218 219 Rappture::Balloon $itk_component(hull).legend -title "Legend" … … 639 640 } 640 641 $g legend bind all <ButtonRelease> [itcl::code $this _legend toggle] 642 $g legend bind all <ButtonRelease-3> [itcl::code $this _legend showall] 643 $g legend bind all <ButtonRelease-2> [itcl::code $this _legend showone] 641 644 642 645 # … … 842 845 set g $itk_component(plot) 843 846 set elem "" 847 848 # Peek inside of Blt_ZoomStack package to see if we're currently in the 849 # middle of a zoom selection. 850 if {[info exists ::zoomInfo($g,corner)] && $::zoomInfo($g,corner) == "B" } { 851 return; 852 } 844 853 if {$state == "at"} { 845 854 if {[$g element closest $x $y info -interpolate yes]} { … … 1541 1550 } 1542 1551 } 1543 } 1544 } 1552 "showall" { 1553 set g $itk_component(plot) 1554 set cur [$g legend get current] 1555 foreach name [$g element show] { 1556 $g legend deactivate $name 1557 $g element configure $name -hide no 1558 update 1559 } 1560 $g element configure $cur -hide yes 1561 $g legend activate $cur 1562 } 1563 "showone" { 1564 set g $itk_component(plot) 1565 set cur [$g legend get current] 1566 foreach name [$g element show] { 1567 $g legend activate $name 1568 $g element configure $name -hide yes 1569 } 1570 $g element configure $cur -hide no 1571 $g legend deactivate $cur 1572 } 1573 } 1574 }
Note: See TracChangeset
for help on using the changeset viewer.