'Return a list of all widgets in the registry. If `category` is
specified return only widgets which belong to the category.
Parameters
category : :class:`CategoryDescription` or str, optional
Return only descriptions of widgets belonging to the category.'

def widgets(self, category=None):

    if (category is None):
        categories = self.categories()
    elif isinstance(category, str):
        categories = [self.category(category)]
    else:
        categories = [category]
    widgets = []
    for cat in categories:
        if isinstance(cat, str):
            cat = self.category(cat)
        cat_widgets = self._categories_dict[cat.name][1]
        widgets.extend(sorted(cat_widgets, key=attrgetter('priority')))
    return widgets
