On Mon, 2013-03-11 at 16:06 -0400, Chris Lumens wrote:
---
pyanaconda/ui/gui/spokes/custom.py | 21 ++++++++++-
pyanaconda/ui/gui/spokes/lib/refresh.py | 62 ++++++++++++++++++++++++++++++++-
2 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 3a94dbd..bc18eab 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -77,6 +77,7 @@ from pyanaconda.ui.gui.spokes.storage import StorageChecker
from pyanaconda.ui.gui.spokes.lib.cart import SelectedDisksDialog
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
from pyanaconda.ui.gui.categories.storage import StorageCategory
@@ -2369,7 +2370,25 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# This callback is for the button that has anaconda go back and rescan the
# disks to pick up whatever changes the user made outside our control.
def on_refresh_clicked(self, *args):
- pass
+ dialog = RefreshDialog(self.data, self.storage)
+ with enlightbox(self.window, dialog.window):
+ rc = dialog.run()
+ dialog.window.destroy()
+
+ if rc == 0:
+ # User hit cancel on the dialog, so there was no rescanning done.
+ return
+ elif rc == 1:
+ # User hit OK on the dialog, indicating they stayed on the dialog
+ # until rescanning completed and now needs to go back to the
+ # main storage spoke.
+ self.skipTo = "StorageSpoke"
What about closing dialog by
hitting Escape? I think the best pattern
for those cases is "if rc == OK_CODE, do else do nothing".
+
+ # Can't use this spoke's on_back_clicked method as that will try to
+ # save the right hand side, which is no longer valid. The user must
+ # go back and select their disks all over again since whatever they
+ # did on the shell could have changed what disks are available.
+ NormalSpoke.on_back_clicked(self, None)
def on_info_bar_clicked(self, *args):
log.debug("info bar clicked: %s (%s)" % (self._error, args))
diff --git a/pyanaconda/ui/gui/spokes/lib/refresh.py
b/pyanaconda/ui/gui/spokes/lib/refresh.py
index 83d2efb..3fc9b57 100644
--- a/pyanaconda/ui/gui/spokes/lib/refresh.py
+++ b/pyanaconda/ui/gui/spokes/lib/refresh.py
@@ -19,10 +19,13 @@
# Red Hat Author(s): Chris Lumens <clumens(a)redhat.com>
#
-from gi.repository import Gtk
+from gi.repository import GLib, Gtk
Please add "# pylint:
disable-msg=E0611" before this import.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic