FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 01-27-2010, 01:27 PM
Hans de Goede
 
Default cleardisk_gui: Base autoselection of bootdev on detected BIOS order

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.getDeviceByNam e(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_row s()

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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 01-28-2010, 11:46 AM
Hans de Goede
 
Default cleardisk_gui: Base autoselection of bootdev on detected BIOS order

---
iw/cleardisks_gui.py | 45 +++++++++++++++------------------------------
1 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/iw/cleardisks_gui.py b/iw/cleardisks_gui.py
index e60d6a8..3dfe219 100644
--- a/iw/cleardisks_gui.py
+++ b/iw/cleardisks_gui.py
@@ -126,6 +126,11 @@ class ClearDisksWindow (InstallWindow):
self.rightDS.addColumn(_("Model"), 5)
self.rightDS.addColumn(_("Capacity"), 6)

+ # Store the first disk (according to our detected BIOS order) for
+ # auto boot device selection
+ self.bootDisk = sorted(self.anaconda.id.storage.exclusiveDisks,
+ self.anaconda.id.storage.compareDisks)[0]
+
# The device filtering UI set up exclusiveDisks as a list of the names
# 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
@@ -166,19 +171,20 @@ class ClearDisksWindow (InstallWindow):

return self.vbox

+ def _autoSelectBootDisk(self):
+ if self.rightDS.getSelected():
+ return
+
+ for row in self.store:
+ if row[OBJECT_COL].name == self.bootDisk and row[self.rightVisible]:
+ row[self.rightActive] = True
+
def _add_clicked(self, widget, *args, **kwargs):
(filteredModel, pathlist) = self.leftTreeView.get_selection().get_selected_row s()

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:
@@ -190,14 +196,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()

@@ -207,8 +206,6 @@ class ClearDisksWindow (InstallWindow):
if not pathlist:
return

- setFirstActive = False
-
for path in reversed(pathlist):
filteredIter = filteredModel.get_iter(path)
if not filteredIter:
@@ -216,22 +213,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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




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

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org