[master] Pass/check displaymode in collect_catories and collectCategoriesAndSpokes.

Samantha N. Bueno sbueno+anaconda at redhat.com
Mon Jun 9 13:17:07 UTC 2014


Need to have displaymode passed to so that categories can be
appropriately determined based on whether a user is in graphical or
text mode.
---
 pyanaconda/ui/common.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
index 08409ff..d083ba4 100644
--- a/pyanaconda/ui/common.py
+++ b/pyanaconda/ui/common.py
@@ -698,13 +698,17 @@ def collect_spokes(mask_paths, category):
 
     return spokes
 
-def collect_categories(mask_paths):
+def collect_categories(mask_paths, displaymode):
     """Return a list of all category subclasses. Look for them in modules
        imported as module_mask % basename(f) where f is name of all files in path.
     """
     categories = []
-    for mask, path in mask_paths:
-        categories.extend(collect(mask, path, lambda obj: getattr(obj, "displayOnHub", None) is not None))
+    if displaymode == DISPLAY_MODE_TEXT:
+        for mask, path in mask_paths:
+            categories.extend(collect(mask, path, lambda obj: getattr(obj, "displayOnHubTUI", None) is not None))
+    else:
+        for mask, path in mask_paths:
+            categories.extend(collect(mask, path, lambda obj: getattr(obj, "displayOnHubGUI", None) is not None))
 
     return categories
 
@@ -720,13 +724,10 @@ def collectCategoriesAndSpokes(paths, klass, displaymode):
     # Collect all the categories this hub displays, then collect all the
     # spokes belonging to all those categories.
     if displaymode == DISPLAY_MODE_TEXT:
-        # bit of a hack, but the category displayOnHub defaults to GUI values,
-        # so just ignore displayOnHub if we're doing a text install since
-        # everything goes on the summary hub anyway
-        categories = sorted(collect_categories(paths["categories"]),
+        categories = sorted(filter(lambda c: c.displayOnHubTUI == klass.__name__, collect_categories(paths["categories"], displaymode)),
                             key=lambda c: c.sortOrder)
     else:
-        categories = sorted(filter(lambda c: c.displayOnHub == klass.__name__, collect_categories(paths["categories"])),
+        categories = sorted(filter(lambda c: c.displayOnHubGUI == klass.__name__, collect_categories(paths["categories"], displaymode)),
                             key=lambda c: c.sortOrder)
     for c in categories:
         ret[c] = collect_spokes(paths["spokes"], c.__name__)
-- 
1.8.3.1



More information about the anaconda-patches mailing list