LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-12-2007, 11:17 PM   #1
bingo
Member
 
Registered: Apr 2006
Distribution: Slackware
Posts: 57

Rep: Reputation: 15
Front-end for shell scripts


I have a collection of shell scripts that I would like to build front-ends for. The requirements are very simple... some input fields and a button to execute "script(input1, input2, etc.)". Where should I start for this? I apologize if this is trivial, this isn't my specialty :-) Thanks!
 
Old 08-12-2007, 11:21 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Just grab gtkdialog or xdialog (even gxmessage or xmessage for the simplest stuff). You could reinvent a more specific or straightforward wheel in the language of your choice, but they should suffice for most things.

-- Something in your phrasing made me think 'GUI' but, if you mean a console frontend then dialog/cdialog is okay.

Last edited by slakmagik; 08-12-2007 at 11:23 PM. Reason: TUI option
 
Old 08-13-2007, 12:24 AM   #3
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Rep: Reputation: 30
Quote:
Originally Posted by bingo View Post
I have a collection of shell scripts that I would like to build front-ends for. The requirements are very simple... some input fields and a button to execute "script(input1, input2, etc.)". Where should I start for this? I apologize if this is trivial, this isn't my specialty :-) Thanks!
hi
here some useful example..
there is two buttons...
i used here gtk..

Code:
#include <stdlib.h>
#include <gtk/gtk.h>
#include <glib.h>

GtkWidget *status_bar;

static void push_item( GtkWidget *widget,
                       gpointer   data )
{
  static int count = 1;
  gchar *buff;

  buff = g_strdup_printf ("Item %d", count++);
  gtk_statusbar_push (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data), buff);
  g_free (buff);
}

static void pop_item( GtkWidget *widget,
                      gpointer   data )
{
  gtk_statusbar_pop (GTK_STATUSBAR (status_bar), GPOINTER_TO_INT (data));
}

int main( int   argc,
          char *argv[] )
{

    GtkWidget *window;
    GtkWidget *vbox;
    GtkWidget *button;

    gint context_id;

    gtk_init (&argc, &argv);

    /* create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100);
    gtk_window_set_title (GTK_WINDOW (window), "GTK Example");
    g_signal_connect (G_OBJECT (window), "delete_event",
                      G_CALLBACK (exit), NULL);
 
    vbox = gtk_vbox_new (FALSE, 1);
    gtk_container_add (GTK_CONTAINER (window), vbox);
    gtk_widget_show (vbox);
          
    status_bar = gtk_statusbar_new ();      
    gtk_box_pack_start (GTK_BOX (vbox), status_bar, TRUE, TRUE, 0);
    gtk_widget_show (status_bar);

    context_id = gtk_statusbar_get_context_id(
                          GTK_STATUSBAR (status_bar), "Statusbar example");

    button = gtk_button_new_with_label ("push item");
    g_signal_connect (G_OBJECT (button), "clicked",
                      G_CALLBACK (push_item), GINT_TO_POINTER (context_id));
    gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
    gtk_widget_show (button);              

    button = gtk_button_new_with_label ("pop last item");
    g_signal_connect (G_OBJECT (button), "clicked",
                      G_CALLBACK (pop_item), GINT_TO_POINTER (context_id));
    gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 2);
    gtk_widget_show (button);

    /* always display the window as the last step so it all splashes on
     * the screen at once. */
    gtk_widget_show (window);

    gtk_main ();

    return 0;
}
will be usefull

cheers..
munna
 
Old 08-13-2007, 04:17 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,312

Rep: Reputation: 175Reputation: 175
you may find tcl/tk ideal for this.
it's dead easy to use,

(assuming you have it installed)
type this into an xterm and you will get a button
that does an ls
Code:
wish
button .b -text hello -command "/bin/ls"
pack .b
 
Old 08-13-2007, 08:01 AM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,775

Rep: Reputation: 481Reputation: 481Reputation: 481Reputation: 481Reputation: 481
Xdialog is the most complete implementation of what you want. It uses the GTK libs so it is pretty universally compatible. I use it hundreds of ways, but I've also found and use other tools like greq, gxmessage or gtk-shell for special needs.
 
Old 08-13-2007, 05:12 PM   #6
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Quote:
Originally Posted by gnashley View Post
Xdialog is the most complete implementation of what you want. It uses the GTK libs so it is pretty universally compatible.
It probably would do what he wants, but I'm not sure I'd agree that it's the most complete. It has a lot of widgets but they are pretty limited - there's no '--4inputsbox ', for instance - just 1-3. Gtkdialog let's you essentially define most any interface out of a few widget atoms, so to speak, and you can define stuff with glade if you have to. And while gtk is pretty universal, debian-devel is having a fight now about removing it - gtk2 is also pretty universal and not about to be removed from anything. Xdialog has an essentially unsupported compile option to use gtk2 but is basically a gtk1 app, gtkdialog is gtk2.

But both are cool and will cover most needs.
 
Old 08-13-2007, 06:51 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
If I understand the question correctly, Zenity is a pretty simple way of makin a GUI interface to a script.
 
Old 08-13-2007, 08:36 PM   #8
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
zenity is gnome-specific, though - it may well work without the whole enchilada, but it needs a lot of gnome libs and junk like gconf. Bingo didn't say, so that may be okay but, odds are, with him running Slackware especially, gnome deps would be a negative.
 
Old 08-13-2007, 09:19 PM   #9
bingo
Member
 
Registered: Apr 2006
Distribution: Slackware
Posts: 57

Original Poster
Rep: Reputation: 15
Wow, thanks for all of the feedback! After the replies, I started reading more, and found that Slackware includes "dialog". It's been very simple to code, and I'm used to the interface from the Slackware utilities. There are probably limitations to what this tool can do, but it's working for me, and it doesn't need X, so it's very fast. Thanks again! ...Steve
 
Old 08-13-2007, 09:48 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Quote:
Originally Posted by digiot View Post
zenity is gnome-specific, though - it may well work without the whole enchilada, but it needs a lot of gnome libs and junk like gconf. Bingo didn't say, so that may be okay but, odds are, with him running Slackware especially, gnome deps would be a negative.
I've installed Zenity on two different KDE boxes--no issues whatever: It's in the repositories, grabs a few libraries, and all is good. I don't get upset about Gnome libs when using GIMP either. Is that an issue for Slackware users???
 
Old 08-13-2007, 11:24 PM   #11
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Gimp is just a gtk2 app - it doesn't actually require any gnome stuff. Just gtk2 and a truckload of multimedia libs. And since it's part of Slackware, all that's taken care of.

Actually, I stand somewhat corrected, though - looking at zenity on a Debian box, it would just install libart, a couple of libgnomecanvas libs, and scrollkeeper and libscrollkeeper. And I can't imagine scrollkeeper is an actual functional requisite. So it's not as much as I was thinking, but still some junk as opposed to the various other solutions. I was thinking it wanted gconf and a bunch of other garbage.
 
  


Reply

Tags
frontend


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c dbg front-end kpachopoulos Linux - Software 1 06-09-2007 12:59 PM
looking for a mysql front-end nephish Linux - Software 3 11-08-2006 01:04 PM
Building front end for shell scripts endfx Linux - Software 4 03-16-2006 05:22 AM
Front End Advice Please thadco Programming 2 06-21-2005 05:02 AM
Front- End for Qmail Koven Linux - Software 1 03-09-2005 03:56 PM


All times are GMT -5. The time now is 07:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration