Ignore:
Timestamp:
Feb 19, 2006, 8:10:19 PM (18 years ago)
Author:
mmc
Message:
  • Added "Upload..." capability to the <loader> widget. You can now add an <upload> directive containing the path of the control that will receive data. A file is uploaded from the desktop and saved in the specified control.
  • Fixed download capability to work properly for all result types, including contour plots and molecules.
  • Added rappture::signal so we can catch SIGHUP and clean up the upload/download spool directory.
File:
1 edited

Legend:

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

    r173 r193  
    5454    public method load {file}
    5555    public method clear {}
    56     public method download {}
     56    public method download {option}
    5757
    5858    protected method _plot {args}
     
    198198        itk_component add download {
    199199            button $w.top.dl -text "Download..." -anchor w \
    200                 -command [itcl::code $this download]
     200                -command [itcl::code $this download now]
    201201        }
    202202        pack $itk_component(download) -side right -padx {4 0}
     
    204204
    205205NOTE:  Your web browser must allow pop-ups from this site.  If your output does not appear, look for a 'pop-up blocked' message and enable pop-ups."
     206
     207        bind $itk_component(download) <Enter> \
     208            [itcl::code $this download coming]
    206209    }
    207210
     
    521524
    522525# ----------------------------------------------------------------------
    523 # USAGE: download
     526# USAGE: download coming
     527# USAGE: download now
    524528#
    525529# Spools the current result so the user can download it.
    526530# ----------------------------------------------------------------------
    527 itcl::body Rappture::Analyzer::download {} {
     531itcl::body Rappture::Analyzer::download {option} {
    528532    if {[Rappture::filexfer::enabled]} {
    529533        set title [$itk_component(resultselector) value]
    530534        set page [$itk_component(resultselector) translate $title]
    531         if {$page != ""} {
    532             set ext ""
    533             set f [$itk_component(resultpages) page $page]
    534             foreach {ext data} [$f.rviewer download] break
    535             if {"" == $ext} {
    536                 Rappture::Tooltip::cue $itk_component(download) \
    537                     "Can't download this result."
    538                 return
    539             }
    540             regsub -all {[\ -\/\:-\@\{-\~]} $title {} title
    541             set file "$title$ext"
    542         } else {
    543             # this shouldn't happen
    544             set file error.html
    545             set data "<h1>Not Found</h1>There is no result selected."
    546         }
    547 
    548         if {[catch {Rappture::filexfer::spool $data $file} result]} {
    549             if {"no clients" == $result} {
    550                 Rappture::Tooltip::cue $itk_component(download) \
    551                     "Can't download this result.  Looks like you might be having trouble with the version of Java installed for your browser."
    552             } else {
    553                 error $result "    (while spooling result \"$title\")"
     535
     536        switch -- $option {
     537            coming {
     538                #
     539                # Warn result that a download is coming, in case
     540                # it needs to take a screen snap.
     541                #
     542                if {$page != ""} {
     543                    set f [$itk_component(resultpages) page $page]
     544                    $f.rviewer download coming
     545                }
     546            }
     547            now {
     548                #
     549                # Perform the actual download.
     550                #
     551                if {$page != ""} {
     552                    set ext ""
     553                    set f [$itk_component(resultpages) page $page]
     554                    foreach {ext data} [$f.rviewer download now] break
     555                    if {"" == $ext} {
     556                        Rappture::Tooltip::cue $itk_component(download) \
     557                            "Can't download this result."
     558                        return
     559                    }
     560                    regsub -all {[\ -\/\:-\@\{-\~]} $title {} title
     561                    set file "$title$ext"
     562                } else {
     563                    # this shouldn't happen
     564                    set file error.html
     565                    set data "<h1>Not Found</h1>There is no result selected."
     566                }
     567
     568                if {[catch {Rappture::filexfer::spool $data $file} result]} {
     569                    if {"no clients" == $result} {
     570                        Rappture::Tooltip::cue $itk_component(download) \
     571                            "Can't download this result.  Looks like you might be having trouble with the version of Java installed for your browser."
     572                    } else {
     573                        error $result "    (while spooling result \"$title\")"
     574                    }
     575                }
     576            }
     577            default {
     578                error "bad option \"$option\": should be coming, now"
    554579            }
    555580        }
Note: See TracChangeset for help on using the changeset viewer.