[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A simple GUI
From: |
David Bateman |
Subject: |
Re: A simple GUI |
Date: |
Mon, 04 Dec 2006 10:19:00 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
Søren Hauberg wrote:
> Hi Everybody,
> I've just created a simple octave wrapper for the "zenity" command
> line tool. It allows the creation of simple GUI's such as file
> selections, calendars, text entries, message windows, and a few other
> kinds of windows.
> So, my first question is: does anybody want this code? If so, I'll
> upload it to octave-forge.
> My second and more important question is about shell scripting inside
> octave. If you have zenity installed (it comes with the GNOME desktop)
> you can get a progress dialog from bash using these commands:
>
> (
> echo "10" ; sleep 1
> echo "# Updating mail logs" ; sleep 1
> echo "20" ; sleep 1
> echo "# Resetting cron jobs" ; sleep 1
> echo "50" ; sleep 1
> echo "This line will just be ignored" ; sleep 1
> echo "75" ; sleep 1
> echo "# Rebooting system" ; sleep 1
> echo "100" ; sleep 1
> ) |
> zenity --progress \
> --title="Update System Logs" \
> --text="Scanning mail logs..." \
> --percentage=0
>
> Does anybody know how I can do this from octave using this syntax:
> zenity_progress(10, "Updating mail logs");
> zenity_progress(20, "Resetting cron jobs");
> zenity_progress(75, "Rebooting system");
> or something similar?
>
> Thanks,
> Søren
>
In an oct-file why not something like
std::ostringstream buf;
buf << "zenity --progress --title=\"Update System Logs\"
--text=\"Scanning mail logs...\" --percentage=0"
oprocstream filter (buf.str ());
if (filter && filter.is_open ())
{
filter << "echo \"10\"; sleep 1\n";
filter << "echo \"# Updating mail logs\" ; sleep 1\n";
filter << "echo \"20\" ; sleep 1\n";
filter << "echo \"# Resetting cron jobs\" ; sleep 1\n";
filter << "echo \"50\" ; sleep 1\n";
filter << "echo \"This line will just be ignored\" ; sleep 1\n";
filter << "echo \"75\" ; sleep 1\n";
filter << "echo \"# Rebooting system\" ; sleep 1\n";
filter << "echo \"100\" ; sleep 1\n";
int status = filter.close ();
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
warning("zenity filter exited abnormally");
}
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
- A simple GUI, Søren Hauberg, 2006/12/01
- Re: A simple GUI,
David Bateman <=