Ignore:
Timestamp:
Apr 26, 2006, 6:42:46 PM (18 years ago)
Author:
mmc
Message:
  • Added <description> capability to output objects, including axes.
  • Fixed the ResultSet? so that it is more compact and supports the simulation number as a parameter. This is useful when there are datasets with wildly varying parameters.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/analyzer.tcl

    r216 r413  
    6464    protected method _simState {state args}
    6565    protected method _simOutput {message}
     66    protected method _resultTooltip {}
    6667
    6768    private variable _tool ""          ;# belongs to this tool
     
    7071    private variable _pages 0          ;# number of pages for result sets
    7172    private variable _label2page       ;# maps output label => result set
     73    private variable _label2desc       ;# maps output label => description
    7274    private variable _lastlabel ""     ;# label of last example loaded
    7375    private variable _plotlist ""      ;# items currently being plotted
     
    7577    private common job                 ;# array var used for blt::bgexec jobs
    7678
    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
     85proc analyzer_init_resources {} {
     86    Rappture::resources::register \
     87        results_directory Rappture::Analyzer::setResultDir
    9288}
    9389                                                                               
     
    214210        [itcl::code $this download coming]
    215211
     212    Rappture::Tooltip::for $itk_component(resultselector) \
     213        "@[itcl::code $this _resultTooltip]"
     214
    216215    if {[Rappture::filexfer::enabled]} {
    217216        $itk_component(resultselector) choices insert end \
     
    221220
    222221        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 \
    224223                -borderwidth 1 -relief flat -overrelief raised \
    225224                -command [itcl::code $this download now $w.top.dl]
     
    235234
    236235    itk_component add results {
    237         Rappture::Panes $w.pane
     236        Rappture::Panes $w.pane -sashwidth 1 -sashrelief solid -sashpadding {4 0}
    238237    }
    239238    pack $itk_component(results) -expand yes -fill both
     
    254253    pack $itk_component(resultset) -expand yes -fill both
    255254    bind $itk_component(resultset) <<Control>> [itcl::code $this _fixSize]
     255    bind $itk_component(results) <Configure> [itcl::code $this _fixSize]
    256256
    257257    eval itk_initialize $args
     
    360360                set result "$msg\n$errorInfo"
    361361            }
     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            }
    362368        } else {
    363369            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?"
    365371        }
    366372    }
     
    465471    # if there are any valid results, add them to the resultset
    466472    if {$haveresults} {
    467         set size [$itk_component(resultset) size]
    468473        set index [$itk_component(resultset) add $xmlobj]
    469474
     
    483488                    set page [$itk_component(resultpages) insert end $name]
    484489                    set _label2page($label) $page
     490                    set _label2desc($label) \
     491                        [$xmlobj get output.$item.about.description]
    485492                    Rappture::ResultViewer $page.rviewer
    486493                    pack $page.rviewer -expand yes -fill both -pady 4
     
    535542
    536543    $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
    538550
    539551    foreach label [array names _label2page] {
     
    544556    $itk_component(resultselector) choices delete 0 end
    545557    catch {unset _label2page}
     558    catch {unset _label2desc}
    546559    set _plotlist ""
    547560
     
    775788# ----------------------------------------------------------------------
    776789itcl::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
    780797    }
    781798    _fixSimControl
     
    937954
    938955# ----------------------------------------------------------------------
     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# ----------------------------------------------------------------------
     964itcl::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# ----------------------------------------------------------------------
    939978# USAGE: _fixSimControl
    940979#
Note: See TracChangeset for help on using the changeset viewer.