summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--library/demos/image2.tcl11
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 96622d6..bddda72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2007-10-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * library/demos/image2.tcl (loadImage): Mark non-loadable images
+ as such instead of throwing a nasty dialog, following suggestion
+ from Don Porter.
+
* generic/tkImgPhoto.c (Tk_PhotoPutBlock): More optimization, derived
from [Patch 224066].
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl
index 916551e..0aed1f5 100644
--- a/library/demos/image2.tcl
+++ b/library/demos/image2.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a simple collection of widgets
# that allow you to select and view images in a Tk label.
#
-# RCS: @(#) $Id: image2.tcl,v 1.9 2004/12/21 11:56:35 dkf Exp $
+# RCS: @(#) $Id: image2.tcl,v 1.10 2007/10/31 16:11:49 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -22,7 +22,7 @@ proc loadDir w {
global dirName
$w.f.list delete 0 end
- foreach i [lsort [glob -directory $dirName *]] {
+ foreach i [lsort [glob -type f -directory $dirName *]] {
$w.f.list insert end [file tail $i]
}
}
@@ -57,7 +57,12 @@ proc loadImage {w x y} {
global dirName
set file [file join $dirName [$w.f.list get @$x,$y]]
- image2a configure -file $file
+ if {[catch {
+ image2a configure -file $file
+ }]} then {
+ # Mark the file as not loadable
+ $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000
+ }
}
set w .image2