On Tue, Feb 25, 2014 at 01:02:17PM +0100, Vratislav Podzimek wrote:
On Tue, 2014-02-25 at 04:30 -0500, Samantha N. Bueno wrote:
> A GtkDialog box which shows the progress of dasdfmt as it is run
> against unformatted DASDs.
>
> Resolves: rhbz#1064423
> ---
> po/POTFILES.in | 2 +
> pyanaconda/ui/gui/spokes/lib/dasdfmt.glade | 211 +++++++++++++++++++++++++++++
> pyanaconda/ui/gui/spokes/lib/dasdfmt.py | 111 +++++++++++++++
> 3 files changed, 324 insertions(+)
> create mode 100644 pyanaconda/ui/gui/spokes/lib/dasdfmt.glade
> create mode 100644 pyanaconda/ui/gui/spokes/lib/dasdfmt.py
> diff --git a/pyanaconda/ui/gui/spokes/lib/dasdfmt.py
b/pyanaconda/ui/gui/spokes/lib/dasdfmt.py
> new file mode 100644
> index 0000000..802855c
> --- /dev/null
> +++ b/pyanaconda/ui/gui/spokes/lib/dasdfmt.py
<> snip <>
> +
> + def run_dasdfmt(self, *args):
> + """
> + Loop through our disks and run dasdfmt against them. After that loop has
> + finished, launch stage two of this operation (finish_dasdfmt).
> + """
> + for disk in self.to_format:
> + try:
> + self._label.set_text(_("Formatting /dev/%s. This may take a
moment." % disk))
This shoudl be called with gtk_call_once as it is called from a non-main
thread.
Fixed locally.
> + format_dasd(disk)
> + except DasdFormatError as err:
> + # Log errors if formatting fails, but don't halt the installer
> + log.error(str(err))
> + continue
> +
> + gtk_call_once(self.finish_dasdfmt)
Should this be called even when the dialog is exited by clicking the
link button? If not, have a look at the NTPConfig dialog that uses an
epoch to discard outdated actions.
Ahh, nope. I will indeed look at the NTPConfig dialog -- thanks.
> +
> + def dasdfmt(self, *args):
> + """
> + This is the handler that gets called from the GtkDialog and sets things
> + in motion. We launch the *actual* call to run dasdfmt from a thread.
> + """
> + # Run through all of the formatting
> + self._cancel_button.set_sensitive(True)
> + self._ok_button.set_sensitive(False)
> + self._notebook.set_current_page(0)
> +
> + # Loop through all of our unformatted DASDs and format them
> + threadMgr.add(AnacondaThread(name=constants.THREAD_DASDFMT,
> + target=self.run_dasdfmt, args=(self,)))
> +
> + def finish_dasdfmt(self):
> + """
> + This is the second stage of the dasdfmt operation; now that formatting
> + is complete, we need to reinitialize storage so that the newly
> + formatted devices are added properly to the devicetree.
> + """
> + protectedNames = map(lambda d: d.name, self.storage.protectedDevices)
> + threadMgr.add(AnacondaThread(name=constants.THREAD_STORAGE,
target=storageInitialize,
> + args=(self.storage, self.data,
protectedNames)))
I believe threadMgr.add returns the thread name (at least on master). So
you can store it and use it in the following wait call. Might make the
code a bit clearer.
Gotcha; I will make that change on the master version. threadMgr.add
does not return the thread name on rhel7-branch.
> +
> + threadMgr.wait(constants.THREAD_STORAGE)
> + self._notebook.set_current_page(1)
> + self._ok_button.set_sensitive(True)
> +
> + def return_to_hub_link_clicked(self, label, uri):
> + """
> + The user clicked on the link that takes them back to the hub. We need
> + to emit a special response ID indicating the user did not press OK.
> +
> + NOTE: There is no button with response_id=2.
> + """
> + self.window.response(2)
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches