| |
 |
|
|
Linux Forum Index » Linux Miscellaneous Topics 2 » converting bash-scripts into GUI's...
Page 1 of 2 Goto page 1, 2 Next
|
| Author |
Message |
| Rahul... |
Posted: Sat Jul 05, 2008 3:43 pm |
|
|
|
Guest
|
Myself, I prefer the command-line for executing most applications. The
command line + options + text config files allow a very powerful, flexible,
scriptable way to do most things. Besides pipes make chaining easier.
But, every so often I come to users who refuse to be weaned away from their
"GUI-addiction"; even for trivial tasks where the GUI does not add any
functionality they demand a GUI. Do other people face this situation too?
Is there any easy workaround? Let's say I've a nice bash / perl script that
works great with options etc. And now I want to "GUI"ize it with minimum
effort what would people recommend? Or will I have to recode everything in
a language with a GUI library support (Python?)? vtk, gtk etc. come to
mind. But that's a lot of rework I feel.
Of course, I have very little confidence in my aesthetic abilities and
whenever I try to select colors / line-styles etc. things end up looking
perfectly ghastly. So if there are GUI designing templates etc. that make
the task any easier for the aesthetically-challenged all the more better.
Basically what's the quick-n-dirty way of converting scripts to GUI's? I'm
on RHEL.
--
Rahul |
|
|
| Back to top |
|
| Sam... |
Posted: Sat Jul 05, 2008 10:01 pm |
|
|
|
Guest
|
Rahul writes:
Quote: Basically what's the quick-n-dirty way of converting scripts to GUI's? I'm
on RHEL.
It's the same "quick-n-dirty" way that you'd use to convert an apple into
an orange. The two are completely different beasts, that have very little to
do with each other. I am not aware of any individuals tools that can quickly
slap on a GUI on top of a shell script. There's an ancient tool "xmessage"
which a shell script can run to pop up a dialog window with a canned set of
button, wait for a selection, and return an indication of what was selected
to the shell script. That's pretty much it.
If your needs are for a more sophisticated GUI, you'll have to recode the
bash script into something else. A C/C++ based GTK or Qt application, or a
python script with gtk (or qt) bindings. |
|
|
| Back to top |
|
| Bill Waddington... |
Posted: Sat Jul 05, 2008 10:10 pm |
|
|
|
Guest
|
On Sun, 6 Jul 2008 01:43:47 +0000 (UTC), Rahul <nospam at (no spam) nospam.invalid> wrote:
Quote: Myself, I prefer the command-line for executing most applications. The
command line + options + text config files allow a very powerful, flexible,
scriptable way to do most things. Besides pipes make chaining easier.
But, every so often I come to users who refuse to be weaned away from their
"GUI-addiction"; even for trivial tasks where the GUI does not add any
functionality they demand a GUI. Do other people face this situation too?
Is there any easy workaround? Let's say I've a nice bash / perl script that
works great with options etc. And now I want to "GUI"ize it with minimum
effort what would people recommend? Or will I have to recode everything in
a language with a GUI library support (Python?)? vtk, gtk etc. come to
mind. But that's a lot of rework I feel.
Of course, I have very little confidence in my aesthetic abilities and
whenever I try to select colors / line-styles etc. things end up looking
perfectly ghastly. So if there are GUI designing templates etc. that make
the task any easier for the aesthetically-challenged all the more better.
Basically what's the quick-n-dirty way of converting scripts to GUI's? I'm
on RHEL.
I'm not really sure what you are looking for, but maybe something like this:
http://freshmeat.net/projects/zenity
I fooled around with it once, but went back to the command line. YMMV.
Bill
--
William D Waddington
william.waddington at (no spam) beezmo.com
"Even bugs...are unexpected signposts on
the long road of creativity..." - Ken Burtch |
|
|
| Back to top |
|
| Robert Heller... |
Posted: Sat Jul 05, 2008 11:04 pm |
|
|
|
Guest
|
At Sun, 6 Jul 2008 01:43:47 +0000 (UTC) Rahul <nospam at (no spam) nospam.invalid> wrote:
Quote:
Myself, I prefer the command-line for executing most applications. The
command line + options + text config files allow a very powerful, flexible,
scriptable way to do most things. Besides pipes make chaining easier.
But, every so often I come to users who refuse to be weaned away from their
"GUI-addiction"; even for trivial tasks where the GUI does not add any
functionality they demand a GUI. Do other people face this situation too?
Is there any easy workaround? Let's say I've a nice bash / perl script that
works great with options etc. And now I want to "GUI"ize it with minimum
effort what would people recommend? Or will I have to recode everything in
a language with a GUI library support (Python?)? vtk, gtk etc. come to
mind. But that's a lot of rework I feel.
Of course, I have very little confidence in my aesthetic abilities and
whenever I try to select colors / line-styles etc. things end up looking
perfectly ghastly. So if there are GUI designing templates etc. that make
the task any easier for the aesthetically-challenged all the more better.
Basically what's the quick-n-dirty way of converting scripts to GUI's? I'm
on RHEL.
There is no 'quick-n-dirty' way of converting scripts to GUI's (as in
totally automated). For most of my non-trivial CLI scripts I tend to
use Tcl, so converting a CLI script written in Tcl to a GUI one is
fairly trivial: just a matter of 'package require Tk' and writting a
GUI front-end to the argc/argv processing (and it is possible to put
all of the GUI business as part of an if statement and use the same
script file for both CLI and GUI).
Writing a GUI wrapper for any program (including bash scripts) in
Tcl/Tk (or, I guess, Python/Tk) is pretty fast and easy. Writing a GUI
in C (eg Gtk), C++ (eg Qt), or Java is a LOT of work, no matter how
trivial and is probably not worth it for most simple bash scripts (if
it was, you probably would have written the original program in C or
C++ or Java).
Note: for a bash script that has no required options or parameters, it
is possible to just add a launcher button/menu/icon to any of the
typical desktop managers. I guess for a bash script does have required
options or parameters, this can still be done, if there is some specific
set of options and parameters that the end-user is interested in. This
is about as quick-n-dirty as you get.
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller at (no spam) deepsoft.com -- Contract Programming: C/C++, Tcl/Tk |
|
|
| Back to top |
|
| General Schvantzkopf... |
Posted: Sun Jul 06, 2008 6:53 am |
|
|
|
Guest
|
On Sun, 06 Jul 2008 01:43:47 +0000, Rahul wrote:
Quote: Myself, I prefer the command-line for executing most applications. The
command line + options + text config files allow a very powerful,
flexible, scriptable way to do most things. Besides pipes make chaining
easier.
But, every so often I come to users who refuse to be weaned away from
their "GUI-addiction"; even for trivial tasks where the GUI does not add
any functionality they demand a GUI. Do other people face this situation
too?
Is there any easy workaround? Let's say I've a nice bash / perl script
that works great with options etc. And now I want to "GUI"ize it with
minimum effort what would people recommend? Or will I have to recode
everything in a language with a GUI library support (Python?)? vtk, gtk
etc. come to mind. But that's a lot of rework I feel.
Of course, I have very little confidence in my aesthetic abilities and
whenever I try to select colors / line-styles etc. things end up looking
perfectly ghastly. So if there are GUI designing templates etc. that
make the task any easier for the aesthetically-challenged all the more
better.
Basically what's the quick-n-dirty way of converting scripts to GUI's?
I'm on RHEL.
For the trivial case where the user doesn't have to specify any arguments
you could just create a custom launcher on the Gnome panel that calls
your bash script. Just right click on the Gnome panel, select Add to
Panel, then select Custom Application Launcher, then call the bash script
from Command in the launcher.
If you need more than that you will probably have to write some Python.
You can call anything from anything so you could use Python to write a
GUI that allows someone to specify arguments and then it can call your
scripts. |
|
|
| Back to top |
|
| ray... |
Posted: Sun Jul 06, 2008 9:15 am |
|
|
|
Guest
|
On Sun, 06 Jul 2008 01:43:47 +0000, Rahul wrote:
Quote: Myself, I prefer the command-line for executing most applications. The
command line + options + text config files allow a very powerful,
flexible, scriptable way to do most things. Besides pipes make chaining
easier.
But, every so often I come to users who refuse to be weaned away from
their "GUI-addiction"; even for trivial tasks where the GUI does not add
any functionality they demand a GUI. Do other people face this situation
too?
Is there any easy workaround? Let's say I've a nice bash / perl script
that works great with options etc. And now I want to "GUI"ize it with
minimum effort what would people recommend? Or will I have to recode
everything in a language with a GUI library support (Python?)? vtk, gtk
etc. come to mind. But that's a lot of rework I feel.
Of course, I have very little confidence in my aesthetic abilities and
whenever I try to select colors / line-styles etc. things end up looking
perfectly ghastly. So if there are GUI designing templates etc. that
make the task any easier for the aesthetically-challenged all the more
better.
Basically what's the quick-n-dirty way of converting scripts to GUI's?
I'm on RHEL.
I'm not aware of anything that will help much - it's a pity too. Years ago
when we were using CDE on a DEC Alpha with Tru64 Unix, there was 'dtksh' -
desktop kornshell - which was very useful in that respect. I've not been
able to find anything close for Linux. |
|
|
| Back to top |
|
| Dan Espen... |
Posted: Sun Jul 06, 2008 10:18 am |
|
|
|
Guest
|
Rahul <nospam at (no spam) nospam.invalid> writes:
Quote: Myself, I prefer the command-line for executing most applications. The
command line + options + text config files allow a very powerful, flexible,
scriptable way to do most things. Besides pipes make chaining easier.
But, every so often I come to users who refuse to be weaned away from their
"GUI-addiction"; even for trivial tasks where the GUI does not add any
functionality they demand a GUI. Do other people face this situation too?
Is there any easy workaround? Let's say I've a nice bash / perl script that
works great with options etc. And now I want to "GUI"ize it with minimum
effort what would people recommend? Or will I have to recode everything in
a language with a GUI library support (Python?)? vtk, gtk etc. come to
mind. But that's a lot of rework I feel.
Of course, I have very little confidence in my aesthetic abilities and
whenever I try to select colors / line-styles etc. things end up looking
perfectly ghastly. So if there are GUI designing templates etc. that make
the task any easier for the aesthetically-challenged all the more better.
Basically what's the quick-n-dirty way of converting scripts to GUI's? I'm
on RHEL.
I've used Gtk-Perl.
Works pretty well. |
|
|
| Back to top |
|
| Maxwell Lol... |
Posted: Sun Jul 06, 2008 7:45 pm |
|
|
|
Guest
|
Rahul <nospam at (no spam) nospam.invalid> writes:
Quote: Is there any easy workaround? Let's say I've a nice bash / perl script that
works great with options etc. And now I want to "GUI"ize it with minimum
effort what would people recommend?
Perl/TK |
|
|
| Back to top |
|
| Rahul... |
Posted: Mon Jul 07, 2008 9:52 am |
|
|
|
Guest
|
Robert Heller <heller at (no spam) deepsoft.com> wrote in
news:06qdnXaoiqZ6tO_VnZ2dnUVZ_vSdnZ2d at (no spam) posted.localnet:
Quote:
I believe the OP wants to take a bash or perl script, that has various
parameters and/or options and create a GUI front end, where it pops up
a window with various entries, check buttons, option buttons/menus,
etc. that deal with the parameters and options. This is pretty much a
non-trivial task and I don't believe there are any automated programs
for doing this.
That's exactly what I wanted to do Robert.
--
Rahul |
|
|
| Back to top |
|
| Roland Latour... |
Posted: Mon Jul 07, 2008 4:16 pm |
|
|
|
Guest
|
On Mon, 07 Jul 2008 19:52:13 +0000, Rahul wrote:
Quote: Robert Heller <heller at (no spam) deepsoft.com> wrote in
news:06qdnXaoiqZ6tO_VnZ2dnUVZ_vSdnZ2d at (no spam) posted.localnet:
I believe the OP wants to take a bash or perl script, that has various
parameters and/or options and create a GUI front end, where it pops up
a window with various entries, check buttons, option buttons/menus,
etc. that deal with the parameters and options. This is pretty much a
non-trivial task and I don't believe there are any automated programs
for doing this.
That's exactly what I wanted to do Robert.
Why not use 'dialog' or 'xmessage' in your shell script? |
|
|
| Back to top |
|
| Robert Heller... |
Posted: Mon Jul 07, 2008 4:57 pm |
|
|
|
Guest
|
At Mon, 07 Jul 2008 16:16:26 -0500 Roland Latour <bogus at (no spam) bogus.com> wrote:
Quote:
On Mon, 07 Jul 2008 19:52:13 +0000, Rahul wrote:
Robert Heller <heller at (no spam) deepsoft.com> wrote in
news:06qdnXaoiqZ6tO_VnZ2dnUVZ_vSdnZ2d at (no spam) posted.localnet:
I believe the OP wants to take a bash or perl script, that has various
parameters and/or options and create a GUI front end, where it pops up
a window with various entries, check buttons, option buttons/menus,
etc. that deal with the parameters and options. This is pretty much a
non-trivial task and I don't believe there are any automated programs
for doing this.
That's exactly what I wanted to do Robert.
Why not use 'dialog' or 'xmessage' in your shell script?
dialog is limited to shell windows (it is not a 'true' GUI in a sense).
xmessage can only display a message and a batch of buttons. It has no
provision for things like:
entries (for entering random short strings)
option menus (for a selection of choices)
file browsers (for selecting a file)
check buttons (for selecting (or not) optional values)
radio buttons (for selecting one of several choices)
etc.
Say you have a shell script, replacestr.sh, that takes a two file names
(one input and one output) that edits the file, replacing the first (or
last) N (all by default) occurences of some string X replacing it with
string Y. The script takes four fixed parameters and two options:
./replacestr.sh [-count N] [-from start/end] infile outfile string1 string2
A GUI for this would have:
two file browsers, one that checks for an existing file and one that
checks for a possible overwrite of an existing file.
two entries, one for string1 and one for string2
It would have two check boxes: [] first N strings [] last N strings
and a checkbox/entry combo: for all? and for the count (with checking
for a positive non-zero integer)
You could probably do this with dialog (might take 2-3 screens), I don't
think xmessage can do this.
This is all easy enough to do with Tcl/Tk (esp. with BWidget and SNIT)
and can be done with Perl/Tk or Python/Tk or one can re-write one's
10-line shell script with 500+ lines of C or C++ using Gtk or Qt...
--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller at (no spam) deepsoft.com -- Contract Programming: C/C++, Tcl/Tk |
|
|
| Back to top |
|
| Maxwell Lol... |
Posted: Mon Jul 07, 2008 7:33 pm |
|
|
|
Guest
|
Rahul <nospam at (no spam) nospam.invalid> writes:
Quote: Robert Heller <heller at (no spam) deepsoft.com> wrote in
news:06qdnXaoiqZ6tO_VnZ2dnUVZ_vSdnZ2d at (no spam) posted.localnet:
I believe the OP wants to take a bash or perl script, that has various
parameters and/or options and create a GUI front end, where it pops up
a window with various entries, check buttons, option buttons/menus,
etc. that deal with the parameters and options. This is pretty much a
non-trivial task and I don't believe there are any automated programs
for doing this.
That's exactly what I wanted to do Robert.
And since you said perl. as I said before, perl/TK would be a great
way to start.
Here's a simple tutorial to get you started.
http://www.perl.com/1999/10/perltk/sld001.htm |
|
|
| Back to top |
|
| Rahul... |
Posted: Tue Jul 08, 2008 5:05 am |
|
|
|
Guest
|
Robert Heller <heller at (no spam) deepsoft.com> wrote in
news:IIqdnWFeR7ixDO_VnZ2dnUVZ_rDinZ2d at (no spam) posted.localnet:
Quote: This is all easy enough to do with Tcl/Tk (esp. with BWidget and SNIT)
and can be done with Perl/Tk or Python/Tk or one can re-write one's
10-line shell script with 500+ lines of C or C++ using Gtk or Qt...
Thanks again Robert for the detailed description. That is exactly the
situation I was facing. BTW, 10 lines of bash => 500+ C/C++ ballpark. What
about Tcl/tk, perl/tk or python/tk? Any estimates about their code
verbosities?
--
Rahul |
|
|
| Back to top |
|
| Rahul... |
Posted: Tue Jul 08, 2008 5:09 am |
|
|
|
Guest
|
Robert Heller <heller at (no spam) deepsoft.com> wrote in
news:IIqdnWFeR7ixDO_VnZ2dnUVZ_rDinZ2d at (no spam) posted.localnet:
Quote: This is all easy enough to do with Tcl/Tk (esp. with BWidget and SNIT)
and can be done with Perl/Tk or Python/Tk or one can re-write one's
10-line shell script with 500+ lines of C or C++ using Gtk or Qt...
Just as Tk can be bound to perl/python/tcl/C/C++ is there a bash/tk
interface? THat would be the most straigntforward solution for me right? I
already have bash do the job. Now I need a window manager which I find in
tk. Why not just directly tie them together? Or does such a beast not
exist?
--
Rahul |
|
|
| Back to top |
|
| Curt... |
Posted: Tue Jul 08, 2008 11:14 am |
|
|
|
Guest
|
On 2008-07-07, Robert Heller <heller at (no spam) deepsoft.com> wrote:
Quote:
Why not use 'dialog' or 'xmessage' in your shell script?
dialog is limited to shell windows (it is not a 'true' GUI in a sense).
What about 'xdialog'? |
|
|
| Back to top |
|
| |
Page 1 of 2 Goto page 1, 2 Next
All times are GMT - 5 Hours
The time now is Fri Aug 29, 2008 10:16 pm
|
|