Metadata-Version: 2.4
Name: zenity_soso
Version: 0.1.0
Summary: Python wrapper for zenity.
Author-email: Leon Dionne <ldionne@dridesign.sh.cn>
Description-Content-Type: text/markdown
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: X11 Applications :: GTK
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Desktop Environment
Classifier: Topic :: Desktop Environment :: Gnome
License-File: LICENSE
Project-URL: Home, https://github.com/Zen-Master-SoSo/zenity_soso

# zenity_soso

Python wrapper for zenity.

From the zenity manpage:

>	zenity is a program that will display GTK+ dialogs, and return (either in the
	return code, or on standard output) the users input. This allows you to present
	information, and ask for information from the user, from all manner of shell
	scripts.

>	For example, zenity --question will return either 0, 1 or 5, depending on
	whether the user pressed OK, Cancel or timeout has been reached. zenity
	--entry will output on standard output what the user typed into the text entry
	field.

These python wrapper classes accept any of the zenity options as keywrd
arguments to their constructor. Alternatively, you can set any of the zenity
arguments as attibutes of the class. Obviously, attributes and keyword
arguments may not contain dashes ("-"), so replace any dashes in the zenity
option with an underscore ("_").

After constructing an instance and optionally setting attributes, call the
"show()" method and save the return value. "show()" calls the zenity program
and usually returns the content of stdout as received from zenity.

The List and Form classes return more than just stdout from the "show()"
method. These classes interpret the return value from zenity in order to
provide you with a more convenient data structure to work with. See the
documentation for details.

After calling "show()", the returncode from zenity is always available as the
"returncode" property, and the output of zenity is available as the "stdout"
property.


## Examples:

#### Show a message:

```python
from zenity_soso import Info

dlg = Info(text = 'This is the message text', title = 'Some info')
dlg.show()
```

#### Ask a question:

```python
from zenity_soso import Question

dlg = Question(text = 'Are you <b>really</b> sure you want to do that?',
    ok_label = 'Sure', cancel_label = 'No, not ever')
if dlg.show():
    print('Okay, you asked for it!')
```

(The above example illustrates the use of "Pango" markup. See:
https://docs.gtk.org/Pango/pango_markup.html)

#### Choose one out of a list of strings:

```python
from zenity_soso import List

dlg = List(['Tom', 'Dick', 'Harry'])
recipient = dlg.show()
if result:
    print(f'Sending this off to {recipient} ...')
```

#### Choose one out of a list of dicts:

```python
from zenity_soso import List
from repr_soso import Repr

dicts = [
	{
		'Name'			: 'Tom',
		'Department'	: 'I.T.',
		'Room'			: 'B11'
	},
	{
		'Name'			: 'Dick',
		'Department'	: 'Sales',
		'Room'			: '9A'
	},
	{
		'Name'			: 'Harry',
		'Department'	: 'Shipping',
		'Room'			: '101'
	}
]
dlg = List(dicts)
result = dlg.show()
Repr(result).print()
```

The above code prints (when selected):

	[
		{
			"Name"		: 'Harry',
			"Department": 'Shipping',
			"Room"		: '101'
		}
	]

#### Pick a color:

```python
from zenity_soso import Color_Selection

dlg = Color_Selection(color = "#00FF00")
result = dlg.show()
if result:
    print(f'Color me {result}')
```

## Limitations

As of this moment, the `Progress` class is not finished. If you would like to
contribute a solution, feel free to make a pull request!

