GNOME Bugzilla – Bug 412493
a new --form option for personal one-window solution in zenity
Last modified: 2011-07-09 05:47:35 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
*** Bug 457069 has been marked as a duplicate of this bug. ***
Just like I already said in the dupped bug: Notebooks and Treeviews would be nice, too.
Created attachment 118060 [details] Screenshot of te solution
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.
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=";"
Patch applied on master branch.