[anaconda][master/rhel7-branch][PATCH 2/2] Add dialog box for adding DASDs. (#1070115)

Samantha N. Bueno sbueno+anaconda at redhat.com
Fri Aug 29 12:57:09 UTC 2014


On Fri, Aug 29, 2014 at 09:06:44AM +0200, Vratislav Podzimek wrote:
> On Thu, 2014-08-28 at 15:18 -0400, Samantha N. Bueno wrote:
> > diff --git a/pyanaconda/ui/gui/spokes/advstorage/dasd.py b/pyanaconda/ui/gui/spokes/advstorage/dasd.py
> > new file mode 100644
> > index 0000000..aec1dc7
> > --- /dev/null
> > +++ b/pyanaconda/ui/gui/spokes/advstorage/dasd.py
> > <> snip <>
> > @@ -0,0 +1,141 @@
> > +
> > +    def _set_configure_sensitive(self, sensitivity):
> > +        """ Set entries to a given sensitivity. """
> > +        for child in self._configureGrid.get_children():
> > +            child.set_sensitive(sensitivity)
> You can set_sensitive the whole grid instead of every child.

Ah, will do.
 
> > +
> > +    def on_start_clicked(self, *args):
> > +        """ Go through the process of validating entry contents and then
> > +            attempt to add the device.
> > +        """
> > +        # First update widgets
> > +        self._startButton.hide()
> > +        self._cancelButton.set_sensitive(False)
> > +        self._okButton.set_sensitive(False)
> > +
> > +        self._conditionNotebook.set_current_page(1)
> > +        self._set_configure_sensitive(False)
> > +        self._deviceEntry.set_sensitive(False)
> > +
> > +        self._conditionNotebook.set_current_page(1)
> > +        try:
> > +            device = sanitize_dasd_dev_input(self._deviceEntry.get_text())
> > +        except ValueError as e:
> > +            _config_error = str(e)
> > +            self.builder.get_object("deviceErrorLabel").set_text(_config_error)
> > +            self._conditionNotebook.set_current_page(2)
> > +            self._set_configure_sensitive(True)
> > +            return
> > +
> > +        spinner = self.builder.get_object("waitSpinner")
> What about adding 'self._spinner = self.builder...' to __init__?

Yes, I should probably do that. I will.
 
> > +        spinner.start()
> > +
> > +        self._discover(device)
> > +        self._check_discover()
> > +
> > +    @gtk_action_nowait
> > +    def _check_discover(self, *args):
> > +        """ After the DASD discover thread runs, check to see whether a valid
> > +            device was discovered. Display an error message if not.
> > +        """
> > +
> > +        spinner = self.builder.get_object("waitSpinner")
> > +        spinner.stop()
> > +
> > +        if self._discoveryError:
> > +            # Failure, display a message and leave the user on the dialog so
> > +            # they can try again (or cancel)
> > +            self.builder.get_object("deviceErrorLabel").set_text(self._discoveryError)
> > +            self._discoveryError = None
> > +            self._conditionNotebook.set_current_page(2)
> > +            self._set_configure_sensitive(True)
> > +        else:
> > +            # Great success. Just return to the advanced storage window and let the
> > +            # UI update with the newly-added device
> > +            self.window.response(1)
> > +            return True
> > +
> > +        self._cancelButton.set_sensitive(True)
> > +        return False
> > +
> > +    def _discover(self, *args):
> Same question as Brian here.

Yeah, to answer you and Brian that is just laziness/leftover, since I
used zfcp.py as a template for this file. :-/
 
> -- 
> Vratislav Podzimek
> 
> Anaconda Rider | RHCE | Red Hat, Inc. | Brno - Czech Republic
> 
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches


More information about the anaconda-patches mailing list