libGringo
replacement for Dialog/Whiptail that works both in console and under X11
libGringo is available at http://www.badpenguin.org/pub/softw...
it does provide:
- libgringo – library to handle CUI/GUI dialog
- gringosh – shell like interpreter for gringo language
- gringodlg – replacement for dialog and whiptail
libGringo goal is to replace dialog/whiptail and having the same utility to work in terminal mode or under X11; indeed libGringo requires X11 and GTK to work in GUI mode otherwise it works in terminal (CUI) mode
What is libgringo ?
libgringo is a library to write apps that runs both in console (CUI mode) and in X-Window (GUI mode). To do that libgringo uses ‘ncurses’ fro console I/O and ‘gtk’ to build X-Window apps. You are free to add support for other libraries like slang, xform, libQt or Motif in respect of the license of this software.
What libgringo provides ?
libgringo provides you the following widgets and their events:
- window
- label
- button
- edit box
- checkboxe
- grid
- listbox
What is libgringo suitable for ?
libgringo was written in order to make some configuration scripts to work both in console and under X-Window without any modification. Infact libgringo main goal is to be used by ‘gringosh’ BTW gringosh is suitable only for easy application based on a single window. Writeing your apps directly in C you can develop powerfull and easy applications.
And last but not least to deprecate the ?uck?ng ‘dialog’ package.
Example in C:
void leave() {
gringo_Terminate(0);
fprintf( stderr, "nnTerminated by the user.n" );
}
int main( int argc, char* argv[] ) {
TWindow *win1;
TGrid *grid1;
TButton *button1;
gringo_Init( &argc, &argv );
win1 = window_Create( 10, 3, 60, 18, "Network Configuration" );
window_BackTitle( win1, "libhardware :: example 4" );
label_Create( win1, 2, 2, 0, " IP Address:" );
label_Create( win1, 2, 4, 0, "Subnet mask:" );
edit_Create( win1, 15, 2, 20, NULL );
edit_Create( win1, 15, 4, 20, NULL );
button1 = button_Create( win1, 21, 6, 0, "Chiudi" );
button_OnClick (button1, leave);
checkbox_Create( win1, 2, 8, "Sposta posta letta", 1 );
grid1 = grid_Create( win1, 2, 10, 50, 7 );
grid_AddColumn( grid1, "Colonna 1", 10 );
grid_AddColumn( grid1, "Colonna 2", 10 );
grid_AddColumn( grid1, "Data", 4 );
grid_AddColumn( grid1, "Descrizione", 8 );
grid_AddColumn( grid1, "Col5", 5 );
grid_AddColumn( grid1, "Col6", 6 );
grid_AddText( grid1, "X", "enlightenment", "0.16.2", NULL );
grid_AddText( grid1, "I", "perl", "5.0.004", NULL );
grid_AddText( grid1, "a", "bbbbbbbbb", "cccccccccc", NULL );
grid_AddText( grid1, "dd", "eeee", "ffffff", NULL );
grid_AddText( grid1, "g", "h", "i", "lllllllll", "mmmmmmmm", "nnnnnnnn", NULL );
window_OnClose (win1, leave);
gringo_Loop();
gringo_Quit();
return 0;
}
GringoSH
What is GringoSh
Gringo is an attempt to achieve two goals.
- Creating a powerfull tool to use in shell scripts.
- Creating a libraries for curses programming.
How to run gringosh
- cat example.gringosh | gringosh
- gringosh -f example.gringosh
Language
# Create a window WINDOW, x, y, w, h, Title # Create a label LABEL, x, y, [w], Caption # Create an edit box EDIT, x, y, [w], [Text], Widget Name # Create a button BUTTON, x, y, [w], Caption, Widget Name # Create a checkbox CHECKBOX, x, y, value, Caption, Widget Name # Create an empty listbox LISTBOX, x, y, w, h, Widget Name # Add en element to the listbox LISTITEM, Text
Example
# GringoSHell Example WINDOW| 10| 3| 60| 18| Network Configuration BACKTITLE| libhardare by Antonio Gallo - example.gringosh LABEL| 3| 2|| IP Address: LABEL| 2| 4|| Subnet mask: EDIT| 15| 2| 20|| EDIT1 EDIT| 15| 4| 20|| EDIT2 BUTTON| 21| 6|| Chiudi| BUTTON1 CHECKBOX| 2| 8| 1| Sposta posta letta| CHECK1 LISTBOX| 2| 10| 50| 7| LIST1 LISTITEM| Elemento Uno LISTITEM| Elemento con descrizione oltre i cinquanta caratteri LISTITEM| Elemento Tre LISTITEM| Elemento Quattro LISTITEM| Elemento Cinque LISTITEM| Elemento Sei LISTITEM| Elemento Sette
GringoDLG
Gringodlg is designed to work like dialog and suppress the old gringosh
Example: invoking
#!/bin/sh ../gringodlg/gringodlg -f example.dlg 1>example.out 2>example.err
Example: example.dlg
--width 40 --cwindow Ciao Bellezza! --backtitle provola --lowertitle provolone --clabel Ciao frocione! --newline --listbox 5 --listitem icoa --listitem icob --listitem icoc --cbutton VA BENE! --newline
| « previous | ↑ back | » forward » |





