Re: [SLUG] {SPAM?} Linux gui programming

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Mon Mar 14 2005 - 21:41:13 EST


Donald E Haselwood wrote:
> For doing small (home/hobby type) gui base projects, which language would you
> recommend? I've been looking at Qt, GTK, and Java, and each one gets touted
> as the best.
>
> I've struggled through the learning with WN98SE, C++, wilth MFC (and it's
> miserable documentation). Getting over to Linux is now the goal. I would
> like to avoid the situation of investing the time and effort in learning only
> to discover that I picked one that was on its way out, a dog, obsolete, etc.

Just wanted to show an example of the Xdialog program that I mentioned
earlier:

During my administration tasks I need to visit a few dozen machines each
day. To facilitate this, I created a short script using both "dialog"
and "Xdialog" (the text and GUI versions). Here's a simple script using
Xdialog:

---START

#!/bin/ksh

MACHINE_LIST=~/.ssh/machine_list

while [[ "$RETCODE" -ne "1" ]]
do
     Xdialog --menu "Choose server:" 24 35 16 `cat ${MACHINE_LIST}`
2>/tmp/choice.$$
     RETCODE=$?
     CHOICE=`cat /tmp/choice.$$`
     rm /tmp/choice.$$

     if [ "$RETCODE" -ne "1" ]; then
         clear
         xterm -e "ssh ${CHOICE}" &
     fi
done

---END

To use it, do the following:

1) Install Xdialog
    Grab the sources from http://xdialog.dyns.net/ and compile. I have
    RPMs for Fedora, RedHat 9, and a few others.

2) Edit the ~/.ssh/machine_list directory and create a list of hosts and
descriptions. The file should look similar to this:

---START
epsilon Dell_Laptop
theta IBM_ThinkPad
gamma Cust_1
omega Depot_Sales
alpha Front_Office
omicron File_Server
---END

3) Optionally, configure SSH host keys on the remote server.

4) Run the script. (Watch the line breaks!)

You should get a menu showing the machine names. Double click on a name
to launch a new shell window.

As you can see, there's barely twenty lines of code but it can create an
application that would take perhaps 100 lines in another toolkit.

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:39:39 EDT