Changeset 2970 for branches/blt4/gui


Ignore:
Timestamp:
Apr 13, 2012, 4:15:52 PM (12 years ago)
Author:
gah
Message:

sync back with trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/gui/scripts/analyzer.tcl

    r2745 r2970  
    5858    public method reset {{when -eventually}}
    5959    public method load {xmlobj}
    60     public method clear {}
     60    public method clear {{xmlobj ""}}
    6161    public method download {option args}
    6262
     
    648648
    649649# ----------------------------------------------------------------------
    650 # USAGE: clear
    651 #
    652 # Discards all results previously loaded into the analyzer.
    653 # ----------------------------------------------------------------------
    654 itcl::body Rappture::Analyzer::clear {} {
    655     foreach obj $_runs {
    656         itcl::delete object $obj
    657     }
    658     set _runs ""
    659 
    660     $itk_component(resultset) clear
    661 
    662     # reset the size of the controls area
    663     set ht [winfo height $itk_component(results)]
    664     set cntlht [$itk_component(resultset) size -controlarea]
    665     set frac [expr {double($cntlht)/$ht}]
    666     $itk_component(results) fraction end $frac
    667 
    668     foreach label [array names _label2page] {
    669         set page $_label2page($label)
    670         destroy $page.rviewer
    671         #$page.rviewer clear
    672     }
    673     $itk_component(resultselector) value ""
    674     $itk_component(resultselector) choices delete 0 end
    675     catch {unset _label2page}
    676     catch {unset _label2desc}
    677     set _plotlist ""
    678 
    679     $itk_component(resultselector) choices insert end --- "---"
    680     $itk_component(resultselector) choices insert end \
    681         @download [Rappture::filexfer::label download]
    682     set _lastlabel ""
     650# USAGE: clear ?<xmlobj>?
     651#
     652# Discards one or more results previously loaded into the analyzer.
     653# If an <xmlobj> is specified, then that one result is cleared.
     654# Otherwise, all results are cleared.
     655# ----------------------------------------------------------------------
     656itcl::body Rappture::Analyzer::clear {{xmlobj ""}} {
     657    if {$xmlobj ne ""} {
     658        set i [lsearch -exact $_runs $xmlobj]
     659        if {$i >= 0} {
     660            itcl::delete object $xmlobj
     661            set _runs [lreplace $_runs $i $i]
     662
     663            # delete this result from all viewers
     664            foreach label [array names _label2page] {
     665                set page $_label2page($label)
     666                $page.rviewer clear $xmlobj
     667            }
     668        }
     669    } else {
     670        # clear everything
     671        foreach obj $_runs {
     672            itcl::delete object $obj
     673        }
     674        set _runs ""
     675    }
     676
     677    if {[llength $_runs] == 0} {
     678        # reset the size of the controls area
     679        set ht [winfo height $itk_component(results)]
     680        set cntlht [$itk_component(resultset) size -controlarea]
     681        set frac [expr {double($cntlht)/$ht}]
     682        $itk_component(results) fraction end $frac
     683
     684        foreach label [array names _label2page] {
     685            set page $_label2page($label)
     686            destroy $page.rviewer
     687        }
     688        $itk_component(resultselector) value ""
     689        $itk_component(resultselector) choices delete 0 end
     690        catch {unset _label2page}
     691        catch {unset _label2desc}
     692        set _plotlist ""
     693
     694        $itk_component(resultselector) choices insert end --- "---"
     695        $itk_component(resultselector) choices insert end \
     696            @download [Rappture::filexfer::label download]
     697        set _lastlabel ""
     698    }
    683699
    684700    #
Note: See TracChangeset for help on using the changeset viewer.