Re: Seeking advice and information



On Tue, 5 Jul 2011 17:38:49 +0100
Duncan Ferguson <duncan_j_ferguson yahoo co uk> wrote:


I would much prefer to start up a number of Tk/Gtk2 windows with the terminal or shell embedded in them, 
then when a key press event is received i just forward on to each window - then this avoids the X event 
conversion which means the key pressed is actually the one put into each terminal and there isn't an issue 
with the terminal window supporting allowSendEvents.


I may be missing some fine point of how all this works, but the
first thing that comes to mind, is this: UNTESTED :-)

It might be easier to avoid the embedded terminals and
just handle all input and output thru IPC::Open3 or whatever
IPC module suits you.

1. Make as may gtk vboxes as you need for the number of machines
you want to run in parallel, and assign a hostname to it.
Each should have a scrolled text widget, a label, and possibly
an entry for issuing unique commands to solo hosts.

2. Make your filehandles for all the connections
It is easiest to store all information in a hash with the hostname
as key, like 
$hash{$hostname}{ 'filehandle_stdin'}  
$hash{$hostname}{ 'filehandle_stdout'}  
$hash{$hostname}{ 'filehandle_stderr'}  
etc etc

3. Start each ssh connection using IPC::Open3 ( or whichever IPC module you prefer and works )

4. Use the typical boilerplate gtk io watch on all the stdout and stderr filehandles

5. Create 1 entry widget, connected to your console's stdin, and when you type
something on stdin, in the callback repeat it to all of the $hash{$hostname}{ 'filehandle_stdin'}  
filehandles thru a loop thru the hash.

0m,
zentara



 










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