Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora Development (http://www.linux-archive.org/fedora-development/)
-   -   cleardisk_gui: Base autoselection of bootdev on detected BIOS order (http://www.linux-archive.org/fedora-development/315877-cleardisk_gui-base-autoselection-bootdev-detected-bios-order.html)

Chris Lumens 01-27-2010 03:26 PM

cleardisk_gui: Base autoselection of bootdev on detected BIOS order
 
> diff --git a/iw/cleardisks_gui.py b/iw/cleardisks_gui.py
> index 4f26560..10ffdcb 100644
> --- a/iw/cleardisks_gui.py
> +++ b/iw/cleardisks_gui.py
> @@ -88,7 +88,6 @@ class ClearDisksWindow (InstallWindow):
> gobject.TYPE_STRING, gobject.TYPE_STRING,
> gobject.TYPE_STRING, gobject.TYPE_STRING,
> gobject.TYPE_STRING)
> - self.store.set_sort_column_id(5, gtk.SORT_ASCENDING)
>
> # The left view shows all the drives that will just be mounted, but
> # can still be moved to the right hand side.
> @@ -130,7 +129,13 @@ class ClearDisksWindow (InstallWindow):
> # of all the disks we should use later on. Now we need to go get those,
> # look up some more information in the devicetree, and set up the
> # selector.
> - for d in self.anaconda.id.storage.exclusiveDisks:
> + disks = self.anaconda.id.storage.exclusiveDisks
> + disks.sort(self.anaconda.id.storage.compareDisks)
> + # Store the first disk for auto boot device selection, the order
> + # in the store may change if the users changes the sorting
> + self.bootDisk = disks[0]
> +
> + for d in disks:
> device = self.anaconda.id.storage.devicetree.getDeviceByNam e(d)
> if not device:
> continue

You're putting things into the store sorted in a special order that has
no corresponding column, but then leaving the possibility open to the
user to sort in a different way by clicking on the column headers.
However, there's no way for the user to restore the default ordering no
matter what they click on.

> @@ -160,19 +165,21 @@ class ClearDisksWindow (InstallWindow):
>
> return self.vbox
>
> + def _autoSelectBootDisk(self):
> + if self.rightDS.getSelected():
> + return
> +
> + for i in range(0, len(self.store)):
> + if self.store[i][OBJECT_COL].name == self.bootDisk and
> + self.store[i][self.rightVisible]:
> + self.store[i][self.rightActive] = True

gtk.WhateverStores are iterable, so this can be simplified down to:

for row in self.store:
if row[OBJECT_COL].name == self.bootDisk and row[self.rightVisible]:
row[self.rightActive] = True

I didn't do this everywhere I could have in the filtering UI, for
reasons which probably no longer make sense.

What happens to the UI if I'm on a machine with no preset boot disk, but
then I add several things to the right panel and click next? Do any of
the radio buttons get updated? Does the "You must select one drive to
boot from" message still appear?

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

Chris Lumens 01-28-2010 05:30 PM

cleardisk_gui: Base autoselection of bootdev on detected BIOS order
 
> >>@@ -160,19 +165,21 @@ class ClearDisksWindow (InstallWindow):
> >>
> >> return self.vbox
> >>
> >>+ def _autoSelectBootDisk(self):
> >>+ if self.rightDS.getSelected():
> >>+ return
> >>+
> >>+ for i in range(0, len(self.store)):
> >>+ if self.store[i][OBJECT_COL].name == self.bootDisk and
> >>+ self.store[i][self.rightVisible]:
> >>+ self.store[i][self.rightActive] = True
> >
> >gtk.WhateverStores are iterable, so this can be simplified down to:
> >
> > for row in self.store:
> > if row[OBJECT_COL].name == self.bootDisk and row[self.rightVisible]:
> > row[self.rightActive] = True
> >
>
> Ah yes that is much better, will change in next revision of the patch.

And I'm working on replacing my old busted crud with this style, too. I
might as well follow my own advice.

> >What happens to the UI if I'm on a machine with no preset boot disk, but
> >then I add several things to the right panel and click next? Do any of
> >the radio buttons get updated?
>
> In this case the first drive according to our fallback sorting (used when
> no EDD info is present) gets auto selected (if added to the right column),
> like it was autoselected in the old auto_part_type UI.
>
> >Does the "You must select one drive to
> >boot from" message still appear?
>
> If no drive is selected because the first drive according to the compareDisks
> sort order is not added to the right pane, yes (I tested this to make sure).

Okay, good. This is what I was hoping would happen.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 11:23 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.