本文整理汇总了Python中exe.engine.genericidevice.GenericIdevice类的典型用法代码示例。如果您正苦于以下问题:Python GenericIdevice类的具体用法?Python GenericIdevice怎么用?Python GenericIdevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericIdevice类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgradeToVersion1
def upgradeToVersion1(self):
"""
Called to upgrade from 0.3 release
"""
self._nextNodeId = 0
self._nodeIdDict = {}
# Also upgrade all the nodes.
# This needs to be done here so that draft gets id 0
# If it's done in the nodes, the ids are assigned in reverse order
draft = getattr(self, "draft")
draft._id = self._regNewNode(draft)
draft._package = self
setattr(self, "editor", Node(self, None, _(u"iDevice Editor")))
# Add a default idevice to the editor
idevice = GenericIdevice("", "", "", "", "")
editor = getattr(self, "editor")
idevice.parentNode = editor
editor.addIdevice(idevice)
def superReg(node):
"""Registers all our nodes
because in v0 they were not registered
in this way"""
node._id = self._regNewNode(node)
node._package = self
for child in node.children:
superReg(child)
superReg(self.root)
示例2: __createNewIdevice
def __createNewIdevice(self, request):
"""
Create a new idevice and add to idevicestore
"""
idevice = GenericIdevice("", "", "", "", "")
idevice.icon = ""
idevice.id = self.ideviceStore.getNewIdeviceId()
self.editorPane.setIdevice(idevice)
self.editorPane.process(request, "new")
self.isNewIdevice = True
示例3: __createReading011
def __createReading011(self):
"""
Create the Reading Activity 0.11
We do this only once when the user first runs eXe 0.11
"""
from exe.engine.genericidevice import GenericIdevice
readingAct = GenericIdevice(_(u"Reading Activity 0.11"),
u"reading",
_(u"University of Auckland"),
x_(u"""<p>The reading activity, as the name
suggests, should ask the learner to perform some form of activity. This activity
should be directly related to the text the learner has been asked to read.
Feedback to the activity where appropriate, can provide the learner with some
reflective guidance.</p>"""),
x_(u"Teachers should keep the following "
"in mind when using this iDevice: "
"<ol>"
"<li>"
"Think about the number of "
"different types of activity "
"planned for your resource that "
"will be visually signalled in the "
"content. Avoid using too many "
"different types or classification "
"of activities otherwise learner "
"may become confused. Usually three "
"or four different types are more "
"than adequate for a teaching "
"resource."
"</li>"
"<li>"
"From a visual design "
"perspective, avoid having two "
"iDevices immediately following "
"each other without any text in "
"between. If this is required, "
"rather collapse two questions or "
"events into one iDevice. "
"</li>"
"<li>"
"Think "
"about activities where the "
"perceived benefit of doing the "
"activity outweighs the time and "
"effort it will take to complete "
"the activity. "
"</li>"
"</ol>"))
readingAct.emphasis = Idevice.SomeEmphasis
readingAct.addField(TextAreaField(_(u"What to read"),
_(u"""Enter the details of the reading including reference details. The
referencing style used will depend on the preference of your faculty or
department.""")))
readingAct.addField(TextAreaField(_(u"Activity"),
_(u"""Describe the tasks related to the reading learners should undertake.
This helps demonstrate relevance for learners.""")))
readingAct.addField(FeedbackField(_(u"Feedback"),
_(u"""Use feedback to provide a summary of the points covered in the reading,
or as a starting point for further analysis of the reading by posing a question
or providing a statement to begin a debate.""")))
objectives = GenericIdevice(_(u"Objectives"),
u"objectives",
_(u"University of Auckland"),
_(u"""Objectives describe the expected outcomes of the learning and should
define what the learners will be able to do when they have completed the
learning tasks."""),
u"")
objectives.emphasis = Idevice.SomeEmphasis
objectives.addField(TextAreaField(_(u"Objectives"),
_(u"""Type the learning objectives for this resource.""")))
self.generic.append(objectives)
preknowledge = GenericIdevice(_(u"Preknowledge"),
u"preknowledge",
"",
_(u"""Prerequisite knowledge refers to the knowledge learners should already
have in order to be able to effectively complete the learning. Examples of
pre-knowledge can be: <ul>
<li> Learners must have level 4 English </li>
<li> Learners must be able to assemble standard power tools </li></ul>
"""), u"")
preknowledge.emphasis = Idevice.SomeEmphasis
preknowledge.addField(TextAreaField(_(u"Preknowledge"),
_(u"""Describe the prerequisite knowledge learners should have to effectively
complete this learning.""")))
self.generic.append(preknowledge)
activity = GenericIdevice(_(u"Activity"),
u"activity",
_(u"University of Auckland"),
_(u"""An activity can be defined as a task or set of tasks a learner must
complete. Provide a clear statement of the task and consider any conditions
that may help or hinder the learner in the performance of the task."""),
u"")
activity.emphasis = Idevice.SomeEmphasis
activity.addField(TextAreaField(_(u"Activity"),
#.........这里部分代码省略.........
示例4: __createGeneric
def __createGeneric(self):
"""
Create the Generic iDevices which you get for free
(not created using the iDevice editor, but could have been)
Called when we can't find 'generic.data', generates an initial set of
free/builtin idevices and writes the new 'generic.data' file
"""
from exe.engine.genericidevice import GenericIdevice
readingAct = GenericIdevice(_(u"Reading Activity"),
u"reading",
_(u"University of Auckland"),
x_(u"""<p>The Reading Activity will primarily
be used to check a learner's comprehension of a given text. This can be done
by asking the learner to reflect on the reading and respond to questions about
the reading, or by having them complete some other possibly more physical task
based on the reading.</p>"""),
x_(u"<p>Teachers should keep the following "
"in mind when using this iDevice: </p>"
"<ol>"
"<li>"
"Think about the number of "
"different types of activity "
"planned for your resource that "
"will be visually signalled in the "
"content. Avoid using too many "
"different types or classification "
"of activities otherwise learner "
"may become confused. Usually three "
"or four different types are more "
"than adequate for a teaching "
"resource."
"</li>"
"<li>"
"From a visual design "
"perspective, avoid having two "
"iDevices immediately following "
"each other without any text in "
"between. If this is required, "
"rather collapse two questions or "
"events into one iDevice. "
"</li>"
"<li>"
"Think "
"about activities where the "
"perceived benefit of doing the "
"activity outweighs the time and "
"effort it will take to complete "
"the activity. "
"</li>"
"</ol>"), Idevice.Content)
readingAct.emphasis = Idevice.SomeEmphasis
readingAct.group = Idevice.Content
readingAct.addField(TextAreaField(_(u"What to read"),
_(u"""Enter the details of the reading including reference details. The
referencing style used will depend on the preference of your faculty or
department.""")))
readingAct.addField(TextAreaField(_(u"Activity"),
_(u"""Describe the tasks related to the reading learners should undertake.
This helps demonstrate relevance for learners.""")))
readingAct.addField(FeedbackField(_(u"Feedback"),
_(u"""Use feedback to provide a summary of the points covered in the reading,
or as a starting point for further analysis of the reading by posing a question
or providing a statement to begin a debate.""")))
self.generic.append(readingAct)
objectives = GenericIdevice(_(u"Objectives"),
u"objectives",
_(u"University of Auckland"),
_(u"""Objectives describe the expected outcomes of the learning and should
define what the learners will be able to do when they have completed the
learning tasks."""),
u"", group=Idevice.Didactics)
objectives.emphasis = Idevice.SomeEmphasis
objectives.addField(TextAreaField(_(u"Objectives"),
_(u"""Type the learning objectives for this resource.""")))
objectives.addField(ExportOptionField(_(u"Export Option"), _(u"Choose export type for this iDevice")))
self.generic.append(objectives)
preknowledge = GenericIdevice(_(u"Preknowledge"),
u"preknowledge",
"",
_(u"""Prerequisite knowledge refers to the knowledge learners should already
have in order to be able to effectively complete the learning. Examples of
pre-knowledge can be: <ul>
<li> Learners must have level 4 English </li>
<li> Learners must be able to assemble standard power tools </li></ul>
"""), u"", group=Idevice.Didactics)
preknowledge.emphasis = Idevice.SomeEmphasis
preknowledge.addField(TextAreaField(_(u"Preknowledge"),
_(u"""Describe the prerequisite knowledge learners should have to effectively
complete this learning.""")))
self.generic.append(preknowledge)
activity = GenericIdevice(_(u"Activity"),
u"activity",
_(u"University of Auckland"),
#.........这里部分代码省略.........
示例5: EditorPane
class EditorPane(object):
"""
The EditorPane is responsible for creating new idevice
"""
def __init__(self, webServer, parent):
"""
Initialize
JR: anado parente para poder acceder a algunos atributos de editorpag, en concreto a showHide
"""
self.ideviceStore = webServer.application.ideviceStore
self.webDir = webServer.application.config.webDir
self.styles = webServer.application.config.styleStore.getStyles()
self.elements = []
self.idevice = GenericIdevice("", "", "", "", "")
self.idevice.id = self.ideviceStore.getNewIdeviceId()
self.originalIdevice = GenericIdevice("", "", "", "", "")
self.purpose = ""
self.tip = ""
self.message = ""
self.parent = parent
self._nameInstruc = \
x_(u"Your new iDevice will appear in the iDevice "
u"pane with this title. This is a compulsory field "
u"and you will be prompted to enter a label if you try "
u"to submit your iDevice without one.")
self._authorInstruc = x_(u"This is an optional field.")
self._purposeInstruc = x_(u"The purpose dialogue allows you to describe"
u" your intended purpose of the iDevice to other"
u" potential users.")
self._emphasisInstruc = x_(u"Use this pulldown to select whether or not "
u" the iDevice should have any formatting "
u" applied to it to distinguish "
u"it; ie. a border and an icon.")
self._tipInstruc = x_(u"Use this field to describe "
u"your intended use and the pedagogy behind "
u"the device's development. This can be useful "
u"if your iDevice is to be exported for others "
u"to use.")
self._lineInstruc = x_(u"Add a single text line to an iDevice. "
u"Useful if you want the ability to place a "
u"label within the iDevice.")
self._textBoxInstruc = x_(u"Add a text entry box to an iDevice. "
u"Used for entering larger amounts of textual "
u"content.")
self._feedbackInstruc = x_(u"Add an interactive feedback field to your iDevice.")
self._flashInstruc = x_(u"Add a flash video to your iDevice.")
self._mp3Instruc = x_(u"Add an mp3 file to your iDevice.")
self._attachInstruc = x_(u"Add an attachment file to your iDevice.")
self.style = self.styles[0]
# Properties
nameInstruc = lateTranslate('nameInstruc')
authorInstruc = lateTranslate('authorInstruc')
purposeInstruc = lateTranslate('purposeInstruc')
emphasisInstruc = lateTranslate('emphasisInstruc')
tipInstruc = lateTranslate('tipInstruc')
lineInstruc = lateTranslate('lineInstruc')
textBoxInstruc = lateTranslate('textBoxInstruc')
feedbackInstruc = lateTranslate('feedbackInstruc')
flashInstruc = lateTranslate('flashInstruc')
mp3Instruc = lateTranslate('mp3Instruc')
attachInstruc = lateTranslate('attachInstruc')
def setIdevice(self, idevice):
"""
Sets the iDevice to edit
"""
self.idevice = idevice.clone()
self.idevice.id = idevice.id
self.originalIdevice = idevice
def process(self, request, status):
"""
Process
"""
log.debug("process " + repr(request.args))
self.message = ""
if status == "old":
for element in self.elements:
element.process(request)
if "title" in request.args:
self.idevice.title = unicode(request.args["title"][0], 'utf8')
if "tip" in request.args:
self.idevice.tip = unicode(request.args["tip"][0], 'utf8')
if "emphasis" in request.args:
self.idevice.emphasis = int(request.args["emphasis"][0])
if self.idevice.emphasis == 0:
self.idevice.icon = ""
if "addText" in request.args:
field = TextField(_(u"Enter the label here"),
#.........这里部分代码省略.........
示例6: EditorPane
class EditorPane(object):
"""
The EditorPane is responsible for creating new idevice
"""
def __init__(self, webServer, parent):
"""
Initialize
JR: anado parente para poder acceder a algunos atributos de editorpag, en concreto a showHide
"""
self.ideviceStore = webServer.application.ideviceStore
self.webDir = webServer.application.config.webDir
self.styles = webServer.application.config.styles
self.elements = []
self.idevice = GenericIdevice("", "", "", "", "")
self.idevice.id = self.ideviceStore.getNewIdeviceId()
self.originalIdevice = GenericIdevice("", "", "", "", "")
self.purpose = ""
self.tip = ""
self.message = ""
self.parent = parent
self._nameInstruc = \
x_(u"Your new iDevice will appear in the iDevice "
u"pane with this title. This is a compulsory field "
u"and you will be prompted to enter a label if you try "
u"to submit your iDevice without one.")
self._authorInstruc = x_(u"This is an optional field.")
self._purposeInstruc = x_(u"The purpose dialogue allows you to describe"
u" your intended purpose of the iDevice to other"
u" potential users.")
self._emphasisInstruc = x_(u"Use this pulldown to select whether or not "
u" the iDevice should have any formatting "
u" applied to it to distinguish "
u"it; ie. a border and an icon.")
self._tipInstruc = x_(u"Use this field to describe "
u"your intended use and the pedagogy behind "
u"the device's development. This can be useful "
u"if your iDevice is to be exported for others "
u"to use.")
self._lineInstruc = x_(u"Add a single text line to an iDevice. "
u"Useful if you want the ability to place a "
u"label within the iDevice.")
self._textBoxInstruc = x_(u"Add a text entry box to an iDevice. "
u"Used for entering larger amounts of textual "
u"content.")
self._feedbackInstruc = x_(u"Add an interactive feedback field to your iDevice.")
self._flashInstruc = x_(u"Add a flash video to your iDevice.")
self._mp3Instruc = x_(u"Add an mp3 file to your iDevice.")
self._attachInstruc = x_(u"Add an attachment file to your iDevice.")
self.style = "default"
# Properties
nameInstruc = lateTranslate('nameInstruc')
authorInstruc = lateTranslate('authorInstruc')
purposeInstruc = lateTranslate('purposeInstruc')
emphasisInstruc = lateTranslate('emphasisInstruc')
tipInstruc = lateTranslate('tipInstruc')
lineInstruc = lateTranslate('lineInstruc')
textBoxInstruc = lateTranslate('textBoxInstruc')
feedbackInstruc = lateTranslate('feedbackInstruc')
flashInstruc = lateTranslate('flashInstruc')
mp3Instruc = lateTranslate('mp3Instruc')
attachInstruc = lateTranslate('attachInstruc')
def setIdevice(self, idevice):
"""
Sets the iDevice to edit
"""
self.idevice = idevice.clone()
self.idevice.id = idevice.id
self.originalIdevice = idevice
def process(self, request, status):
"""
Process
"""
log.debug("process " + repr(request.args))
self.message = ""
if status == "old":
for element in self.elements:
element.process(request)
if "title" in request.args:
self.idevice.title = unicode(request.args["title"][0], 'utf8')
if "tip" in request.args:
self.idevice.tip = unicode(request.args["tip"][0], 'utf8')
if "emphasis" in request.args:
self.idevice.emphasis = int(request.args["emphasis"][0])
if self.idevice.emphasis == 0:
self.idevice.icon = ""
if "addText" in request.args:
field = TextField(_(u"Enter the label here"),
#.........这里部分代码省略.........