Changeset 766 for trunk/gui


Ignore:
Timestamp:
Jun 10, 2007, 4:06:35 PM (17 years ago)
Author:
mmc
Message:

Fixed the output viewer for numbers/integers to show a plot of
the value versus input parameters. As you change the ResultSet?
control, the x-axis updates to show the number versus values
in the result set.

Fixed the Rappture::result command to include the user's login
in the metadata, so we know who performed the computation.

Location:
trunk/gui/scripts
Files:
1 added
17 edited

Legend:

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

    r739 r766  
    4242    public method delete {args}
    4343    public method scale {args}
     44    public method parameters {title args} { # do nothing }
    4445    public method download {option args}
    4546
  • trunk/gui/scripts/deviceEditor.tcl

    r689 r766  
    3030    public method add {dataobj {settings ""}}
    3131    public method delete {args}
     32    public method parameters {title args} { # do nothing }
    3233
    3334    protected method _redraw {}
  • trunk/gui/scripts/deviceViewer1D.tcl

    r742 r766  
    3535    public method get {}
    3636    public method delete {args}
     37    public method parameters {title args} { # do nothing }
    3738
    3839    public method controls {option args}
  • trunk/gui/scripts/deviceresult.tcl

    r689 r766  
    2828    public method delete {args}
    2929    public method scale {args}
     30    public method parameters {title args} { # do nothing }
    3031    public method download {option args}
    3132
  • trunk/gui/scripts/energyLevels.tcl

    r761 r766  
    4747    public method scale {args}
    4848    public method download {args} {}
     49    public method parameters {title args} { # do nothing }
    4950
    5051    protected method _redraw {{what all}}
     
    270271        -linestyle solid
    271272        -description ""
     273        -param ""
    272274    }
    273275    foreach {opt val} $settings {
  • trunk/gui/scripts/field3dresult.tcl

    r676 r766  
    3737    public method delete {args}
    3838    public method scale {args}
     39    public method parameters {title args} { # do nothing }
    3940    public method download {option args}
    4041
  • trunk/gui/scripts/imageresult.tcl

    r676 r766  
    3232    public method delete {args}
    3333    public method scale {args}
     34    public method parameters {title args} { # do nothing }
    3435    public method download {option args}
    3536
  • trunk/gui/scripts/meshresult.tcl

    r676 r766  
    3636    public method delete {args}
    3737    public method scale {args}
     38    public method parameters {title args} { # do nothing }
    3839    public method download {option args}
    3940
  • trunk/gui/scripts/moleculeViewer.tcl

    r730 r766  
    3434    public method get {}
    3535    public method delete {args}
     36    public method parameters {title args} { # do nothing }
    3637
    3738    public method emblems {option}
  • trunk/gui/scripts/molvisviewer.tcl

    r706 r766  
    3333    public method get {}
    3434    public method delete {args}
     35    public method parameters {title args} { # do nothing }
    3536
    3637    public method emblems {option}
  • trunk/gui/scripts/nanovisviewer.tcl

    r713 r766  
    4444    public method scale {args}
    4545    public method download {option args}
     46    public method parameters {title args} { # do nothing }
    4647
    4748    public method connect {{hostlist ""}}
  • trunk/gui/scripts/resultset.tcl

    r764 r766  
    6565    protected method _drawValue {column widget wmax}
    6666    protected method _toggleAll {{column "current"}}
     67    protected method _getValues {column {which ""}}
    6768    protected method _getTooltip {role column}
    68     protected method _getParamDesc {{index "current"}}
     69    protected method _getParamDesc {which {index "current"}}
    6970
    7071    private variable _dispatcher ""  ;# dispatchers for !events
     
    650651            set col [lindex $args 1]
    651652
    652             if {$col == "xmlobj"} {
    653                  # load the Simulation # control
    654                  set nruns [$_results size]
    655 
    656                  # load the results into the control
    657                  $dial clear
    658                  for {set n 0} {$n < $nruns} {incr n} {
    659                      $dial add "#[expr {$n+1}]" $n
    660                  }
    661                  return
    662             }
    663 
    664             set havenums 1
    665             set vlist ""
    666             foreach rec [$_results get -format [list xmlobj $col]] {
    667                 set xo [lindex $rec 0]
    668                 set v [lindex $rec 1]
    669 
    670                 if {![info exists values($v)]} {
    671                     lappend vlist $v
    672                     foreach {raw norm} [Rappture::LibraryObj::value $xo $col] break
    673                     set values($v) $norm
    674 
    675                     if {$havenums && ![string is double $norm]} {
    676                         set havenums 0
    677                     }
    678                 }
    679             }
    680 
    681             if {!$havenums} {
    682                 # don't have normalized nums? then sort and create nums
    683                 catch {unset values}
    684 
    685                 set n 0
    686                 foreach v [lsort $vlist] {
    687                     set values($v) [incr n]
    688                 }
    689             }
    690 
    691             # load the results into the control
    692653            $dial clear
    693             foreach v [array names values] {
    694                 $dial add $v $values($v)
     654            foreach {label val} [_getValues $col all] {
     655                $dial add $label $val
    695656            }
    696657        }
     
    11141075    _doPrompt off
    11151076
     1077    if {[info exists _cntlInfo($this-$_active-label)]} {
     1078        lappend params $_cntlInfo($this-$_active-label)
     1079    } else {
     1080        lappend params "???"
     1081    }
     1082    eval lappend params [_getValues $_active all]
     1083
    11161084    switch -- [$_results size] {
    11171085        0 {
     
    11211089        1 {
    11221090            # only one data set? then plot it
    1123             _doSettings [list 0 [list -width 2 -description [_getParamDesc]]]
     1091            _doSettings [list \
     1092                0 [list -width 2 \
     1093                        -param [_getValues $_active current] \
     1094                        -description [_getParamDesc all] \
     1095                  ] \
     1096                params $params \
     1097            ]
    11241098            return
    11251099        }
     
    12461220            # single result -- always use active color
    12471221            set i [lindex $ilist 0]
    1248             set plist [list $i [list -width 2 -description [_getParamDesc $i]]]
     1222            set plist [list \
     1223                $i [list -width 2 \
     1224                         -param [_getValues $_active $i] \
     1225                         -description [_getParamDesc all $i] \
     1226                   ] \
     1227                params $params \
     1228            ]
    12491229        } else {
    12501230            #
     
    12521232            # the color spectrum.
    12531233            #
    1254             set plist ""
     1234            set plist [list params $params]
    12551235            foreach i $ilist {
    12561236                if {$i == $icurr} {
    12571237                    lappend plist $i [list -width 3 -raise 1 \
    1258                         -description [_getParamDesc $i]]
     1238                        -param [_getValues $_active $i] \
     1239                        -description [_getParamDesc all $i]]
    12591240                } else {
    12601241                    lappend plist $i [list -brightness 0.7 -width 1 \
    1261                         -description [_getParamDesc $i]]
     1242                        -param [_getValues $_active $i] \
     1243                        -description [_getParamDesc all $i]]
    12621244                }
    12631245            }
     
    14701452
    14711453# ----------------------------------------------------------------------
     1454# USAGE: _getValues <column> ?<which>?
     1455#
     1456# Called automatically whenever the user hovers a control within
     1457# this widget.  Returns the tooltip associated with the control.
     1458# ----------------------------------------------------------------------
     1459itcl::body Rappture::ResultSet::_getValues {col {which ""}} {
     1460    if {$col == "xmlobj"} {
     1461        # load the Simulation # control
     1462        set nruns [$_results size]
     1463        for {set n 0} {$n < $nruns} {incr n} {
     1464            set v "#[expr {$n+1}]"
     1465            set label2val($v) $n
     1466        }
     1467    } else {
     1468        set havenums 1
     1469        set vlist ""
     1470        foreach rec [$_results get -format [list xmlobj $col]] {
     1471            set xo [lindex $rec 0]
     1472            set v [lindex $rec 1]
     1473
     1474            if {![info exists label2val($v)]} {
     1475                lappend vlist $v
     1476                foreach {raw norm} [Rappture::LibraryObj::value $xo $col] break
     1477                set label2val($v) $norm
     1478
     1479                if {$havenums && ![string is double $norm]} {
     1480                    set havenums 0
     1481                }
     1482            }
     1483        }
     1484
     1485        if {!$havenums} {
     1486            # don't have normalized nums? then sort and create nums
     1487            catch {unset label2val}
     1488
     1489            set n 0
     1490            foreach v [lsort $vlist] {
     1491                incr n
     1492                set label2val($v) $n
     1493            }
     1494        }
     1495    }
     1496
     1497    switch -- $which {
     1498        current {
     1499            set curr $_cntlInfo($this-$col-value)
     1500            if {[info exists label2val($curr)]} {
     1501                return [list $curr $label2val($curr)]
     1502            }
     1503            return ""
     1504        }
     1505        all {
     1506            return [array get label2val]
     1507        }
     1508        default {
     1509            if {[string is integer $which]} {
     1510                if {$col == "xmlobj"} {
     1511                    set val "#[expr {$which+1}]"
     1512                } else {
     1513                    set val [lindex [$_results get -format $col $which] 0]
     1514                }
     1515                if {[info exists label2val($val)]} {
     1516                    return [list $val $label2val($val)]
     1517                }
     1518                return ""
     1519            }
     1520            error "bad option \"$which\": should be all, current, or an integer index"
     1521        }
     1522    }
     1523}
     1524
     1525# ----------------------------------------------------------------------
    14721526# USAGE: _getTooltip <role> <column>
    14731527#
     
    15181572
    15191573# ----------------------------------------------------------------------
    1520 # USAGE: _getParamDesc ?<index>?
     1574# USAGE: _getParamDesc <which> ?<index>?
    15211575#
    15221576# Used internally to build a descripton of parameters for the data
     
    15241578# results viewer, so it will know what data is being viewed.
    15251579# ----------------------------------------------------------------------
    1526 itcl::body Rappture::ResultSet::_getParamDesc {{index "current"}} {
     1580itcl::body Rappture::ResultSet::_getParamDesc {which {index "current"}} {
    15271581    if {$index == "current"} {
    15281582        # search for the result for these settings
     
    15391593    }
    15401594
    1541     set desc ""
    1542     foreach col $_cntlInfo($this-all) {
    1543         set quantity $_cntlInfo($this-$col-label)
    1544         set val [lindex [$_results get -format $col $index] 0]
    1545         if {$col == "xmlobj"} {
    1546             set num [lindex [$_results find -format xmlobj $val] 0]
    1547             set val "#[expr {$num+1}]"
    1548         }
    1549         append desc "$quantity = $val\n"
    1550     }
    1551     return [string trim $desc]
     1595    switch -- $which {
     1596        active {
     1597            if {"" == $_active} {
     1598                return ""
     1599            }
     1600        }
     1601        all {
     1602            set desc ""
     1603            foreach col $_cntlInfo($this-all) {
     1604                set quantity $_cntlInfo($this-$col-label)
     1605                set val [lindex [$_results get -format $col $index] 0]
     1606                if {$col == "xmlobj"} {
     1607                    set num [lindex [$_results find -format xmlobj $val] 0]
     1608                    set val "#[expr {$num+1}]"
     1609                }
     1610                append desc "$quantity = $val\n"
     1611            }
     1612            return [string trim $desc]
     1613        }
     1614        default {
     1615            error "bad value \"$which\": should be active or all"
     1616        }
     1617    }
    15521618}
    15531619
  • trunk/gui/scripts/resultviewer.tcl

    r736 r766  
    4343    private variable _mode2widget    ;# maps plotting mode => widget
    4444    private variable _dataslots ""   ;# list of all data objects in this widget
    45     private variable _plotlist ""    ;# list of indices plotted in _dataslots
    4645}
    4746                                                                               
     
    154153    switch -- $option {
    155154        add {
     155            set params ""
    156156            foreach {index opts} $args {
     157                if {$index == "params"} {
     158                    set params $opts
     159                    continue
     160                }
    157161                set reset "-color autoreset"
    158162                set slot [lindex $_dataslots $index]
     
    179183                }
    180184            }
     185            if {"" != $params && "" != $_mode} {
     186                eval $_mode2widget($_mode) parameters $params
     187            }
    181188        }
    182189        clear {
     
    185192                $_mode2widget($_mode) delete
    186193            }
    187             set _plotlist ""
    188194        }
    189195        default {
     
    289295                    }
    290296                }
    291                 number - integer - boolean - choice {
     297                number - integer {
     298                    set mode "number"
     299                    if {![info exists _mode2widget($mode)]} {
     300                        set w $itk_interior.number
     301                        Rappture::NumberResult $w
     302                        set _mode2widget($mode) $w
     303                    }
     304                }
     305                boolean - choice {
    292306                    set mode "value"
    293307                    if {![info exists _mode2widget($mode)]} {
  • trunk/gui/scripts/sequenceresult.tcl

    r676 r766  
    3434    public method delete {args}
    3535    public method scale {args}
     36    public method parameters {title args} { # do nothing }
    3637    public method download {option args}
    3738
  • trunk/gui/scripts/textresult.tcl

    r702 r766  
    3131    public method delete {args}
    3232    public method scale {args}
     33    public method parameters {title args} { # do nothing }
    3334    public method download {option args}
    3435
  • trunk/gui/scripts/valueresult.tcl

    r761 r766  
    2626    public method delete {args}
    2727    public method scale {args}
     28    public method parameters {title args} { # do nothing }
    2829    public method download {option args}
    2930
  • trunk/gui/scripts/xyresult.tcl

    r738 r766  
    4848    public method delete {args}
    4949    public method scale {args}
     50    public method parameters {title args} { # do nothing }
    5051    public method download {option args}
    5152
Note: See TracChangeset for help on using the changeset viewer.