[PATCH] Add the "Add FCoE" dialog.
Vratislav Podzimek
vpodzime at redhat.com
Tue Apr 23 08:52:47 UTC 2013
On Mon, 2013-04-22 at 11:21 -0400, Chris Lumens wrote:
> ---
> po/POTFILES.in | 1 +
> pyanaconda/constants.py | 1 +
> pyanaconda/ui/gui/spokes/advstorage/fcoe.glade | 268 +++++++++++++++++++++++++
> pyanaconda/ui/gui/spokes/advstorage/fcoe.py | 121 +++++++++++
> pyanaconda/ui/gui/spokes/filter.py | 15 +-
> 5 files changed, 405 insertions(+), 1 deletion(-)
> create mode 100644 pyanaconda/ui/gui/spokes/advstorage/fcoe.glade
> create mode 100644 pyanaconda/ui/gui/spokes/advstorage/fcoe.py
> + def _check_add(self, *args):
> + if threadMgr.get(constants.THREAD_FCOE):
> + return True
I think this deserves a comment that returning True means "keep
running", but see the other comment below.
> +
> + # When fcoe discovery is done, update the UI. We don't need to worry
> + # about the user escaping from the dialog because all the buttons are
> + # marked insensitive.
> + self._addSpinner.stop()
> + self._addSpinner.hide()
> +
> + if self._addError:
> + # Failure. Display some error message and leave the user on the
> + # dialog to try again.
> + self.builder.getObject("errorLabel").set_text(self._addError)
> + self._addError = None
> + self._addButton.set_sensitive(True)
> + self._cancelButton.set_sensitive(True)
> + else:
> + # Success. There's nothing else the user can do on this dialog.
> + self.window.response(1)
> +
> + def on_add_clicked(self, *args):
> + # Set some widgets to visible/not while we work.
> + self._errorBox.hide()
> + self._addButton.set_sensitive(False)
> + self._cancelButton.set_sensitive(False)
> + self._addSpinner.set_visible(True)
> + self._addSpinner.show()
> +
> + self._addSpinner.start()
> +
> + threadMgr.add(AnacondaThread(name=constants.THREAD_FCOE, target=self._add))
> + GLib.timeout_add(250, self._check_add)
I know that we use this kind of polling quite often, but why not use a
callback (decorated with @gtk_action) invoked at the end of the
self._add method instead of periodically checking if the thread is still
running and if not, doing something more?
Otherwise this looks good to me, however, I cannot test it as well.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list