Exemplo n.º 1
0
 def test4(self):
     """luban.weaver.web.Library.expand"""
     Library.reset()
     jquery = Library('jquery', javascripts=['jquery.js'])
     luban = Library('luban',
                     javascripts=['luban.js'],
                     dependencies=['jquery'])
     expanded = list(expand((luban)))
     self.assertEqual(len(expanded), 2)
     self.assertTrue(luban in expanded)
     self.assertTrue(jquery in expanded)
     return
Exemplo n.º 2
0
    def _createImplDocument(self):
        from luban.weaver.web.Library import Library
        name = self.object_type.__unique_type_name__
        try:
            lib = Library.get('luban.widgets.%s' % name)
        except KeyError:
            return luban.e.document()
        deps = lib.dependencies
        if not deps: return luban.e.document()

        impl = luban.e.document(
            title='Javascript widget library dependencies:')
        for dep in deps:
            dep = Library.get(dep)
            text = '<a class="ext" href="%s" target="_blank">%s</a>' % (
                dep.website, dep.name)
            impl.htmldocument(text=text)
            continue
        return impl
Exemplo n.º 3
0
 def test5(self):
     """luban.weaver.web.Library.extractAllDeps exclude_libs"""
     Library.reset()
     jquery = Library('jquery', javascripts=['jquery.js'])
     luban = Library('luban',
                     javascripts=['luban.js'],
                     dependencies=['jquery'])
     jui_tabs = Library('jquery.ui.tabs', dependencies=['jquery'])
     tabs = Library('luban.tabs',
                    javascripts=['luban.tabs.js'],
                    dependencies=['luban', 'jquery.ui.tabs'])
     deps = list(tabs.extractAllDeps(exclude_libs=['luban']))
     self.assertEqual(len(deps), 1)
     self.assertEqual(deps[0], jui_tabs)
     return
Exemplo n.º 4
0
 def test2(self):
     """luban.weaver.web.Library.extractAllDeps"""
     Library.reset()
     jquery = Library('jquery', javascripts=['jquery.js'])
     luban = Library('luban',
                     javascripts=['luban.js'],
                     dependencies=['jquery'])
     deps = list(luban.extractAllDeps())
     self.assertEqual(len(deps), 1)
     self.assertEqual(deps[0], jquery)
     return
Exemplo n.º 5
0
 def test3(self):
     """luban.weaver.web.Library.extractAllDeps recurse"""
     Library.reset()
     jquery = Library('jquery', javascripts=['jquery.js'])
     luban = Library('luban',
                     javascripts=['luban.js'],
                     dependencies=['jquery'])
     tabs = Library('luban.tabs',
                    javascripts=['luban.tabs.js'],
                    dependencies=['luban'])
     deps = list(tabs.extractAllDeps())
     self.assertEqual(len(deps), 2)
     self.assertEqual(deps[0], jquery)
     self.assertEqual(deps[1], luban)
     return
Exemplo n.º 6
0
    def test(self):
        """luban.weaver.web: Frame2HtmlDocument + renderer.render"""
        # luban ui object
        frame = luban.e.frame(title='test frame', name='frame')
        document = frame.document(name='document')
        p = document.paragraph(name='p')
        
        # frame->htmldoc renderer
        from luban.weaver.web.Librarian import Librarian
        librarian = Librarian()

        from luban.weaver.web.Library import Library
        base = Library('base', ['myproject.css'], ['luban-base.js'])
        librarian.register('base', ['base'])
        
        from luban.weaver.web.JsonReprRenderer import JsonReprRenderer
        obj2json = JsonReprRenderer()
        from luban.weaver.web.Frame2HtmlDocument import Frame2HtmlDocument
        mill = Frame2HtmlDocument(librarian=librarian, obj2json=obj2json)
        
        # htmldoc
        from luban.weaver.web.content.HtmlDocument import HtmlDocument
        htmldoc = HtmlDocument()
        
        # frame->htmldoc
        body, jsdoc = mill.render(frame, html_target=htmldoc)
        
        # htmldoc -> text
        from luban.weaver.web.renderer import render
        texts = render(htmldoc, javascriptdoc = jsdoc)
        
        #
        filename = 'out-HtmlRenderer-breakdown-test.html'
        out = open(filename, 'w')
        out.write('\n'.join(texts))
        
        return
Exemplo n.º 7
0
    'slides', 'slide',
    'bulletinboard', 'bulletinboardannouncement',
    
    'form', 
    'formtextfield', 'formpasswordfield', 'formtextarea',
    'formselectorfield', 'formradiobox', 'formcheckbox',
    'formsubmitbutton',

    'progressbar',
    
    'dialog',
    
    ]


for element in elements:
    js = 'luban.timber/widgets/%s.js' % element
    lib = Library(
        "luban.widgets.%s" % element,
        javascripts = [js],
        )
    continue


Library.get('luban.widgets.codeviewer').dependencies = ['prettify']
Library.get('luban.widgets.uploader').dependencies = ['blueimp-fileupload']
Library.get('luban.widgets.slides').dependencies = ['jquery.cycle']


# End of file 
Exemplo n.º 8
0
# -*- Python -*-
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#                                   Jiao Lin
#                      California Institute of Technology
#                      (C) 2006-2011  All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#

from luban.weaver.web.Library import Library
from luban.weaver.web.libraries import luban_core_debug

from .luban_timber_core_js_modules import modules as js_mods

lib = Library.get('luban.core')
lib.css += [
    'luban.timber.css',
]
lib.javascripts += ['luban.timber/%s' % m for m in js_mods]

lib.dependencies += [
    # history
    'jquery.history',
]

# End of file
Exemplo n.º 9
0
 def test1(self):
     """luban.weaver.web.Library"""
     jquery = Library('jquery', javascripts=['jquery.js'])
     self.assertEqual(Library.get('jquery'), jquery)
     return
Exemplo n.º 10
0
    'formtextfield',
    'formpasswordfield',
    'formtextarea',
    'formselectorfield',
    'formradiobox',
    'formcheckbox',
    'formsubmitbutton',
    'progressbar',
    'dialog',
    'sketchcanvas',
]

for element in elements:
    js = 'luban.timber/widgets/%s.js' % element
    lib = Library(
        "luban.widgets.%s" % element,
        javascripts=[js],
    )
    continue

Library.get('luban.widgets.accordion').dependencies = ['jqueryui.accordion']
Library.get('luban.widgets.codeviewer').dependencies = ['prettify']
Library.get('luban.widgets.uploader').dependencies = [
    'blueimp-fileupload', 'jqueryui.progressbar'
]
Library.get('luban.widgets.slides').dependencies = ['jquery.cycle']
Library.get('luban.widgets.progressbar').dependencies = [
    'jqueryui.progressbar'
]
Library.get('luban.widgets.dialog').dependencies = ['jqueryui.dialog']
Library.get('luban.widgets.sketchcanvas').dependencies = ['jquery.sketch']
Exemplo n.º 11
0
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#


from luban.weaver.web.libraries import jquery_ext

from luban.weaver.web.Library import Library

root = 'jquery.ext'
jsp = lambda j: '%s/%s' % (root, j)

Library(
    name='jquery.history',
    javascripts = [jsp('jquery.history.js')],
    )

Library(
    name='jquery.iframe-transport',
    javascripts = [jsp('jquery.iframe-transport.js')],
    )

Library(
    name='jquery.sketch',
    javascripts = [jsp('sketch.js')],
    website = 'http://intridea.github.com/sketch.js/',
    )


# End of file 
Exemplo n.º 12
0
# -*- Python -*-
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#                                   Jiao Lin
#                      California Institute of Technology
#                      (C) 2006-2011  All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#

from luban.weaver.web.Library import Library
lib = Library(
    name='blueimp-fileupload',
    css=['jquery.ext/blueimp-file-upload/jquery.fileupload-ui.css'],
    javascripts=['jquery.ext/blueimp-file-upload/jquery.fileupload.js'],
    dependencies=['jquery.iframe-transport'],
    website="https://github.com/blueimp/jQuery-File-Upload",
)

lib.demosite = "http://aquantum-demo.appspot.com/file-upload"

# End of file
Exemplo n.º 13
0
# -*- Python -*-
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#                                   Jiao Lin
#                      California Institute of Technology
#                      (C) 2006-2011  All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#

from luban.weaver.web.Library import Library
lib = Library(
    name = 'jquery.cycle',
    javascripts = ['jquery.ext/jquery.cycle.all.js'],
    website = "http://jquery.malsup.com/cycle/",
    )

# End of file 

Exemplo n.º 14
0
# -*- Python -*-
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
#                                   Jiao Lin
#                      California Institute of Technology
#                      (C) 2006-2011  All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#

from luban.weaver.web.Library import Library
lib = Library(
    name='prettify',
    css=['other/prettify/prettify.css'],
    javascripts=['other/prettify/prettify.js'],
    website="http://code.google.com/p/google-code-prettify/",
)

# End of file