Esempio n. 1
0
 def __init__(self, avatarId = None, db = None, *a, **k):
     mods = athena.jsDeps.mapping
     mods[self.moduleName] = Settings.BaseDir+'/scripts/'+self.moduleScript
     athena.LivePage.__init__(self, jsModules = athena.JSPackage(mods))
     self.avatarId = avatarId
     self.db = db
     self.lockStatus, self.lockTime, self.lockUser = isLocked()
     self.sysconf = confparse.Config()
     self.render_userBar = render_userBar
Esempio n. 2
0
    def __init__(self, avatarId=None, enamel=None, *a, **k):
        print "Initialisation"
        mods = athena.jsDeps.mapping
        self.avatarId = avatarId
        self.enamel = enamel

        for moduleName, t in self.elements.items():
            fragment, fragmentClass, script = t
            mods[moduleName] = script
            setattr(
                self, 'render_%s' % moduleName,
                self.fragmentRenderer(fragment, unicode(fragmentClass),
                                      moduleName))
            setattr(self, 'element_%s' % moduleName,
                    T.invisible(render=T.directive(moduleName)))

        athena.LivePage.__init__(self, jsModules=athena.JSPackage(mods))
        self.docFactory = self.document()
Esempio n. 3
0
 def __init__(self, avatarId = None, db = None, *a, **k):
     mods = athena.jsDeps.mapping
     mods[self.moduleName] = Settings.BaseDir+'/scripts/'+self.moduleScript
     athena.LivePage.__init__(self, jsModules = athena.JSPackage(mods) )
     self.avatarId = avatarId
     self.db = db
Esempio n. 4
0
from nevow import athena
from twisted.python import util
import myelement

myPackage = athena.JSPackage({
    'MyModule': 'mymodule.js',
})
Esempio n. 5
0
__docformat__ = "restructuredtext en"

from nevow import athena, loaders, tags, inevow, livepage
from twisted.python import util
from twisted.python.failure import Failure
from twisted.internet import reactor

from ipython1.kernel import results
myPackage = athena.JSPackage({
    'ControllerModule': util.sibpath(__file__, 'athenawidgets.js')
    })

athena.jsDeps.mapping.update(myPackage.mapping)

def classTag(tag, klass):
    if not isinstance(tag, tags.Tag):
        tag = getattr(tags, str(tag))(tmp='tmp')
        del tag.attributes['tmp']
    tag.attributes['class'] = klass
    return tag

def htmlString(s):
    return s.replace('<', '&lt;').replace('>', '&gt;').replace('\n','<br/>')

def statusListToHTML(statusList, pending, queue, history, local):
    s = "<table id='statusTable' align='center'><tr><td><b>id</b>"
    for e in ['pending', 'queue', 'history', 'local']:
        if locals()[e]:
            s+= "<td><b>%s</b></td>" %e    
    for r in statusList:
        s += "<tr><td valign='top'>%i</td>"%r[0]
Esempio n. 6
0
        self.gatherers.append(gatherer)
        gatherer.source = self
        for r in self.results:
            try:
                gatherer.handleResult(r)
            except:
                return
    
    def loseGatherer(self, gatherer=None):
        try:
            self.gatherers.remove(gatherer)
        except ValueError:
            pass
    
myPackage = athena.JSPackage({
    'ControllerModule': basedir+'/controllerajaxpb.js'
    })

athena.jsDeps.mapping.update(myPackage.mapping)

class ResultPage(athena.LivePage):
    addSlash = True
    source = None
    CSS = open(basedir+'/ajaxpb.css').read()
    start = CSS.find('height', CSS.find('resultOut'))
    stop = CSS.find('\n', start)
    css = CSS[:start]+'height: 30em;\n'+CSS[stop:]
    docFactory = loaders.stan(tags.html[
        tags.head(render=tags.directive('liveglue')),
        tags.style(type="text/css")[css],
        tags.body(render=tags.directive('resultElement'))])