本文整理汇总了Python中exe.webui.block.Block类的典型用法代码示例。如果您正苦于以下问题:Python Block类的具体用法?Python Block怎么用?Python Block使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Block类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, idevice):
"""
'parent' is our parent 'Renderable' instance
"""
Block.__init__(self, parent, idevice)
if not hasattr(self.idevice,'undo'):
self.idevice.undo = True
示例2: process
def process(self, request):
"""
Process the request arguments from the web server
"""
Block.process(self, request)
is_cancel = common.requestHasCancel(request)
if ("addQuestion"+self.id) in request.args:
self.idevice.addQuestion()
self.idevice.edit = True
# disable Undo once a question has been added:
self.idevice.undo = False
for element in self.questionElements:
element.process(request)
if "title"+self.id in request.args \
and not is_cancel:
self.idevice.title = request.args["title"+self.id][0]
if ("action" in request.args and request.args["action"][0] == "done"
or not self.idevice.edit):
# remove the undo flag in order to reenable it next time:
if hasattr(self.idevice,'undo'):
del self.idevice.undo
示例3: __init__
def __init__(self, parent, idevice):
Block.__init__(self, parent, idevice)
self.elements = []
for field in self.idevice:
self.elements.append(g_elementFactory.createElement(field))
if not hasattr(self.idevice,'undo'):
self.idevice.undo = True
示例4: process
def process(self, request):
"""
Process the request arguments from the web server
"""
Block.process(self, request)
is_cancel = common.requestHasCancel(request)
self.storyElement.process(request)
if (u"addQuestion"+unicode(self.id)) in request.args:
self.idevice.addQuestion()
self.idevice.edit = True
# disable Undo once another activity has been added:
self.idevice.undo = False
if "title"+self.id in request.args \
and not is_cancel:
self.idevice.title = request.args["title"+self.id][0]
if "action" in request.args and request.args[u"action"][0] != u"delete":
for element in self.questionElements:
element.process(request)
if request.args[u"action"][0] == u'done':
# remove the undo flag in order to reenable it next time:
if hasattr(self.idevice,'undo'):
del self.idevice.undo
示例5: process
def process(self, request):
"""
Process the request arguments from the web server to see if any
apply to this block
"""
log.debug("process " + repr(request.args))
Block.process(self, request)
if "code" + self.id in request.args:
self.idevice.appletCode = request.args["code" + self.id][0]
if "action" in request.args and request.args["action"][0] == self.id:
self.idevice.deleteFile(request.args["object"][0])
self.idevice.edit = True
if "action" in request.args and request.args["action"][0] == "changeType" + self.id:
self.idevice.type = request.args["object"][0]
self.idevice.copyFiles()
self.idevice.edit = True
if "upload" + self.id in request.args:
if "path" + self.id in request.args:
filePath = request.args["path"+self.id][0]
if filePath:
if self.idevice.type == "geogebra" and not filePath.endswith(".ggb"):
self.idevice.message = _("Please upload a .ggb file.")
else:
self.idevice.uploadFile(filePath)
self.idevice.message = ""
self.idevice.edit = True
示例6: process
def process(self, request):
"""
Process the request arguments from the web server to see if any
apply to this block
"""
is_cancel = common.requestHasCancel(request)
if is_cancel:
self.idevice.edit = False
# but double-check for first-edits, and ensure proper attributes:
if not hasattr(self.idevice.content, 'content_w_resourcePaths'):
self.idevice.content.content_w_resourcePaths = ""
if not hasattr(self.idevice.content, 'content_wo_resourcePaths'):
self.idevice.content.content_wo_resourcePaths = ""
return
Block.process(self, request)
if "title" + self.id in request.args and not is_cancel:
self.idevice.title = request.args["title" + self.id][0]
if (u"action" not in request.args or
request.args[u"action"][0] != u"delete"):
content = self.contentElement.process(request)
if content:
self.idevice.content = content
示例7: process
def process(self, request):
"""
Process the request arguments from the web server to see if any
apply to this block
"""
self.idevice.message = ""
Block.process(self, request)
for sortableElement in self.sortableItemElements:
sortableElement.process(request)
# check and see about deleting from the list
field_engine_check_delete(sortableElement, request, self.idevice.itemsToSort)
self.idevice.uploadNeededScripts()
errorMsg = ""
if "addSortableItem" + unicode(self.id) in request.args:
self.idevice.addItemToSort()
self.idevice.edit = True
self.idevice.undo = False
field_engine_process_all_elements(self.mainElements, request)
self.idevice.title = self.mainElements["title"].renderView()
field_engine_check_fields_are_ints(self.mainElements, ["itemwidth", "itemheight"], thisIdevice=self.idevice)
示例8: process
def process(self, request):
"""
Process the request arguments from the web server
"""
is_cancel = common.requestHasCancel(request)
Block.process(self, request)
if (u"action" not in request.args or
request.args[u"action"][0] != u"delete"):
for element in self.elements:
element.process(request)
if "title"+self.id in request.args \
and not is_cancel:
self.idevice.title = request.args["title"+self.id][0]
if "iconiDevice"+self.id in request.args \
and not is_cancel:
self.idevice.icon = request.args["iconiDevice"+self.id][0]
if not is_cancel:
if self.idevice.title !='' or self.idevice.icon !='':
self.idevice.emphasis = Idevice.SomeEmphasis
else:
self.idevice.emphasis = Idevice.NoEmphasis
示例9: __init__
def __init__(self, parent, idevice):
"""
Pre-create our field ids
"""
Block.__init__(self, parent, idevice)
# to compensate for the strange unpickling timing when objects are
# loaded from an elp, ensure that proper idevices are set:
if idevice.instructionsForLearners.idevice is None:
idevice.instructionsForLearners.idevice = idevice
if idevice.content.idevice is None:
idevice.content.idevice = idevice
if idevice.feedback.idevice is None:
idevice.feedback.idevice = idevice
dT = common.getExportDocType()
sectionTag = "div"
if dT == "HTML5":
sectionTag = "section"
idevice.instructionsForLearners.htmlTag = sectionTag
idevice.instructionsForLearners.class_ = "block instructions"
idevice.feedback.htmlTag = sectionTag
self.instructionElement = TextAreaElement(idevice.instructionsForLearners)
self.instructionElement.field.content_w_resourcePaths = c_(self.instructionElement.field.content_w_resourcePaths)
self.listaElement = ListaElement(idevice.content)
self.feedbackElement = \
TextAreaElement(idevice.feedback)
self.previewing = False # In view or preview render
if not hasattr(self.idevice,'undo'):
self.idevice.undo = True
示例10: process
def process(self, request):
"""
Process the request arguments from the web server to see if any
apply to this block
"""
Block.process(self, request)
self.idevice.uploadNeededScripts()
if "addPlacableObject" + unicode(self.id) in request.args:
self.idevice.addPlacableObject()
self.idevice.edit = True
self.idevice.undo = False
if "checktimer" + unicode(self.id) in request.args:
if "enabletimer" + unicode(self.id) in request.args:
self.idevice.gameTimerShown.content = True
else:
self.idevice.gameTimerShown.content = False
self.titleElement.process(request)
self.idevice.title = self.titleElement.renderView()
self.contentElement.process(request)
self.mainAreaElement.process(request)
self.positiveResponseElement.process(request)
self.negativeResponseElement.process(request)
self.clickToStartElement.process(request)
self.gameTimeLimit.process(request)
self.partbinNumCols.process(request)
for placableObjectElement in self.placableObjectElements:
placableObjectElement.process(request)
示例11: __init__
def __init__(self, parent, idevice):
"""
Initialize a new Block object
"""
Block.__init__(self, parent, idevice)
self.idevice = idevice
self.questionElements = []
# to compensate for the strange unpickling timing when objects are
# loaded from an elp, ensure that proper idevices are set:
if idevice.storyTextArea.idevice is None:
idevice.storyTextArea.idevice = idevice
self.storyElement = TextAreaElement(idevice.storyTextArea)
self.questionInstruc = idevice.questionInstruc
self.storyInstruc = idevice.storyInstruc
self.feedbackInstruc = idevice.feedbackInstruc
self.previewing = False # In view or preview render
if not hasattr(self.idevice,'undo'):
self.idevice.undo = True
i = 0
for question in idevice.questions:
self.questionElements.append(QuestionElement(i, idevice, question))
i += 1
示例12: process
def process(self, request):
"""
Handles a post from the webui and changes our state accordingly
"""
log.debug("process " + repr(request.args))
# If the commit is not to do with us forget it
is_cancel = common.requestHasCancel(request)
obj = request.args.get('object', [''])[0]
if "title"+self.id in request.args \
and not is_cancel:
self.idevice.title = request.args["title"+self.id][0]
if obj != self.id:
self.idevice.recreateResources()
self.processCaptions(request)
if obj != self.id:
Block.process(self, request)
return
# Separate out the action we want to do and the params
action = request.args.get('action', [''])[0]
if action.startswith('gallery.'):
self.processGallery(action)
if self.mode == Block.Edit \
and not is_cancel:
self.processCaptions(request)
if action == 'done':
self.idevice.recreateResources()
# remove the undo flag in order to reenable it next time:
if hasattr(self.idevice,'undo'):
del self.idevice.undo
# Let our ancestor deal with the rest
Block.process(self, request)
示例13: process
def process(self, request):
"""
Process the request arguments from the web server to see if any
apply to this block
"""
Block.process(self, request)
is_cancel = common.requestHasCancel(request)
self.showDescBlock.process(request)
self.introHTMLElement.process(request)
showDesc = False
if self.showDescBlock.renderView() == "yes":
showDesc = True
if showDesc == True:
self.idevice.emphasis = Idevice.SomeEmphasis
else:
self.idevice.emphasis = Idevice.NoEmphasis
for fileElement in self.fileAttachmentElements:
fileElement.process(request)
if field_engine_is_delete(fileElement, request, self.idevice.fileAttachmentFields):
#fileElement.field.deleteFile()
field_engine_check_delete(fileElement, request, self.idevice.fileAttachmentFields)
if "addFileAttachment" + unicode(self.id) in request.args:
self.idevice.addFileAttachmentField()
self.idevice.edit = True
self.idevice.undo = False
#check the title - lifted from genericblock
if "title"+self.id in request.args \
and not is_cancel:
self.idevice.title = request.args["title"+self.id][0]
示例14: __init__
def __init__(self, parent, idevice):
Block.__init__(self, parent, idevice)
self.mainElements = idevice.mainFieldSet.makeElementDict()
self.memoryMatchElements = []
for memoryMatchField in idevice.matchPairFields:
memoryMatchElement = MemoryMatchPairElement(memoryMatchField)
self.memoryMatchElements.append(memoryMatchElement)
示例15: __init__
def __init__(self, parent, idevice):
"""
Initialize a new Block object
"""
Block.__init__(self, parent, idevice)
self.idevice = idevice
self.questionElements = []
self.questionInstruc = idevice.questionInstruc
self.keyInstruc = idevice.keyInstruc
self.feedbackInstruc = idevice.feedbackInstruc
self.hintInstruc = idevice.hintInstruc
# to compensate for the strange unpickling timing when objects are
# loaded from an elp, ensure that proper idevices are set:
if idevice.instructionsForLearners.idevice is None:
idevice.instructionsForLearners.idevice = idevice
self.instructionElement = \
TextAreaElement(idevice.instructionsForLearners)
if not hasattr(self.idevice,'undo'):
self.idevice.undo = True
i = 0
for question in idevice.questions:
self.questionElements.append(OpinionElement(i, idevice,
question))
i += 1