[PATCH 04/16] Make TUI ready for getting spokes from multiple directories

Chris Lumens clumens at redhat.com
Thu Dec 13 19:12:28 UTC 2012


> diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
> index a51a19e..1abe008 100644
> --- a/pyanaconda/ui/tui/spokes/__init__.py
> +++ b/pyanaconda/ui/tui/spokes/__init__.py
> @@ -81,13 +81,21 @@ class NormalTUISpoke(TUISpoke, NormalSpoke):
>  class PersonalizationTUISpoke(TUISpoke, PersonalizationSpoke):
>      pass
>  
> -def collect_spokes(category):
> +def collect_spokes(mask_paths, category):
>      """Return a list of all spoke subclasses that should appear for a given
>         category.
>      """
> -    return collect("pyanaconda.ui.tui.spokes.%s", os.path.dirname(__file__), lambda obj: hasattr(obj, "category") and obj.category != None and obj.category == category)
> -
> -def collect_categories():
> -    classes = collect("pyanaconda.ui.tui.spokes.%s", os.path.dirname(__file__), lambda obj: hasattr(obj, "category") and obj.category != None and obj.category != "")
> +    spokes = []
> +    for mask, path in mask_paths:
> +        spokes.extend(collect(mask, path, lambda obj: hasattr(obj, "category") and obj.category != None and obj.category == category))
> +        
> +    return spokes
> +        
> +def collect_categories(mask_paths):
> +    classes = []
> +    for mask, path in mask_paths:
> +        classes.extend(collect(mask, path, lambda obj: hasattr(obj, "category") and obj.category != None and obj.category != ""))
> +        
>      categories = set([c.category for c in classes])
>      return categories
> +

Couldn't this be combined with similar code we've got for the GUI?

- Chris


More information about the anaconda-patches mailing list