Last night I spent some time working on bug #500911, adding some more useful functions to the quidgets.prompts namespace.
quidgets.prompts.yes_no() works like this:
This is a little different than the other functions in the namespace in that in that the responses are gtk.RESPONSE_YES or gtk.RESPONSE_NO, rather than gtk.RESPONSE_OK, or gtk.RESPONSE_CANCEL. Of course, there is no "value", as you are just looking for a yes or no from the user.
response = quidgets.prompts.yes_no("I need some info","Do you want to give me a yes or no?")
if response == gtk.RESPONSE_YES:
print "they said yes"
elif response == gtk.RESPONSE_NO:
print "they said no"
print "they dismissed the dialog"
Warning, Error, and Info are similar, but you don't even check the return value, as you are not seeking any feedback. You just supply a title and some text that you are trying to tell the user.
I hope that folks find this useful, and that it saves writing lots of lines of code. I've pushed the branch, and should get it into my PPA in the next few days.
quidgets.prompts.warning("Title goes here","Warning")
error("Title goes here","Error")
info("Title goes here","Info")
Quickly + Widgets = Quidgets
There is a Launchpad Project for Quidgets
The most up to date changes are in the Quidgets Trunk Branch