Changeset 1774 for branches


Ignore:
Timestamp:
Jun 21, 2010, 2:16:16 PM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r1771 r1774  
    7070    private method ResetSettings { }
    7171    private method GetOutput {}
    72     private method Done { state }
     72    private method SetWaitVariable { state }
    7373    private method SetLayoutOption { option }
    7474    private method GetAxisType { axis }
     
    112112        button $itk_interior.ok -text "Save" \
    113113            -highlightthickness 0 \
    114             -command [itcl::code $this Done 1] \
     114            -command [itcl::code $this SetWaitVariable 1] \
    115115            -compound left \
    116116            -image [Rappture::icon download]
     
    119119        button $itk_interior.cancel -text "Cancel" \
    120120            -highlightthickness 0 \
    121             -command [itcl::code $this Done 0] \
     121            -command [itcl::code $this SetWaitVariable 0] \
    122122            -compound left \
    123123            -image [Rappture::icon cancel]
     
    158158
    159159itcl::body Rappture::XyPrint::reset {} {
    160     Done 0
    161 }
    162 
    163 itcl::body Rappture::XyPrint::Done { state } {
     160    SetWaitVariable 0
     161}
     162
     163itcl::body Rappture::XyPrint::SetWaitVariable { state } {
    164164    set _wait($this) $state
    165165}
     
    171171    RestoreSettings $toolName $plotName
    172172    InitializeSettings
    173     set _wait($this) 0
     173    SetWaitVariable 0
    174174    tkwait variable [itcl::scope _wait($this)]
     175    SaveSettings $toolName $plotName
    175176    set output ""
    176177    if { $_wait($this) } {
    177178        set output [GetOutput]
    178179    }
    179     SaveSettings $toolName $plotName
    180180    DestroySettings
    181181    return $output
     
    395395
    396396itcl::body Rappture::XyPrint::SetOption { opt } {
    397     set new $_settings($this-graph-$opt)
    398     set old [$_clone cget -$opt]
    399     set code [catch [list $_clone configure -$opt $new] err]
     397    set new $_settings($this-graph$opt)
     398    set old [$_clone cget $opt]
     399    set code [catch [list $_clone configure $opt $new] err]
    400400    if { $code != 0 } {
    401401        bell
    402402        global errorInfo
    403403        puts stderr "$err: $errorInfo"
    404         set _settings($this-graph-$opt) $old
    405         $_clone configure -$opt $old
     404        set _settings($this-graph$opt) $old
     405        $_clone configure $opt $old
    406406    }
    407407}
    408408
    409409itcl::body Rappture::XyPrint::SetComponentOption { comp opt } {
    410     set new $_settings($this-$comp-$opt)
    411     set old [$_clone $comp cget -$opt]
    412     set code [catch [list $_clone $comp configure -$opt $new] err]
     410    set new $_settings($this-$comp$opt)
     411    set old [$_clone $comp cget $opt]
     412    set code [catch [list $_clone $comp configure $opt $new] err]
    413413    if { $code != 0 } {
    414414        bell
    415415        global errorInfo
    416416        puts stderr "$err: $errorInfo"
    417         set _settings($this-$comp-$opt) $old
    418         $_clone $comp configure -$opt $old
     417        set _settings($this-$comp$opt) $old
     418        $_clone $comp configure $opt $old
    419419    }
    420420}
    421421
    422422itcl::body Rappture::XyPrint::SetNamedComponentOption { comp name opt } {
    423     set new $_settings($this-$comp-$opt)
    424     set old [$_clone $comp cget $name -$opt]
    425     set code [catch [list $_clone $comp configure $name -$opt $new] err]
     423    set new $_settings($this-$comp$opt)
     424    set old [$_clone $comp cget $name $opt]
     425    set code [catch [list $_clone $comp configure $name $opt $new] err]
    426426    if { $code != 0 } {
    427427        bell
    428428        global errorInfo
    429429        puts stderr "$err: $errorInfo"
    430         set _settings($this-$comp-$opt) $old
    431         $_clone $comp configure $name -$opt $old
     430        set _settings($this-$comp$opt) $old
     431        $_clone $comp configure $name $opt $old
    432432    }
    433433}
     
    514514    set _settings($this-element-color) [$_clone element cget $elem -color]
    515515    set _settings($this-element-dashes) [$_clone element cget $elem -dashes]
    516     set _settings($this-element-hide) [$_clone element cget $elem -hide]
     516    #set _settings($this-element-hide) [$_clone element cget $elem -hide]
    517517    set _settings($this-element-label) [$_clone element cget $elem -label]
    518518    set page $itk_component(legend_page)
     
    663663    set _settings($this-legend-position)  [$page.position current]
    664664    set _settings($this-legend-anchor)    [$page.anchor current]
    665     foreach option { hide position anchor borderwidth } {
     665    foreach option { -hide -position -anchor -borderwidth } {
    666666        SetComponentOption legend $option
    667667    }
     
    10751075    set _settings($this-legend-anchor)    [$page.anchor current]
    10761076
    1077     foreach option { hide position anchor borderwidth } {
     1077    foreach option { -hide -position -anchor -borderwidth } {
    10781078        SetComponentOption legend $option
    10791079    }
     
    10921092    set page $itk_component(axis_page)
    10931093    $_clone configure -plotpad${type} $_settings($this-axis-plotpad)
    1094     foreach option { grid min max loose title stepsize subdivisions } {
     1094    foreach option { -grid -min -max -loose -title -stepsize -subdivisions } {
    10951095        SetNamedComponentOption axis $axis $option
    10961096    }
     
    11191119    set _settings($this-element-symbol) [$page.symbol current]
    11201120    set _settings($this-element-dashes) [$page.dashes current]
    1121     foreach option { symbol color dashes hide label } {
     1121    foreach option { -symbol -color -dashes -label } {
    11221122        SetNamedComponentOption element $elem $option
    11231123    }
     
    13381338    # Element settings
    13391339    foreach elem [$_clone element show] {
    1340         append out "    if \{ \[preview element exists \"$elem\"\] \} \{\n"
    1341         append out "        preview element configure \"$elem\""
    1342         foreach opt { -symbol -color -dashes -hide -label } {
     1340        set label [$_clone element cget $elem -label]
     1341        if { $label == "" } {
     1342            continue
     1343        }
     1344        append out "    if \{ \[preview element exists \"$label\"\] \} \{\n"
     1345        append out "        preview element configure \"$label\""
     1346        foreach opt { -symbol -color -dashes -label } {
    13431347            set value [list [$_clone element cget $elem $opt]]
    13441348            append out " $opt $value"
Note: See TracChangeset for help on using the changeset viewer.