[PATCH] Add a function to allow ignoring escape, and use it on rescan (#965770).
Brian C. Lane
bcl at redhat.com
Sat Jun 22 02:20:49 UTC 2013
On Fri, Jun 21, 2013 at 02:45:00PM -0400, Chris Lumens wrote:
> This dialog is doing an important background task, and it's the intention
> that it not be closeable while running. Thus, this function. There are
> likely other places (iscsi, at least) where this could be used.
> ---
> pyanaconda/ui/gui/spokes/custom.py | 3 ++-
> pyanaconda/ui/gui/utils.py | 14 ++++++++++++++
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> index da2808c..98aa4d1 100644
> --- a/pyanaconda/ui/gui/spokes/custom.py
> +++ b/pyanaconda/ui/gui/spokes/custom.py
> @@ -72,7 +72,7 @@ from pyanaconda.ui.gui.spokes.lib.passphrase import PassphraseDialog
> from pyanaconda.ui.gui.spokes.lib.accordion import *
> from pyanaconda.ui.gui.spokes.lib.refresh import RefreshDialog
> from pyanaconda.ui.gui.spokes.lib.summary import ActionSummaryDialog
> -from pyanaconda.ui.gui.utils import setViewportBackground, gtk_action_wait, enlightbox, fancy_set_sensitive
> +from pyanaconda.ui.gui.utils import setViewportBackground, gtk_action_wait, enlightbox, fancy_set_sensitive, ignoreEscape
> from pyanaconda.ui.gui.categories.storage import StorageCategory
> from pyanaconda.ui.lib.disks import size_str
>
> @@ -2714,6 +2714,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
> # disks to pick up whatever changes the user made outside our control.
> def on_refresh_clicked(self, *args):
> dialog = RefreshDialog(self.data, self.storage)
> + ignoreEscape(dialog.window)
> with enlightbox(self.window, dialog.window):
> rc = dialog.run()
> dialog.window.destroy()
> diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py
> index 1be3bd1..829e2c2 100644
> --- a/pyanaconda/ui/gui/utils.py
> +++ b/pyanaconda/ui/gui/utils.py
> @@ -102,6 +102,20 @@ def enlightbox(mainWindow, dialog):
> yield
> lightbox.destroy()
>
> +def ignoreEscape(dlg):
> + """Prevent a dialog from accepting the escape keybinding, which emits a
> + close signal and will cause the dialog to close with some return value
> + we are likely not expecting. Instead, this method will cause the
> + escape key to do nothing for the given GtkDialog.
> + """
> + provider = Gtk.CssProvider()
> + provider.load_from_data("""@binding-set IgnoreEscape {
> + unbind "Escape";
> +};
> +GtkDialog { gtk-key-bindings: IgnoreEscape }""")
Can this be indented so that it doesn't look so ugly in the middle of
our beautifully formatted python?
Ack otherwise.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20130621/33da2243/attachment.sig>
More information about the anaconda-patches
mailing list