[PATCH] Don't require pressing escape twice to kill the media check window (#965625).
Chris Lumens
clumens at redhat.com
Thu Sep 26 12:59:57 UTC 2013
Also, allow the user to cancel media check while it's working.
---
pyanaconda/ui/gui/spokes/source.glade | 1 +
pyanaconda/ui/gui/spokes/source.py | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade
index 91d716d..554d673 100644
--- a/pyanaconda/ui/gui/spokes/source.glade
+++ b/pyanaconda/ui/gui/spokes/source.glade
@@ -91,6 +91,7 @@
<property name="type_hint">dialog</property>
<property name="decorated">False</property>
<property name="has_resize_grip">False</property>
+ <signal name="close" handler="on_close" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 7bcae6e..869bba2 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -25,7 +25,7 @@ import time
import logging
log = logging.getLogger("anaconda")
-import os.path
+import os, signal
from gi.repository import GLib
@@ -155,6 +155,7 @@ class MediaCheckDialog(GUIObject):
def __init__(self, data):
GUIObject.__init__(self, data)
self.progressBar = self.builder.get_object("mediaCheck-progressBar")
+ self._pid = None
def _checkisoEndsCB(self, pid, status):
doneButton = self.builder.get_object("doneButton")
@@ -168,6 +169,7 @@ class MediaCheckDialog(GUIObject):
self.progressBar.set_fraction(1.0)
doneButton.set_sensitive(True)
GLib.spawn_close_pid(pid)
+ self._pid = None
def _checkisoStdoutWatcher(self, fd, condition):
if condition == GLib.IOCondition.HUP:
@@ -187,7 +189,7 @@ class MediaCheckDialog(GUIObject):
return True
def run(self, devicePath):
- (retval, pid, _stdin, stdout, _stderr) = \
+ (retval, self._pid, _stdin, stdout, _stderr) = \
GLib.spawn_async_with_pipes(None, ["checkisomd5", "--gauge", devicePath], [],
GLib.SpawnFlags.DO_NOT_REAP_CHILD|GLib.SpawnFlags.SEARCH_PATH,
None, None)
@@ -195,13 +197,19 @@ class MediaCheckDialog(GUIObject):
return
# This function waits for checkisomd5 to end and then cleans up after it.
- GLib.child_watch_add(pid, self._checkisoEndsCB)
+ GLib.child_watch_add(self._pid, self._checkisoEndsCB)
# This function watches the process's stdout.
GLib.io_add_watch(stdout, GLib.IOCondition.IN|GLib.IOCondition.HUP, self._checkisoStdoutWatcher)
self.window.run()
+ def on_close(self, *args):
+ if self._pid:
+ os.kill(self._pid, signal.SIGKILL)
+
+ self.window.destroy()
+
def on_done_clicked(self, *args):
self.window.destroy()
--
1.8.1.2
More information about the anaconda-patches
mailing list