--- a/svgui/pyjs/pyjs.py Mon Aug 14 22:30:41 2017 +0300
+++ b/svgui/pyjs/pyjs.py Mon Aug 14 23:27:15 2017 +0300
@@ -90,6 +90,7 @@
"tuple",
)
+
def pyjs_builtin_remap(name):
# XXX HACK!
if name == 'list':
@@ -119,17 +120,20 @@
(';', r'\x3B')
) + tuple([('%c' % z, '\\x%02X' % z) for z in range(32)])
+
def escapejs(value):
"""Hex encodes characters for use in JavaScript strings."""
for bad, good in JS_ESCAPES:
value = value.replace(bad, good)
return value
+
def uuprefix(name, leave_alone=0):
name = name.split(".")
name = name[:leave_alone] + map(lambda x: "__%s" % x, name[leave_alone:])
return '.'.join(name)
+
class Klass:
klasses = {}
@@ -154,9 +158,11 @@
def __str__(self):
return self.message
+
def strip_py(name):
return name
+
def mod_var_name_decl(raw_module_name):
""" function to get the last component of the module e.g.
pyjamas.ui.DOM into the "namespace". i.e. doing
@@ -174,6 +180,7 @@
child_name = name[-1]
return "var %s = %s;\n" % (child_name, raw_module_name)
+
def gen_mod_import(parentName, importName, dynamic=1):
#pyjs_ajax_eval("%(n)s.cache.js", null, true);
return """
@@ -181,6 +188,7 @@
""" % ({'p': parentName, 'd': dynamic, 'n': importName}) + \
mod_var_name_decl(importName)
+
class Translator:
def __init__(self, mn, module_name, raw_module_name, src, debug, mod, output,
@@ -1534,6 +1542,7 @@
import cStringIO
+
def translate(file_name, module_name, debug=False):
f = file(file_name, "r")
src = f.read()
@@ -1633,10 +1642,12 @@
target.defaults = source.defaults
target.doc = source.doc # @@@ not sure we need to do this any more
+
def dotreplace(fname):
path, ext = os.path.splitext(fname)
return path.replace(".", "/") + ext
+
class AppTranslator:
def __init__(self, library_dirs=[], parser=None, dynamic=False,
@@ -1757,6 +1768,7 @@
usage: %s file_name [module_name]
"""
+
def main():
import sys
if len(sys.argv)<2: