From ab8123dc6883b0e80561ab2c8671635288ded6bb Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 16 Jan 2010 12:01:49 +0000 Subject: [PATCH] Fix html mode, also valid xhtml transitional --- direct/src/p3d/pdeploy.py | 45 ++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/direct/src/p3d/pdeploy.py b/direct/src/p3d/pdeploy.py index 8b98111899..4172544567 100644 --- a/direct/src/p3d/pdeploy.py +++ b/direct/src/p3d/pdeploy.py @@ -186,12 +186,12 @@ if not appFilename.exists(): print 'Application filename does not exist!' sys.exit(1) -if shortname.lower() != shortname or ' ' in shortname: - print '\nProvided short name should be lowercase, and may not contain spaces!\n' - if shortname == '': shortname = appFilename.getBasenameWoExtension() +if shortname.lower() != shortname or ' ' in shortname: + print '\nProvided short name should be lowercase, and may not contain spaces!\n' + if fullname == '': fullname = shortname @@ -251,16 +251,36 @@ elif deploy_mode == 'installer': i.build(output, platform) elif deploy_mode == 'html': + w, h = tokens.get("width", 640), tokens.get("height", 480) + if "data" not in tokens: + tokens["data"] = appFilename.getBasename() + print "Creating %s.html..." % shortname - html = open(shortname + ".html", "w") - html.write("\n") - html.write(" \n") - html.write(" %s\n" % fullname) - html.write(" \n") - html.write(" \n") - html.write(" \n" % appFilename.getBasename()) - html.write(" \n") - html.write("\n") + html = open(Filename(outputDir, shortname + ".html").toOsSpecific(), "w") + print >>html, "" + print >>html, "" + print >>html, " " + print >>html, " %s" % fullname + print >>html, " " + if authorname: + print >>html, " " % authorname.replace('"', '\\"') + print >>html, " " + print >>html, " " + print >>html, " >html, "%s=\"%s\"" % (key, value.replace('"', '\\"')), + if "width" not in tokens: + print >>html, "width=\"%s\"" % w, + if "height" not in tokens: + print >>html, "height=\"%s\"" % h, + print >>html, "type=\"application/x-panda3d\">" + print >>html, " " % (w, h) + for key, value in tokens.items(): + print >>html, " " % (key, value.replace('"', '\\"')) + print >>html, " " + print >>html, " " + print >>html, " " + print >>html, "" html.close() else: usage(1, 'Invalid deployment mode!') @@ -268,3 +288,4 @@ else: # An explicit call to exit() is required to exit the program, when # this module is packaged in a p3d file. sys.exit(0) +