Commit 792cd34c by Alexander Kryklia

documentation for drag and drop inputtype python subclass

parent b436e6d4
...@@ -791,8 +791,8 @@ registry.register(OpenEndedInput) ...@@ -791,8 +791,8 @@ registry.register(OpenEndedInput)
class DragAndDropInput(InputTypeBase): class DragAndDropInput(InputTypeBase):
""" """
Input for molecular geometry--show possible structures, let student Input for drag and drop problems. Allows student to drag and drop images and
pick structure and label positions with atoms or electron pairs. labels to base image.
""" """
template = 'drag_and_drop_input.html' template = 'drag_and_drop_input.html'
...@@ -801,12 +801,14 @@ class DragAndDropInput(InputTypeBase): ...@@ -801,12 +801,14 @@ class DragAndDropInput(InputTypeBase):
def setup(self): def setup(self):
def parse(tag, tag_type): def parse(tag, tag_type):
"""Parses <tag ... /> xml element to dictionary. """Parses <tag ... /> xml element to dictionary. Stores
'draggable' and 'target' tags with attributes to dictionary and
returns last.
Args: Args:
tag: xml etree element <tag...> with attributes tag: xml etree element <tag...> with attributes
tag_type: type of tag: 'draggable' or 'target'. tag_type: 'draggable' or 'target'.
If tag_type is 'draggable' : all attributes (name or label or If tag_type is 'draggable' : all attributes (name or label or
icon) are optional, but at least one attribute must be icon) are optional, but at least one attribute must be
...@@ -841,7 +843,7 @@ class DragAndDropInput(InputTypeBase): ...@@ -841,7 +843,7 @@ class DragAndDropInput(InputTypeBase):
return dic return dic
# add labels to images: # add labels to images?:
self.no_labels = Attribute('no_labels', self.no_labels = Attribute('no_labels',
default="False").parse_from_xml(self.xml) default="False").parse_from_xml(self.xml)
...@@ -869,7 +871,6 @@ class DragAndDropInput(InputTypeBase): ...@@ -869,7 +871,6 @@ class DragAndDropInput(InputTypeBase):
self.loaded_attributes['drag_and_drop_json'] = json.dumps(to_js) self.loaded_attributes['drag_and_drop_json'] = json.dumps(to_js)
self.to_render.add('drag_and_drop_json') self.to_render.add('drag_and_drop_json')
# import ipdb; ipdb.set_trace()
try: # for tests and mock up, work normally not in tets try: # for tests and mock up, work normally not in tets
self.loaded_attributes['course_folder'] = \ self.loaded_attributes['course_folder'] = \
self.system.course_id.split('/')[1] self.system.course_id.split('/')[1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment