# 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
    route_name = None
    params = None
    url = None
    active = False
    items = None
    sort_weight = 0
    permission = None
    widget = None


class NavBar(object):

    def __init__(self):
        self.request = None
        self._items = []

    def set_request(self, request):
        self.request = request

    def set_urls(self, items):
        for item in items:
            if item.items:
                self.set_urls(item.items)
            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):

# 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

    route_name = None
    params = None
    url = None
    active = False
    items = None
    sort_weight = 0
    permission = None
    widget = None


class NavBar(object):

    def __init__(self):
        self.request = None
        self._items = []

    def set_request(self, request):
        self.request = request

    def set_urls(self, items):
        for item in items:
            if item.items:
                self.set_urls(item.items)
            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)