# Path: webalchemy/server.py
# def _generate_session_id():
# def async_delay(secs):
# def _dreload(module, dreload_blacklist_starting_with, just_visit=False):
#     def __dreload(mdl):
#     def initialize(self, **kwargs):
#     def get(self, *varargs):
# def async_delay(secs):
#     def on_open(self, info):
#     def handle_binary_message(self, message):
#     def on_close(self):
#     def on_message(self, message):
#     def send_data(self, text, data):
#     def flush_dom(self):
#     def please_reload(self):
#     def msg_to_sessions(self, msg, send_to_self=False, to_session_ids=None):
#     def prepare_session_for_general_reload(self):
#     def handle_binary_message(self, message):
#     def send_heartbeat(self):
#     def init_localdocument(self, message):
#     def handle_js_to_py_rpc_message(self, msg):
#     def rpc(self, f, *varargs, send_to_self=False, to_session_ids=None, **kwargs):
#     def __init__(self, app, kwa, router, cls, shared_wshandlers, dreload_blacklist_starting_with, shared_data,
#                  additional_monitored_files):
#     def set_additional_monitored_files(self, fns):
#     def update_app(self):
#     def __init__(self):
#     def get_store(self, uid):
#     def remove_store(self, uid):
# def run(app=None, **kwargs):
# def generate_static(app):
# class _MainHandler(tornado.web.RequestHandler):
# class WebSocketHandler(SockJSConnection):
# class _AppUpdater:
# class PrivateDataStore:
# 
# Path: webalchemy/widgets/basic/menu.py
# class Menu:
# 
#     def __init__(self, rdoc, on_add=None):
#         self.rdoc = rdoc
#         self.element = rdoc.element('nav')
#         vn = '#' + self.element.varname
#         self.rule_menu = rdoc.stylesheet.rule(vn)
#         self.rule_item = rdoc.stylesheet.rule(vn + ' > li')
#         self.rule_item_hover = rdoc.stylesheet.rule(vn + ' > li:hover')
#         self.rule_item_selected = rdoc.stylesheet.rule(vn + ' > li.selected')
#         self.rule_item_selected_hover = rdoc.stylesheet.rule(vn + ' > li.selected:hover')
#         self.on_add = on_add
#         self.id_dict = {}
# 
#     def add_item(self, *varargs):
#         for text in varargs:
#             i = self.rdoc.element('li', text)
#             self.id_dict[i.att.varname] = i
#             self.element.append(i)
#             if self.on_add:
#                 self.on_add(i)


from webalchemy import server
from webalchemy.widgets.basic.menu import Menu
    from colors_meteor_example import ColorsMeteorApp
            rpc(self.color_liked, srv(self.menu.element).app.selected.id,
                srv(self.menu.element).app.selected.app.color, -1)

        button2.events.add(click=button_click_n, translate=True)

    def color_liked(self, sender_com_id, item_id, color, amount):
        if sender_com_id == self.com.id:
            # button clicked on this session
            self.sdata[color] += int(amount)
            self.com.rpc(self.color_liked, item_id, color, amount)
        else:
            # button clicked by other session
            item = self.menu.id_dict[item_id]
            self.menu.increase_count_by(item, int(amount))

    def color_selected(self, sender_id, color):
        self.tdata['selected color text'] = color

    def build_menu(self):
        # the following function will be used to initialize all menu items
        def on_add(item):
            nonlocal m
            col = item.text
            item.app.color = col
            item.app.clickedcount = self.sdata.get(col, 0)
            m.increase_count_by(item, 0)
            if item.text == self.tdata.get('selected color text', None):
                m.select_color(item)

        # create a menu element with the above item initializer

# Path: webalchemy/server.py
# def _generate_session_id():
# def async_delay(secs):
# def _dreload(module, dreload_blacklist_starting_with, just_visit=False):
#     def __dreload(mdl):
#     def initialize(self, **kwargs):
#     def get(self, *varargs):
# def async_delay(secs):
#     def on_open(self, info):
#     def handle_binary_message(self, message):
#     def on_close(self):
#     def on_message(self, message):
#     def send_data(self, text, data):
#     def flush_dom(self):
#     def please_reload(self):
#     def msg_to_sessions(self, msg, send_to_self=False, to_session_ids=None):
#     def prepare_session_for_general_reload(self):
#     def handle_binary_message(self, message):
#     def send_heartbeat(self):
#     def init_localdocument(self, message):
#     def handle_js_to_py_rpc_message(self, msg):
#     def rpc(self, f, *varargs, send_to_self=False, to_session_ids=None, **kwargs):
#     def __init__(self, app, kwa, router, cls, shared_wshandlers, dreload_blacklist_starting_with, shared_data,
#                  additional_monitored_files):
#     def set_additional_monitored_files(self, fns):
#     def update_app(self):
#     def __init__(self):
#     def get_store(self, uid):
#     def remove_store(self, uid):
# def run(app=None, **kwargs):
# def generate_static(app):
# class _MainHandler(tornado.web.RequestHandler):
# class WebSocketHandler(SockJSConnection):
# class _AppUpdater:
# class PrivateDataStore:
# 
# Path: webalchemy/widgets/basic/menu.py
# class Menu:
# 
#     def __init__(self, rdoc, on_add=None):
#         self.rdoc = rdoc
#         self.element = rdoc.element('nav')
#         vn = '#' + self.element.varname
#         self.rule_menu = rdoc.stylesheet.rule(vn)
#         self.rule_item = rdoc.stylesheet.rule(vn + ' > li')
#         self.rule_item_hover = rdoc.stylesheet.rule(vn + ' > li:hover')
#         self.rule_item_selected = rdoc.stylesheet.rule(vn + ' > li.selected')
#         self.rule_item_selected_hover = rdoc.stylesheet.rule(vn + ' > li.selected:hover')
#         self.on_add = on_add
#         self.id_dict = {}
# 
#     def add_item(self, *varargs):
#         for text in varargs:
#             i = self.rdoc.element('li', text)
#             self.id_dict[i.att.varname] = i
#             self.element.append(i)
#             if self.on_add:
#                 self.on_add(i)


# Path: examples/colors_meteor/colors_meteor_example.py
from webalchemy import server
from webalchemy.widgets.basic.menu import Menu
    from colors_meteor_example import ColorsMeteorApp

            rpc(self.color_liked, srv(self.menu.element).app.selected.id,
                srv(self.menu.element).app.selected.app.color, -1)

        button2.events.add(click=button_click_n, translate=True)

    def color_liked(self, sender_com_id, item_id, color, amount):
        if sender_com_id == self.com.id:
            # button clicked on this session
            self.sdata[color] += int(amount)
            self.com.rpc(self.color_liked, item_id, color, amount)
        else:
            # button clicked by other session
            item = self.menu.id_dict[item_id]
            self.menu.increase_count_by(item, int(amount))

    def color_selected(self, sender_id, color):
        self.tdata['selected color text'] = color

    def build_menu(self):
        # the following function will be used to initialize all menu items
        def on_add(item):
            nonlocal m
            col = item.text
            item.app.color = col
            item.app.clickedcount = self.sdata.get(col, 0)
            m.increase_count_by(item, 0)
            if item.text == self.tdata.get('selected color text', None):
                m.select_color(item)

        # create a menu element with the above item initializer

        m = Menu(self.rdoc, on_add)