本文整理汇总了Python中exe.webui.blockfactory.g_blockFactory.registerBlockType函数的典型用法代码示例。如果您正苦于以下问题:Python registerBlockType函数的具体用法?Python registerBlockType怎么用?Python registerBlockType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerBlockType函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
"""
html = u'<script type="text/javascript" src="common.js"></script>\n'
html += u'<script type="text/javascript" src="libot_drag.js"></script>'
html += u"\n<div class=\"iDevice "
html += u"emphasis"+unicode(self.idevice.emphasis)+"\">\n"
html += u'<img alt="" class="iDevice_icon" '
html += u"src=\"icon_"+self.idevice.icon+".gif\" />\n"
html += u"<span class=\"iDeviceTitle\">"
html += self.idevice.title+"</span><br/>\n"
html += u"<div class=\"iDevice_inner\">\n"
html += self.instructionElement.renderView()
for element in self.questionElements:
html += "<div class=\"question\">\n"
html += element.renderQuestionView()
html += element.renderFeedbackView()
html += "</div>\n"
html += u"</div>\n"
html += u"</div>\n"
return html
from exe.engine.opinionidevice import OpinionIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(OpinionBlock, OpinionIdevice)
# ===========================================================================
示例2: renderView
def renderView(self, style):
"""
Remembers if we're previewing or not,
then implicitly calls self.renderViewContent (via Block.renderPreview)
"""
self.previewing = False
return Block.renderView(self, style)
def renderViewContent(self):
"""
Returns an XHTML string for this block
"""
# html = u'<script type="text/javascript" src="common.js"></script>\n'
# html += u'<div class="iDevice_inner">\n'
html = u'<div class="iDevice_inner">\n'
if self.previewing:
html += self.activityElement.renderPreview()
else:
html += self.activityElement.renderView()
html += "</div>\n"
return html
from exe.engine.orientacionesalumnadofpdidevice import OrientacionesalumnadofpdIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(OrientacionesalumnadofpdBlock, OrientacionesalumnadofpdIdevice)
# ===========================================================================
示例3: renderView
return html
def renderView(self, style):
"""
Returns an XHTML string for viewing this block,
i.e. when exported as a webpage or SCORM package
"""
html = u"<div class=\"iDevice "
html += u"emphasis"+unicode(self.idevice.emphasis)+"\">\n"
if self.idevice.icon:
html += u'<img alt="%s" ' % _(u'IDevice Icon')
html += u' class="iDevice_icon" '
html += u"src=\"icon_"+self.idevice.icon+".gif\"/>\n"
html += u"<span class=\"iDeviceTitle\">"
html += self.idevice.title
html += u"</span>\n"
html += u"<div class=\"iDevice_inner\">\n"
for element in self.elements:
html += element.renderView()
html += u"<br/>\n"
html += u"</div>\n"
html += u"</div>\n"
return html
from exe.engine.genericidevice import GenericIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(GenericBlock, GenericIdevice)
# ===========================================================================
示例4: renderPreview
return html
def renderPreview(self, style):
"""
Returns an XHTML string for previewing this block
"""
html = common.ideviceHeader(self, style, "preview")
for element in self.questionElements:
html += element.renderPreview()
html += common.ideviceFooter(self, style, "preview")
return html
def renderView(self, style):
"""
Returns an XHTML string for viewing this block
"""
html = common.ideviceHeader(self, style, "view")
for element in self.questionElements:
html += element.renderView()
html += common.ideviceFooter(self, style, "view")
return html
from exe.engine.multiselectidevice import MultiSelectIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(MultiSelectBlock, MultiSelectIdevice)
# ===========================================================================
示例5: hasattr
"""
Returns an XHTML string for previewing this block
"""
if hasattr(self.idevice, 'parent') and self.idevice.parent and not self.idevice.parent.edit:
return u""
html = u"<div class=\"iDevice "
html += u"emphasis"+unicode(self.idevice.emphasis)+"\" "
html += u"style=\"position: relative\" "
html += u"ondblclick=\"submitLink('edit',"+self.id+", 0);\">\n"
html += self.contentElement.renderPreview()
html += self.renderViewButtons()
html += "</div>\n"
return html
def renderView(self, style):
"""
Returns an XHTML string for viewing this block
"""
html = u"<div class=\"iDevice "
html += u"emphasis"+unicode(self.idevice.emphasis)+"\">\n"
html += self.contentElement.renderView()
html += u"</div>\n"
return html
from exe.engine.freetextidevice import FreeTextIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(FreeTextBlock, FreeTextIdevice)
# ===========================================================================
示例6: _
html += self.activityElement.renderPreview()
else:
html += self.activityElement.renderView()
html += '<div id="view%s" style="display:block;">' % self.id
html += common.feedbackButton("btnshow"+self.id, _(u"Click here"),
onclick="showAnswer('%s',1)" % self.id)
html += '</div>\n'
html += '<div id="hide%s" style="display:none;">' % self.id
html += common.feedbackButton("btnshow"+self.id, _(u"Hide"),
onclick="showAnswer('%s',0)" % self.id)
html += '</div>\n'
html += '<div id="s%s" class="feedback" style=" ' % self.id
html += 'display: none;">'
if self.previewing:
html += self.answerElement.renderPreview()
else:
html += self.answerElement.renderView()
html += "</div>\n"
html += "</div>\n"
return html
from exe.engine.reflectionidevice import ReflectionIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(ReflectionBlock, ReflectionIdevice)
# ===========================================================================
示例7: _
"""
html = u'<div class="classnote">\n'
if self.commentElement.field.content:
html += '<div class="notetitleex" onclick="jQuery(\'#fb%s\').toggle()" title="%s">' % (self.id , _(u"Show/Hide"))
else:
html += '<div class="notetitle">'
html +='%s</div>' % self.idevice.title
if self.commentElement.field.content:
html += '<div id="fb%s" class="notearea">' % self.id
if self.previewing:
html += self.commentElement.renderPreview()
else:
html += self.commentElement.renderView()
html += "</div>\n"
if self.previewing:
html +=Block.renderViewButtons(self)
html +="<a title=\""+_(u"Delete all notes")+"\" href=\"#\" onclick=\"confirmThenSubmitLink('"+_(u"Would you delete all notes?")+"', '"+u'deleteallnotes'+"', '"+self.id+"', 1);\" style=\"float:right;margin-top:-20px;\"><img alt=\""+_(u"Delete all notes")+"\" width=\"16\" height=\"16\" class=\"submit\" src=\"/images/stock-delete.png\"></a>"
html += "</div>\n"
return html
from exe.engine.notaidevice import NotaIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(NotaBlock, NotaIdevice)
# ===========================================================================
示例8: renderView
def renderView(self, style):
"""
Remembers if we're previewing or not,
then implicitly calls self.renderViewContent (via Block.renderPreview)
"""
self.previewing = False
return Block.renderView(self, style)
def renderViewContent(self):
"""
Returns an XHTML string for this block
"""
# html = u'<script type="text/javascript" src="common.js"></script>\n'
# html += u'<div class="iDevice_inner">\n'
html = u'<div class="iDevice_inner">\n'
if self.previewing:
html += self.activityElement.renderPreview()
else:
html += self.activityElement.renderView()
html += "</div>\n"
return html
from exe.engine.parasabermasfpdidevice import ParasabermasfpdIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(ParasabermasfpdBlock, ParasabermasfpdIdevice)
# ===========================================================================
示例9: renderText
def renderText(self):
"""
Returns an XHTML string for text file export.
"""
if self.previewing:
html = '<p>' + self.instructionElement.renderPreview() +'</p>'
else:
html = '<p>' + self.instructionElement.renderView() +'</p>'
html += '<p>' + self.listaElement.renderText() + '</p>'
if self.feedbackElement.field.content:
html += '<p>%s:</P>' % c_(u"Feedback")
if self.previewing:
html += '<p>' +self.feedbackElement.renderPreview(False,
class_="feedback")
html += '</p>'
else:
html += '<p>' +self.feedbackElement.renderView(False,
class_="feedback")
html += '</p>'
html += self.listaElement.renderAnswers()
return html
#=======================================================
from exe.engine.listaidevice import ListaIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(ListaBlock, ListaIdevice)
示例10: renderViewContent
"""
self.previewing = True
return Block.renderPreview(self, style)
def renderViewContent(self):
"""
Returns an XHTML string for this block
"""
log.debug("renderViewContent called with previewing mode = " + str(self.previewing))
html = u""
if self.previewing:
html += self.storyElement.renderPreview()
html + u"<br />\n"
for element in self.questionElements:
html += element.renderPreview()
else:
html += self.storyElement.renderView()
html + u"<br />\n"
for element in self.questionElements:
html += element.renderView()
return html
from exe.engine.ejercicioresueltofpdidevice import EjercicioresueltofpdIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(EjercicioresueltofpdBlock, EjercicioresueltofpdIdevice)
# ===========================================================================
示例11: renderView
def renderView(self, style):
"""
Remembers if we're previewing or not,
then implicitly calls self.renderViewContent (via Block.renderPreview)
"""
self.previewing = False
return Block.renderView(self, style)
def renderViewContent(self):
"""
Returns an XHTML string for this block
"""
# html = u'<script type="text/javascript" src="common.js"></script>\n'
# html += u'<div class="iDevice_inner">\n'
html = u'<div class="iDevice_inner">\n'
if self.previewing:
html += self.activityElement.renderPreview()
else:
html += self.activityElement.renderView()
html += "</div>\n"
return html
from exe.engine.casopracticofpdidevice import CasopracticofpdIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(CasopracticofpdBlock, CasopracticofpdIdevice)
# ===========================================================================
示例12: DummyBlock
import unittest
from exe.webui.block import Block
from exe.engine.idevice import Idevice
from exe.webui.blockfactory import g_blockFactory
# ===========================================================================
class DummyBlock(Block):
def __init__(self, parent, idevice):
pass
class DummyIdevice(Idevice):
def __init__(self):
pass
g_blockFactory.registerBlockType(DummyBlock, DummyIdevice)
# ===========================================================================
class TestBlockFactory(unittest.TestCase):
def setUp(self):
pass
def testBlockFactory(self):
myidevice = DummyIdevice()
myblock = g_blockFactory.createBlock(None, myidevice)
self.assertEquals(type(myblock), DummyBlock)
if __name__ == "__main__":
unittest.main()
示例13: _
html = u"<div class=\"iDevice "
html += u"emphasis"+unicode(self.idevice.emphasis)+"\" "
html += u"ondblclick=\"submitLink('edit',"+self.id+", 0);\">\n"
html += u'<img alt="%s" ' % _(u'IDevice Icon')
html += u' class="iDevice_icon" '
html += u"src=\"/style/"+style+"/icon_"+self.idevice.icon+".gif\" />\n"
html += u"<span class=\"iDeviceTitle\"><strong>"
html += self.idevice.title+"</strong></span>\n"
html += "<div class=\"iDevice_inner\">\n"
aux = self.questionElements[len(self.questionElements) - 1]
for element in self.questionElements:
if element == aux:
html += element.renderPreview("/images/panel-amusements.png", "/images/stock-stop.png")
else:
html += element.renderPreview("/images/panel-amusements.png", "/images/stock-stop.png") + "<br/>"
html += "</div>\n"
html += self.renderViewButtons()
html += "</div>\n"
return html
from exe.engine.eleccionmultiplefpdidevice import EleccionmultiplefpdIdevice
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(EleccionmultiplefpdBlock, EleccionmultiplefpdIdevice)
# ===========================================================================
示例14: __init__
def __init__(self, field):
Element.__init__(self, field)
self.elements = field.mainFields.makeElementDict()
def process(self, request):
field_engine_process_all_elements(self.elements, request)
def renderEdit(self):
html = ""
#to make sure people see what is a pair..
html += "<div style='border: 2px solid green; margin: 5px; padding: 5px'>\n"
html += self.field.mainFields.renderEditInOrder(self.elements)
html += "</div>"
return html
#makes the line of Javascript for adding this to the game
def makeJSLine(self):
html = ""
html += "memMatchGame%(ideviceid)s.addPairToMatch('%(pair1id)s', '%(pair2id)s');\n" \
% { 'ideviceid' : str(self.field.idevice.id), 'pair1id' : self.elements['match1'].id, \
'pair2id' : self.elements['match2'].id}
return html
# ===========================================================================
"""Register this block with the BlockFactory"""
from exe.engine.memorymatchidevice import MemoryMatchIdeviceInc
from exe.webui.blockfactory import g_blockFactory
g_blockFactory.registerBlockType(MemoryMatchBlockInc, MemoryMatchIdeviceInc)
# ===========================================================================