# Path: scribeui_pyramid/modules/webui/ui.py
# class UIObject(object):
#     def __init__(self, **kwargs):
#         for k, v in kwargs.iteritems():
#             if hasattr(self, k):
#                 setattr(self, k, v)
# 
# Path: scribeui_pyramid/modules/app/interfaces.py
# class INavBar(Interface):
#     pass


from operator import attrgetter
from ..webui.ui import UIObject
from .interfaces import INavBar
            if self.request:
                if item.params:
                    item.url = self.request.route_url(item.route_name, **item.params)
                else:
                    item.url = self.request.route_url(item.route_name)

    def add(self, item):
        self._items.append(item)

    @property
    def items(self):
        self.set_urls(self._items)
        return sorted(self._items, key=attrgetter('sort_weight', 'name'))


def get_navbar_from_config(config):
    return config.registry.queryUtility(INavBar)


def get_navbar_from_request(request):
    return request.registry.queryUtility(INavBar)


def get_navbar(request):
    navbar = get_navbar_from_request(request)
    navbar.set_request(request)
    return navbar


def includeme(config):

# Path: scribeui_pyramid/modules/webui/ui.py
# class UIObject(object):
#     def __init__(self, **kwargs):
#         for k, v in kwargs.iteritems():
#             if hasattr(self, k):
#                 setattr(self, k, v)
# 
# Path: scribeui_pyramid/modules/app/interfaces.py
# class INavBar(Interface):
#     pass


# Path: scribeui_pyramid/modules/app/navbar.py
from operator import attrgetter
from ..webui.ui import UIObject
from .interfaces import INavBar

            if self.request:
                if item.params:
                    item.url = self.request.route_url(item.route_name, **item.params)
                else:
                    item.url = self.request.route_url(item.route_name)

    def add(self, item):
        self._items.append(item)

    @property
    def items(self):
        self.set_urls(self._items)
        return sorted(self._items, key=attrgetter('sort_weight', 'name'))


def get_navbar_from_config(config):
    return config.registry.queryUtility(INavBar)


def get_navbar_from_request(request):
    return request.registry.queryUtility(INavBar)


def get_navbar(request):
    navbar = get_navbar_from_request(request)
    navbar.set_request(request)
    return navbar


def includeme(config):

    config.registry.registerUtility(NavBar(), INavBar)