# 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:


from webalchemy import server
    from jquerymobile_example import JQueryMobileExample

class JQueryMobileExample:

    # Include the jQuery mobile stylesheet and the jQuery/jQuery mobile scripts
    stylesheets = ['http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css']
    include = ['http://code.jquery.com/jquery-1.10.2.min.js',
               'http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js']
               
    # Use the modified html
    main_html_file_path = "jquerymobile_example.html"

    def initialize(self, **kwargs):
        self.rdoc = kwargs['remote_document']
        # Grab the main <div> from the html document and inject some elements
        self.main = self.rdoc.getElementById('main')
        self.main.element(h1="Main content")
        self.main.element(button="A button")
        # Force jQuery to redraw (enhance) the document
        self.rdoc.JS('jQuery(#{self.main}).trigger("create")')


if __name__ == '__main__':
    # this import is necessary because of the live editing. Everything else works OK without it

# 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: examples/jquerymobile/jquerymobile_example.py
from webalchemy import server
    from jquerymobile_example import JQueryMobileExample


class JQueryMobileExample:

    # Include the jQuery mobile stylesheet and the jQuery/jQuery mobile scripts
    stylesheets = ['http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css']
    include = ['http://code.jquery.com/jquery-1.10.2.min.js',
               'http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js']
               
    # Use the modified html
    main_html_file_path = "jquerymobile_example.html"

    def initialize(self, **kwargs):
        self.rdoc = kwargs['remote_document']
        # Grab the main <div> from the html document and inject some elements
        self.main = self.rdoc.getElementById('main')
        self.main.element(h1="Main content")
        self.main.element(button="A button")
        # Force jQuery to redraw (enhance) the document
        self.rdoc.JS('jQuery(#{self.main}).trigger("create")')


if __name__ == '__main__':
    # this import is necessary because of the live editing. Everything else works OK without it

    server.run(JQueryMobileExample)