After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 412493 - a new --form option for personal one-window solution in zenity
a new --form option for personal one-window solution in zenity
Status: RESOLVED FIXED
Product: zenity
Classification: Core
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
: 457069 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-02-27 01:48 UTC by Aurélio A. Heckert
Modified: 2011-07-09 05:47 UTC
See Also:
GNOME target: 3.0
GNOME version: Unversioned Enhancement


Attachments
Screenshot of te solution (12.44 KB, image/png)
2008-09-04 22:26 UTC, Diego Torres Milano
  Details
Patch for --form option (24.58 KB, patch)
2010-10-13 14:56 UTC, Arx Cruz
none Details | Review

Description Aurélio A. Heckert 2007-02-27 01:48:10 UTC
All users of the beautiful Zenity any day (or every day) dream with
a login window, with login name and password in the same window. But
an one use-case window is not good for zenity.

This login case and other one-window solution could be done with a
user defined window. Yeas ago ideas for this has born and died...
Zenity must be simple and this "one-window solution" are commonly
complex.

But, i think we need to talk about it again. ;-)

Imagine this:

zenity --form --text="Enter in ftp.bli.org" --title="Downloader" \
       --separator=" " \
       --add-entry="Login" --value="$USER"  \
       --add-password="Password"

Giving we this:

   +---------------------------------------------+
   |                Downloader               _ x |
   +---------------------------------------------+
   |                                             |
   | Enter in ftp.bli.org                        |
   |                                             |
   |            +------------------------------+ |
   |    Login:  | zezinho                      | |
   |            +==============================+ |
   | Password:  | **********                   | |
   |            +------------------------------+ |
   |                                             |
   |   +--------+                     +------+   |
   |   | Cancel |                     |  Ok  |   |
   |   +--------+                     +------+   |
   +---------------------------------------------+

Returning this:
zezinho  xkjhw8f39m

Pease, see the help:

$ zenity --help-form

Options for form
  --form         Show personal fom dialog
  --text         Add a text for the window top
  --add-*=<text> Add a form item and defines it's label
                 Veja os tipos de itens na sequencia:
  --add-entry    Add a text field
  --add-password Add a protected text field
  --add-select   Add a selection box
  --add-radio    Add a radiobox group
  --add-checkbox Add a checkbox group
  --separator=SEPARATOR Define the separator for in and out list
                 of values
  --value        Define the initial value for uniq value fields or
                 a list of values for options fields
  --value#       Define a list of values with two units for each.
                 the first is a internal value and the second the
                 user friendily value, like this:
                 --add-checkbox="fruits" \
                 --value#="1,banana,2,apple,3,papaia"
                 This will show a fruit group of checkboxes and
                 the user will see only "banana", "apple", and
                 "papaia", but when select "banana" and "papaia"
                 the zenity writes "1,3" for the stdout.

  The window wil be represented whith the fields and field groups
  in the command line definition argument sequence and wil have
  the "Ok" e "Cancel" buttons doing what they must do. :-)

  All the returning value come in one line. The field separation
  is made with two list separators, and fiels that return a list
  of values will put one separator between then.

Examples:

A user register:

zenity --form --text="Add Person" --title="Bash Register" \
       --add-entry="Name" \
       --add-radio="Sex" --value#="M,Masculine,F,Feminine" \
       --add-checkbox="Grupos" --value="users,art,devel,network"

Could retorn:
Berenice Silva,,F,,users,art,network


My Music Box Starter:

xmms -p $( zenity --form --title="Music Starter" \
       --text="Select a Style" \
       --add-select="Playlist" \
       --value#="aurium.pls,Aurium Ones,jazz.pls,Jazz" )

Could result in:
xmms -p aurium.pls

I think this is simple and growable. If you want to add the
calendar in the next release to do a ease date field... Ok
nothing will change. The same for the scale, file selection
(like the input file form HTML) and other form things.

Thanks,
 Aurium
Comment 1 Christopher Roy Bratusek 2008-03-18 13:20:02 UTC
*** Bug 457069 has been marked as a duplicate of this bug. ***
Comment 2 Christopher Roy Bratusek 2008-03-18 13:26:31 UTC
Just like I already said in the dupped bug:

Notebooks and Treeviews would be nice, too.
Comment 3 Diego Torres Milano 2008-09-04 22:26:27 UTC
Created attachment 118060 [details]
Screenshot of te solution
Comment 4 Diego Torres Milano 2008-09-04 22:27:31 UTC
This problem has an extremely simple solution using autoglade (http://autoglade.sf.net), which can handle this simple and more complex forms.
Solution is explained in http://dtmilano.blogspot.com/2008/09/from-z-to.html.
Comment 5 Arx Cruz 2010-10-13 14:56:14 UTC
Created attachment 172276 [details] [review]
Patch for --form option

Attached is a patch for this bug. You can use the follow command to use the new option
./zenity --forms --add-entry=Name: --add-calendar=Birthday: --add-password="Your password:" --text="<b>Account forms</b>" --title="Zenity script" --add-entry=City: --add-entry=State: --add-calendar="Another date:" --width=500 --separator=";"
Comment 6 Arx Cruz 2010-11-18 16:42:44 UTC
Patch applied on master branch.