And sort the drivers by (detected) BIOS order by default. --- iw/cleardisks_gui.py | 50 ++++++++++++++++++-------------------------------- 1 files changed, 18 insertions(+), 32 deletions(-) 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.getDeviceByName(d) if not device: continue @@ -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 + def _add_clicked(self, widget, *args, **kwargs): (filteredModel, pathlist) = self.leftTreeView.get_selection().get_selected_rows() if not pathlist: return - # If there aren't any rows in the right side to begin with, activate - # the first one in the list after the selection has been applied. - if self.rightDS.getNVisible() == 0: - setFirstActive = True - else: - setFirstActive = False - for path in reversed(pathlist): filteredIter = filteredModel.get_iter(path) if not filteredIter: @@ -184,14 +191,7 @@ class ClearDisksWindow (InstallWindow): self.store.set_value(sortedIter, self.rightVisible, True) self.store.set_value(sortedIter, self.rightActive, False) - if setFirstActive: - i = 0 - - while not self.store[i][self.rightVisible]: - i += 1 - - self.store[i][self.rightActive] = True - + self._autoSelectBootDisk() self.leftFilteredModel.refilter() self.rightFilteredModel.refilter() @@ -201,8 +201,6 @@ class ClearDisksWindow (InstallWindow): if not pathlist: return - setFirstActive = False - for path in reversed(pathlist): filteredIter = filteredModel.get_iter(path) if not filteredIter: @@ -210,22 +208,10 @@ class ClearDisksWindow (InstallWindow): sortedIter = self.rightFilteredModel.convert_iter_to_child_iter(filteredIter) - # If we're removing a row that was checked, try to set the first - # visible one to active after the selection is applied. - if self.store.get_value(sortedIter, self.rightActive): - setFirstActive = True - self.store.set_value(sortedIter, self.leftVisible, True) self.store.set_value(sortedIter, self.rightVisible, False) self.store.set_value(sortedIter, self.rightActive, False) - if self.rightDS.getNVisible() > 0 and setFirstActive: - i = 0 - - while not self.store[i][self.rightVisible]: - i += 1 - - self.store[i][self.rightActive] = True - + self._autoSelectBootDisk() self.leftFilteredModel.refilter() self.rightFilteredModel.refilter() -- 1.6.5.2 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list