Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
792cd34c
Commit
792cd34c
authored
Jan 03, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documentation for drag and drop inputtype python subclass
parent
b436e6d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
common/lib/capa/capa/inputtypes.py
+7
-6
No files found.
common/lib/capa/capa/inputtypes.py
View file @
792cd34c
...
@@ -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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment