Ejemplo n.º 1
0
def _put_root_static(wcommon, container_resource):
    """Place all the simple resources, that are not necessarily sourced from files but at least are unchanging and public."""
    
    for name in ['', 'client', 'test', 'manual', 'tools']:
        container_resource.putChild(name, _make_static_resource(os.path.join(static_resource_path, name if name != '' else 'index.html')))
    
    # Link deps into /client/.
    client = container_resource.children['client']
    for name in ['require.js', 'text.js']:
        client.putChild(name, _make_static_resource(os.path.join(deps_path, name)))
    for name in ['measviz.js', 'measviz.css']:
        client.putChild(name, _make_static_resource(os.path.join(deps_path, 'measviz/src', name)))
    
    # Link deps into /test/.
    test = container_resource.children['test']
    jasmine = SlashedResource()
    test.putChild('jasmine', jasmine)
    for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']:
        jasmine.putChild(name, _make_static_resource(os.path.join(
            deps_path, 'jasmine/lib/jasmine-core/', name)))
    
    # Special resources
    container_resource.putChild('favicon.ico',
        _make_static_resource(os.path.join(static_resource_path, 'client/icon/icon-32.png')))
    client.putChild('web-app-manifest.json',
        WebAppManifestResource(wcommon))
    _put_plugin_resources(client)
Ejemplo n.º 2
0
def _put_root_static(container_resource):
    """Place all the simple static files."""

    for name in ['', 'client', 'test', 'manual', 'tools']:
        container_resource.putChild(
            name,
            _make_static_resource(
                os.path.join(static_resource_path,
                             name if name != '' else 'index.html')))

    # Link deps into /client/.
    client = container_resource.children['client']
    for name in ['require.js', 'text.js']:
        client.putChild(name,
                        _make_static_resource(os.path.join(deps_path, name)))
    for name in ['measviz.js', 'measviz.css']:
        client.putChild(
            name,
            _make_static_resource(os.path.join(deps_path, 'measviz/src',
                                               name)))

    # Link deps into /test/.
    test = container_resource.children['test']
    jasmine = SlashedResource()
    test.putChild('jasmine', jasmine)
    for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']:
        jasmine.putChild(
            name,
            _make_static_resource(
                os.path.join(deps_path, 'jasmine/lib/jasmine-core/', name)))

    _put_plugin_resources(client)
Ejemplo n.º 3
0
def _put_root_static(wcommon, container_resource):
    """Place all the simple resources, that are not necessarily sourced from files but at least are unchanging and public."""
    
    for name in ['', 'client', 'test', 'manual', 'tools']:
        container_resource.putChild(name, _make_static_resource(os.path.join(static_resource_path, name if name != '' else 'index.html')))
    
    # Link deps into /client/.
    client = container_resource.children['client']
    for name in ['require.js', 'text.js']:
        client.putChild(name, _make_static_resource(os.path.join(deps_path, name)))
    for name in ['measviz.js', 'measviz.css']:
        client.putChild(name, _make_static_resource(os.path.join(deps_path, 'measviz/src', name)))
    
    # Link deps into /test/.
    test = container_resource.children['test']
    jasmine = SlashedResource()
    test.putChild('jasmine', jasmine)
    for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']:
        jasmine.putChild(name, _make_static_resource(os.path.join(
            deps_path, 'jasmine/lib/jasmine-core/', name)))
    
    # Special resources
    container_resource.putChild('favicon.ico',
        _make_static_resource(os.path.join(static_resource_path, 'client/icon/icon-32.png')))
    client.putChild('web-app-manifest.json',
        WebAppManifestResource(wcommon))
    _put_plugin_resources(client)
Ejemplo n.º 4
0
def _put_root_static(container_resource):
    """Place all the simple static files."""
    
    for name in ['', 'client', 'test', 'manual', 'tools']:
        container_resource.putChild(name, _make_static_resource(os.path.join(static_resource_path, name if name != '' else 'index.html')))
    
    # Link deps into /client/.
    client = container_resource.children['client']
    client.putChild('require.js', _make_static_resource(os.path.join(deps_path, 'require.js')))
    client.putChild('text.js', _make_static_resource(os.path.join(deps_path, 'text.js')))
    
    # Link deps into /test/.
    test = container_resource.children['test']
    jasmine = SlashedResource()
    test.putChild('jasmine', jasmine)
    for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']:
        jasmine.putChild(name, _make_static_resource(os.path.join(
            deps_path, 'jasmine/lib/jasmine-core/', name)))
    
    _put_plugin_resources(client)
Ejemplo n.º 5
0
 def __init__(self, reactor, root_object, note_dirty, read_only_dbs, writable_db, http_endpoint, ws_endpoint, root_cap, title, flowgraph_for_debug):
     self.__http_port = http_endpoint
     self.__ws_port = ws_endpoint
     
     wcommon = WebServiceCommon(note_dirty=note_dirty, ws_endpoint=ws_endpoint)
     
     # Roots of resource trees
     # - appRoot is everything stateful/authority-bearing
     # - serverRoot is the HTTP '/' and static resources are placed there
     serverRoot = _make_static(static_resource_path)
     if root_cap is None:
         appRoot = serverRoot
         self.__visit_path = '/'
         ws_caps = {None: root_object}
     else:
         serverRoot = _make_static(static_resource_path)
         appRoot = SlashedResource()
         serverRoot.putChild(root_cap, appRoot)
         self.__visit_path = '/' + urllib.quote(root_cap, safe='') + '/'
         ws_caps = {root_cap: root_object}
     
     self.__ws_protocol = txws.WebSocketFactory(
         FactoryWithArgs.forProtocol(OurStreamProtocol, ws_caps, note_dirty))
     
     # UI entry point
     appRoot.putChild('', _RadioIndexHtmlResource(wcommon=wcommon, title=title))
     
     # Exported radio control objects
     appRoot.putChild('radio', BlockResource(root_object, wcommon, not_deletable))
     
     # Frequency DB
     appRoot.putChild('dbs', shinysdr.i.db.DatabasesResource(read_only_dbs))
     appRoot.putChild('wdb', shinysdr.i.db.DatabaseResource(writable_db))
     
     # Debug graph
     appRoot.putChild('flow-graph', FlowgraphVizResource(reactor, flowgraph_for_debug))
     
     # Ephemeris
     appRoot.putChild('ephemeris', EphemerisResource())
     
     # Construct explicit resources for merge.
     test = _reify(serverRoot, 'test')
     jasmine = _reify(test, 'jasmine')
     for name in ['jasmine.css', 'jasmine.js', 'jasmine-html.js']:
         jasmine.putChild(name, static.File(os.path.join(
             deps_path, 'jasmine/lib/jasmine-core/', name)))
     
     client = _reify(serverRoot, 'client')
     client.putChild('require.js', static.File(os.path.join(deps_path, 'require.js')))
     client.putChild('text.js', static.File(os.path.join(deps_path, 'text.js')))
     
     _add_plugin_resources(client)
     
     self.__site = server.Site(serverRoot)
     self.__ws_port_obj = None
     self.__http_port_obj = None