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
bc3f373e
Commit
bc3f373e
authored
Jan 09, 2013
by
jmclaus
Committed by
Victor Shnayder
Feb 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added design protein 2D
parent
a52bf818
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
2 deletions
+105
-2
common/lib/capa/capa/inputtypes.py
+36
-0
common/lib/capa/capa/responsetypes.py
+3
-2
common/lib/capa/capa/templates/designprotein2dinput.html
+39
-0
common/static/applets/capa/Protex.jar
+0
-0
common/static/js/capa/design-protein-2d.js
+27
-0
No files found.
common/lib/capa/capa/inputtypes.py
View file @
bc3f373e
...
...
@@ -863,3 +863,39 @@ class EditAMoleculeInput(InputTypeBase):
return
context
registry
.
register
(
EditAMoleculeInput
)
#-----------------------------------------------------------------------------
class
DesignProtein2dInput
(
InputTypeBase
):
"""
An input type for design of a protein in 2D. Integrates with the Protex java applet.
Example:
<designprotein2d width="800" hight="500" target_shape="E;NE;NW;W;SW;E;none" />
"""
template
=
"designprotein2dinput.html"
tags
=
[
'designprotein2dinput'
]
@classmethod
def
get_attributes
(
cls
):
"""
Note: width, hight, and target_shape are required.
"""
return
[
Attribute
(
'width'
),
Attribute
(
'height'
),
Attribute
(
'target_shape'
)
]
def
_extra_context
(
self
):
"""
"""
context
=
{
'applet_loader'
:
'/static/js/capa/design-protein-2d.js'
,
}
return
context
registry
.
register
(
DesignProtein2dInput
)
common/lib/capa/capa/responsetypes.py
View file @
bc3f373e
...
...
@@ -188,7 +188,7 @@ class LoncapaResponse(object):
# problem author can make this span display:inline
if
self
.
xml
.
get
(
'inline'
,
''
):
tree
.
set
(
'class'
,
'inline'
)
for
item
in
self
.
xml
:
# call provided procedure to do the rendering
item_xhtml
=
renderer
(
item
)
...
...
@@ -875,7 +875,8 @@ def sympy_check2():
allowed_inputfields
=
[
'textline'
,
'textbox'
,
'crystallography'
,
'chemicalequationinput'
,
'vsepr_input'
,
'drag_and_drop_input'
,
'editamoleculeinput'
]
'drag_and_drop_input'
,
'editamoleculeinput'
,
'designprotein2dinput'
]
def
setup_response
(
self
):
xml
=
self
.
xml
...
...
common/lib/capa/capa/templates/designprotein2dinput.html
0 → 100644
View file @
bc3f373e
<section
id=
"designprotein2dinput_${id}"
class=
"designprotein2dinput"
>
<div
class=
"script_placeholder"
data-src=
"${applet_loader}"
/>
% if status == 'unsubmitted':
<div
class=
"unanswered"
id=
"status_${id}"
>
% elif status == 'correct':
<div
class=
"correct"
id=
"status_${id}"
>
% elif status == 'incorrect':
<div
class=
"incorrect"
id=
"status_${id}"
>
% elif status == 'incomplete':
<div
class=
"incorrect"
id=
"status_${id}"
>
% endif
<object
type=
"application/x-java-applet"
id=
"applet_${id}"
class=
"applet"
width=
"${width}"
height=
"${height}"
>
<param
name=
"archive"
value=
"/static/applets/capa/Protex.jar"
/>
<param
name=
"code"
value=
"protex.ProtexApplet.class"
/>
<param
name=
"TARGET_SHAPE"
value=
"${target_shape}"
/>
Applet failed to run. No Java plug-in was found.
</object>
<input
type=
"hidden"
name=
"input_${id}"
id=
"input_${id}"
value=
"${value|h}"
/>
<p
class=
"status"
>
% if status == 'unsubmitted':
unanswered
% elif status == 'correct':
correct
% elif status == 'incorrect':
incorrect
% elif status == 'incomplete':
incomplete
% endif
</p>
<p
id=
"answer_${id}"
class=
"answer"
></p>
% if status in ['unsubmitted', 'correct', 'incorrect', 'incomplete']:
</div>
% endif
</section>
common/static/applets/capa/Protex.jar
0 → 100644
View file @
bc3f373e
File added
common/static/js/capa/design-protein-2d.js
0 → 100644
View file @
bc3f373e
(
function
()
{
var
timeout
=
1000
;
function
initializeApplet
(
applet
)
{
console
.
log
(
"Initializing "
+
applet
);
waitForApplet
(
applet
);
}
function
waitForApplet
(
applet
)
{
if
(
applet
.
isActive
&&
applet
.
isActive
())
{
console
.
log
(
"Applet is ready."
);
var
answerStr
=
applet
.
checkAnswer
();
console
.
log
(
answerStr
);
var
input
=
$
(
'.designprotein2dinput input'
);
console
.
log
(
input
);
input
.
val
(
answerStr
);
}
else
if
(
timeout
>
30
*
1000
)
{
console
.
error
(
"Applet did not load on time."
);
}
else
{
console
.
log
(
"Waiting for applet..."
);
setTimeout
(
function
()
{
waitForApplet
(
applet
);
},
timeout
);
}
}
var
applets
=
$
(
'.designprotein2dinput object'
);
applets
.
each
(
function
(
i
,
el
)
{
initializeApplet
(
el
);
});
}).
call
(
this
);
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