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
143d2c86
Commit
143d2c86
authored
Apr 05, 2013
by
Vasyl Nakvasiuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix WordCloudDescriptor
parent
bb9bc421
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
common/lib/xmodule/xmodule/word_cloud_module.py
+9
-8
No files found.
common/lib/xmodule/xmodule/word_cloud_module.py
View file @
143d2c86
...
...
@@ -21,7 +21,7 @@ from xmodule.x_module import XModule
from
xmodule.stringify
import
stringify_children
from
xmodule.mako_module
import
MakoModuleDescriptor
from
xmodule.xml_module
import
XmlDescriptor
from
xblock.core
import
Scope
,
String
,
Object
,
Boolean
,
List
from
xblock.core
import
Scope
,
String
,
Object
,
Boolean
,
List
,
Integer
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -29,12 +29,13 @@ log = logging.getLogger(__name__)
class
WordCloudFields
(
object
):
# Name of poll to use in links to this poll
display_name
=
String
(
help
=
"Display name for this module"
,
scope
=
Scope
.
settings
)
num_inputs
=
Integer
(
help
=
"Number of inputs"
,
scope
=
Scope
.
settings
)
submitted
=
Boolean
(
help
=
"Whether this student has voted on the poll"
,
scope
=
Scope
.
student_state
,
default
=
False
)
student_words
=
List
(
help
=
"Student answer"
,
scope
=
Scope
.
student_state
,
default
=
[])
all_words
=
Object
(
help
=
"All possible words from other students"
,
scope
=
Scope
.
content
)
top_words
=
Object
(
help
=
"Top N words for word cloud"
,
scope
=
Scope
.
content
)
top_low_border
=
Int
(
help
=
"Number to distinguish top from all words"
,
scope
=
Scope
.
content
)
top_low_border
=
Int
eger
(
help
=
"Number to distinguish top from all words"
,
scope
=
Scope
.
content
)
class
WordCloudModule
(
WordCloudFields
,
XModule
):
"""WordCloud Module"""
...
...
@@ -44,8 +45,8 @@ class WordCloudModule(WordCloudFields, XModule):
resource_string
(
__name__
,
'js/src/word_cloud/word_cloud.js'
),
resource_string
(
__name__
,
'js/src/word_cloud/word_cloud_main.js'
)]
}
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/word_cloud/display.scss'
)]}
js_module_name
=
"Word
_
Cloud"
#
css = {'scss': [resource_string(__name__, 'css/word_cloud/display.scss')]}
js_module_name
=
"WordCloud"
Number_of_top_words
=
250
...
...
@@ -103,7 +104,7 @@ class WordCloudModule(WordCloudFields, XModule):
})
elif
dispatch
==
'get_state'
:
return
json
.
dumps
({
'student_answers'
:
self
.
student_answers
,
'top_words'
:
self
.
top_words
)
'top_words'
:
self
.
top_words
})
else
:
# return error message
return
json
.
dumps
({
'error'
:
'Unknown Command!'
})
...
...
@@ -132,7 +133,6 @@ class WordCloudModule(WordCloudFields, XModule):
return
self
.
content
class
WordCloudDescriptor
(
WordCloudFields
,
MakoModuleDescriptor
,
XmlDescriptor
):
_tag_name
=
'word_cloud'
...
...
@@ -159,8 +159,9 @@ class WordCloudDescriptor(WordCloudFields, MakoModuleDescriptor, XmlDescriptor):
def
definition_to_xml
(
self
,
resource_fs
):
"""Return an xml element representing to this definition."""
poll_str
=
'<{tag_name}
/>'
.
format
(
tag_name
=
self
.
_tag_name
)
xml_object
=
etree
.
fromstring
(
pol
l_str
)
xml_str
=
'<{tag_name}
/>'
.
format
(
tag_name
=
self
.
_tag_name
)
xml_object
=
etree
.
fromstring
(
xm
l_str
)
xml_object
.
set
(
'display_name'
,
self
.
display_name
)
xml_object
.
set
(
'num_inputs'
,
self
.
num_inputs
)
return
xml_object
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