Skip to content

Commit 6cbbb3c

Browse files
committed
update Django test application
1 parent cbbd953 commit 6cbbb3c

8 files changed

Lines changed: 17 additions & 781 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
django-demo/djscript/static/CACHE/
12
*.py[cod]
23
*~
34
# C extensions

django-demo/djscript/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
os.path.join(ROOT, 'templates'),
110110
)
111111

112-
COMPRESS_PRECOMPILERS = ( ('text/pythonscript', 'pythonscript < {infile} > {outfile}'), )
112+
COMPRESS_PRECOMPILERS = ( ('text/pythonjs', 'pythonjs < {infile} > {outfile}'), )
113113

114114
INSTALLED_APPS = (
115115
'django.contrib.auth',

django-demo/djscript/static/CACHE/js/app.7f96cd61c158.js

Lines changed: 0 additions & 128 deletions
This file was deleted.

django-demo/djscript/static/app.py

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1 @@
1-
### PROGRESSIVE TEXT ######################################################
2-
3-
class Animator:
4-
5-
def __init__(self, func, delay, loop):
6-
self.func = func
7-
self.delay = delay
8-
self.loop = loop
9-
10-
def run(self):
11-
var(delay, func)
12-
delay = self.delay
13-
func = self.func
14-
if self.loop:
15-
self.id = JS('setInterval(adapt_arguments(func), delay)')
16-
else:
17-
JS('setTimeout(adapt_arguments(func), delay)')
18-
19-
def stop(self):
20-
var(id)
21-
id = self.id
22-
JS('clearInterval(id)')
23-
24-
ABC = str('azertyuiopQSDFGHJKLMwxcvbnAZERTYUIOPqsdfghjklmWXCVBN ')
25-
26-
27-
class ProgressiveText:
28-
29-
def __init__(self, selector, text, callback=None, delay=3000):
30-
self.delay = delay
31-
self.text = text
32-
self.length = len(text)
33-
var(element)
34-
element = J(selector)
35-
element.html('')
36-
for i in text:
37-
element.append('<span>a</span>')
38-
self.elements = J(selector + ' span')
39-
40-
def start(self):
41-
self.animation = Animator(self.update, self.delay, True)
42-
self.animation.run()
43-
44-
def update(self):
45-
var(to_update)
46-
to_update = False
47-
for index in range(self.length):
48-
var(element, char, expected)
49-
element = self.elements.get(index)
50-
char = element.html()
51-
expected = self.text.get(index)
52-
if char != expected:
53-
var(novo)
54-
novo = ABC.get(ABC.index(char) + 1)
55-
element.html(novo)
56-
to_update = True
57-
if not to_update:
58-
self.animation.stop()
59-
60-
### END PROGRESSIVE TEXT ##############################################
61-
62-
ProgressiveText("#héllo", str('Hello World')).start()
1+
alert('Héllo from PythonJS')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../pythonjs.js

0 commit comments

Comments
 (0)