diff options
author | Cole Robinson <crobinso@redhat.com> | 2014-01-26 17:42:24 -0500 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2014-01-26 17:51:15 -0500 |
commit | 58d5e0b799e93e9e026aa8e3161302a0344458b8 (patch) | |
tree | 7bd883ca5be9a16d78fef1c85f96ca7ba613ea11 /virtManager/error.py | |
parent | 20088ab8fb42ca9b9f3ae2637865b5d05eb82726 (diff) | |
download | virt-manager-58d5e0b799e93e9e026aa8e3161302a0344458b8.tar.gz |
uihelpers: Move a few more functions closer to their callers
Diffstat (limited to 'virtManager/error.py')
-rw-r--r-- | virtManager/error.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/virtManager/error.py b/virtManager/error.py index 79eb2e6f..01779d40 100644 --- a/virtManager/error.py +++ b/virtManager/error.py @@ -179,6 +179,30 @@ class vmmErrorDialog(vmmGObject): secondary_text=text2, chktext=chktext) + def chkbox_helper(self, getcb, setcb, text1, text2=None, + alwaysrecord=False, + default=True, + chktext=_("Don't ask me again")): + """ + Helper to prompt user about proceeding with an operation + Returns True if the 'yes' or 'ok' button was selected, False otherwise + + @alwaysrecord: Don't require user to select 'yes' to record chkbox value + @default: What value to return if getcb tells us not to prompt + """ + do_prompt = getcb() + if not do_prompt: + return default + + res = self.warn_chkbox(text1=text1, text2=text2, + chktext=chktext, + buttons=Gtk.ButtonsType.YES_NO) + response, skip_prompt = res + if alwaysrecord or response: + setcb(not skip_prompt) + + return response + class _errorDialog (Gtk.MessageDialog): """ |