From 0afe6c11abacfa9cb085b2f80e75ced72704ae83 Mon Sep 17 00:00:00 2001 From: Vasyl Nakvasiuk Date: Mon, 13 May 2013 18:26:05 +0300 Subject: [PATCH 1/5] word cloud: fix pylint warnings, use MetadataOnlyEditingDescriptor instead of RawDescriptor --- common/lib/xmodule/xmodule/word_cloud_module.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/word_cloud_module.py b/common/lib/xmodule/xmodule/word_cloud_module.py index aca1259ed5..919fbd6a2c 100644 --- a/common/lib/xmodule/xmodule/word_cloud_module.py +++ b/common/lib/xmodule/xmodule/word_cloud_module.py @@ -10,7 +10,7 @@ import json import logging from pkg_resources import resource_string -from xmodule.raw_module import RawDescriptor +from xmodule.editing_module import MetadataOnlyEditingDescriptor from xmodule.x_module import XModule from xblock.core import Scope, String, Object, Boolean, List, Integer @@ -19,8 +19,9 @@ log = logging.getLogger(__name__) def pretty_bool(value): - BOOL_DICT = [True, "True", "true", "T", "t", "1"] - return value in BOOL_DICT + """Check value for possible `True` value.""" + bool_dict = [True, "True", "true", "T", "t", "1"] + return value in bool_dict class WordCloudFields(object): @@ -227,7 +228,7 @@ class WordCloudModule(WordCloudFields, XModule): return self.content -class WordCloudDescriptor(WordCloudFields, RawDescriptor): +class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor): """Descriptor for WordCloud Xmodule.""" module_class = WordCloudModule template_dir_name = 'word_cloud' From 0eb1b97ffc514e1a8169751dbe41fbdbc9929696 Mon Sep 17 00:00:00 2001 From: Vasyl Nakvasiuk Date: Mon, 13 May 2013 18:43:05 +0300 Subject: [PATCH 2/5] add more docs --- common/lib/xmodule/xmodule/word_cloud_module.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/word_cloud_module.py b/common/lib/xmodule/xmodule/word_cloud_module.py index 919fbd6a2c..23576cb154 100644 --- a/common/lib/xmodule/xmodule/word_cloud_module.py +++ b/common/lib/xmodule/xmodule/word_cloud_module.py @@ -19,7 +19,11 @@ log = logging.getLogger(__name__) def pretty_bool(value): - """Check value for possible `True` value.""" + """Check value for possible `True` value. + + Using this function we can manage different type of Boolean value + in xml files. + """ bool_dict = [True, "True", "true", "T", "t", "1"] return value in bool_dict From d86dab9a3a6efda997e26843b844897e7c90f2fe Mon Sep 17 00:00:00 2001 From: Vasyl Nakvasiuk Date: Tue, 14 May 2013 12:00:24 +0300 Subject: [PATCH 3/5] word cloud: add more docs about `display_student_percents` options --- doc/public/course_data_formats/word_cloud/word_cloud.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/public/course_data_formats/word_cloud/word_cloud.rst b/doc/public/course_data_formats/word_cloud/word_cloud.rst index 32212510c1..4ee1c8db65 100644 --- a/doc/public/course_data_formats/word_cloud/word_cloud.rst +++ b/doc/public/course_data_formats/word_cloud/word_cloud.rst @@ -18,12 +18,17 @@ The following attributes can be specified for this tag:: [display_name| AUTOGENERATE] – Display name of xmodule. When this attribute is not defined - display name autogenerate with some hash. [num_inputs| 5] – Number of inputs. [num_top_words| 250] – Number of max words, which will be displayed. - [display_student_percents| True] – Display usage percents for each word. + [display_student_percents| True] – Display usage percents for each word on the same line together with words. + +.. note:: + + Percent is shown always when mouse over the word in cloud. .. note:: If you want to use the same word cloud (the same storage of words), you must use the same display_name value. + Code Example ============ From 92476ecacdb419ea5896b00d027315a0d0a59e74 Mon Sep 17 00:00:00 2001 From: Vasyl Nakvasiuk Date: Tue, 14 May 2013 12:54:05 +0300 Subject: [PATCH 4/5] add docs note about possible values for boolean type --- doc/public/course_data_formats/word_cloud/word_cloud.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/public/course_data_formats/word_cloud/word_cloud.rst b/doc/public/course_data_formats/word_cloud/word_cloud.rst index 4ee1c8db65..5c3d31e149 100644 --- a/doc/public/course_data_formats/word_cloud/word_cloud.rst +++ b/doc/public/course_data_formats/word_cloud/word_cloud.rst @@ -24,6 +24,12 @@ The following attributes can be specified for this tag:: Percent is shown always when mouse over the word in cloud. +.. note:: + + Possible answer for boolean type attributes: + True – "True", "true", "T", "t", "1" + False – "False", "false", "F", "f", "0" + .. note:: If you want to use the same word cloud (the same storage of words), you must use the same display_name value. From b02e92a80c563432a1d51bccce4986ce430fe340 Mon Sep 17 00:00:00 2001 From: Vasyl Nakvasiuk Date: Wed, 15 May 2013 11:35:56 +0300 Subject: [PATCH 5/5] fix word cloud test --- common/lib/xmodule/xmodule/word_cloud_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/word_cloud_module.py b/common/lib/xmodule/xmodule/word_cloud_module.py index 23576cb154..440da8b887 100644 --- a/common/lib/xmodule/xmodule/word_cloud_module.py +++ b/common/lib/xmodule/xmodule/word_cloud_module.py @@ -10,6 +10,7 @@ import json import logging from pkg_resources import resource_string +from xmodule.raw_module import RawDescriptor from xmodule.editing_module import MetadataOnlyEditingDescriptor from xmodule.x_module import XModule @@ -232,9 +233,8 @@ class WordCloudModule(WordCloudFields, XModule): return self.content -class WordCloudDescriptor(WordCloudFields, MetadataOnlyEditingDescriptor): +class WordCloudDescriptor(MetadataOnlyEditingDescriptor, RawDescriptor, WordCloudFields): """Descriptor for WordCloud Xmodule.""" module_class = WordCloudModule template_dir_name = 'word_cloud' stores_state = True - mako_template = "widgets/raw-edit.html"