From: "Brian C. Lane" bcl@redhat.com
This method can be used to clean up a spoke before starting the installation. The method is called when continue is clicked on the summary hub. It is completely optional and if it doesn't exist on the spoke it will be skipped.
Add finished method to the Network spoke to handle killing nmce and disconnecting callbacks so that they don't cause problems if the installation triggers network changes. --- pyanaconda/ui/common.py | 8 ++++++++ pyanaconda/ui/gui/hubs/summary.py | 9 +++++++++ pyanaconda/ui/gui/spokes/network.py | 7 +++++++ 3 files changed, 24 insertions(+)
diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py index 4596045..1a392ea 100644 --- a/pyanaconda/ui/common.py +++ b/pyanaconda/ui/common.py @@ -348,6 +348,14 @@ def exit_logger(self): """ log.debug("Left spoke: %s", self.__class__.__name__)
+ def finished(self): + """Called when exiting the Summary Hub + + This can be used to cleanup the spoke before continuing the + installation. This method is optional. + """ + pass + # Inherit abstract methods from Spoke # pylint: disable=abstract-method class NormalSpoke(Spoke): diff --git a/pyanaconda/ui/gui/hubs/summary.py b/pyanaconda/ui/gui/hubs/summary.py index 847f722..160133f 100644 --- a/pyanaconda/ui/gui/hubs/summary.py +++ b/pyanaconda/ui/gui/hubs/summary.py @@ -64,3 +64,12 @@ def __init__(self, data, storage, payload, instclass): else: self._checker = DirInstallSpaceChecker(storage, payload)
+ # Add a continue-clicked handler + self.window.connect("continue-clicked", self._on_continue_clicked) + + def _on_continue_clicked(self, win, user_data=None): + """Call finished method of spokes when leaving the hub. + """ + for spoke in sorted(self._spokes.values(), key=lambda x: x.__class__.__name__): + if hasattr(spoke, "finished"): + spoke.finished() diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py index e38cef8..7460fc3 100644 --- a/pyanaconda/ui/gui/spokes/network.py +++ b/pyanaconda/ui/gui/spokes/network.py @@ -1495,6 +1495,13 @@ def on_back_clicked(self, button): self.clear_info() NormalSpoke.on_back_clicked(self, button)
+ def finished(self): + """Disconnect callbacks + + Called when leaving summary hub + """ + self.network_control_box.kill_nmce(msg="finished with network spoke") + self.network_control_box.disconnect_client_callbacks()
class NetworkStandaloneSpoke(StandaloneSpoke): """