reference/ocr-simple/browser.tcl
changeset 0 6b8091ca909a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/reference/ocr-simple/browser.tcl	Thu May 18 23:12:51 2006 +0200
@@ -0,0 +1,35 @@
+#!/usr/sww/bin/wish -f
+
+scrollbar .scroll -command ".list yview"
+listbox .list -yscrollcommand ".scroll set" -relief raised -geometry 20x20
+pack append . .scroll {right filly} .list {left expand fill}
+
+if {$argc > 0} {
+    set dir [lindex $argv 0]
+} else {
+    set dir .
+}
+foreach i [exec ls -aF $dir] {
+    .list insert end $i
+}
+proc browse {dir file} {
+    if {$dir != "."} {set file $dir/$file}
+    if [file isdirectory $file] {
+	exec browser.tcl $file &
+    } else {
+	if [file isfile $file] {
+	    exec mx $file &
+	} else {
+	    puts stdout "This is neither dir nor regular file"
+	}
+    }
+}
+
+bind .list <Control-c> {destroy .}
+bind .list <Double-Button-1> {
+    foreach i [selection get] {browse $dir $i}
+}
+focus .list
+
+
+