Date: Sat, 13 Oct 2001 14:19:29 -0400 From: The Anarcat <anarcat@anarcat.dyndns.org> To: Libh <freebsd-libh@freebsd.org> Subject: tclh hui console ready! Message-ID: <20011013141929.F739@shall.anarcat.dyndns.org>
next in thread | raw e-mail | index | archive | help
--kjpMrWxdCilgNbo1
Content-Type: multipart/mixed; boundary="E7i4zwmWs5DOuDSH"
Content-Disposition: inline
--E7i4zwmWs5DOuDSH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
I made a primitive hui console. It does not take care of stdout/err
redirection yet, but does return the "value" of tcl commands and also
the errors in such commands.
How to use:
source console.tcl
open_console $hui
or from command line:
$ tclh console_init.tcl
Anyways, anyone knows how I could *read* from *stdout*? :)
A.
--E7i4zwmWs5DOuDSH
Content-Type: application/x-tcl
Content-Description: console include code
Content-Disposition: attachment; filename="console.tcl"
Content-Transfer-Encoding: quoted-printable
global cons_w=0A=0Aproc read_cmd {hui button data} {=0A=0A global comman=
d=0A =0A catch [$command text] sid=0A cons_append $sid=0A =0A}=
=0A=0Aproc cons_append {string} {=0A global cons_out=0A =0A # XXX: t=
his is probably not the (c) good way=0A $cons_out text [format "%s%s" [$=
cons_out text] $string]=0A if {$string !=3D "" && $string !=3D "\n"} {=
=0A cons_append "\n"=0A }=0A}=0A=0A# make the console openable on=
ly once=0Aproc open_console {hui} {=0A=0A global cons_w=0A if {[info =
vars cons_w] =3D=3D "cons_w" &&=0A ![catch {set cons_w $cons_w}] &&=
=0A ![H::is_null $cons_w]=0A } {=0A $cons_w show=0A =
return=0A } else {=0A cons_make_main_win $hui=0A } =0A=
=0A=0A}=0A=0A# Create the main-window and its elements=0A#=0A# do not call =
this from outside console.tcl, use open_console instead=0Aproc cons_make_ma=
in_win {hui} {=0A global command=0A global cons_out=0A global cons=
_w=0A =0A set cons_w [$hui window cons_w "Console" "0 0" "25 20" "ver=
tical"] =0A =0A set cmd_cont [$cons_w container "container"]=0A =
=0A set command [$cmd_cont inputLine "Console Command" "" -1]=0A $cmd=
_cont button "gobutton" "&Eval" {read_cmd ""} "default"=0A =0A set co=
ns_out [$cons_w textEdit "Console Output" "" FALSE]=0A =0A $cmd_cont =
resize "3 -1"=0A # Finally, show the window=0A $cons_w show=0A}
--E7i4zwmWs5DOuDSH
Content-Type: application/x-tcl
Content-Description: console bootstrap code
Content-Disposition: attachment; filename="console_init.tcl"
Content-Transfer-Encoding: quoted-printable
source console.tcl=0A=0A# Init UI=0Aset hui [Hui::open "auto"]=0A=0A# Creat=
e the main-window=0Acons_make_main_win $hui=0A=0A# Run hui=0A$hui run
--E7i4zwmWs5DOuDSH--
--kjpMrWxdCilgNbo1
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjvIhbAACgkQttcWHAnWiGeE7gCeK+0EUSXItDyEdDeDORsDgJYZ
rHAAn2Vgh7/6tFvttk0LQUVvvbOvBkzR
=8XN+
-----END PGP SIGNATURE-----
--kjpMrWxdCilgNbo1--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-libh" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011013141929.F739>
