Changeset 1141


Ignore:
Timestamp:
Sep 4, 2008, 5:23:26 PM (16 years ago)
Author:
gah
Message:

fixes for entry label editting

Location:
trunk/gui/scripts
Files:
3 edited

Legend:

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

    r1081 r1141  
    5757    public method delete {args}
    5858    public method scale {args}
    59     public method GetLimits { ivol } {
    60         if { [info exists _id2style($ivol)] } {
    61             set tf $_id2style($ivol)
    62             set _limits(min) ""
    63             set _limits(max) ""
    64             foreach ivol $_style2ids($tf) {
    65             if { ![info exists _limits($ivol-min)] } {
    66                 puts stderr "In GetLimits $ivol"
    67                 parray _limits
    68                 error "can't find $ivol limits"
    69             }
    70                 if { $_limits(min) == "" ||
    71                      $_limits(min) > $_limits($ivol-min) } {
    72                     set _limits(min) $_limits($ivol-min)
    73                 }
    74                 if { $_limits(max) == "" ||
    75                      $_limits(max) < $_limits($ivol-max) } {
    76                     set _limits(max) $_limits($ivol-max)
    77                 }
    78             }
    79         }
    80         return [array get _limits]
    81     }
     59    public method GetLimits { ivol }
    8260    public method download {option args}
    8361    public method parameters {title args} {
     
    609587# USAGE: delete ?<dataobj1> <dataobj2> ...?
    610588#
    611 # Clients use this to delete a dataobj from the plot.  If no dataobjs
    612 # are specified, then all dataobjs are deleted.
     589#       Clients use this to delete a dataobj from the plot.  If no dataobjs
     590#       are specified, then all dataobjs are deleted.  No data objects are
     591#       deleted.  They are only removed from the display list.
     592#
    613593# ----------------------------------------------------------------------
    614594itcl::body Rappture::NanovisViewer::delete {args} {
     
    616596        set args $_dlist
    617597    }
    618     # delete all specified dataobjs
     598    # Delete all specified dataobjs
    619599    set changed 0
    620600    foreach dataobj $args {
    621601        set pos [lsearch -exact $_dlist $dataobj]
    622         if {$pos >= 0} {
     602        if { $pos >= 0 } {
    623603            set _dlist [lreplace $_dlist $pos $pos]
    624604            foreach key [array names _obj2ovride $dataobj-*] {
     
    628608        }
    629609    }
    630     # if anything changed, then rebuild the plot
     610    # If anything changed, then rebuild the plot
    631611    if {$changed} {
    632612        $_dispatcher event -idle !rebuild
     
    717697    }
    718698    set result [VisViewer::Connect $_hosts]
     699    if { $result } {
     700        set w [winfo width $itk_component(3dview)]
     701        set h [winfo height $itk_component(3dview)]
     702        _send "screen $w $h"
     703    }
    719704    return $result
    720705}
     
    826811
    827812    if 0 {
     813        # Add this when we fix grid for volumes
    828814    _send "volume axis label x \"\""
    829815    _send "volume axis label y \"\""
     
    10351021        }
    10361022    }
     1023    set w [winfo width $itk_component(3dview)]
     1024    set h [winfo height $itk_component(3dview)]
     1025    _send "screen $w $h"
     1026
     1027    #
     1028    # Reset the camera and other view parameters
     1029    #
     1030    set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
     1031    _send "camera angle $xyz"
     1032    _send "camera zoom $_view(zoom)"
     1033   
     1034    _fixSettings light
     1035    _fixSettings transp
     1036    _fixSettings isosurface
     1037    _fixSettings grid
     1038    _fixSettings axes
     1039    _fixSettings outline
     1040
    10371041    if {[llength $_sendobjs] > 0} {
    10381042        # send off new data objects
     
    10401044        return
    10411045    }
    1042 
    1043     set w [winfo width $itk_component(3dview)]
    1044     set h [winfo height $itk_component(3dview)]
    1045     _send "screen $w $h"
    10461046
    10471047    # nothing to send -- activate the proper ivol
     
    10821082    _send "volume data state [_state volume] $vols"
    10831083    $_dispatcher event -idle !legend
    1084    
    1085     #
    1086     # Reset the camera and other view parameters
    1087     #
    1088     _send "camera angle [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]"
    1089     _send "camera zoom $_view(zoom)"
    1090    
    1091     _fixSettings light
    1092     _fixSettings transp
    1093     _fixSettings isosurface
    1094     _fixSettings grid
    1095     _fixSettings axes
    1096     _fixSettings outline
    10971084}
    10981085
     
    15771564    }
    15781565    SendBytes "transfunc define $tf { $cmap } { $wmap }\n"
    1579     #puts stdout "transfunc define $tf { $cmap } { $wmap }\n"
    15801566    return [SendBytes "volume shading transfunc $tf $_style2ids($tf)\n"]
    15811567}
     
    17451731    return ""
    17461732}
     1733
     1734itcl::body Rappture::NanovisViewer::GetLimits { ivol } {
     1735    if { ![info exists _id2style($ivol)] } {
     1736        return
     1737    }
     1738    set tf $_id2style($ivol)
     1739    set _limits(min) ""
     1740    set _limits(max) ""
     1741    foreach ivol $_style2ids($tf) {
     1742        if { ![info exists _limits($ivol-min)] } {
     1743            error "can't find $ivol limits"
     1744        }
     1745        if { $_limits(min) == "" || $_limits(min) > $_limits($ivol-min) } {
     1746            set _limits(min) $_limits($ivol-min)
     1747        }
     1748        if { $_limits(max) == "" || $_limits(max) < $_limits($ivol-max) } {
     1749            set _limits(max) $_limits($ivol-max)
     1750        }
     1751    }
     1752    return [array get _limits]
     1753}
  • trunk/gui/scripts/visviewer.tcl

    r1111 r1141  
    2323    set _servers(nanovis) ""
    2424    set _servers(pymol)   ""
    25     #set _servers(nanovis) "128.210.189.216:2000"
    26     #set _servers(pymol) "128.210.189.216:2020"
     25    set _servers(nanovis) "128.210.189.216:2000"
     26    set _servers(pymol) "128.210.189.216:2020"
    2727
    2828    protected variable _dispatcher ""   ;# dispatcher for !events
     
    273273#
    274274#       Helper routine called from a file event to send data when the
     275#       connection is writable (i.e. not blocked).  Sets a magic
     276#       variable _done($this) when we're done.
     277#
     278itcl::body Rappture::VisViewer::_SendHelper {} {
     279    puts $_sid $_buffer(out)
     280    flush $_sid
     281    set _done($this) 1;         # Success
     282}
     283
     284#
     285# _SendHelper.old --
     286#
     287#       Helper routine called from a file event to send data when the
    275288#       connection is writable (i.e. not blocked).  Sends data in chunks
    276289#       of 8k (or less).  Sets magic variable _done($this) to indicate
     
    278291#       the server (failure).
    279292#
    280 itcl::body Rappture::VisViewer::_SendHelper {} {
    281     puts $_sid $_buffer(out)
    282     flush $_sid
    283     set _done($this) 1;         # Success
    284 }
    285 
    286293itcl::body Rappture::VisViewer::_SendHelper.old {} {
    287294    set bytesLeft [string length $_buffer(out)]
     
    326333        if { $code == 0 && $ok} {
    327334            $_dispatcher event -idle !rebuild
    328             Rappture::Tooltip::cue hide
    329         } else {
     335            Rappture::Tooltip::cue hide
     336            return 1
     337       } else {
    330338            Rappture::Tooltip::cue @$x,$y "Can't connect to visualization server.  This may be a network problem.  Wait a few moments and try resetting the view."
     339           return 0
    331340        }
    332         return
    333     }
     341    }
     342    # Even though the data is sent in only 1 "puts", we need to verify that
     343    # the server is ready first.  Wait for the socket to become writable
     344    # before sending anything.
    334345    set _done($this) 1
    335346    set _buffer(out) $bytes
  • trunk/gui/scripts/xylegend.tcl

    r1140 r1141  
    2929    private variable tree_      ""
    3030    private variable diff_      ""
    31     private variable focus_     -1
     31    private variable focus_     ""
    3232    private variable diffelements_
    3333
     
    102102    grid $itk_component(controls) -column 0 -row 1 -sticky nsew
    103103    grid columnconfigure $itk_component(hull) 0 -weight 1
    104     grid rowconfigure $itk_component(hull) 1 -weight 0
     104    grid rowconfigure $itk_component(hull) 1 \
     105        -minsize [winfo reqheight $itk_component(scrollbars)]
    105106    grid rowconfigure $itk_component(hull) 0 -weight 1
    106107    grid $itk_component(scrollbars) -column 0 -row 0 -sticky nsew
     
    196197        set label [$graph_ element cget $elem -label]
    197198        if { $label == "" } {
    198             continue
     199            set label $elem
    199200        }
    200201        Add $elem $label
     
    330331        lappend delnodes $node
    331332        if { $diff_ != "" && [info exists diffelements_($elem)] } {
    332             $graph_ element delete $diff_
     333            $graph_ marker delete $diff_
    333334            array unset diffelements_
    334335            set diff_ ""
     
    457458
    458459itcl::body Rappture::XyLegend::Difference {} {
    459     set nodes [$itk_component(legend) curselection]
    460     set elements {}
    461     set sum [blt::vector create \#auto -command ""]
    462 
    463     set xcoords [blt::vector create \#auto -command ""]
    464     set ycoords [blt::vector create \#auto -command ""]
    465 
    466     # Step 1. Get the x-values for each curve, then sort them to get the
    467     #         unique values.
    468 
    469     foreach node $nodes {
    470         set elem [$tree_ label $node]
    471         $xcoords append [GetData $elem -x]
    472         set elements [linsert $elements 0 $elem]
    473     }
    474     # Sort the abscissas keeping unique values.
    475     $xcoords sort -uniq
    476 
    477     # Step 2. Now for each curve, generate a cubic spline of that curve
    478     #         and interpolate to get the corresponding y-values for each
    479     #         abscissa.  Normally the abscissa are the same, so we're
    480     #         interpolation the knots.
    481 
    482     set x [blt::vector create \#auto -command ""]
    483     set y [blt::vector create \#auto -command ""]
    484     $sum length [$xcoords length]
    485 
    486     foreach node $nodes {
    487         set elem [$tree_ label $node]
    488         $x set [GetData $elem -x]
    489         $y set [GetData $elem -y]
    490         blt::spline natural $x $y $xcoords $ycoords
    491 
    492         # Sum the interpolated y-coordinate values.
    493         $sum expr "fabs($ycoords - $sum)"
    494     }
    495     blt::vector destroy $x $y
    496 
    497     # Get the average
    498     #$sum expr "$sum / [llength $elements]"
    499 
    500     # Step 3.  Create a new curve which is the average. Append it to the
    501     #          the end.
    502 
    503     set count 0
    504     while {[$graph_ element exists diff$count] } {
    505         incr count
    506     }
    507     set elements [lsort -dictionary $elements]
    508     set name "diff$count"
    509     set label "Diff. [join $elements ,]"
    510 
    511     # Don't use the vector because we don't know when it will be cleaned up.
    512 
    513     $graph_ element create $name -label $label -x [$xcoords range 0 end] \
    514         -y [$sum range 0 end]
    515     blt::vector destroy $xcoords $ycoords $sum
    516     set node [Add $name $label]
    517     Raise $node
    518 }
    519 
    520 itcl::body Rappture::XyLegend::Difference {} {
    521460
    522461    if { $diff_ != "" } {
     
    529468    if { [info exists diffelements_($elem1)] &&
    530469         [info exists diffelements_($elem2)] } {
    531         array unset diffelements_
    532         return
     470        array unset diffelements_;      # Toggle the difference.
     471        return;                         
    533472    }
    534473    array unset diffelements_
     
    581520        activate {
    582521            set focus_ [$itk_component(legend) index focus]
    583             if { $focus_ == -1 } {
     522            if { $focus_ == "" } {
    584523                return;
    585524            }
Note: See TracChangeset for help on using the changeset viewer.