[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: X-servers for Win & Mac Re: Introduction



Hi Bill,

You might want a copy of SpecTcl from http://www.scriptics.com/spectcl/. 
It's a graphical IDE for Tcl/Tk (and Java, though an extremely old version
of it).  Development has stopped so it's a little buggy but enough to get
work done.

I never read a book on Tcl, but learned the language from online
tutorials floating around the net, some example programs here and
there, and the man pages (they're quite good; look in section n), plus
some attempts to write my own tcl/tk front ends for one or two utils
(e.g. smbclient).

I have to admit, tcl is not exactly the best language for computation- or
data-intensive apps; but tcl/tk works great for quick and dirty GUIs. Perl
is loads more efficient than Tcl, so I figured Perl/Tk'd be the best of
both worlds; but I haven't got down to exploring it yet. 

For bigger projects, use either Perl/Tk or iTcl/iTk, which is like
object-oriented tcl with lots of mega-widgets.  Again, I haven't
examined that in detail.

I've seen TkDesk, but don't know if it is easy to add tcl/tk
`scriptlets' to it.

In the mean time, here's a tcl/tk script that will do the mount thingy:

 #! /bin/sh
 # the next line restarts using wish \
 exec wish "$0" "$@"

 set mount_cmd "/bin/mount /dev/fd0"    # Or whatever partitions
 set umount_cmd "/bin/umount /dev/fd0"  # you want to mount

 proc toggle_do { widget text cmd new_text new_cmd } {

    if {[catch {eval "exec $cmd"}] == 0} {

        $widget configure -text "$new_text" \
                -command [list toggle_do "$widget" \
                "$new_text" "$new_cmd" "$text" "$cmd"]
        pack $widget
    }
 }

 button .btnMount
 .btnMount configure -text "mount"
 .btnMount configure -command [list \
        toggle_do .btnMount \
        mount "$mount_cmd" \
        unmount "$umount_cmd"]

 pack .btnMount

If you like, you might want to add a browse list of all the valid
devices and their mount status'.  One way to do this is to grep out
the relevant lines from dmesg (the kernel will report whatever
hardware it can find) and look into /proc/mounts to decide what is
currently mounted (/etc/mtab is unreliable).  You could also add a
status bar while you're at it.

See also Red Hat's fstool in the control panel.

---
Rhandeev Singh                          rhandeev@comp.nus.edu.sg
Linux User Group                        http://linux.comp.nus.edu.sg
School of Computing                     http://www.comp.nus.edu.sg
National University of Singapore