Changeset 413 for trunk/gui/scripts/analyzer.tcl
- Timestamp:
- Apr 26, 2006, 6:42:46 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/analyzer.tcl
r216 r413 64 64 protected method _simState {state args} 65 65 protected method _simOutput {message} 66 protected method _resultTooltip {} 66 67 67 68 private variable _tool "" ;# belongs to this tool … … 70 71 private variable _pages 0 ;# number of pages for result sets 71 72 private variable _label2page ;# maps output label => result set 73 private variable _label2desc ;# maps output label => description 72 74 private variable _lastlabel "" ;# label of last example loaded 73 75 private variable _plotlist "" ;# items currently being plotted … … 75 77 private common job ;# array var used for blt::bgexec jobs 76 78 77 private common icons 78 set icons(download) [image create photo -data { 79 R0lGODlhFAAUAMYBAAAAAP///+js9vL1+4yhxrbD21h6sFp8slx+tV6Bt2CFumSIvmOHvWaLwGyS 80 yG6UynCRwWiOw2yUyXCZzm+XzG+Wy3Oc0XKaz3We1Hqk23mj2Xqk2nmi2ICex/T3+3Od0nqm3Hag 81 1Xun3Iat3ZK56JK03t7n8uzy+PX4+/f5+/T4+/L3+vn7/Pj7/Pf7/Pb6+/n9/fz///r9/fn8/Pz+ 82 /vv9/fr8/Pz9/UGMfluegZzRp6XYqwWXC67frwCZAAKaAgOaAgOaAwWbBQabBQicCA6fDg6eDw+f 83 Dw+fEA+eDxCfEF6/Xl+/X6TbpKbbpqzerK7frq3era/fr/z+/P3+/bXjsXjSbKrjotbw02bSVKvj 84 olnSQYPfcJbjh5/jk1TSOV7XQm3bVIvidprmiKjqmXTgV4DjZrPuo7TupNb1zo/qc5nsf8L0s8Hz 85 sar0j7L1mdD5wdH5wur+4eL91f///////////////////////////////////////////////yH5 86 BAEAAH8ALAIAAgAQABAAAAfYgAUlIiAbHCEYHxcTFRIdBX8jJJOUlZQQfyKam5ycDX8ZAaKjpKMM 87 fxoBLC0pHis7Rz5GOiYBCn8cATI2LC8oSFhVWEkCAQl/IQE3NTIzLj5aVlc+JwEIfxgBNDXLMD5e 88 WV4+AwEHfxbaNNs1Pl1bXT4qAQZ/FAExPUo++1xfXPs+eEh5IIpJGjJjxIQBE0bMGDJpljgQFQUI 89 GjNlMmY0c0bIEwIRGizAEYTNGjUo17QhkoPKn5cvnwSJ88bNGzhEmkyByfPJDzlz5AxxspMnTyix 90 ijxx+TIQADs= 91 }] 79 # resources file tells us the results directory 80 public common _resultdir "" 81 public proc setResultDir {path} { set _resultdir $path } 82 } 83 84 # must use this name -- plugs into Rappture::resources::load 85 proc analyzer_init_resources {} { 86 Rappture::resources::register \ 87 results_directory Rappture::Analyzer::setResultDir 92 88 } 93 89 … … 214 210 [itcl::code $this download coming] 215 211 212 Rappture::Tooltip::for $itk_component(resultselector) \ 213 "@[itcl::code $this _resultTooltip]" 214 216 215 if {[Rappture::filexfer::enabled]} { 217 216 $itk_component(resultselector) choices insert end \ … … 221 220 222 221 itk_component add download { 223 button $w.top.dl -image $icons(download)-anchor e \222 button $w.top.dl -image [Rappture::icon download] -anchor e \ 224 223 -borderwidth 1 -relief flat -overrelief raised \ 225 224 -command [itcl::code $this download now $w.top.dl] … … 235 234 236 235 itk_component add results { 237 Rappture::Panes $w.pane 236 Rappture::Panes $w.pane -sashwidth 1 -sashrelief solid -sashpadding {4 0} 238 237 } 239 238 pack $itk_component(results) -expand yes -fill both … … 254 253 pack $itk_component(resultset) -expand yes -fill both 255 254 bind $itk_component(resultset) <<Control>> [itcl::code $this _fixSize] 255 bind $itk_component(results) <Configure> [itcl::code $this _fixSize] 256 256 257 257 eval itk_initialize $args … … 360 360 set result "$msg\n$errorInfo" 361 361 } 362 363 # if there's a results_directory defined in the resources 364 # file, then move the run.xml file there for storage 365 if {"" != $_resultdir} { 366 file rename -force -- $file $_resultdir 367 } 362 368 } else { 363 369 set status 1 364 set result "Can't find result file in output :\n\n$result"370 set result "Can't find result file in output.\nDid you call Rappture::result in your simulator?" 365 371 } 366 372 } … … 465 471 # if there are any valid results, add them to the resultset 466 472 if {$haveresults} { 467 set size [$itk_component(resultset) size]468 473 set index [$itk_component(resultset) add $xmlobj] 469 474 … … 483 488 set page [$itk_component(resultpages) insert end $name] 484 489 set _label2page($label) $page 490 set _label2desc($label) \ 491 [$xmlobj get output.$item.about.description] 485 492 Rappture::ResultViewer $page.rviewer 486 493 pack $page.rviewer -expand yes -fill both -pady 4 … … 535 542 536 543 $itk_component(resultset) clear 537 $itk_component(results) fraction end 0.1 544 545 # reset the size of the controls area 546 set ht [winfo height $itk_component(results)] 547 set cntlht [$itk_component(resultset) size -controlarea] 548 set frac [expr {double($cntlht)/$ht}] 549 $itk_component(results) fraction end $frac 538 550 539 551 foreach label [array names _label2page] { … … 544 556 $itk_component(resultselector) choices delete 0 end 545 557 catch {unset _label2page} 558 catch {unset _label2desc} 546 559 set _plotlist "" 547 560 … … 775 788 # ---------------------------------------------------------------------- 776 789 itcl::body Rappture::Analyzer::_fixSize {} { 777 set f [$itk_component(results) fraction end] 778 if {$f < 0.4} { 779 $itk_component(results) fraction end [expr {$f+0.15}] 790 set ht [winfo height $itk_component(results)] 791 if {$ht <= 1} { set ht [winfo reqheight $itk_component(results)] } 792 set cntlht [$itk_component(resultset) size -controlarea] 793 set frac [expr {double($cntlht)/$ht}] 794 795 if {$frac < 0.4} { 796 $itk_component(results) fraction end $frac 780 797 } 781 798 _fixSimControl … … 937 954 938 955 # ---------------------------------------------------------------------- 956 # USAGE: _resultTooltip 957 # 958 # Used internally to build the tooltip string displayed for the 959 # result selector. If the current page has an associated description, 960 # then it is displayed beneath the result. 961 # 962 # Returns the string for the tooltip. 963 # ---------------------------------------------------------------------- 964 itcl::body Rappture::Analyzer::_resultTooltip {} { 965 set tip "" 966 set name [$itk_component(resultselector) value] 967 if {[info exists _label2desc($name)] && 968 [string length $_label2desc($name)] > 0} { 969 append tip "$_label2desc($name)\n\n" 970 } 971 if {[array size _label2page] > 1} { 972 append tip "Use this control to display other output results." 973 } 974 return $tip 975 } 976 977 # ---------------------------------------------------------------------- 939 978 # USAGE: _fixSimControl 940 979 #
Note: See TracChangeset
for help on using the changeset viewer.