diff options
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/doc/release/r8.1.html | 1 | ||||
-rw-r--r-- | ds9/library/colorbar.tcl | 97 |
2 files changed, 61 insertions, 37 deletions
diff --git a/ds9/doc/release/r8.1.html b/ds9/doc/release/r8.1.html index b58b6b8..1eeb36a 100644 --- a/ds9/doc/release/r8.1.html +++ b/ds9/doc/release/r8.1.html @@ -81,6 +81,7 @@ <li><tt><b>05.15.2019 RELEASE version 8.1b1</b></tt></li> <li><tt>05.28.2019 URL: more tolerant of mime types when downloading via http.</tt></li> <li><tt>06.04.2019 COLORBAR: fixed a number of issues with updating the screen with color tags active.</tt></li> +<li><tt>06.05.2019 GUI: colobar cmds load/save errors now report via Error proc.</tt></li> <li><tt><b>xx.xx.2019 RELEASE version 8.1b2</b></tt></li> </ol> </div> diff --git a/ds9/library/colorbar.tcl b/ds9/library/colorbar.tcl index f3a657f..c3fa35f 100644 --- a/ds9/library/colorbar.tcl +++ b/ds9/library/colorbar.tcl @@ -133,33 +133,39 @@ proc LoadColormap {} { } # used by backup -proc LoadColormapFile {filename} { +proc LoadColormapFile {fn} { global colorbar global icolorbar global current global ds9 - if {$filename != {}} { - colorbar load "\{$filename\}" - set id [colorbar get id] - set colorbar(map) [colorbar get name] + if {$fn == {}} { + return + } + + if {[catch {colorbar load "\{$fn\}"} rr]} { + Error $rr + return + } + + set id [colorbar get id] + set colorbar(map) [colorbar get name] + + $ds9(mb).color.user add radiobutton \ + -label "$colorbar(map)" \ + -variable colorbar(map) \ + -command [list ChangeColormapID $id] - $ds9(mb).color.user add radiobutton \ + if {[winfo exists $icolorbar(top)]} { + $icolorbar(mb).colormap.user add radiobutton \ -label "$colorbar(map)" \ -variable colorbar(map) \ -command [list ChangeColormapID $id] - - if {[winfo exists $icolorbar(top)]} { - $icolorbar(mb).colormap.user add radiobutton \ - -label "$colorbar(map)" \ - -variable colorbar(map) \ - -command [list ChangeColormapID $id] - } - incr icolorbar(count) - - ChangeColormapID $id } + incr icolorbar(count) + + ChangeColormapID $id } proc SaveColormap {} { @@ -167,36 +173,45 @@ proc SaveColormap {} { SaveColormapFile [SaveFileDialog colorbarfbox] } -proc SaveColormapFile {filename} { - if {$filename != {}} { - colorbar save "\{$filename\}" +proc SaveColormapFile {fn} { + if {$fn == {}} { + return + } + + if {[catch {colorbar save "\{$fn\}"} rr]} { + Error $rr + return } } proc LoadContrastBias {} { global dcolorbar - set filename [OpenFileDialog contrastbiasfbox] - if {$filename != {}} { - if {![catch {set ch [open $filename r]}]} { - set ll [gets $ch] - close $ch - set dcolorbar(contrast) [lindex $ll 0] - set dcolorbar(bias) [lindex $ll 1] - ApplyColormap - } + set fn [OpenFileDialog contrastbiasfbox] + if {$fn == {}} { + return + } + + if {![catch {set ch [open $fn r]}]} { + set ll [gets $ch] + close $ch + set dcolorbar(contrast) [lindex $ll 0] + set dcolorbar(bias) [lindex $ll 1] + ApplyColormap } } proc SaveContrastBias {} { global dcolorbar - set filename [SaveFileDialog contrastbiasfbox] - if {$filename != {}} { - if {![catch {set ch [open $filename w]}]} { - puts $ch "$dcolorbar(contrast) $dcolorbar(bias)" - close $ch - } + set fn [SaveFileDialog contrastbiasfbox] + if {$fn == {}} { + return + } + + if {![catch {set ch [open $fn w]}]} { + puts $ch "$dcolorbar(contrast) $dcolorbar(bias)" + close $ch } } @@ -676,7 +691,10 @@ proc LoadColorTag {fn} { if {$fn != {}} { # yes, we need this UpdateColormapLevel - $current(colorbar) tag load "\{$fn\}" + if {[catch {$current(colorbar) tag load "\{$fn\}"} rr]} { + Error $rr + return + } if {$current(frame) != {}} { $current(frame) colormap [$current(colorbar) get colormap] $current(frame) colorbar tag "\{[$current(colorbar) get tag]\}" @@ -688,8 +706,13 @@ proc SaveColorTag {} { global current set fn [SaveFileDialog colortagfbox] - if {$fn != {}} { - $current(colorbar) tag save "\{$fn\}" + if {$fn == {}} { + return + } + + if {[catch {colorbar tag save "\{$fn\}"} rr]} { + Error $rr + return } } |