Changeset 997 for trunk/gui


Ignore:
Timestamp:
Apr 24, 2008 11:30:56 AM (16 years ago)
Author:
dkearney
Message:

added ability for sequence.elemtents to contain a free text label. users can write their own label to sequence.element.about.label and it will show up next to the "Frame = 1" text just above the play button. Also made the "Frame = 1" text optional. if the user leaves out sequence.index.label, the "Frame = 1" will not show up.

Location:
trunk/gui/scripts
Files:
3 edited

Legend:

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

    r844 r997  
    4444    private variable _dataslots ""   ;# list of all data objects in this widget
    4545}
    46                                                                                
     46
    4747itk::usual ResultViewer {
    4848    keep -background -foreground -cursor -font
     
    239239                    set mode "contour"
    240240                    if {![info exists _mode2widget($mode)]} {
    241                         set mesh [$dataobj mesh]
     241                        set mesh [$dataobj mesh]
    242242                        set fmt [expr {("" != $mesh) ? "vtk" : "heightmap"}]
    243243                        set w $itk_interior.contour
     
    245245                        set _mode2widget($mode) $w
    246246                    }
    247                 }
     247                }
    248248                3D {
    249249                    set mode "field3D"
     
    414414            return [Rappture::Curve ::#auto $xmlobj $path]
    415415        }
    416         histogram {
     416        histogram {
    417417            return [Rappture::Histogram ::#auto $xmlobj $path]
    418418        }
  • trunk/gui/scripts/sequence.tcl

    r894 r997  
    2323
    2424    public method value {pos}
     25    public method label {pos}
    2526    public method index {pos}
    2627    public method size {}
     
    2930    private variable _xmlobj ""  ;# ref to lib obj with sequence data
    3031    private variable _dataobjs   ;# maps index => data object
     32    private variable _labels     ;# maps index => labels
    3133    private variable _indices    ;# list of sorted index values
    3234    private variable _hints      ;# cache of hints stored in XML
     
    5153        }
    5254
     55        # check for an element about.label stanza
     56        set elelabel [$xmlobj get $path.$name.about.label]
     57
    5358        set ctype ""
    5459        set _dataobjs($index) ""
     60        set _labels($index) ""
    5561        foreach cname [$_xmlobj children $name] {
    5662            set type [$xmlobj element -as type $path.$name.$cname]
     
    6066                    continue
    6167                }
     68                about {
     69                    # ignore this
     70                    continue
     71                }
    6272                curve {
    6373                    set obj [Rappture::Curve ::#auto $xmlobj $path.$name.$cname]
     
    100110            if {$type == $ctype} {
    101111                lappend _dataobjs($index) $obj
     112                set _labels($index) $elelabel
    102113            } else {
    103114                itcl::delete object $obj
     
    172183
    173184# ----------------------------------------------------------------------
     185# USAGE: label <pos>
     186#
     187# Returns the label for the element as position <pos> in the
     188# list of all elements.  Here, <pos> runs from 0 to size-1.
     189# ----------------------------------------------------------------------
     190itcl::body Rappture::Sequence::label {pos} {
     191    set i [lindex [lindex $_indices $pos] 0]
     192    return $_labels($i)
     193}
     194
     195# ----------------------------------------------------------------------
    174196# USAGE: index <pos>
    175197#
  • trunk/gui/scripts/sequenceresult.tcl

    r976 r997  
    115115    }
    116116    pack $itk_component(indexValue) -side left
     117
     118    # add an element.about.label stanza
     119    itk_component add eleLabel {
     120        label $itk_component(info).elabel -padx 10
     121    }
     122    pack $itk_component(eleLabel) -side left
    117123
    118124    itk_component add options {
     
    538544    }
    539545
    540     set val [$itk_component(dial) get -format label current]
    541     $itk_component(indexValue) configure -text "= $val"
    542     set _pos [lsearch -glob $_indices $val*]
     546    # if the indexLabel is empty, don't show indexValue
     547    if {"" != [$_topmost hints indexlabel]} {
     548        set val [$itk_component(dial) get -format label current]
     549        $itk_component(indexValue) configure -text "= $val"
     550        set _pos [lsearch -glob $_indices $val*]
     551    }
     552
     553    # populate the label for this element
     554    $itk_component(eleLabel) configure -text "[$_topmost label $_pos]"
    543555
    544556    $viewer delete
Note: See TracChangeset for help on using the changeset viewer.