WJG (23/08/13) Wanted a simple, no frills (or thrills) viewer for Metakit data files. This was pretty easy to do using the gnocl::list widget.
#---------------
# metakit-viewer.tcl
#---------------
#
# !/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
package require Mk4tcl
#---------------
# simple loader and viewer
#---------------
#
proc mk:viewer {dbname} {
set nb [gnocl::notebook -homogeneous 1]
set i 0
mk::file open db $dbname
foreach v [mk::file views db] {
set lv [gnocl::list -titles [mk::view layout db.$v] -ruleHint 1]
$nb addPage $lv $v
mk::loop i db.$v {
set item [mk::get $i]
for {set j 1} {$j < [llength $item] } {incr j 2} {
lappend str [lindex $item $j]
}
$lv add $str -singleRow 1
unset str
}
}
return $nb
}
gnocl::window -child [mk:viewer $::argv] -setSize 0.2 -title "mk:viewer - $::argv" -onDelete {exit}
To install, simply open a shell terminal in the directory containing the script and run:
chmod +x *.tcl
cp metakit-viewer.tcl -f $HOME/bin/