|
14 | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 | # |
16 | 16 |
|
17 | | -# This files runs during runestone build. It generates the node data |
| 17 | +# This file runs during runestone build. It generates the node data |
18 | 18 | # that is used to render the component by the quizly.js script. |
19 | 19 |
|
20 | 20 | # Note: An import entry for quizly must be included in runestone/__init__.py |
21 | 21 |
|
| 22 | +# Note: The content files for the quizly component must stored in the |
| 23 | +# course's _static folder. Download the following file and unzip it in _static: |
| 24 | +# https://github.com/ram8647/quizly/blob/35ee7c945e6f240450f46f41ad9c80735215b5e0/quizly-runestone.zip |
| 25 | +# |
| 26 | + |
22 | 27 | __author__ = "rmorelli" |
23 | 28 |
|
24 | 29 | # Debug flags |
25 | | -DEBUG = True |
| 30 | +DEBUG = False |
26 | 31 | VERBOSE = False |
27 | 32 |
|
28 | 33 | import os, shutil |
|
42 | 47 | </div> |
43 | 48 | """ |
44 | 49 |
|
45 | | -# Resource files should be stored in the X/_static directory, from where they |
46 | | -# will be automatically copied into build/x/_static, where 'x' is the project name |
47 | | -STATIC_DIR = "./_static" |
48 | | - |
49 | | -# Copy the resource files into the _static folder, maintaining proper folder hierarchy |
50 | | -# The resources should be organized as follows: |
51 | | -# _static |
52 | | -# |-quizly |
53 | | -# |- all_appinventor.js - compressed js files |
54 | | -# |- all_blockly.js - compressed js files |
55 | | -# |- all_quizly.js - compressed js files |
56 | | -# |- quizme-helper.js - main source code |
57 | | -# |- quizzes.js - quizly quizzes |
58 | | -# |- index.html - container for the iframe |
59 | | -# |- blockly.html - blockly iframe |
60 | | -# |- main.css |
61 | | -# |- media - folder of images, etc. |
62 | | -# Perhaps there's a runestone routine to copy files? |
63 | | -# TODO: Test this with MobileCSP units |
64 | | -# def copyfiles(): |
65 | | -# CURR_DIR = os.path.dirname(os.path.realpath(__file__)) |
66 | | -# QUIZLY_DIR = STATIC_DIR+'/quizly' |
67 | | -# MEDIA_DIR = QUIZLY_DIR+'/media' |
68 | | -# if not os.path.exists(QUIZLY_DIR): |
69 | | -# print('Missing directory ' + QUIZLY_DIR) if DEBUG else None |
70 | | -# # shutil.rmtree(QUIZLY_DIR) |
71 | | -# # os.mkdir(QUIZLY_DIR, mode=0o755) |
72 | | -# # os.mkdir(QUIZLY_DIR+'/media', mode=0o755) |
73 | | -# js_folder = Path(CURR_DIR).glob('js/*.js') |
74 | | -# html_folder = Path(CURR_DIR).glob('js/*.html') |
75 | | -# media_folder = Path(CURR_DIR).glob('js/media/*') |
76 | | -# css_folder = Path(CURR_DIR).glob('js/*.css') |
77 | | -# files = [x for x in js_folder] |
78 | | -# print('Copying resource files to ' + STATIC_DIR) if VERBOSE else None |
79 | | -# for f in files: |
80 | | -# print(str(f) + ' --> ' + QUIZLY_DIR) if VERBOSE else None |
81 | | -# shutil.copy(f, QUIZLY_DIR) |
82 | | -# files = [x for x in css_folder] |
83 | | -# for f in files: |
84 | | -# print(str(f) + ' --> ' + QUIZLY_DIR) if VERBOSE else None |
85 | | -# shutil.copy(f, QUIZLY_DIR) |
86 | | -# files = [x for x in html_folder] |
87 | | -# for f in files: |
88 | | -# print(str(f) + ' --> ' + QUIZLY_DIR) if VERBOSE else None |
89 | | -# shutil.copy(f, QUIZLY_DIR) |
90 | | -# files = [x for x in media_folder] |
91 | | -# for f in files: |
92 | | -# print(str(f) + ' --> ' + MEDIA_DIR) if VERBOSE else None |
93 | | -# shutil.copy(f, MEDIA_DIR) |
94 | | - |
95 | 50 | # Define the quizly directive |
96 | 51 | def setup(app): |
97 | 52 | app.add_directive("quizly", Quizly) |
@@ -126,7 +81,6 @@ def visit_quizly_node(self, node): |
126 | 81 | print('DEBUG: visit_quizly_node options = ' + str(node.runestone_options)) if DEBUG else None |
127 | 82 |
|
128 | 83 | res = node.template % (node.runestone_options) |
129 | | -# copyfiles() # Copy resource files |
130 | 84 | print('DEBUG: visit_quizly_node res = ' + res) if DEBUG else None |
131 | 85 | self.body.append(res) |
132 | 86 |
|
|
0 commit comments