summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2013-02-26 15:57:58 -0500
committerChris Lumens <clumens@redhat.com>2013-02-28 14:24:13 -0500
commit671ea1b4a9c96cb97cda2b2687e9fa5c5a15cf44 (patch)
tree24650c54baa3b85611dfd39bc6bfb5dad33433e3
parent3c78c1a5c23b131f96d1dfdfe6b66faa2e25d55d (diff)
downloadanaconda-671ea1b4a9c96cb97cda2b2687e9fa5c5a15cf44.tar.gz
anaconda-671ea1b4a9c96cb97cda2b2687e9fa5c5a15cf44.tar.xz
anaconda-671ea1b4a9c96cb97cda2b2687e9fa5c5a15cf44.zip
Get rid of the currentPage method.
When multiple pages can be expanded at the same time, the currentPage method doesn't make a lot of sense. Instead, make it a property of the custom spoke and have it depend on the current selector.
-rw-r--r--pyanaconda/ui/gui/spokes/custom.py28
-rw-r--r--pyanaconda/ui/gui/spokes/lib/accordion.py7
2 files changed, 22 insertions, 13 deletions
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 13fa160a5..910bfc161 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -638,6 +638,20 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
def translated_new_install_name(self):
return _(new_install_name) % (productName, productVersion)
+ @property
+ def _current_page(self):
+ # The current page is really a function of the current selector.
+ # Whatever selector on the LHS is selected, the current page is the
+ # page containing that selector.
+ if not self._current_selector:
+ return None
+
+ for page in self._accordion.allPages:
+ if self._current_selector in page.members:
+ return page
+
+ return None
+
def _do_refresh(self, mountpointToShow=None):
# block mountpoint selector signal handler for now
self._initialized = False
@@ -647,8 +661,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# We can only have one page expanded at a time.
page_order = []
- if self._accordion.currentPage():
- page_order.append(self._accordion.currentPage().pageTitle)
+ if self._current_page:
+ page_order.append(self._current_page.pageTitle)
# Make sure we start with a clean slate.
self._accordion.removeAllPages()
@@ -764,8 +778,10 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
break
self._initialized = True
- self.on_page_clicked(self._accordion.currentPage(),
- mountpointToShow=mountpointToShow)
+ currentPage = self._current_page
+ if currentPage:
+ self.on_page_clicked(self.currentPage,
+ mountpointToShow=mountpointToShow)
###
### RIGHT HAND SIDE METHODS
@@ -1818,7 +1834,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# mountpoint within that page is given, display that. Otherwise, just
# default to the first selector available.
if not page:
- page = self._accordion.currentPage()
+ page = self._current_page
log.debug("show first mountpoint: %s" % getattr(page, "pageTitle", None))
if page.members:
@@ -1837,7 +1853,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
if not self._current_selector:
return
- page = self._accordion.currentPage()
+ page = self._current_page
selector = self._current_selector
device = self._current_selector._device
root_name = None
diff --git a/pyanaconda/ui/gui/spokes/lib/accordion.py b/pyanaconda/ui/gui/spokes/lib/accordion.py
index 464febed3..e70bbe70a 100644
--- a/pyanaconda/ui/gui/spokes/lib/accordion.py
+++ b/pyanaconda/ui/gui/spokes/lib/accordion.py
@@ -132,13 +132,6 @@ class Accordion(Gtk.Box):
def allSelectors(self):
return [s for p in self.allPages for s in p.members]
- def currentPage(self):
- for e in self._expanders:
- if e.get_expanded():
- return e.get_child()
-
- return None
-
def expandPage(self, pageTitle):
page = self._find_by_title(pageTitle)
if not page: