Changeset 464


Ignore:
Timestamp:
Jun 6, 2006, 10:33:16 AM (18 years ago)
Author:
mmc
Message:

Added popup options for the "download" button. Right now this works
only for <curve> objects. You can select between CSV and PDF output.
Will add other formats later.

Fixed a few "after cancel" errors that were happening when you switch
between inputs in the structure demo.

Fixed the colors and fonts for the new bug report window.

Location:
trunk/gui
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/driver

    r462 r464  
    2929package require Rappture
    3030package require RapptureGUI
    31 
    32 # install a better bug handler
    33 Rappture::bugreport::install
    3431
    3532option add *MainWin.mode desktop startupFile
     
    5552option add *Balloon.titleBackground #6666cc
    5653option add *Balloon.titleForeground white
     54option add *Balloon*Label.font -*-helvetica-medium-r-normal-*-*-120-*
     55option add *Balloon*Radiobutton.font -*-helvetica-medium-r-normal-*-*-120-*
     56option add *Balloon*Checkbutton.font -*-helvetica-medium-r-normal-*-*-120-*
    5757option add *ResultSet.controlbarBackground #6666cc
    5858option add *ResultSet.controlbarForeground white
     
    6060option add *ResultSet.activeControlForeground black
    6161option add *Radiodial.length 3i
     62option add *BugReport*banner*foreground white
     63option add *BugReport*banner*background #a9a9a9
     64option add *BugReport*banner*highlightBackground #a9a9a9
     65option add *BugReport*banner*font -*-helvetica-bold-r-normal-*-*-180-*
    6266
    6367switch $tcl_platform(platform) {
     
    6973    }
    7074}
     75
     76# install a better bug handler
     77Rappture::bugreport::install
    7178
    7279# fix the "grab" command to support a stack of grab windows
  • trunk/gui/scripts/analyzer.tcl

    r428 r464  
    223223            button $w.top.dl -image [Rappture::icon download] -anchor e \
    224224                -borderwidth 1 -relief flat -overrelief raised \
    225                 -command [itcl::code $this download now $w.top.dl]
     225                -command [itcl::code $this download start $w.top.dl]
    226226        }
    227227        pack $itk_component(download) -side right -padx {4 0}
     
    533533                $itk_component(resultpages) current $page
    534534                $itk_component(resultselector) value $first
     535                set _lastlabel $first
    535536                break
    536537            }
     
    592593# ----------------------------------------------------------------------
    593594# USAGE: download coming
     595# USAGE: download controls <downloadCommand>
     596# USAGE: download start ?widget?
    594597# USAGE: download now ?widget?
    595598#
     
    610613                    set f [$itk_component(resultpages) page $page]
    611614                    $f.rviewer download coming
     615                }
     616            }
     617            controls {
     618                # no controls for this download yet
     619                return ""
     620            }
     621            start {
     622                set widget $itk_component(download)
     623                if {[llength $args] > 0} {
     624                    set widget [lindex $args 0]
     625                    if {[catch {winfo class $widget}]} {
     626                        set widget $itk_component(download)
     627                    }
     628                }
     629                #
     630                # See if this download has any controls.  If so, then
     631                # post them now and let the user continue the download
     632                # after selecting a file format.
     633                #
     634                if {$page != ""} {
     635                    set ext ""
     636                    set f [$itk_component(resultpages) page $page]
     637                    set popup [$f.rviewer download controls \
     638                        [itcl::code $this download now $widget]]
     639
     640                    if {"" != $popup} {
     641                        $popup activate $widget below
     642                    } else {
     643                        download now $widget
     644                    }
     645                } else {
     646                    # this shouldn't happen
     647                    set file error.html
     648                    set data "<h1>Not Found</h1>There is no result selected."
    612649                }
    613650            }
     
    661698            }
    662699            default {
    663                 error "bad option \"$option\": should be coming, now"
     700                error "bad option \"$option\": should be coming, controls, now, start"
    664701            }
    665702        }
     
    769806        $itk_component(resultselector) component entry configure -state disabled
    770807        # perform the actual download
    771         download now $itk_component(resultselector)
     808        download start $itk_component(resultselector)
    772809    } elseif {$page == "---"} {
    773810        # put the combobox back to its last value
  • trunk/gui/scripts/bugreport.tcl

    r462 r464  
    8383pack .bugreport.banner.icon -side left -padx 2 -pady 2
    8484label .bugreport.banner.title -text "Oops! Unexpected Error"
    85 pack .bugreport.banner.title -side left -padx 2 -pady 2
     85pack .bugreport.banner.title -side left -padx {0 8} -pady 2
    8686
    8787button .bugreport.ok -text "OK" -command Rappture::bugreport::deactivate
  • trunk/gui/scripts/contourresult.tcl

    r456 r464  
    4242    public method delete {args}
    4343    public method scale {args}
    44     public method download {option}
     44    public method download {option args}
    4545
    4646    protected method _rebuild {}
     
    337337        -brightness 0
    338338        -raise 0
     339        -description ""
    339340    }
    340341    foreach {opt val} $settings {
     
    449450# ----------------------------------------------------------------------
    450451# USAGE: download coming
     452# USAGE: download controls <downloadCommand>
    451453# USAGE: download now
    452454#
     
    456458# "string" is the data itself.
    457459# ----------------------------------------------------------------------
    458 itcl::body Rappture::ContourResult::download {option} {
     460itcl::body Rappture::ContourResult::download {option args} {
    459461    switch $option {
    460462        coming {
     
    463465                $_download put #000000
    464466            }
     467        }
     468        controls {
     469            # no controls for this download yet
     470            return ""
    465471        }
    466472        now {
     
    480486        }
    481487        default {
    482             error "bad option \"$option\": should be coming, now"
     488            error "bad option \"$option\": should be coming, controls, now"
    483489        }
    484490    }
  • trunk/gui/scripts/deviceViewer1D.tcl

    r437 r464  
    3333
    3434    public method controls {option args}
    35     public method download {option}
     35    public method download {option args}
    3636                                                                               
    3737    protected method _loadDevice {}
     
    106106
    107107    bind $itk_component(graph) <Configure> "
    108         after cancel [itcl::code $this _fixAxes]
    109         after 100 [itcl::code $this _fixAxes]
     108        [list after cancel [list catch [itcl::code $this _align]]]
     109        [list after 100 [list catch [itcl::code $this _align]]]
    110110    "
    111111
     
    170170# ----------------------------------------------------------------------
    171171# USAGE: download coming
     172# USAGE: download controls <downloadCommand>
    172173# USAGE: download now
    173174#
     
    177178# "string" is the data itself.
    178179# ----------------------------------------------------------------------
    179 itcl::body Rappture::DeviceViewer1D::download {option} {
     180itcl::body Rappture::DeviceViewer1D::download {option args} {
    180181    switch $option {
    181182        coming {
    182183            # nothing to do
    183184        }
     185        controls {
     186            # no controls for this download yet
     187            return ""
     188        }
    184189        now {
    185190            return ""  ;# not implemented yet!
    186191        }
    187192        default {
    188             error "bad option \"$option\": should be coming, now"
     193            error "bad option \"$option\": should be coming, controls, now"
    189194        }
    190195    }
     
    460465
    461466    # let the widget settle, then fix the axes to "nice" values
    462     after cancel [itcl::code $this _fixAxes]
    463     after 100 [itcl::code $this _fixAxes]
     467    after cancel [list catch [itcl::code $this _fixAxes]]
     468    after 100 [list catch [itcl::code $this _fixAxes]]
    464469}
    465470
     
    489494    set graph $itk_component(graph)
    490495    if {![winfo ismapped $graph]} {
    491         after cancel [itcl::code $this _fixAxes]
    492         after 100 [itcl::code $this _fixAxes]
     496        after cancel [list catch [itcl::code $this _fixAxes]]
     497        after 100 [list catch [itcl::code $this _fixAxes]]
    493498        return
    494499    }
  • trunk/gui/scripts/imageresult.tcl

    r413 r464  
    3232    public method delete {args}
    3333    public method scale {args}
    34     public method download {option}
     34    public method download {option args}
    3535
    3636    protected method _rebuild {args}
     
    166166        -raise 0
    167167        -linestyle solid
     168        -description ""
    168169    }
    169170    foreach {opt val} $settings {
     
    266267# ----------------------------------------------------------------------
    267268# USAGE: download coming
     269# USAGE: download controls <downloadCommand>
    268270# USAGE: download now
    269271#
     
    273275# "string" is the data itself.
    274276# ----------------------------------------------------------------------
    275 itcl::body Rappture::ImageResult::download {option} {
     277itcl::body Rappture::ImageResult::download {option args} {
    276278    switch $option {
    277279        coming {
    278280            # nothing to do
     281        }
     282        controls {
     283            # no controls for this download yet
     284            return ""
    279285        }
    280286        now {
     
    299305        }
    300306        default {
    301             error "bad option \"$option\": should be coming, now"
     307            error "bad option \"$option\": should be coming, controls, now"
    302308        }
    303309    }
  • trunk/gui/scripts/meshresult.tcl

    r413 r464  
    3636    public method delete {args}
    3737    public method scale {args}
    38     public method download {option}
     38    public method download {option args}
    3939
    4040    protected method _rebuild {}
     
    131131        -raise 0
    132132        -linestyle solid
     133        -description ""
    133134    }
    134135    foreach {opt val} $settings {
     
    259260
    260261# ----------------------------------------------------------------------
    261 # USAGE: download
     262# USAGE: download coming
     263# USAGE: download controls <downloadCommand>
     264# USAGE: download now
    262265#
    263266# Clients use this method to create a downloadable representation
     
    266269# "string" is the data itself.
    267270# ----------------------------------------------------------------------
    268 itcl::body Rappture::MeshResult::download {option} {
     271itcl::body Rappture::MeshResult::download {option args} {
    269272    switch $option {
    270273        coming {
    271274            # nothing to do
     275        }
     276        controls {
     277            # no controls for this download yet
     278            return ""
    272279        }
    273280        now {
     
    291298        }
    292299        default {
    293             error "bad option \"$option\": should be coming, now"
     300            error "bad option \"$option\": should be coming, controls, now"
    294301        }
    295302    }
  • trunk/gui/scripts/moleculeViewer.tcl

    r413 r464  
    3232
    3333    public method emblems {option}
    34     public method download {option}
     34    public method download {option args}
    3535
    3636    protected method _clear {}
     
    205205# ----------------------------------------------------------------------
    206206# USAGE: download coming
     207# USAGE: download controls <downloadCommand>
    207208# USAGE: download now
    208209#
     
    212213# "string" is the data itself.
    213214# ----------------------------------------------------------------------
    214 itcl::body Rappture::MoleculeViewer::download {option} {
     215itcl::body Rappture::MoleculeViewer::download {option args} {
    215216    switch $option {
    216217        coming {
     
    219220                $_download put #000000
    220221            }
     222        }
     223        controls {
     224            # no controls for this download yet
     225            return ""
    221226        }
    222227        now {
     
    236241        }
    237242        default {
    238             error "bad option \"$option\": should be coming, now"
     243            error "bad option \"$option\": should be coming, controls, now"
    239244        }
    240245    }
  • trunk/gui/scripts/nanovisviewer.tcl

    r462 r464  
    4141    public method delete {args}
    4242    public method scale {args}
    43     public method download {option}
     43    public method download {option args}
    4444
    4545    public method connect {{hostlist ""}}
     
    441441        -brightness 0
    442442        -raise 0
     443        -description ""
    443444    }
    444445    foreach {opt val} $settings {
     
    552553# ----------------------------------------------------------------------
    553554# USAGE: download coming
     555# USAGE: download controls <downloadCommand>
    554556# USAGE: download now
    555557#
     
    559561# "string" is the data itself.
    560562# ----------------------------------------------------------------------
    561 itcl::body Rappture::NanovisViewer::download {option} {
     563itcl::body Rappture::NanovisViewer::download {option args} {
    562564    switch $option {
    563565        coming {
     
    566568                $_image(download) put #000000
    567569            }
     570        }
     571        controls {
     572            # no controls for this download yet
     573            return ""
    568574        }
    569575        now {
     
    583589        }
    584590        default {
    585             error "bad option \"$option\": should be coming, now"
     591            error "bad option \"$option\": should be coming, controls, now"
    586592        }
    587593    }
  • trunk/gui/scripts/resultset.tcl

    r428 r464  
    6666    protected method _toggleAll {{column "current"}}
    6767    protected method _getTooltip {role column}
     68    protected method _getParamDesc {{index "current"}}
    6869
    6970    private variable _dispatcher ""  ;# dispatchers for !events
     
    11181119        1 {
    11191120            # only one data set? then plot it
    1120             _doSettings [list 0 [list -width 2]]
     1121            _doSettings [list 0 [list -width 2 -description [_getParamDesc]]]
    11211122            return
    11221123        }
     
    12431244            # single result -- always use active color
    12441245            set i [lindex $ilist 0]
    1245             set plist [list $i [list -width 2]]
     1246            set plist [list $i [list -width 2 -description [_getParamDesc $i]]]
    12461247        } else {
    12471248            #
     
    12521253            foreach i $ilist {
    12531254                if {$i == $icurr} {
    1254                     lappend plist $i [list -width 3 -raise 1]
     1255                    lappend plist $i [list -width 3 -raise 1 \
     1256                        -description [_getParamDesc $i]]
    12551257                } else {
    1256                     lappend plist $i [list -brightness 0.7 -width 1]
     1258                    lappend plist $i [list -brightness 0.7 -width 1 \
     1259                        -description [_getParamDesc $i]]
    12571260                }
    12581261            }
     
    15131516
    15141517# ----------------------------------------------------------------------
     1518# USAGE: _getParamDesc ?<index>?
     1519#
     1520# Used internally to build a descripton of parameters for the data
     1521# tuple at the specified <index>.  This is passed on to the underlying
     1522# results viewer, so it will know what data is being viewed.
     1523# ----------------------------------------------------------------------
     1524itcl::body Rappture::ResultSet::_getParamDesc {{index "current"}} {
     1525    if {$index == "current"} {
     1526        # search for the result for these settings
     1527        set format ""
     1528        set tuple ""
     1529        foreach col [lrange [$_results column names] 1 end] {
     1530            lappend format $col
     1531            lappend tuple $_cntlInfo($this-$col-value)
     1532        }
     1533        set index [$_results find -format $format -- $tuple]
     1534        if {"" == $index} {
     1535            return ""  ;# somethings wrong -- bail out!
     1536        }
     1537    }
     1538
     1539    set desc ""
     1540    foreach col $_cntlInfo($this-all) {
     1541        set quantity $_cntlInfo($this-$col-label)
     1542        set val [lindex [$_results get -format $col $index] 0]
     1543        if {$col == "xmlobj"} {
     1544            set num [lindex [$_results find -format xmlobj $val] 0]
     1545            set val "#[expr {$num+1}]"
     1546        }
     1547        append desc "$quantity = $val\n"
     1548    }
     1549    return [string trim $desc]
     1550}
     1551
     1552# ----------------------------------------------------------------------
    15151553# OPTION: -missingdata
    15161554# ----------------------------------------------------------------------
  • trunk/gui/scripts/resultviewer.tcl

    r460 r464  
    3333
    3434    public method plot {option args}
    35     public method download {option}
     35    public method download {option args}
    3636
    3737    protected method _plotAdd {xmlobj {settings ""}}
     
    358358# ----------------------------------------------------------------------
    359359# USAGE: download coming
     360# USAGE: download controls <downloadCommand>
    360361# USAGE: download now
    361362#
     
    365366# "string" is the data itself.
    366367# ----------------------------------------------------------------------
    367 itcl::body Rappture::ResultViewer::download {option} {
     368itcl::body Rappture::ResultViewer::download {option args} {
    368369    if {"" == $_mode} {
    369370        return ""
    370371    }
    371     return [$_mode2widget($_mode) download $option]
     372    return [eval $_mode2widget($_mode) download $option $args]
    372373}
    373374
  • trunk/gui/scripts/scroller.tcl

    r168 r464  
    3030
    3131    constructor {args} { # defined below }
     32    destructor { # defined below }
    3233
    3334    public method contents {{frame "!@#query"}}
     
    9091
    9192    eval itk_initialize $args
     93}
     94
     95# ----------------------------------------------------------------------
     96# DESTRUCTOR
     97# ----------------------------------------------------------------------
     98itcl::body Rappture::Scroller::destructor {} {
     99    after cancel [itcl::code $this _lock reset x]
     100    after cancel [itcl::code $this _lock reset y]
    92101}
    93102
  • trunk/gui/scripts/sequenceresult.tcl

    r459 r464  
    3434    public method delete {args}
    3535    public method scale {args}
    36     public method download {option}
     36    public method download {option args}
    3737
    3838    public method play {}
     
    191191        -raise 0
    192192        -linestyle solid
     193        -description ""
    193194    }
    194195    foreach {opt val} $settings {
     
    271272# ----------------------------------------------------------------------
    272273# USAGE: download coming
     274# USAGE: download controls <downloadCommand>
    273275# USAGE: download now
    274276#
     
    278280# "string" is the data itself.
    279281# ----------------------------------------------------------------------
    280 itcl::body Rappture::SequenceResult::download {option} {
     282itcl::body Rappture::SequenceResult::download {option args} {
    281283    switch $option {
    282284        coming {
    283285            return [$itk_component(area).viewer download coming]
     286        }
     287        controls {
     288            # no controls for this download yet
     289            return ""
    284290        }
    285291        now {
     
    311317        }
    312318        default {
    313             error "bad option \"$option\": should be coming, now"
     319            error "bad option \"$option\": should be coming, controls, now"
    314320        }
    315321    }
  • trunk/gui/scripts/textresult.tcl

    r413 r464  
    3131    public method delete {args}
    3232    public method scale {args}
    33     public method download {option}
     33    public method download {option args}
    3434
    3535    public method select {option args}
     
    152152        -linestyle ""
    153153        -raise 0
     154        -description ""
    154155    }
    155156    foreach {opt val} $settings {
     
    271272# ----------------------------------------------------------------------
    272273# USAGE: download coming
     274# USAGE: download controls <downloadCommand>
    273275# USAGE: download now
    274276#
     
    278280# "string" is the data itself.
    279281# ----------------------------------------------------------------------
    280 itcl::body Rappture::TextResult::download {option} {
     282itcl::body Rappture::TextResult::download {option args} {
    281283    switch $option {
    282284        coming {
    283285            # nothing to do
    284286        }
     287        controls {
     288            # no controls for this download yet
     289            return ""
     290        }
    285291        now {
    286292            return [list .txt [$itk_component(text) get 1.0 end]]
    287293        }
    288294        default {
    289             error "bad option \"$option\": should be coming, now"
     295            error "bad option \"$option\": should be coming, controls, now"
    290296        }
    291297    }
  • trunk/gui/scripts/valueresult.tcl

    r195 r464  
    2828    public method delete {args}
    2929    public method scale {args}
    30     public method download {option}
     30    public method download {option args}
    3131
    3232    set _dataobj ""  ;# data object currently being displayed
     
    7373        -linestyle ""
    7474        -raise ""
     75        -description ""
    7576    }
    7677    foreach {opt val} $settings {
     
    148149# ----------------------------------------------------------------------
    149150# USAGE: download coming
     151# USAGE: download controls <downloadCommand>
    150152# USAGE: download now
    151153#
     
    155157# "string" is the data itself.
    156158# ----------------------------------------------------------------------
    157 itcl::body Rappture::ValueResult::download {option} {
     159itcl::body Rappture::ValueResult::download {option args} {
    158160    switch $option {
    159161        coming {
    160162            # nothing to do
     163        }
     164        controls {
     165            # no controls for this download yet
     166            return ""
    161167        }
    162168        now {
     
    166172        }
    167173        default {
    168             error "bad option \"$option\": should be coming, now"
     174            error "bad option \"$option\": should be coming, controls, now"
    169175        }
    170176    }
  • trunk/gui/scripts/xyresult.tcl

    r413 r464  
    4848    public method delete {args}
    4949    public method scale {args}
    50     public method download {option}
     50    public method download {option args}
    5151
    5252    protected method _rebuild {}
     
    6464    private variable _curve2dashes ;# maps curve => BLT -dashes list
    6565    private variable _curve2raise  ;# maps curve => raise flag 0/1
     66    private variable _curve2desc   ;# maps curve => description of data
    6667    private variable _elem2curve   ;# maps graph element => curve
    6768    private variable _label2axis   ;# maps axis label => axis ID
     
    7273    private variable _axis         ;# info for axis manipulations
    7374    private variable _axisPopup    ;# info for axis being edited in popup
     75    common _downloadPopup          ;# download options from popup
    7476}
    7577                                                                               
     
    8587    $_dispatcher register !rebuild
    8688    $_dispatcher dispatch $this !rebuild "[itcl::code $this _rebuild]; list"
     89
     90    array set _downloadPopup {
     91        format csv
     92    }
    8793
    8894    option add hull.width hull.height
     
    213219        -raise 0
    214220        -linestyle solid
     221        -description ""
    215222    }
    216223    foreach {opt val} $settings {
     
    266273        set _curve2dashes($curve) $params(-linestyle)
    267274        set _curve2raise($curve) $params(-raise)
     275        set _curve2desc($curve) $params(-description)
    268276
    269277        $_dispatcher event -idle !rebuild
     
    391399# ----------------------------------------------------------------------
    392400# USAGE: download coming
     401# USAGE: download controls <downloadCommand>
    393402# USAGE: download now
    394403#
     
    398407# "string" is the data itself.
    399408# ----------------------------------------------------------------------
    400 itcl::body Rappture::XyResult::download {option} {
     409itcl::body Rappture::XyResult::download {option args} {
    401410    switch $option {
    402411        coming {
    403412            # nothing to do
    404413        }
     414        controls {
     415            set popup .xyresultdownload
     416            if {![winfo exists .xyresultdownload]} {
     417                # if we haven't created the popup yet, do it now
     418                Rappture::Balloon $popup -title "Download as..."
     419                set inner [$popup component inner]
     420                label $inner.summary -text "" -anchor w
     421                pack $inner.summary -side top
     422                radiobutton $inner.csv -text "Data as Comma-Separated Values" \
     423                    -variable Rappture::XyResult::_downloadPopup(format) \
     424                    -value csv
     425                pack $inner.csv -anchor w
     426                radiobutton $inner.pdf -text "Image as PDF/PostScript" \
     427                    -variable Rappture::XyResult::_downloadPopup(format) \
     428                    -value pdf
     429                pack $inner.pdf -anchor w
     430                button $inner.go -text "Download Now" \
     431                    -command [lindex $args 0]
     432                pack $inner.go -pady 4
     433            } else {
     434                set inner [$popup component inner]
     435            }
     436            set num [llength [get]]
     437            set num [expr {($num == 1) ? "1 result" : "$num results"}]
     438            $inner.summary configure -text "Download $num in the following format:"
     439            update idletasks ;# fix initial sizes
     440            return $popup
     441        }
    405442        now {
    406             set psdata [$itk_component(plot) postscript output -maxpect 1]
    407 
    408             set cmds {
    409                 set fout "xy[pid].pdf"
    410                 exec ps2pdf - $fout << $psdata
    411 
    412                 set fid [open $fout r]
    413                 fconfigure $fid -translation binary -encoding binary
    414                 set pdfdata [read $fid]
    415                 close $fid
    416 
    417                 file delete -force $fout
    418             }
    419             if {[catch $cmds result] == 0} {
    420                 return [list .pdf $pdfdata]
    421             }
    422             return [list .ps $psdata]
     443            set popup .xyresultdownload
     444            if {[winfo exists .xyresultdownload]} {
     445                $popup deactivate
     446            }
     447            switch -- $_downloadPopup(format) {
     448              csv {
     449                # reverse the objects so the selected data appears on top
     450                set dlist ""
     451                foreach dataobj [get] {
     452                    set dlist [linsert $dlist 0 $dataobj]
     453                }
     454
     455                # generate the comma-separated value data for these objects
     456                set csvdata ""
     457                foreach dataobj $dlist {
     458                    append csvdata "[string repeat - 60]\n"
     459                    append csvdata " [$dataobj hints label]\n"
     460                    if {[info exists _curve2desc($dataobj)]
     461                          && [llength [split $_curve2desc($dataobj) \n]] > 1} {
     462                        set indent "for:"
     463                        foreach line [split $_curve2desc($dataobj) \n] {
     464                            append csvdata " $indent $line\n"
     465                            set indent "    "
     466                        }
     467                    }
     468                    append csvdata "[string repeat - 60]\n"
     469
     470                    append csvdata "[$dataobj hints xlabel], [$dataobj hints ylabel]\n"
     471                    set first 1
     472                    foreach comp [$dataobj components] {
     473                        if {!$first} {
     474                            # blank line between components
     475                            append csvdata "\n"
     476                        }
     477                        set xv [$dataobj mesh $comp]
     478                        set yv [$dataobj values $comp]
     479                        foreach x [$xv range 0 end] y [$yv range 0 end] {
     480                            append csvdata [format "%20.15g, %20.15g\n" $x $y]
     481                        }
     482                        set first 0
     483                    }
     484                    append csvdata "\n"
     485                }
     486                return [list .txt $csvdata]
     487              }
     488              pdf {
     489                set psdata [$itk_component(plot) postscript output -maxpect 1]
     490
     491                set cmds {
     492                    set fout "xy[pid].pdf"
     493                    exec ps2pdf - $fout << $psdata
     494
     495                    set fid [open $fout r]
     496                    fconfigure $fid -translation binary -encoding binary
     497                    set pdfdata [read $fid]
     498                    close $fid
     499
     500                    file delete -force $fout
     501                }
     502                if {[catch $cmds result] == 0} {
     503                    return [list .pdf $pdfdata]
     504                }
     505                return [list .ps $psdata]
     506              }
     507            }
    423508        }
    424509        default {
    425             error "bad option \"$option\": should be coming, now"
     510            error "bad option \"$option\": should be coming, controls, now"
    426511        }
    427512    }
Note: See TracChangeset for help on using the changeset viewer.